1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/tests/CMakeLists.txt

380 lines
11 KiB
CMake
Raw Normal View History

if(ESP_PLATFORM)
###################################
# Tests do not build for ESP-IDF. #
###################################
else()
cmake_minimum_required(VERSION 3.13)
project(lvgl_tests LANGUAGES C)
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
-DLV_DPI_DEF=40
-DLV_USE_DRAW_MASKS=0
-DLV_USE_METER=0
-DLV_USE_LOG=1
-DLV_USE_ASSERT_NULL=0
-DLV_USE_ASSERT_MALLOC=0
-DLV_USE_ASSERT_MEM_INTEGRITY=0
-DLV_USE_ASSERT_OBJ=0
-DLV_USE_ASSERT_STYLE=0
-DLV_USE_USER_DATA=0
-DLV_FONT_UNSCII_8=1
-DLV_USE_BIDI=0
-DLV_USE_ARABIC_PERSIAN_CHARS=0
-DLV_BUILD_EXAMPLES=1
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
-DLV_USE_PNG=1
-DLV_USE_BMP=1
-DLV_USE_GIF=1
-DLV_USE_QRCODE=1
-DLV_USE_MSG=1
)
set(LVGL_TEST_OPTIONS_NORMAL_8BIT
-DLV_COLOR_DEPTH=8
-DLV_MEM_SIZE=65535
-DLV_DPI_DEF=40
-DLV_USE_DRAW_MASKS=1
-DLV_USE_LOG=1
-DLV_USE_ASSERT_NULL=0
-DLV_USE_ASSERT_MALLOC=0
-DLV_USE_ASSERT_MEM_INTEGRITY=0
-DLV_USE_ASSERT_OBJ=0
-DLV_USE_ASSERT_STYLE=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
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
-DLV_USE_PNG=1
-DLV_USE_BMP=1
-DLV_USE_SJPG=1
-DLV_USE_GIF=1
-DLV_USE_QRCODE=1
-DLV_USE_MSG=1
)
set(LVGL_TEST_OPTIONS_16BIT
-DLV_COLOR_DEPTH=16
-DLV_MEM_SIZE=65536
-DLV_DPI_DEF=40
-DLV_USE_DRAW_MASKS=1
-DLV_DITHER_GRADIENT=1
-DLV_USE_LOG=1
-DLV_USE_ASSERT_NULL=0
-DLV_USE_ASSERT_MALLOC=0
-DLV_USE_ASSERT_MEM_INTEGRITY=0
-DLV_USE_ASSERT_OBJ=0
-DLV_USE_ASSERT_STYLE=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
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
-DLV_USE_PNG=1
-DLV_USE_BMP=1
-DLV_USE_SJPG=1
-DLV_USE_GIF=1
-DLV_USE_QRCODE=1
-DLV_USE_MSG=1
)
set(LVGL_TEST_OPTIONS_16BIT_SWAP
-DLV_COLOR_DEPTH=16
-DLV_MEM_SIZE=65536
-DLV_DPI_DEF=40
-DLV_USE_DRAW_MASKS=1
-DLV_DITHER_GRADIENT=1
-DLV_DITHER_ERROR_DIFFUSION=1
-DLV_GRAD_CACHE_DEF_SIZE=8*1024
-DLV_USE_LOG=1
-DLV_USE_ASSERT_NULL=0
-DLV_USE_ASSERT_MALLOC=0
-DLV_USE_ASSERT_MEM_INTEGRITY=0
-DLV_USE_ASSERT_OBJ=0
-DLV_USE_ASSERT_STYLE=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
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
-DLV_USE_PNG=1
-DLV_USE_BMP=1
-DLV_USE_SJPG=1
-DLV_USE_GIF=1
-DLV_USE_QRCODE=1
-DLV_USE_MSG=1
)
set(LVGL_TEST_OPTIONS_FULL_32BIT
-DLV_COLOR_DEPTH=32
-DLV_MEM_SIZE=8388608
-DLV_DPI_DEF=160
-DLV_USE_DRAW_MASKS=1
-DLV_SHADOW_CACHE_SIZE=1
-DLV_IMG_CACHE_DEF_SIZE=32
-DLV_USE_LOG=1
-DLV_LOG_LEVEL=LV_LOG_LEVEL_TRACE
-DLV_LOG_PRINTF=1
-DLV_USE_FONT_SUBPX=1
-DLV_FONT_SUBPX_BGR=1
-DLV_USE_PERF_MONITOR=1
-DLV_USE_ASSERT_NULL=1
-DLV_USE_ASSERT_MALLOC=1
-DLV_USE_ASSERT_MEM_INTEGRITY=1
-DLV_USE_ASSERT_OBJ=1
-DLV_USE_ASSERT_STYLE=1
-DLV_USE_USER_DATA=1
-DLV_USE_LARGE_COORD=1
-DLV_FONT_MONTSERRAT_8=1
-DLV_FONT_MONTSERRAT_10=1
-DLV_FONT_MONTSERRAT_12=1
-DLV_FONT_MONTSERRAT_14=1
-DLV_FONT_MONTSERRAT_16=1
-DLV_FONT_MONTSERRAT_18=1
-DLV_FONT_MONTSERRAT_20=1
-DLV_FONT_MONTSERRAT_22=1
-DLV_FONT_MONTSERRAT_24=1
-DLV_FONT_MONTSERRAT_26=1
-DLV_FONT_MONTSERRAT_28=1
-DLV_FONT_MONTSERRAT_30=1
-DLV_FONT_MONTSERRAT_32=1
-DLV_FONT_MONTSERRAT_34=1
-DLV_FONT_MONTSERRAT_36=1
-DLV_FONT_MONTSERRAT_38=1
-DLV_FONT_MONTSERRAT_40=1
-DLV_FONT_MONTSERRAT_42=1
-DLV_FONT_MONTSERRAT_44=1
-DLV_FONT_MONTSERRAT_46=1
-DLV_FONT_MONTSERRAT_48=1
-DLV_FONT_MONTSERRAT_12_SUBPX=1
-DLV_FONT_MONTSERRAT_28_COMPRESSED=1
-DLV_FONT_DEJAVU_16_PERSIAN_HEBREW=1
-DLV_FONT_SIMSUN_16_CJK=1
-DLV_FONT_UNSCII_8=1
-DLV_FONT_UNSCII_16=1
-DLV_FONT_FMT_TXT_LARGE=1
-DLV_USE_FONT_COMPRESSED=1
-DLV_USE_BIDI=1
-DLV_USE_ARABIC_PERSIAN_CHARS=1
-DLV_USE_PERF_MONITOR=1
-DLV_USE_MEM_MONITOR=1
-DLV_LABEL_TEXT_SELECTION=1
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
-DLV_FONT_DEFAULT=&lv_font_montserrat_24
-DLV_USE_FS_STDIO=1
-DLV_FS_STDIO_LETTER='A'
-DLV_USE_FS_POSIX=1
-DLV_FS_POSIX_LETTER='B'
-DLV_USE_PNG=1
-DLV_USE_BMP=1
-DLV_USE_SJPG=1
-DLV_USE_GIF=1
-DLV_USE_QRCODE=1
feat(fragment): add fragment manager (a UI Controller concept) (#2940) * adding lv_obj_controller * adding examples for lv_obj_controller * added some docs * formatted code * updated controller docs * updated controller docs * updated sample controller field * changed lv_controller_manager_parent to lv_controller_manager_get_parent * updated unmanaged controller creation/deletion * renamed lv_controller_manager_t * rename: controller -> fragment * formatted code * Update examples/others/fragment/lv_example_fragment.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Update src/extra/others/fragment/lv_fragment.c Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Update src/extra/others/fragment/lv_fragment.c Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Update src/extra/others/fragment/lv_fragment.c Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * code cleanup * fragment creation rework * (wip) fragment manager * (wip) fragment manager * refactoring fragment * lifecycle fixes * updated fragment event callback * exposed states of fragment * added some docs * updated lv_fragment_managed_states_t name * updated docs * updated docs * updated lv_fragment_manager_dispatch_event docs * removed msgbox fragment * updated fragment docs * updated fragment docs * updated docs * updating examples * fixed example * reformatted code * fixed obj_created set timing * simplified fragment * improved fragment view del assertion * fixed a typo * fixed event_cb check in lv_obj_remove_event_cb_with_user_data * fixing fragment obj assertion * regenerated config * fixed fragment examples * fixed fragment examples * added missing examples * updated docs * fragment api cleanup * rename fragment struct names * added missing param doc * enabled test for 32bit build * feat(porting): add a macro lv_run_timer_handler_in_period to simplify porting (#3063) * feat(porting): add a macro lv_run_timer_handler_in_period to simplify porting * feat: update helper function and doc * doc(porting): update function names * revise to the original os.md * fix: fix typo * fix: mitigate warnings * chore: fix code formatting * fix(fsdrv): replacing sprintf with lv_snprintf for safety (#3079) * fix(Kconfig) remove duplicate LV_BUILD_EXAMPLES configuration * feat(refr) add reset of FPS statistics * fix(conf) mismatched macro judgment * feat(fsdrv) replacing sprintf with lv_snprintf for safety * feat(fsdrv) update stdio and win32 Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com> * fix warnings Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> Co-authored-by: Gabriel Wang <embedded_zhuoran@Hotmail.com> Co-authored-by: _VIFEXTech <1290176185@qq.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
2022-02-11 20:43:08 +09:00
-DLV_USE_FRAGMENT=1
-DLV_USE_IMGFONT=1
-DLV_USE_IME_PINYIN=1
-DLV_USE_MSG=1
-DLV_USE_FILE_EXPLORER=1
2022-01-23 09:58:55 -05:00
)
2022-01-23 09:58:55 -05:00
set(LVGL_TEST_OPTIONS_TEST_COMMON
--coverage
-DLV_COLOR_DEPTH=32
-DLV_MEM_SIZE=2097152
-DLV_SHADOW_CACHE_SIZE=10240
-DLV_IMG_CACHE_DEF_SIZE=32
-DLV_DITHER_GRADIENT=1
-DLV_DITHER_ERROR_DIFFUSION=1
-DLV_GRAD_CACHE_DEF_SIZE=8*1024
-DLV_USE_LOG=1
-DLV_LOG_PRINTF=1
-DLV_USE_FONT_SUBPX=1
-DLV_FONT_SUBPX_BGR=1
-DLV_USE_ASSERT_NULL=0
-DLV_USE_ASSERT_MALLOC=0
-DLV_USE_ASSERT_MEM_INTEGRITY=0
-DLV_USE_ASSERT_OBJ=0
-DLV_USE_ASSERT_STYLE=0
-DLV_USE_USER_DATA=1
-DLV_USE_LARGE_COORD=1
-DLV_FONT_MONTSERRAT_14=1
-DLV_FONT_MONTSERRAT_16=1
-DLV_FONT_MONTSERRAT_18=1
-DLV_FONT_MONTSERRAT_24=1
-DLV_FONT_MONTSERRAT_48=1
-DLV_FONT_MONTSERRAT_12_SUBPX=1
-DLV_FONT_MONTSERRAT_28_COMPRESSED=1
-DLV_FONT_DEJAVU_16_PERSIAN_HEBREW=1
-DLV_FONT_SIMSUN_16_CJK=1
-DLV_FONT_UNSCII_8=1
-DLV_FONT_UNSCII_16=1
-DLV_FONT_FMT_TXT_LARGE=1
-DLV_USE_FONT_COMPRESSED=1
-DLV_USE_BIDI=1
-DLV_USE_ARABIC_PERSIAN_CHARS=1
-DLV_LABEL_TEXT_SELECTION=1
-DLV_USE_FS_STDIO=1
-DLV_FS_STDIO_LETTER='A'
-DLV_FS_STDIO_CACHE_SIZE=100
-DLV_USE_FS_POSIX=1
-DLV_FS_POSIX_LETTER='B'
-DLV_FS_POSIX_CACHE_SIZE=0
-DLV_USE_MSG=1
${LVGL_TEST_COMMON_EXAMPLE_OPTIONS}
-DLV_FONT_DEFAULT=&lv_font_montserrat_14
2022-01-23 09:58:55 -05:00
-Wno-unused-but-set-variable # unused variables are common in the dual-heap arrangement
)
set(LVGL_TEST_OPTIONS_TEST_SYSHEAP
${LVGL_TEST_OPTIONS_TEST_COMMON}
-DLVGL_CI_USING_SYS_HEAP
-DLV_MEM_CUSTOM=1
-fsanitize=address
)
set(LVGL_TEST_OPTIONS_TEST_DEFHEAP
${LVGL_TEST_OPTIONS_TEST_COMMON}
-DLVGL_CI_USING_DEF_HEAP
-DLV_MEM_SIZE=2097152
-fsanitize=address
)
if (OPTIONS_MINIMAL_MONOCHROME)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_MINIMAL_MONOCHROME})
elseif (OPTIONS_NORMAL_8BIT)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_NORMAL_8BIT})
elseif (OPTIONS_16BIT)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_16BIT})
elseif (OPTIONS_16BIT_SWAP)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_16BIT_SWAP})
elseif (OPTIONS_FULL_32BIT)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_FULL_32BIT})
2022-01-23 09:58:55 -05:00
elseif (OPTIONS_TEST_SYSHEAP)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_SYSHEAP})
set (TEST_LIBS --coverage -fsanitize=address)
elseif (OPTIONS_TEST_DEFHEAP)
set (BUILD_OPTIONS ${LVGL_TEST_OPTIONS_TEST_DEFHEAP})
set (TEST_LIBS --coverage -fsanitize=address)
else()
2022-01-23 09:58:55 -05:00
message(FATAL_ERROR "Must provide a known options value (check main.py?).")
endif()
test(txt) initial unit tests and general code cleanup/fixes (#2623) * test(txt): Add test for identifying empty text when trying to get next line * test(txt): Rename next line empty string handling test * test(txt): Add tests for _lv_txt_is_cmd * test(txt): Add initial tests for _lv_txt_ins * fix(txt): Check for NULL before using strlen Passing NULL to strlen is not defined, so we should avoid it * txt: Update docs Remove docs from source file and add comment about pointers to NULL terminated arrays where necessary * txt: Misc update in encoded_size * test(txt): first tests for _lv_txt_cut * tests: Remove -Wmissing-prototype flag from compilation This will allow us to have cleaner test cases files. * test(txt): Remove test (funtion) prototypes as they're no longer necessary * Update src/misc/lv_txt.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Update src/misc/lv_txt.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Revert "tests: Remove -Wmissing-prototype flag from compilation" This reverts commit 8b3217de8d9210eb2e6da5e94c0735beb2735be7. * test(txt): Use pragma to disable missing-prototype warning * test: use extended set of compile options for test cases * Revert "test(txt): Use pragma to disable missing-prototype warning" This reverts commit 64909e30ed124ca1e8ca390ca0639479c3e34f44. * test(txt): Add assert to test_txt_cut_len_longer_than_string test * test(txt): Add test for _lv_txt_encoded_next on valid ascii input * test(txt): Add tests for _lv_txt_encoded_next with 2 byte long inputs * test(txt): Add tests for _lv_txt_encoded_next with 3 byte long inputs * test(txt): Add tests for _lv_txt_encoded_next with 4 byte long inputs * cleanup(txt): Add helper macros to identify ASCII and UTF8 codes * cleanup(txt): Add missing LV_ prefix to helper macros Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> Co-authored-by: embeddedt <42941056+embeddedt@users.noreply.github.com>
2021-10-15 04:37:53 -05:00
# Options lvgl and examples are compiled with.
set(COMPILE_OPTIONS
-DLV_CONF_PATH=${LVGL_TEST_DIR}/src/lv_test_conf.h
-DLV_BUILD_TEST
-pedantic-errors
-Wall
-Wclobbered
-Wdeprecated
-Wdouble-promotion
-Wempty-body
-Werror
-Wextra
-Wformat-security
-Wmaybe-uninitialized
-Wmissing-prototypes
-Wpointer-arith
-Wmultichar
-Wpedantic
-Wreturn-type
-Wshadow
-Wshift-negative-value
-Wsizeof-pointer-memaccess
2022-01-24 14:34:00 -05:00
-Wstack-usage=5000
-Wtype-limits
-Wundef
-Wuninitialized
-Wunreachable-code
${BUILD_OPTIONS}
)
test(txt) initial unit tests and general code cleanup/fixes (#2623) * test(txt): Add test for identifying empty text when trying to get next line * test(txt): Rename next line empty string handling test * test(txt): Add tests for _lv_txt_is_cmd * test(txt): Add initial tests for _lv_txt_ins * fix(txt): Check for NULL before using strlen Passing NULL to strlen is not defined, so we should avoid it * txt: Update docs Remove docs from source file and add comment about pointers to NULL terminated arrays where necessary * txt: Misc update in encoded_size * test(txt): first tests for _lv_txt_cut * tests: Remove -Wmissing-prototype flag from compilation This will allow us to have cleaner test cases files. * test(txt): Remove test (funtion) prototypes as they're no longer necessary * Update src/misc/lv_txt.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Update src/misc/lv_txt.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Revert "tests: Remove -Wmissing-prototype flag from compilation" This reverts commit 8b3217de8d9210eb2e6da5e94c0735beb2735be7. * test(txt): Use pragma to disable missing-prototype warning * test: use extended set of compile options for test cases * Revert "test(txt): Use pragma to disable missing-prototype warning" This reverts commit 64909e30ed124ca1e8ca390ca0639479c3e34f44. * test(txt): Add assert to test_txt_cut_len_longer_than_string test * test(txt): Add test for _lv_txt_encoded_next on valid ascii input * test(txt): Add tests for _lv_txt_encoded_next with 2 byte long inputs * test(txt): Add tests for _lv_txt_encoded_next with 3 byte long inputs * test(txt): Add tests for _lv_txt_encoded_next with 4 byte long inputs * cleanup(txt): Add helper macros to identify ASCII and UTF8 codes * cleanup(txt): Add missing LV_ prefix to helper macros Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> Co-authored-by: embeddedt <42941056+embeddedt@users.noreply.github.com>
2021-10-15 04:37:53 -05:00
# Options test cases are compiled with.
set(LVGL_TESTFILE_COMPILE_OPTIONS
${COMPILE_OPTIONS}
-Wno-missing-prototypes
)
get_filename_component(LVGL_DIR ${LVGL_TEST_DIR} DIRECTORY)
# Include lvgl project file.
include(${LVGL_DIR}/CMakeLists.txt)
target_compile_options(lvgl PUBLIC ${COMPILE_OPTIONS})
target_compile_options(lvgl_examples PUBLIC ${COMPILE_OPTIONS})
set(TEST_INCLUDE_DIRS
$<BUILD_INTERFACE:${LVGL_TEST_DIR}/src>
$<BUILD_INTERFACE:${LVGL_TEST_DIR}/unity>
$<BUILD_INTERFACE:${LVGL_TEST_DIR}>
)
add_library(test_common
STATIC
src/lv_test_indev.c
src/lv_test_init.c
src/test_fonts/font_1.c
src/test_fonts/font_2.c
src/test_fonts/font_3.c
unity/unity_support.c
unity/unity.c
)
target_include_directories(test_common PUBLIC ${TEST_INCLUDE_DIRS})
test(txt) initial unit tests and general code cleanup/fixes (#2623) * test(txt): Add test for identifying empty text when trying to get next line * test(txt): Rename next line empty string handling test * test(txt): Add tests for _lv_txt_is_cmd * test(txt): Add initial tests for _lv_txt_ins * fix(txt): Check for NULL before using strlen Passing NULL to strlen is not defined, so we should avoid it * txt: Update docs Remove docs from source file and add comment about pointers to NULL terminated arrays where necessary * txt: Misc update in encoded_size * test(txt): first tests for _lv_txt_cut * tests: Remove -Wmissing-prototype flag from compilation This will allow us to have cleaner test cases files. * test(txt): Remove test (funtion) prototypes as they're no longer necessary * Update src/misc/lv_txt.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Update src/misc/lv_txt.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Revert "tests: Remove -Wmissing-prototype flag from compilation" This reverts commit 8b3217de8d9210eb2e6da5e94c0735beb2735be7. * test(txt): Use pragma to disable missing-prototype warning * test: use extended set of compile options for test cases * Revert "test(txt): Use pragma to disable missing-prototype warning" This reverts commit 64909e30ed124ca1e8ca390ca0639479c3e34f44. * test(txt): Add assert to test_txt_cut_len_longer_than_string test * test(txt): Add test for _lv_txt_encoded_next on valid ascii input * test(txt): Add tests for _lv_txt_encoded_next with 2 byte long inputs * test(txt): Add tests for _lv_txt_encoded_next with 3 byte long inputs * test(txt): Add tests for _lv_txt_encoded_next with 4 byte long inputs * cleanup(txt): Add helper macros to identify ASCII and UTF8 codes * cleanup(txt): Add missing LV_ prefix to helper macros Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> Co-authored-by: embeddedt <42941056+embeddedt@users.noreply.github.com>
2021-10-15 04:37:53 -05:00
target_compile_options(test_common PUBLIC ${LVGL_TESTFILE_COMPILE_OPTIONS})
# Some examples `#include "lvgl/lvgl.h"` - which is a path which is not
# in this source repository. If this repo is in a directory names 'lvgl'
# then we can add our parent directory to the include path.
# TODO: This is not good practice and should be fixed.
get_filename_component(LVGL_PARENT_DIR ${LVGL_DIR} DIRECTORY)
target_include_directories(lvgl_examples PUBLIC $<BUILD_INTERFACE:${LVGL_PARENT_DIR}>)
# Generate one test executable for each source file pair.
# The sources in src/test_runners is auto-generated, the
# sources in src/test_cases is the actual test case.
file( GLOB TEST_CASE_FILES src/test_cases/*.c )
foreach( test_case_fname ${TEST_CASE_FILES} )
# If test file is foo/bar/baz.c then test_name is "baz".
get_filename_component(test_name ${test_case_fname} NAME_WLE)
if (${test_name} STREQUAL "_test_template")
continue()
endif()
# Create path to auto-generated source file.
set(test_runner_fname src/test_runners/${test_name}_Runner.c)
add_executable( ${test_name}
${test_case_fname}
${test_runner_fname}
)
target_link_libraries(${test_name} test_common lvgl_examples lvgl_demos lvgl png ${TEST_LIBS})
target_include_directories(${test_name} PUBLIC ${TEST_INCLUDE_DIRS})
test(txt) initial unit tests and general code cleanup/fixes (#2623) * test(txt): Add test for identifying empty text when trying to get next line * test(txt): Rename next line empty string handling test * test(txt): Add tests for _lv_txt_is_cmd * test(txt): Add initial tests for _lv_txt_ins * fix(txt): Check for NULL before using strlen Passing NULL to strlen is not defined, so we should avoid it * txt: Update docs Remove docs from source file and add comment about pointers to NULL terminated arrays where necessary * txt: Misc update in encoded_size * test(txt): first tests for _lv_txt_cut * tests: Remove -Wmissing-prototype flag from compilation This will allow us to have cleaner test cases files. * test(txt): Remove test (funtion) prototypes as they're no longer necessary * Update src/misc/lv_txt.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Update src/misc/lv_txt.h Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> * Revert "tests: Remove -Wmissing-prototype flag from compilation" This reverts commit 8b3217de8d9210eb2e6da5e94c0735beb2735be7. * test(txt): Use pragma to disable missing-prototype warning * test: use extended set of compile options for test cases * Revert "test(txt): Use pragma to disable missing-prototype warning" This reverts commit 64909e30ed124ca1e8ca390ca0639479c3e34f44. * test(txt): Add assert to test_txt_cut_len_longer_than_string test * test(txt): Add test for _lv_txt_encoded_next on valid ascii input * test(txt): Add tests for _lv_txt_encoded_next with 2 byte long inputs * test(txt): Add tests for _lv_txt_encoded_next with 3 byte long inputs * test(txt): Add tests for _lv_txt_encoded_next with 4 byte long inputs * cleanup(txt): Add helper macros to identify ASCII and UTF8 codes * cleanup(txt): Add missing LV_ prefix to helper macros Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> Co-authored-by: embeddedt <42941056+embeddedt@users.noreply.github.com>
2021-10-15 04:37:53 -05:00
target_compile_options(${test_name} PUBLIC ${LVGL_TESTFILE_COMPILE_OPTIONS})
add_test(
NAME ${test_name}
WORKING_DIRECTORY ${LVGL_TEST_DIR}
COMMAND ${test_name})
endforeach( test_case_fname ${TEST_CASE_FILES} )
endif()