1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

ci(spinner): add unit test for spinner (#3901)

This commit is contained in:
some00 2023-01-06 21:02:13 +01:00 committed by GitHub
parent 699eca1542
commit 162e451396
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 40 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -72,7 +72,12 @@ static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_
LV_UNUSED(area);
LV_UNUSED(color_p);
memcpy(test_fb, color_p, lv_area_get_size(area) * sizeof(lv_color_t));
for(int y = area->y1; y <= area->y2; y++) {
for(int x = area->x1; x <= area->x2; x++) {
test_fb[y * HOR_RES + x] = *color_p;
color_p++;
}
}
lv_disp_flush_ready(disp_drv);
}

View File

@ -0,0 +1,34 @@
#if LV_BUILD_TEST
#include "../lvgl.h"
#include "unity/unity.h"
static lv_obj_t * active_screen = NULL;
static lv_obj_t * spinner = NULL;
void setUp(void)
{
active_screen = lv_scr_act();
spinner = lv_spinner_create(lv_scr_act(), 1000, 60);
lv_obj_set_size(spinner, 100, 100);
lv_obj_center(spinner);
}
void tearDown(void)
{
lv_obj_clean(active_screen);
}
void test_spinner_spinning(void)
{
for(int i = 0; i < 10; ++i) {
lv_tick_inc(50);
lv_task_handler();
char filename[15];
snprintf(filename, 15, "spinner_%02d.png", i);
TEST_ASSERT_EQUAL_SCREENSHOT(filename);
}
}
#endif