ci(test): add more tests for LV_OBJ_FLAG_OVERFLOW_VISIBLE
@ -282,10 +282,13 @@ static void tranform_rgb888(const uint8_t * src, lv_coord_t src_w, lv_coord_t sr
|
||||
}
|
||||
}
|
||||
|
||||
#include "../../stdlib/lv_string.h"
|
||||
|
||||
static void tranform_argb8888(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride,
|
||||
int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step,
|
||||
int32_t x_end, uint8_t * dest_buf, bool aa)
|
||||
{
|
||||
// lv_memzero(dest_buf, x_end * 4);
|
||||
int32_t xs_ups_start = xs_ups;
|
||||
int32_t ys_ups_start = ys_ups;
|
||||
lv_color32_t * dest_c32 = (lv_color32_t *) dest_buf;
|
||||
@ -300,7 +303,7 @@ static void tranform_argb8888(const uint8_t * src, lv_coord_t src_w, lv_coord_t
|
||||
|
||||
/*Fully out of the image*/
|
||||
if(xs_int < 0 || xs_int >= src_w || ys_int < 0 || ys_int >= src_h) {
|
||||
dest_c32[x].alpha = 0x00;
|
||||
((uint32_t *)dest_buf)[x] = 0x00000000;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 5.9 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 6.4 KiB |
BIN
tests/ref_imgs/obj_flag_overflow_visible_1_4.png
Normal file
After Width: | Height: | Size: 57 KiB |
@ -1,5 +1,5 @@
|
||||
#define LV_MEM_SIZE (8 * 1024 * 1024)
|
||||
#define LV_LAYER_MAX_MEMORY_USAGE (1 * 1024)
|
||||
#define LV_MEM_SIZE (32 * 1024 * 1024)
|
||||
#define LV_LAYER_MAX_MEMORY_USAGE (4 * 1024)
|
||||
#define LV_USE_DRAW_MASKS 1
|
||||
#define LV_SHADOW_CACHE_SIZE (8 * 1024)
|
||||
#define LV_IMG_CACHE_DEF_SIZE 32
|
||||
|
@ -38,31 +38,41 @@ void test_obj_flag_overflow_visible_1(void)
|
||||
lv_obj_t * obj_child_1 = lv_obj_create(obj_main);
|
||||
lv_obj_set_size(obj_child_1, 200, 200);
|
||||
lv_obj_set_style_bg_color(obj_child_1, lv_palette_main(LV_PALETTE_PURPLE), 0);
|
||||
lv_obj_add_flag(obj_child_1, LV_OBJ_FLAG_OVERFLOW_VISIBLE);
|
||||
lv_obj_align(obj_child_1, LV_ALIGN_LEFT_MID, -100, 0);
|
||||
|
||||
lv_obj_t * btn_1 = lv_btn_create(obj_child_1);
|
||||
lv_obj_set_size(btn_1, 100, 100);
|
||||
lv_obj_align(btn_1, LV_ALIGN_LEFT_MID, -75, 0);
|
||||
lv_obj_clear_flag(btn_1, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
||||
uint32_t cnt_1 = 0;
|
||||
uint32_t cnt_1;
|
||||
lv_obj_add_event(btn_1, btn_clicked_event_cb, LV_EVENT_CLICKED, &cnt_1);
|
||||
|
||||
lv_obj_t * label_1 = lv_label_create(btn_1);
|
||||
lv_label_set_text(label_1, "Button 1");
|
||||
lv_obj_center(label_1);
|
||||
|
||||
lv_obj_t * obj_child_2 = lv_obj_create(obj_main);
|
||||
lv_obj_set_size(obj_child_2, 200, 200);
|
||||
lv_obj_set_style_bg_color(obj_child_2, lv_palette_main(LV_PALETTE_ORANGE), 0);
|
||||
lv_obj_add_flag(obj_child_2, LV_OBJ_FLAG_OVERFLOW_VISIBLE);
|
||||
lv_obj_align(obj_child_2, LV_ALIGN_RIGHT_MID, 100, 0);
|
||||
lv_obj_add_flag(obj_child_2, LV_OBJ_FLAG_OVERFLOW_VISIBLE);
|
||||
lv_obj_add_event(obj_child_2, ext_draw_size_event_cb, LV_EVENT_REFR_EXT_DRAW_SIZE, NULL);
|
||||
|
||||
lv_obj_t * btn_2 = lv_btn_create(obj_child_2);
|
||||
lv_obj_set_size(btn_2, 100, 100);
|
||||
lv_obj_align(btn_2, LV_ALIGN_RIGHT_MID, 75, 0);
|
||||
lv_obj_clear_flag(btn_2, LV_OBJ_FLAG_SCROLL_ON_FOCUS);
|
||||
uint32_t cnt_2 = 0;
|
||||
uint32_t cnt_2;
|
||||
lv_obj_add_event(btn_2, btn_clicked_event_cb, LV_EVENT_CLICKED, &cnt_2);
|
||||
|
||||
lv_obj_t * label_2 = lv_label_create(btn_2);
|
||||
lv_label_set_text(label_2, "Button 2");
|
||||
lv_obj_center(label_2);
|
||||
|
||||
|
||||
cnt_1 = 0;
|
||||
cnt_2 = 0;
|
||||
|
||||
/*The clipped part of the left button (shouldn't trigger click event)*/
|
||||
lv_test_mouse_click_at(100, 220);
|
||||
|
||||
@ -87,7 +97,48 @@ void test_obj_flag_overflow_visible_1(void)
|
||||
lv_obj_scroll_by_bounded(obj_child_2, -30, 0, LV_ANIM_OFF);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("obj_flag_overflow_visible_1_3.png");
|
||||
|
||||
/*Test with rotation*/
|
||||
lv_obj_set_style_transform_angle(obj_main, 300, 0);
|
||||
lv_obj_set_style_transform_pivot_x(obj_main, 200, 0);
|
||||
lv_obj_set_style_transform_pivot_y(obj_main, 150, 0);
|
||||
|
||||
lv_obj_set_style_transform_angle(obj_child_1, 300, 0);
|
||||
lv_obj_set_style_transform_pivot_x(obj_child_1, 100, 0);
|
||||
lv_obj_set_style_transform_pivot_y(obj_child_1, 100, 0);
|
||||
|
||||
lv_obj_set_style_transform_angle(obj_child_2, 300, 0);
|
||||
lv_obj_set_style_transform_pivot_x(obj_child_2, 100, 0);
|
||||
lv_obj_set_style_transform_pivot_y(obj_child_2, 100, 0);
|
||||
|
||||
lv_obj_set_style_transform_angle(btn_1, 300, 0);
|
||||
lv_obj_set_style_transform_pivot_x(btn_1, 100, 0);
|
||||
lv_obj_set_style_transform_pivot_y(btn_1, 100, 0);
|
||||
|
||||
lv_obj_set_style_transform_angle(btn_2, 300, 0);
|
||||
lv_obj_set_style_transform_pivot_x(btn_2, 100, 0);
|
||||
lv_obj_set_style_transform_pivot_y(btn_2, 100, 0);
|
||||
|
||||
cnt_1 = 0;
|
||||
cnt_2 = 0;
|
||||
|
||||
/*The clipped part of the left button (shouldn't trigger click event)*/
|
||||
lv_test_mouse_click_at(185, 40);
|
||||
|
||||
/*The non clipped part of the left button (should trigger click event)*/
|
||||
lv_test_mouse_click_at(210, 80);
|
||||
|
||||
/*The left part of the right button (should trigger click event)*/
|
||||
lv_test_mouse_click_at(590, 370);
|
||||
|
||||
/*The outter part of the right button (should trigger click event as obj_child_2 has LV_OBJ_FLAG_OVERFLOW_VISIBLE)*/
|
||||
lv_test_mouse_click_at(600, 430);
|
||||
|
||||
/*The clipped part of the right button (clipped because it's out of the red panel's ext draw size, shouldn't trigger click event)*/
|
||||
lv_test_mouse_click_at(645, 430);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT32(1, cnt_1);
|
||||
TEST_ASSERT_EQUAL_UINT32(2, cnt_2);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("obj_flag_overflow_visible_1_4.png");
|
||||
|
||||
}
|
||||
|
||||
|