feat(mask): add support for image file bitmap masks (#5911)
This commit is contained in:
committed by
GitHub
parent
667f401db6
commit
bcb8dbb736
BIN
tests/ref_imgs/draw/draw_layer_bitmap_mask_not_masked.png
Normal file
BIN
tests/ref_imgs/draw/draw_layer_bitmap_mask_not_masked.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@@ -14,7 +14,7 @@ void tearDown(void)
|
||||
lv_obj_clean(lv_screen_active());
|
||||
}
|
||||
|
||||
void test_draw_layer_bitmap_mask(void)
|
||||
void test_draw_layer_bitmap_mask_from_variable(void)
|
||||
{
|
||||
LV_IMAGE_DECLARE(test_image_cogwheel_a8);
|
||||
|
||||
@@ -31,7 +31,42 @@ void test_draw_layer_bitmap_mask(void)
|
||||
lv_obj_center(label);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("draw/draw_layer_bitmap_mask.png");
|
||||
|
||||
}
|
||||
|
||||
void test_draw_layer_bitmap_mask_from_image(void)
|
||||
{
|
||||
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(obj, 200, 200);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex3(0xf88), 0);
|
||||
lv_obj_set_style_bitmap_mask_src(obj, "A:src/test_files/binimages/cogwheel.A8.bin", 0);
|
||||
lv_obj_center(obj);
|
||||
|
||||
lv_obj_t * label = lv_label_create(obj);
|
||||
lv_obj_set_width(label, lv_pct(100));
|
||||
lv_label_set_text(label,
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque suscipit risus nec pharetra pulvinar. In hac habitasse platea dictumst. Proin placerat congue massa eu luctus. Suspendisse risus nulla, consectetur eget odio ut, mollis sollicitudin magna. Suspendisse volutpat consequat laoreet. Aenean sodales suscipit leo, vitae pulvinar lorem pulvinar eu. Nullam molestie hendrerit est sit amet imperdiet.");
|
||||
lv_obj_center(label);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("draw/draw_layer_bitmap_mask.png");
|
||||
}
|
||||
|
||||
|
||||
void test_draw_layer_bitmap_mask_from_image_not_found(void)
|
||||
{
|
||||
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(obj, 200, 200);
|
||||
lv_obj_set_style_bg_color(obj, lv_color_hex3(0xf88), 0);
|
||||
lv_obj_set_style_bitmap_mask_src(obj, "A:not/exisiting/file", 0);
|
||||
lv_obj_center(obj);
|
||||
|
||||
lv_obj_t * label = lv_label_create(obj);
|
||||
lv_obj_set_width(label, lv_pct(100));
|
||||
lv_label_set_text(label,
|
||||
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque suscipit risus nec pharetra pulvinar. In hac habitasse platea dictumst. Proin placerat congue massa eu luctus. Suspendisse risus nulla, consectetur eget odio ut, mollis sollicitudin magna. Suspendisse volutpat consequat laoreet. Aenean sodales suscipit leo, vitae pulvinar lorem pulvinar eu. Nullam molestie hendrerit est sit amet imperdiet.");
|
||||
lv_obj_center(label);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("draw/draw_layer_bitmap_mask_not_masked.png");
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user