test(demo) add tests for widget and stress demos
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define TIME_STEP 50
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -45,7 +44,7 @@ static uint32_t mem_free_start = 0;
|
||||
|
||||
void lv_demo_stress(void)
|
||||
{
|
||||
lv_timer_create(obj_test_task_cb, TIME_STEP, NULL);
|
||||
lv_timer_create(obj_test_task_cb, LV_DEMO_STRESS_TIME_STEP, NULL);
|
||||
}
|
||||
|
||||
/**********************
|
||||
@@ -107,7 +106,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
t = lv_tabview_add_tab(obj, LV_SYMBOL_CLOSE);
|
||||
|
||||
lv_tabview_set_act(obj, 1, LV_ANIM_ON);
|
||||
auto_del(obj, TIME_STEP * 5 + 30);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 30);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -121,15 +120,15 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
/*Add an infinite width change animation*/
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_time(&a, TIME_STEP * 2);
|
||||
lv_anim_set_time(&a, LV_DEMO_STRESS_TIME_STEP * 2);
|
||||
lv_anim_set_exec_cb(&a, set_width_anim);
|
||||
lv_anim_set_values(&a, 100, 200);
|
||||
lv_anim_set_playback_time(&a, TIME_STEP * 2);
|
||||
lv_anim_set_playback_time(&a, LV_DEMO_STRESS_TIME_STEP * 2);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
lv_anim_start(&a);
|
||||
|
||||
/*Delete the object a few sec later*/
|
||||
auto_del(obj, TIME_STEP * 10);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 10);
|
||||
|
||||
obj = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(obj, "Formatted:\n%d %s", 12, "Volt");
|
||||
@@ -169,12 +168,12 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_bar_set_value(obj, 1800, LV_ANIM_ON);
|
||||
lv_bar_set_start_value(obj, -500, LV_ANIM_ON);
|
||||
|
||||
auto_del(obj, TIME_STEP * 2 + 70);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 70);
|
||||
|
||||
obj = lv_slider_create(main_page);
|
||||
lv_obj_set_style_anim_time(obj, TIME_STEP * 8, 0);
|
||||
lv_obj_set_style_anim_time(obj, LV_DEMO_STRESS_TIME_STEP * 8, 0);
|
||||
lv_slider_set_value(obj, 5000, LV_ANIM_ON); /*Animate to out of range value*/
|
||||
auto_del(obj, TIME_STEP * 5 + 22);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 22);
|
||||
|
||||
obj = lv_switch_create(main_page);
|
||||
|
||||
@@ -190,7 +189,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_win_add_title(obj, "Window title");
|
||||
lv_win_add_btn(obj, LV_SYMBOL_CLOSE, 40);
|
||||
lv_win_add_btn(obj, LV_SYMBOL_DOWN, 40);
|
||||
auto_del(obj, TIME_STEP * 3 + 5);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 3 + 5);
|
||||
|
||||
obj = lv_calendar_create(lv_win_get_content(obj));
|
||||
break;
|
||||
@@ -204,11 +203,11 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_values(&a, LV_VER_RES, LV_VER_RES - lv_obj_get_height(obj));
|
||||
lv_anim_set_time(&a, TIME_STEP + 3);
|
||||
lv_anim_set_time(&a, LV_DEMO_STRESS_TIME_STEP + 3);
|
||||
lv_anim_set_exec_cb(&a, set_y_anim);
|
||||
lv_anim_start(&a);
|
||||
|
||||
auto_del(obj, TIME_STEP * 2 + 18);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 18);
|
||||
break;
|
||||
|
||||
case 11:
|
||||
@@ -216,14 +215,14 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_dropdown_set_options(obj, "Zero\nOne\nTwo\nThree\nFour\nFive\nSix\nSeven\nEight");
|
||||
lv_dropdown_open(obj);
|
||||
lv_dropdown_set_selected(obj, 2);
|
||||
auto_del(obj, TIME_STEP * 3 + 11);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 3 + 11);
|
||||
break;
|
||||
|
||||
case 12:
|
||||
obj = lv_roller_create(main_page);
|
||||
lv_roller_set_options(obj, "Zero\nOne\nTwo\nThree\nFour\nFive\nSix\nSeven\nEight", LV_ROLLER_MODE_INFINITE);
|
||||
lv_roller_set_selected(obj, 2, LV_ANIM_ON);
|
||||
auto_del(obj, TIME_STEP * 20 + 22);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 20 + 22);
|
||||
break;
|
||||
|
||||
case 13:
|
||||
@@ -231,9 +230,9 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, obj);
|
||||
lv_anim_set_values(&a, 180, 400);
|
||||
lv_anim_set_time(&a, TIME_STEP * 2);
|
||||
lv_anim_set_delay(&a, TIME_STEP + 25);
|
||||
lv_anim_set_playback_time(&a, TIME_STEP * 5);
|
||||
lv_anim_set_time(&a, LV_DEMO_STRESS_TIME_STEP * 2);
|
||||
lv_anim_set_delay(&a, LV_DEMO_STRESS_TIME_STEP + 25);
|
||||
lv_anim_set_playback_time(&a, LV_DEMO_STRESS_TIME_STEP * 5);
|
||||
lv_anim_set_repeat_count(&a, 3);
|
||||
lv_anim_set_exec_cb(&a, arc_set_end_angle_anim);
|
||||
lv_anim_start(&a);
|
||||
@@ -243,13 +242,13 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_meter_scale_t * scale = lv_meter_add_scale(obj);
|
||||
lv_meter_add_needle_line(obj, scale, 3, lv_palette_main(LV_PALETTE_RED), -10);
|
||||
|
||||
auto_del(obj, TIME_STEP * 6 + 30);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 6 + 30);
|
||||
break;
|
||||
|
||||
case 14:
|
||||
obj = lv_msgbox_create(NULL, "Title", "Some text on the message box with average length", mbox_btns, true);
|
||||
|
||||
lv_timer_t * msgbox_tmr = lv_timer_create(msgbox_del, TIME_STEP * 5 + 30, obj);
|
||||
lv_timer_t * msgbox_tmr = lv_timer_create(msgbox_del, LV_DEMO_STRESS_TIME_STEP * 5 + 30, obj);
|
||||
lv_timer_set_repeat_count(msgbox_tmr, 1);
|
||||
lv_obj_align(obj, LV_ALIGN_RIGHT_MID, -10, 0);
|
||||
break;
|
||||
@@ -262,7 +261,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
{
|
||||
lv_obj_t * tv = lv_tileview_create(lv_scr_act());
|
||||
lv_obj_set_size(tv, 200, 200);
|
||||
auto_del(tv, TIME_STEP * 4 + 5);
|
||||
auto_del(tv, LV_DEMO_STRESS_TIME_STEP * 4 + 5);
|
||||
|
||||
obj = lv_tileview_add_tile(tv, 0, 0, LV_DIR_ALL);
|
||||
obj = lv_label_create(obj);
|
||||
@@ -289,14 +288,14 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_list_add_btn(obj, LV_SYMBOL_OK, "2. Some very long text to scroll");
|
||||
lv_list_add_btn(obj, LV_SYMBOL_OK, "3. Some very long text to scroll");
|
||||
b = lv_list_add_btn(obj, LV_SYMBOL_OK, "4. Some very long text to scroll");
|
||||
auto_del(b, TIME_STEP);
|
||||
auto_del(b, LV_DEMO_STRESS_TIME_STEP);
|
||||
b = lv_list_add_btn(obj, LV_SYMBOL_OK, "5. Some very long text to scroll");
|
||||
auto_del(b, TIME_STEP + 90);
|
||||
auto_del(b, LV_DEMO_STRESS_TIME_STEP + 90);
|
||||
b = lv_list_add_btn(obj, LV_SYMBOL_OK, "6. Some very long text to scroll");
|
||||
auto_del(b, TIME_STEP + 10);
|
||||
auto_del(b, LV_DEMO_STRESS_TIME_STEP + 10);
|
||||
lv_obj_scroll_to_view(lv_obj_get_child(obj, -1), LV_ANIM_ON);
|
||||
}
|
||||
auto_del(obj, TIME_STEP * 5 + 15);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 15);
|
||||
|
||||
obj = lv_table_create(main_page);
|
||||
lv_table_set_cell_value(obj, 0, 0, "0,0");
|
||||
@@ -354,7 +353,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_spinbox_set_step(obj, 1);
|
||||
lv_spinbox_increment(obj);
|
||||
lv_spinbox_increment(obj);
|
||||
auto_del(obj, TIME_STEP * 2 + 15);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 15);
|
||||
|
||||
lv_obj_scroll_by(main_page, 0, 20, LV_ANIM_ON);
|
||||
|
||||
@@ -375,7 +374,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
lv_chart_set_next_value(obj, s1, 48);
|
||||
lv_chart_set_next_value(obj, s1, 72);
|
||||
|
||||
auto_del(obj, TIME_STEP * 3);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 3);
|
||||
}
|
||||
|
||||
lv_obj_scroll_by(main_page, 0, 20, LV_ANIM_ON);
|
||||
@@ -384,14 +383,14 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
case 24:
|
||||
obj = lv_checkbox_create(main_page);
|
||||
lv_checkbox_set_text(obj, "An option to select");
|
||||
auto_del(obj, TIME_STEP * 2 + 20);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 2 + 20);
|
||||
|
||||
obj = lv_checkbox_create(main_page);
|
||||
lv_obj_add_state(obj, LV_STATE_CHECKED);
|
||||
|
||||
obj = lv_checkbox_create(main_page);
|
||||
lv_obj_add_state(obj, LV_STATE_CHECKED | LV_STATE_DISABLED);
|
||||
auto_del(obj, TIME_STEP * 1 + 60);
|
||||
auto_del(obj, LV_DEMO_STRESS_TIME_STEP * 1 + 60);
|
||||
|
||||
lv_obj_scroll_by(main_page, 0, 20, LV_ANIM_ON);
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ extern "C" {
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
#define LV_DEMO_STRESS_TIME_STEP 50
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
@@ -13,6 +13,12 @@ include(CTest)
|
||||
|
||||
set(LVGL_TEST_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(LVGL_TEST_COMMON_EXAMPLE_OPTIONS
|
||||
-DLV_BUILD_EXAMPLES=1
|
||||
-DLV_USE_DEMO_WIDGETS=1
|
||||
-DLV_USE_DEMO_STRESS=1
|
||||
)
|
||||
|
||||
set(LVGL_TEST_OPTIONS_MINIMAL_MONOCHROME
|
||||
-DLV_COLOR_DEPTH=1
|
||||
-DLV_MEM_SIZE=65535
|
||||
@@ -48,12 +54,12 @@ set(LVGL_TEST_OPTIONS_NORMAL_8BIT
|
||||
-DLV_USE_ASSERT_MEM_INTEGRITY=0
|
||||
-DLV_USE_ASSERT_OBJ=0
|
||||
-DLV_USE_ASSERT_STYLE=0
|
||||
-DLV_USE_USER_DATA=0
|
||||
-DLV_USE_USER_DATA=1
|
||||
-DLV_FONT_UNSCII_8=1
|
||||
-DLV_USE_FONT_SUBPX=1
|
||||
-DLV_USE_BIDI=0
|
||||
-DLV_USE_ARABIC_PERSIAN_CHARS=0
|
||||
-DLV_BUILD_EXAMPLES=1
|
||||
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
|
||||
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
|
||||
-DLV_USE_PNG=1
|
||||
-DLV_USE_BMP=1
|
||||
@@ -75,12 +81,12 @@ set(LVGL_TEST_OPTIONS_16BIT
|
||||
-DLV_USE_ASSERT_MEM_INTEGRITY=0
|
||||
-DLV_USE_ASSERT_OBJ=0
|
||||
-DLV_USE_ASSERT_STYLE=0
|
||||
-DLV_USE_USER_DATA=0
|
||||
-DLV_USE_USER_DATA=1
|
||||
-DLV_FONT_UNSCII_8=1
|
||||
-DLV_USE_FONT_SUBPX=1
|
||||
-DLV_USE_BIDI=0
|
||||
-DLV_USE_ARABIC_PERSIAN_CHARS=0
|
||||
-DLV_BUILD_EXAMPLES=1
|
||||
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
|
||||
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
|
||||
-DLV_USE_PNG=1
|
||||
-DLV_USE_BMP=1
|
||||
@@ -104,12 +110,12 @@ set(LVGL_TEST_OPTIONS_16BIT_SWAP
|
||||
-DLV_USE_ASSERT_MEM_INTEGRITY=0
|
||||
-DLV_USE_ASSERT_OBJ=0
|
||||
-DLV_USE_ASSERT_STYLE=0
|
||||
-DLV_USE_USER_DATA=0
|
||||
-DLV_USE_USER_DATA=1
|
||||
-DLV_FONT_UNSCII_8=1
|
||||
-DLV_USE_FONT_SUBPX=1
|
||||
-DLV_USE_BIDI=0
|
||||
-DLV_USE_ARABIC_PERSIAN_CHARS=0
|
||||
-DLV_BUILD_EXAMPLES=1
|
||||
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
|
||||
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
|
||||
-DLV_USE_PNG=1
|
||||
-DLV_USE_BMP=1
|
||||
@@ -172,7 +178,7 @@ set(LVGL_TEST_OPTIONS_FULL_32BIT
|
||||
-DLV_USE_PERF_MONITOR=1
|
||||
-DLV_USE_MEM_MONITOR=1
|
||||
-DLV_LABEL_TEXT_SELECTION=1
|
||||
-DLV_BUILD_EXAMPLES=1
|
||||
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
|
||||
-DLV_FONT_DEFAULT=&lv_font_montserrat_24
|
||||
-DLV_USE_FS_STDIO='A'
|
||||
-DLV_USE_FS_POSIX='B'
|
||||
@@ -219,9 +225,10 @@ set(LVGL_TEST_OPTIONS_TEST_COMMON
|
||||
-DLV_USE_BIDI=1
|
||||
-DLV_USE_ARABIC_PERSIAN_CHARS=1
|
||||
-DLV_LABEL_TEXT_SELECTION=1
|
||||
-DLV_BUILD_EXAMPLES=1
|
||||
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
|
||||
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
|
||||
-Wno-unused-but-set-variable # unused variables are common in the dual-heap arrangement
|
||||
-Wno-unused-variable
|
||||
)
|
||||
|
||||
set(LVGL_TEST_OPTIONS_TEST_SYSHEAP
|
||||
@@ -345,7 +352,7 @@ foreach( test_case_fname ${TEST_CASE_FILES} )
|
||||
${test_case_fname}
|
||||
${test_runner_fname}
|
||||
)
|
||||
target_link_libraries(${test_name} test_common lvgl_examples lvgl png ${TEST_LIBS})
|
||||
target_link_libraries(${test_name} test_common lvgl_examples lvgl_demos lvgl png ${TEST_LIBS})
|
||||
target_include_directories(${test_name} PUBLIC ${TEST_INCLUDE_DIRS})
|
||||
target_compile_options(${test_name} PUBLIC ${LVGL_TESTFILE_COMPILE_OPTIONS})
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ build_only_options = {
|
||||
}
|
||||
|
||||
test_options = {
|
||||
'OPTIONS_TEST_DEFHEAP': 'Test config, LVGL heap, 32 bit color depth',
|
||||
'OPTIONS_TEST_SYSHEAP': 'Test config, system heap, 32 bit color depth',
|
||||
'OPTIONS_TEST_DEFHEAP': 'Test config, LVGL heap, 32 bit color depth',
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,10 +4,20 @@
|
||||
#ifdef LVGL_CI_USING_SYS_HEAP
|
||||
/* Skip checking heap as we don't have the info available */
|
||||
#define LV_HEAP_CHECK(x) do {} while(0)
|
||||
/* Pick a non-zero value */
|
||||
#define lv_test_get_free_mem() (65536)
|
||||
#else
|
||||
#define LV_HEAP_CHECK(x) x
|
||||
|
||||
static inline uint32_t lv_test_get_free_mem(void)
|
||||
{
|
||||
lv_mem_monitor_t m1;
|
||||
lv_mem_monitor(&m1);
|
||||
return m1.free_size;
|
||||
}
|
||||
#endif /* LVGL_CI_USING_SYS_HEAP */
|
||||
|
||||
|
||||
#endif /*LV_TEST_HELPERS_H*/
|
||||
|
||||
|
||||
|
||||
32
tests/src/test_cases/test_demo_stress.c
Normal file
32
tests/src/test_cases/test_demo_stress.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
#include "../demos/lv_demos.h"
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
#include "lv_test_helpers.h"
|
||||
#include "lv_test_indev.h"
|
||||
|
||||
static void loop_through_stress_test(void)
|
||||
{
|
||||
#if LV_USE_DEMO_STRESS
|
||||
lv_test_indev_wait(LV_DEMO_STRESS_TIME_STEP*33); /* FIXME: remove magic number of states */
|
||||
#endif
|
||||
}
|
||||
void test_demo_stress(void)
|
||||
{
|
||||
#if LV_USE_DEMO_STRESS
|
||||
lv_demo_stress();
|
||||
#endif
|
||||
/* loop once to allow objects to be created */
|
||||
loop_through_stress_test();
|
||||
uint32_t mem_before = lv_test_get_free_mem();
|
||||
/* loop 10 more times */
|
||||
for(uint32_t i = 0; i < 10; i++) {
|
||||
loop_through_stress_test();
|
||||
}
|
||||
TEST_ASSERT_EQUAL(mem_before, lv_test_get_free_mem());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
18
tests/src/test_cases/test_demo_widgets.c
Normal file
18
tests/src/test_cases/test_demo_widgets.c
Normal file
@@ -0,0 +1,18 @@
|
||||
#if LV_BUILD_TEST
|
||||
#include "../lvgl.h"
|
||||
#include "../demos/lv_demos.h"
|
||||
|
||||
#include "unity/unity.h"
|
||||
|
||||
#include "lv_test_helpers.h"
|
||||
#include "lv_test_indev.h"
|
||||
|
||||
void test_demo_widgets(void)
|
||||
{
|
||||
#if LV_USE_DEMO_WIDGETS
|
||||
lv_demo_widgets();
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user