diff --git a/tests/ref_imgs/draw/image_stride_aligned_recolor.png b/tests/ref_imgs/draw/image_stride_aligned_recolor.png new file mode 100644 index 0000000000..13c4cf7a6a Binary files /dev/null and b/tests/ref_imgs/draw/image_stride_aligned_recolor.png differ diff --git a/tests/ref_imgs/draw/image_stride_aligned_rotate_and_recolor.png b/tests/ref_imgs/draw/image_stride_aligned_rotate_and_recolor.png new file mode 100644 index 0000000000..16924e41b9 Binary files /dev/null and b/tests/ref_imgs/draw/image_stride_aligned_rotate_and_recolor.png differ diff --git a/tests/ref_imgs/draw/image_stride_aligned_rotated.png b/tests/ref_imgs/draw/image_stride_aligned_rotated.png new file mode 100644 index 0000000000..3a1ab45ba3 Binary files /dev/null and b/tests/ref_imgs/draw/image_stride_aligned_rotated.png differ diff --git a/tests/ref_imgs/draw/image_stride_aligned_simple.png b/tests/ref_imgs/draw/image_stride_aligned_simple.png new file mode 100644 index 0000000000..e3d4b69559 Binary files /dev/null and b/tests/ref_imgs/draw/image_stride_aligned_simple.png differ diff --git a/tests/src/test_cases/draw/test_image_stride_aligned.c b/tests/src/test_cases/draw/test_image_stride_aligned.c new file mode 100644 index 0000000000..2bd5f8d04b --- /dev/null +++ b/tests/src/test_cases/draw/test_image_stride_aligned.c @@ -0,0 +1,82 @@ +#if LV_BUILD_TEST +#include "../lvgl.h" + +#include "unity/unity.h" + +void setUp(void) +{ + /* Function run before every test */ + lv_obj_set_flex_flow(lv_screen_active(), LV_FLEX_FLOW_ROW_WRAP); + lv_obj_set_flex_align(lv_screen_active(), LV_FLEX_ALIGN_SPACE_EVENLY, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_EVENLY); + + lv_obj_clean(lv_screen_active()); + +} + +void tearDown(void) +{ + /* Function run after every test */ +} + +static void img_create(const char * name, const void * img_src, bool rotate, bool recolor) +{ + lv_obj_t * cont = lv_obj_create(lv_screen_active()); + lv_obj_set_size(cont, 120, LV_SIZE_CONTENT); + lv_obj_set_style_bg_color(cont, lv_palette_main(LV_PALETTE_LIGHT_BLUE), 0); + lv_obj_set_style_pad_all(cont, 5, 0); + + lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_COLUMN); + + lv_obj_t * img = lv_image_create(cont); + lv_image_set_src(img, img_src); + lv_obj_set_style_image_recolor(img, lv_palette_main(LV_PALETTE_RED), 0); /*For A8*/ + if(recolor) lv_obj_set_style_image_recolor_opa(img, LV_OPA_70, 0); + if(rotate) lv_image_set_angle(img, 450); + + lv_obj_t * label = lv_label_create(cont); + lv_label_set_text(label, name); +} + +static void bin_image_create(bool rotate, bool recolor) +{ + img_create("binI1", "A:test_images/stride_align64/UNCOMPRESSED/test_I1.bin", rotate, recolor); + img_create("binI2", "A:test_images/stride_align64/UNCOMPRESSED/test_I2.bin", rotate, recolor); + img_create("binI4", "A:test_images/stride_align64/UNCOMPRESSED/test_I4.bin", rotate, recolor); + img_create("binI8", "A:test_images/stride_align64/UNCOMPRESSED/test_I8.bin", rotate, recolor); + img_create("binA1", "A:test_images/stride_align64/UNCOMPRESSED/test_A1.bin", rotate, recolor); + img_create("binA2", "A:test_images/stride_align64/UNCOMPRESSED/test_A2.bin", rotate, recolor); + img_create("binA4", "A:test_images/stride_align64/UNCOMPRESSED/test_A4.bin", rotate, recolor); + img_create("binA8", "A:test_images/stride_align64/UNCOMPRESSED/test_A8.bin", rotate, recolor); + img_create("binRGB565A8", "A:test_images/stride_align64/UNCOMPRESSED/test_RGB565A8.bin", rotate, recolor); + img_create("binRGB565", "A:test_images/stride_align64/UNCOMPRESSED/test_RGB565.bin", rotate, recolor); + img_create("binRGB888", "A:test_images/stride_align64/UNCOMPRESSED/test_RGB888.bin", rotate, recolor); + img_create("binXRGB8888", "A:test_images/stride_align64/UNCOMPRESSED/test_XRGB8888.bin", rotate, recolor); + img_create("binARGB8888", "A:test_images/stride_align64/UNCOMPRESSED/test_ARGB8888.bin", rotate, recolor); +} + +void test_image_aligned_decode(void) +{ + bin_image_create(false, false); + + TEST_ASSERT_EQUAL_SCREENSHOT("draw/image_stride_aligned_simple.png"); +} + +void test_image_aligned_decode_rotate(void) +{ + bin_image_create(true, false); + TEST_ASSERT_EQUAL_SCREENSHOT("draw/image_stride_aligned_rotated.png"); +} + +void test_image_aligned_decode_recolor(void) +{ + bin_image_create(false, true); + TEST_ASSERT_EQUAL_SCREENSHOT("draw/image_stride_aligned_recolor.png"); +} + +void test_image_aligned_decode_rotate_and_recolor(void) +{ + bin_image_create(true, true); + TEST_ASSERT_EQUAL_SCREENSHOT("draw/image_stride_aligned_rotate_and_recolor.png"); +} + +#endif diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_A1.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_A1.bin new file mode 100644 index 0000000000..50cffa6475 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_A1.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_A2.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_A2.bin new file mode 100644 index 0000000000..e80a931aa6 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_A2.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_A4.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_A4.bin new file mode 100644 index 0000000000..40081d8b23 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_A4.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_A8.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_A8.bin new file mode 100644 index 0000000000..71a801e05d Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_A8.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_ARGB8888.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_ARGB8888.bin new file mode 100644 index 0000000000..ee1505f959 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_ARGB8888.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_I1.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_I1.bin new file mode 100644 index 0000000000..58c3015d68 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_I1.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_I2.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_I2.bin new file mode 100644 index 0000000000..cd07bc2838 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_I2.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_I4.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_I4.bin new file mode 100644 index 0000000000..8bec5c7c92 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_I4.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_I8.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_I8.bin new file mode 100644 index 0000000000..29eb7e6240 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_I8.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_L8.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_L8.bin new file mode 100644 index 0000000000..18f9bd1c46 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_L8.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB565.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB565.bin new file mode 100644 index 0000000000..2126b38627 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB565.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB565A8.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB565A8.bin new file mode 100644 index 0000000000..b4141192ed Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB565A8.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB888.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB888.bin new file mode 100644 index 0000000000..b2acb433b1 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_RGB888.bin differ diff --git a/tests/test_images/stride_align64/UNCOMPRESSED/test_XRGB8888.bin b/tests/test_images/stride_align64/UNCOMPRESSED/test_XRGB8888.bin new file mode 100644 index 0000000000..b7342c3d67 Binary files /dev/null and b/tests/test_images/stride_align64/UNCOMPRESSED/test_XRGB8888.bin differ