From 761295b99d2b27eb212a7f889ebec5a0a10ab597 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 15 Feb 2020 02:19:44 +0100 Subject: [PATCH] fixes in various configurations --- lv_conf_template.h | 7 +- lvgl.h | 2 +- lvgl.mk | 2 +- src/lv_conf_checker.h | 871 ++++++++++++++++++ src/lv_conf_internal.h | 5 - src/lv_core/lv_debug.h | 2 + src/lv_core/lv_obj.c | 18 +- src/lv_core/lv_style.c | 4 +- src/lv_draw/lv_draw_label.c | 4 +- src/lv_draw/lv_draw_rect.c | 5 +- src/lv_themes/lv_theme_material.c | 21 +- src/lv_themes/lv_themes.mk | 7 - src/lv_widgets/lv_bar.c | 4 +- src/lv_widgets/lv_btnmatrix.c | 5 +- src/lv_widgets/lv_calendar.c | 5 +- src/lv_widgets/lv_chart.c | 1 + src/lv_widgets/lv_dropdown.c | 28 +- src/lv_widgets/lv_list.c | 9 +- src/lv_widgets/lv_list.h | 5 +- src/lv_widgets/lv_page.c | 2 + src/lv_widgets/lv_slider.c | 2 + src/lv_widgets/{lv_preload.c => lv_spinner.c} | 2 +- src/lv_widgets/{lv_preload.h => lv_spinner.h} | 0 src/lv_widgets/{lv_objx.mk => lv_widgets.mk} | 24 +- src/lv_widgets/lv_win.h | 8 +- tests/Makefile | 3 + tests/build.py | 113 ++- tests/lv_test_assert.c | 5 +- tests/lv_test_core/lv_test_core.h | 1 + tests/lv_test_core/lv_test_style.c | 151 +-- tests/lv_test_main.c | 6 +- 31 files changed, 1112 insertions(+), 210 deletions(-) create mode 100644 src/lv_conf_checker.h rename src/lv_widgets/{lv_preload.c => lv_spinner.c} (99%) rename src/lv_widgets/{lv_preload.h => lv_spinner.h} (100%) rename src/lv_widgets/{lv_objx.mk => lv_widgets.mk} (55%) diff --git a/lv_conf_template.h b/lv_conf_template.h index 99c945fda..ca2760cc6 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -335,7 +335,6 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i /*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ typedef void * lv_font_user_data_t; - /*================ * THEME USAGE *================*/ @@ -347,10 +346,10 @@ typedef void * lv_font_user_data_t; #define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED #define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE #define LV_THEME_DEFAULT_FLAGS LV_THEME_MATERIAL_FLAG_NONE -#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_roboto_12 +#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_roboto_16 #define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_roboto_16 -#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_roboto_22 -#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_roboto_28 +#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_roboto_16 +#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_roboto_16 /*================= * Text settings diff --git a/lvgl.h b/lvgl.h index fa4e823b0..07842034f 100644 --- a/lvgl.h +++ b/lvgl.h @@ -66,7 +66,7 @@ extern "C" { #include "src/lv_widgets/lv_linemeter.h" #include "src/lv_widgets/lv_switch.h" #include "src/lv_widgets/lv_arc.h" -#include "src/lv_widgets/lv_preload.h" +#include "src/lv_widgets/lv_spinner.h" #include "src/lv_widgets/lv_calendar.h" #include "src/lv_widgets/lv_spinbox.h" diff --git a/lvgl.mk b/lvgl.mk index e1f2926ad..0c578a810 100644 --- a/lvgl.mk +++ b/lvgl.mk @@ -1,6 +1,6 @@ include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core/lv_core.mk include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_hal/lv_hal.mk -include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_objx/lv_objx.mk +include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets/lv_widgets.mk include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font/lv_font.mk include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc/lv_misc.mk include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes/lv_themes.mk diff --git a/src/lv_conf_checker.h b/src/lv_conf_checker.h new file mode 100644 index 000000000..09f788dc1 --- /dev/null +++ b/src/lv_conf_checker.h @@ -0,0 +1,871 @@ +/** + * GENERATED FILE, DO NOT EDIT IT! + * @file lv_conf_checker.h + * Make sure all the defines of lv_conf.h have a default value +**/ + +#ifndef LV_CONF_CHECKER_H +#define LV_CONF_CHECKER_H +/* clang-format off */ + +#include + +/*==================== + Graphical settings + *====================*/ + +/* Maximal horizontal and vertical resolution to support by the library.*/ +#ifndef LV_HOR_RES_MAX +#define LV_HOR_RES_MAX (480) +#endif +#ifndef LV_VER_RES_MAX +#define LV_VER_RES_MAX (320) +#endif + +/* Color depth: + * - 1: 1 byte per pixel + * - 8: RGB233 + * - 16: RGB565 + * - 32: ARGB8888 + */ +#ifndef LV_COLOR_DEPTH +#define LV_COLOR_DEPTH 16 +#endif + +/* Swap the 2 bytes of RGB565 color. + * Useful if the display has a 8 bit interface (e.g. SPI)*/ +#ifndef LV_COLOR_16_SWAP +#define LV_COLOR_16_SWAP 0 +#endif + +/* 1: Enable screen transparency. + * Useful for OSD or other overlapping GUIs. + * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/ +#ifndef LV_COLOR_SCREEN_TRANSP +#define LV_COLOR_SCREEN_TRANSP 0 +#endif + +/*Images pixels with this color will not be drawn (with chroma keying)*/ +#ifndef LV_COLOR_TRANSP +#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/ +#endif + +/* Enable chroma keying for indexed images. */ +#ifndef LV_INDEXED_CHROMA +#define LV_INDEXED_CHROMA 1 +#endif + +/* Enable anti-aliasing (lines, and radiuses will be smoothed) */ +#ifndef LV_ANTIALIAS +#define LV_ANTIALIAS 1 +#endif + +/* Default display refresh period. + * Can be changed in the display driver (`lv_disp_drv_t`).*/ +#ifndef LV_DISP_DEF_REFR_PERIOD +#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ +#endif + +/* Dot Per Inch: used to initialize default sizes. + * E.g. a button with width = LV_DPI / 2 -> half inch wide + * (Not so important, you can adjust it to modify default sizes and spaces)*/ +#ifndef LV_DPI +#define LV_DPI 100 /*[px]*/ +#endif + +/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ + +/*========================= + Memory manager settings + *=========================*/ + +/* LittelvGL's internal memory manager's settings. + * The graphical objects and other related data are stored here. */ + +/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */ +#ifndef LV_MEM_CUSTOM +#define LV_MEM_CUSTOM 0 +#endif +#if LV_MEM_CUSTOM == 0 +/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ +#ifndef LV_MEM_SIZE +# define LV_MEM_SIZE (32U * 1024U) +#endif + +/* Complier prefix for a big array declaration */ +#ifndef LV_MEM_ATTR +# define LV_MEM_ATTR +#endif + +/* Set an address for the memory pool instead of allocating it as an array. + * Can be in external SRAM too. */ +#ifndef LV_MEM_ADR +# define LV_MEM_ADR 0 +#endif + +/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */ +#ifndef LV_MEM_AUTO_DEFRAG +# define LV_MEM_AUTO_DEFRAG 1 +#endif +#else /*LV_MEM_CUSTOM*/ +#ifndef LV_MEM_CUSTOM_INCLUDE +# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ +#endif +#ifndef LV_MEM_CUSTOM_ALLOC +# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/ +#endif +#ifndef LV_MEM_CUSTOM_FREE +# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ +#endif +#endif /*LV_MEM_CUSTOM*/ + +/* Garbage Collector settings + * Used if lvgl is binded to higher level language and the memory is managed by that language */ +#ifndef LV_ENABLE_GC +#define LV_ENABLE_GC 0 +#endif +#if LV_ENABLE_GC != 0 +#ifndef LV_GC_INCLUDE +# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ +#endif +#ifndef LV_MEM_CUSTOM_REALLOC +# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/ +#endif +#ifndef LV_MEM_CUSTOM_GET_SIZE +# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ +#endif +#endif /* LV_ENABLE_GC */ + +/*======================= + Input device settings + *=======================*/ + +/* Input device default settings. + * Can be changed in the Input device driver (`lv_indev_drv_t`)*/ + +/* Input device read period in milliseconds */ +#ifndef LV_INDEV_DEF_READ_PERIOD +#define LV_INDEV_DEF_READ_PERIOD 30 +#endif + +/* Drag threshold in pixels */ +#ifndef LV_INDEV_DEF_DRAG_LIMIT +#define LV_INDEV_DEF_DRAG_LIMIT 10 +#endif + +/* Drag throw slow-down in [%]. Greater value -> faster slow-down */ +#ifndef LV_INDEV_DEF_DRAG_THROW +#define LV_INDEV_DEF_DRAG_THROW 20 +#endif + +/* Long press time in milliseconds. + * Time to send `LV_EVENT_LONG_PRESSSED`) */ +#ifndef LV_INDEV_DEF_LONG_PRESS_TIME +#define LV_INDEV_DEF_LONG_PRESS_TIME 400 +#endif + +/* Repeated trigger period in long press [ms] + * Time between `LV_EVENT_LONG_PRESSED_REPEAT */ +#ifndef LV_INDEV_DEF_LONG_PRESS_REP_TIME +#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 +#endif + + +/* Gesture threshold in pixels */ +#ifndef LV_INDEV_DEF_GESTURE_LIMIT +#define LV_INDEV_DEF_GESTURE_LIMIT 50 +#endif + +/* Gesture min velocity at release before swipe (pixels)*/ +#ifndef LV_INDEV_DEF_GESTURE_MIN_VELOCITY +#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3 +#endif + +/*================== + * Feature usage + *==================*/ + +/*1: Enable the Animations */ +#ifndef LV_USE_ANIMATION +#define LV_USE_ANIMATION 1 +#endif +#if LV_USE_ANIMATION + +/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ + +#endif + +/* 1: Enable shadow drawing*/ +#ifndef LV_USE_SHADOW +#define LV_USE_SHADOW 1 +#endif + +/* 1: Enable object groups (for keyboard/encoder navigation) */ +#ifndef LV_USE_GROUP +#define LV_USE_GROUP 1 +#endif +#if LV_USE_GROUP +#endif /*LV_USE_GROUP*/ + +/* 1: Enable GPU interface*/ +#ifndef LV_USE_GPU +#define LV_USE_GPU 1 +#endif + +/* 1: Enable file system (might be required for images */ +#ifndef LV_USE_FILESYSTEM +#define LV_USE_FILESYSTEM 1 +#endif +#if LV_USE_FILESYSTEM +/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/ +#endif + +/*1: Add a `user_data` to drivers and objects*/ +#ifndef LV_USE_USER_DATA +#define LV_USE_USER_DATA 0 +#endif + +/*======================== + * Image decoder and cache + *========================*/ + +/* 1: Enable indexed (palette) images */ +#ifndef LV_IMG_CF_INDEXED +#define LV_IMG_CF_INDEXED 1 +#endif + +/* 1: Enable alpha indexed images */ +#ifndef LV_IMG_CF_ALPHA +#define LV_IMG_CF_ALPHA 1 +#endif + +/* Default image cache size. Image caching keeps the images opened. + * If only the built-in image formats are used there is no real advantage of caching. + * (I.e. no new image decoder is added) + * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. + * However the opened images might consume additional RAM. + * LV_IMG_CACHE_DEF_SIZE must be >= 1 */ +#ifndef LV_IMG_CACHE_DEF_SIZE +#define LV_IMG_CACHE_DEF_SIZE 1 +#endif + +/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/ + +/*===================== + * Compiler settings + *====================*/ +/* Define a custom attribute to `lv_tick_inc` function */ +#ifndef LV_ATTRIBUTE_TICK_INC +#define LV_ATTRIBUTE_TICK_INC +#endif + +/* Define a custom attribute to `lv_task_handler` function */ +#ifndef LV_ATTRIBUTE_TASK_HANDLER +#define LV_ATTRIBUTE_TASK_HANDLER +#endif + +/* With size optimization (-Os) the compiler might not align data to + * 4 or 8 byte boundary. This alignment will be explicitly applied where needed. + * E.g. __attribute__((aligned(4))) */ +#ifndef LV_ATTRIBUTE_MEM_ALIGN +#define LV_ATTRIBUTE_MEM_ALIGN +#endif + +/* Attribute to mark large constant arrays for example + * font's bitmaps */ +#ifndef LV_ATTRIBUTE_LARGE_CONST +#define LV_ATTRIBUTE_LARGE_CONST +#endif + +/* Export integer constant to binding. + * This macro is used with constants in the form of LV_ that + * should also appear on lvgl binding API such as Micropython + * + * The default value just prevents a GCC warning. + */ +#ifndef LV_EXPORT_CONST_INT +#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning +#endif + +/*=================== + * HAL settings + *==================*/ + +/* 1: use a custom tick source. + * It removes the need to manually update the tick with `lv_tick_inc`) */ +#ifndef LV_TICK_CUSTOM +#define LV_TICK_CUSTOM 0 +#endif +#if LV_TICK_CUSTOM == 1 +#ifndef LV_TICK_CUSTOM_INCLUDE +#define LV_TICK_CUSTOM_INCLUDE "something.h" /*Header for the sys time function*/ +#endif +#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR +#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ +#endif +#endif /*LV_TICK_CUSTOM*/ + + +/*================ + * Log settings + *===============*/ + +/*1: Enable the log module*/ +#ifndef LV_USE_LOG +#define LV_USE_LOG 0 +#endif +#if LV_USE_LOG +/* How important log should be added: + * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information + * LV_LOG_LEVEL_INFO Log important events + * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem + * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + * LV_LOG_LEVEL_NONE Do not log anything + */ +#ifndef LV_LOG_LEVEL +# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN +#endif + +/* 1: Print the log with 'printf'; + * 0: user need to register a callback with `lv_log_register_print_cb`*/ +#ifndef LV_LOG_PRINTF +# define LV_LOG_PRINTF 0 +#endif +#endif /*LV_USE_LOG*/ + +/*================= + * Debug settings + *================*/ + +/* If Debug is enabled LittelvGL validates the parameters of the functions. + * If an invalid parameter is found an error log message is printed and + * the MCU halts at the error. (`LV_USE_LOG` should be enabled) + * If you are debugging the MCU you can pause + * the debugger to see exactly where the issue is. + * + * The behavior of asserts can be overwritten by redefining them here. + * E.g. #define LV_ASSERT_MEM(p) + */ +#ifndef LV_USE_DEBUG +#define LV_USE_DEBUG 1 +#endif +#if LV_USE_DEBUG + +/*Check if the parameter is NULL. (Quite fast) */ +#ifndef LV_USE_ASSERT_NULL +#define LV_USE_ASSERT_NULL 1 +#endif + +/*Checks is the memory is successfully allocated or no. (Quite fast)*/ +#ifndef LV_USE_ASSERT_MEM +#define LV_USE_ASSERT_MEM 1 +#endif + +/*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#ifndef LV_USE_ASSERT_MEM_INTEGRITY +#ifndef LV_USE_ASSERT_MEM_INTEGRITY +#define LV_USE_ASSERT_MEM_INTEGRITY 0 +#endif +#endif + +/* Check the strings. + * Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow) + * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ +#ifndef LV_USE_ASSERT_STR +#define LV_USE_ASSERT_STR 0 +#endif + +/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow) + * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ +#ifndef LV_USE_ASSERT_OBJ +#define LV_USE_ASSERT_OBJ 0 +#endif + +/*Check if the styles are properly initialized. (Fast)*/ +#ifndef LV_USE_ASSERT_STYLE +#define LV_USE_ASSERT_STYLE 1 +#endif + +#endif /*LV_USE_DEBUG*/ + +/*================== + * FONT USAGE + *===================*/ + +/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. + * The symbols are available via `LV_SYMBOL_...` defines + * More info about fonts: https://docs.littlevgl.com/#Fonts + * To create a new font go to: https://littlevgl.com/ttf-font-to-c-array + */ + +/* Robot fonts with bpp = 4 + * https://fonts.google.com/specimen/Roboto */ +#ifndef LV_FONT_ROBOTO_12 +#define LV_FONT_ROBOTO_12 0 +#endif +#ifndef LV_FONT_ROBOTO_16 +#define LV_FONT_ROBOTO_16 1 +#endif +#ifndef LV_FONT_ROBOTO_22 +#define LV_FONT_ROBOTO_22 0 +#endif +#ifndef LV_FONT_ROBOTO_28 +#define LV_FONT_ROBOTO_28 0 +#endif + +/* Demonstrate special features */ +#ifndef LV_FONT_ROBOTO_12_SUBPX +#define LV_FONT_ROBOTO_12_SUBPX 1 +#endif +#ifndef LV_FONT_ROBOTO_28_COMPRESSED +#define LV_FONT_ROBOTO_28_COMPRESSED 1 /*bpp = 3*/ +#endif + +/*Pixel perfect monospace font + * http://pelulamu.net/unscii/ */ +#ifndef LV_FONT_UNSCII_8 +#define LV_FONT_UNSCII_8 0 +#endif + +/* Optionally declare your custom fonts here. + * You can use these fonts as default font too + * and they will be available globally. E.g. + * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \ + * LV_FONT_DECLARE(my_font_2) + */ +#ifndef LV_FONT_CUSTOM_DECLARE +#define LV_FONT_CUSTOM_DECLARE +#endif + +/* Enable it if you have fonts with a lot of characters. + * The limit depends on the font size, font face and bpp + * but with > 10,000 characters if you see issues probably you need to enable it.*/ +#ifndef LV_FONT_FMT_TXT_LARGE +#define LV_FONT_FMT_TXT_LARGE 0 +#endif + +/* Set the pixel order of the display. + * Important only if "subpx fonts" are used. + * With "normal" font it doesn't matter. + */ +#ifndef LV_FONT_SUBPX_BGR +#define LV_FONT_SUBPX_BGR 0 +#endif + +/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ + +/*================ + * THEME USAGE + *================*/ + +/*Always enable at least on theme*/ +#ifndef LV_USE_THEME_MATERIAL +#define LV_USE_THEME_MATERIAL 1 /*A fast and impressive theme*/ +#endif + +#ifndef LV_THEME_DEFAULT_INIT +#define LV_THEME_DEFAULT_INIT lv_theme_material_init +#endif +#ifndef LV_THEME_DEFAULT_COLOR_PRIMARY +#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED +#endif +#ifndef LV_THEME_DEFAULT_COLOR_SECONDARY +#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE +#endif +#ifndef LV_THEME_DEFAULT_FLAGS +#define LV_THEME_DEFAULT_FLAGS LV_THEME_MATERIAL_FLAG_NONE +#endif +#ifndef LV_THEME_DEFAULT_FONT_SMALL +#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_roboto_16 +#endif +#ifndef LV_THEME_DEFAULT_FONT_NORMAL +#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_roboto_16 +#endif +#ifndef LV_THEME_DEFAULT_FONT_SUBTITLE +#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_roboto_16 +#endif +#ifndef LV_THEME_DEFAULT_FONT_TITLE +#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_roboto_16 +#endif + +/*================= + * Text settings + *=================*/ + +/* Select a character encoding for strings. + * Your IDE or editor should have the same character encoding + * - LV_TXT_ENC_UTF8 + * - LV_TXT_ENC_ASCII + * */ +#ifndef LV_TXT_ENC +#define LV_TXT_ENC LV_TXT_ENC_UTF8 +#endif + + /*Can break (wrap) texts on these chars*/ +#ifndef LV_TXT_BREAK_CHARS +#define LV_TXT_BREAK_CHARS " ,.;:-_" +#endif + +/* If a word is at least this long, will break wherever "prettiest" + * To disable, set to a value <= 0 */ +#ifndef LV_TXT_LINE_BREAK_LONG_LEN +#define LV_TXT_LINE_BREAK_LONG_LEN 12 +#endif + +/* Minimum number of characters in a long word to put on a line before a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +#ifndef LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN +#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 +#endif + +/* Minimum number of characters in a long word to put on a line after a break. + * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN +#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 +#endif + +/* The control character to use for signalling text recoloring. */ +#ifndef LV_TXT_COLOR_CMD +#define LV_TXT_COLOR_CMD "#" +#endif + +/* Support bidirectional texts. + * Allows mixing Left-to-Right and Right-to-Left texts. + * The direction will be processed according to the Unicode Bidirectioanl Algorithm: + * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ +#ifndef LV_USE_BIDI +#define LV_USE_BIDI 0 +#endif +#if LV_USE_BIDI +/* Set the default direction. Supported values: + * `LV_BIDI_DIR_LTR` Left-to-Right + * `LV_BIDI_DIR_RTL` Right-to-Left + * `LV_BIDI_DIR_AUTO` detect texts base direction */ +#ifndef LV_BIDI_BASE_DIR_DEF +#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO +#endif +#endif + +/*Change the built in (v)snprintf functions*/ +#ifndef LV_SPRINTF_CUSTOM +#define LV_SPRINTF_CUSTOM 0 +#endif +#if LV_SPRINTF_CUSTOM +#ifndef LV_SPRINTF_INCLUDE +# define LV_SPRINTF_INCLUDE +#endif +#ifndef lv_snprintf +# define lv_snprintf snprintf +#endif +#ifndef lv_vsnprintf +# define lv_vsnprintf vsnprintf +#endif +#endif /*LV_SPRINTF_CUSTOM*/ + +/*=================== + * LV_OBJ SETTINGS + *==================*/ + +/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ + +/*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ +#ifndef LV_USE_OBJ_REALIGN +#define LV_USE_OBJ_REALIGN 1 +#endif + +/* Enable to make the object clickable on a larger area. + * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature + * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) + * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) + */ +#ifndef LV_USE_EXT_CLICK_AREA +#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF +#endif + +/*================== + * LV OBJ X USAGE + *================*/ +/* + * Documentation of the object types: https://docs.littlevgl.com/#Object-types + */ + +/*Arc (dependencies: -)*/ +#ifndef LV_USE_ARC +#define LV_USE_ARC 1 +#endif + +/*Bar (dependencies: -)*/ +#ifndef LV_USE_BAR +#define LV_USE_BAR 1 +#endif + +/*Button (dependencies: lv_cont*/ +#ifndef LV_USE_BTN +#define LV_USE_BTN 1 +#endif +#if LV_USE_BTN != 0 +/*Enable button-state animations - draw a circle on click (dependencies: LV_USE_ANIMATION)*/ +#ifndef LV_BTN_INK_EFFECT +# define LV_BTN_INK_EFFECT 0 +#endif +#endif + +/*Button matrix (dependencies: -)*/ +#ifndef LV_USE_BTNMATRIX +#define LV_USE_BTNMATRIX 1 +#endif + +/*Calendar (dependencies: -)*/ +#ifndef LV_USE_CALENDAR +#define LV_USE_CALENDAR 1 +#endif + +/*Canvas (dependencies: lv_img)*/ +#ifndef LV_USE_CANVAS +#define LV_USE_CANVAS 1 +#endif + +/*Check box (dependencies: lv_btn, lv_label)*/ +#ifndef LV_USE_CHECKBOX +#define LV_USE_CHECKBOX 1 +#endif + +/*Chart (dependencies: -)*/ +#ifndef LV_USE_CHART +#define LV_USE_CHART 1 +#endif +#if LV_USE_CHART +#ifndef LV_CHART_AXIS_TICK_LABEL_MAX_LEN +# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 20 +#endif +#endif + +/*Container (dependencies: -*/ +#ifndef LV_USE_CONT +#define LV_USE_CONT 1 +#endif + +/*Color picker (dependencies: -*/ +#ifndef LV_USE_CPICKER +#define LV_USE_CPICKER 1 +#endif + +/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/ +#ifndef LV_USE_DROPDOWN +#define LV_USE_DROPDOWN 1 +#endif +#if LV_USE_DROPDOWN != 0 +/*Open and close default animation time [ms] (0: no animation)*/ +#ifndef LV_DROPDOWN_DEF_ANIM_TIME +# define LV_DROPDOWN_DEF_ANIM_TIME 200 +#endif +#endif + +/*Gauge (dependencies:lv_bar, lv_linemeter)*/ +#ifndef LV_USE_GAUGE +#define LV_USE_GAUGE 1 +#endif + +/*Image (dependencies: lv_label*/ +#ifndef LV_USE_IMG +#define LV_USE_IMG 1 +#endif + +/*Image Button (dependencies: lv_btn*/ +#ifndef LV_USE_IMGBTN +#define LV_USE_IMGBTN 1 +#endif +#if LV_USE_IMGBTN +/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/ +#ifndef LV_IMGBTN_TILED +# define LV_IMGBTN_TILED 0 +#endif +#endif + +/*Keyboard (dependencies: lv_btnm)*/ +#ifndef LV_USE_KEYBOARD +#define LV_USE_KEYBOARD 1 +#endif + +/*Label (dependencies: -*/ +#ifndef LV_USE_LABEL +#define LV_USE_LABEL 1 +#endif +#if LV_USE_LABEL != 0 +/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/ +#ifndef LV_LABEL_DEF_SCROLL_SPEED +# define LV_LABEL_DEF_SCROLL_SPEED 25 +#endif + +/* Waiting period at beginning/end of animation cycle */ +#ifndef LV_LABEL_WAIT_CHAR_COUNT +# define LV_LABEL_WAIT_CHAR_COUNT 3 +#endif + +/*Enable selecting text of the label */ +#ifndef LV_LABEL_TEXT_SEL +# define LV_LABEL_TEXT_SEL 0 +#endif + +/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/ +#ifndef LV_LABEL_LONG_TXT_HINT +# define LV_LABEL_LONG_TXT_HINT 0 +#endif +#endif + +/*LED (dependencies: -)*/ +#ifndef LV_USE_LED +#define LV_USE_LED 1 +#endif + +/*Line (dependencies: -*/ +#ifndef LV_USE_LINE +#define LV_USE_LINE 1 +#endif + +/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/ +#ifndef LV_USE_LIST +#define LV_USE_LIST 1 +#endif +#if LV_USE_LIST != 0 +/*Default animation time of focusing to a list element [ms] (0: no animation) */ +#ifndef LV_LIST_DEF_ANIM_TIME +# define LV_LIST_DEF_ANIM_TIME 100 +#endif +#endif + +/*Line meter (dependencies: *;)*/ +#ifndef LV_USE_LMETER +#define LV_USE_LMETER 1 +#endif + +/*Mask (dependencies: -)*/ +#ifndef LV_USE_OBJMASK +#define LV_USE_OBJMASK 0 +#endif + +/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/ +#ifndef LV_USE_MSGBOX +#define LV_USE_MSGBOX 1 +#endif + +/*Page (dependencies: lv_cont)*/ +#ifndef LV_USE_PAGE +#define LV_USE_PAGE 1 +#endif +#if LV_USE_PAGE != 0 +/*Focus default animation time [ms] (0: no animation)*/ +#ifndef LV_PAGE_DEF_ANIM_TIME +# define LV_PAGE_DEF_ANIM_TIME 400 +#endif +#endif + +/*Preload (dependencies: lv_arc, lv_anim)*/ +#ifndef LV_USE_SPINNER +#define LV_USE_SPINNER 1 +#endif +#if LV_USE_SPINNER != 0 +#ifndef LV_SPINNER_DEF_ARC_LENGTH +# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/ +#endif +#ifndef LV_SPINNER_DEF_SPIN_TIME +# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/ +#endif +#ifndef LV_SPINNER_DEF_ANIM +# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC +#endif +#endif + +/*Roller (dependencies: lv_ddlist)*/ +#ifndef LV_USE_ROLLER +#define LV_USE_ROLLER 1 +#endif +#if LV_USE_ROLLER != 0 +/*Focus animation time [ms] (0: no animation)*/ +#ifndef LV_ROLLER_DEF_ANIM_TIME +# define LV_ROLLER_DEF_ANIM_TIME 200 +#endif + +/*Number of extra "pages" when the roller is infinite*/ +#ifndef LV_ROLLER_INF_PAGES +# define LV_ROLLER_INF_PAGES 7 +#endif +#endif + +/*Slider (dependencies: lv_bar)*/ +#ifndef LV_USE_SLIDER +#define LV_USE_SLIDER 1 +#endif + +/*Spinbox (dependencies: lv_ta)*/ +#ifndef LV_USE_SPINBOX +#define LV_USE_SPINBOX 1 +#endif + +/*Switch (dependencies: lv_slider)*/ +#ifndef LV_USE_SWITCH +#define LV_USE_SWITCH 1 +#endif + +/*Text area (dependencies: lv_label, lv_page)*/ +#ifndef LV_USE_TEXTAREA +#define LV_USE_TEXTAREA 1 +#endif +#if LV_USE_TEXTAREA != 0 +#ifndef LV_TEXTAREA_DEF_CURSOR_BLINK_TIME +# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ +#endif +#ifndef LV_TEXTAREA_DEF_PWD_SHOW_TIME +# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +#endif +#endif + +/*Table (dependencies: lv_label)*/ +#ifndef LV_USE_TABLE +#define LV_USE_TABLE 1 +#endif +#if LV_USE_TABLE +#ifndef LV_TABLE_COL_MAX +# define LV_TABLE_COL_MAX 12 +#endif +#endif + +/*Tab (dependencies: lv_page, lv_btnm)*/ +#ifndef LV_USE_TABVIEW +#define LV_USE_TABVIEW 1 +#endif +# if LV_USE_TABVIEW != 0 +/*Time of slide animation [ms] (0: no animation)*/ +#ifndef LV_TABVIEW_DEF_ANIM_TIME +# define LV_TABVIEW_DEF_ANIM_TIME 300 +#endif +#endif + +/*Tileview (dependencies: lv_page) */ +#ifndef LV_USE_TILEVIEW +#define LV_USE_TILEVIEW 1 +#endif +#if LV_USE_TILEVIEW +/*Time of slide animation [ms] (0: no animation)*/ +#ifndef LV_TILEVIEW_DEF_ANIM_TIME +# define LV_TILEVIEW_DEF_ANIM_TIME 300 +#endif +#endif + +/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/ +#ifndef LV_USE_WIN +#define LV_USE_WIN 1 +#endif + +/*================== + * Non-user section + *==================*/ + +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ +#ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +#endif +#endif + + +#endif /*LV_CONF_CHECKER_H*/ diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 574a9f549..daac2c91a 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -469,11 +469,6 @@ #define LV_FONT_CUSTOM_DECLARE #endif -/*Always set a default font from the built-in fonts*/ -#ifndef LV_FONT_DEFAULT -#define LV_FONT_DEFAULT &lv_font_roboto_16 -#endif - /* Enable it if you have fonts with a lot of characters. * The limit depends on the font size, font face and bpp * but with > 10,000 characters if you see issues probably you need to enable it.*/ diff --git a/src/lv_core/lv_debug.h b/src/lv_core/lv_debug.h index 93465441f..196a16b3b 100644 --- a/src/lv_core/lv_debug.h +++ b/src/lv_core/lv_debug.h @@ -164,9 +164,11 @@ do { \ #define LV_ASSERT_NULL(p) true #define LV_ASSERT_MEM(p) true +#define LV_ASSERT_MEM_INTEGRITY() true #define LV_ASSERT_STR(p) true #define LV_ASSERT_OBJ(obj, obj_type) true #define LV_ASSERT_STYLE(p) true +#define LV_ASSERT_STYLE_LIST(p) true #endif /* LV_USE_DEBUG */ /*clang-format on*/ diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index ef31cc2ea..fe29880d0 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -57,7 +57,9 @@ static void report_style_mod_core(void * style_p, lv_obj_t * obj); static void refresh_children_style(lv_obj_t * obj); static void delete_children(lv_obj_t * obj); static void base_dir_refr_children(lv_obj_t * obj); +#if LV_USE_ANIMATION static void obj_state_anim_cb(void * p, lv_anim_value_t value); +#endif static void lv_event_mark_deleted(lv_obj_t * obj); static void lv_obj_del_async_cb(void * obj); static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode); @@ -1415,17 +1417,23 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) lv_obj_state_dsc_t dsc_ori = obj->state_dsc; obj->state_dsc.act = new_state; obj->state_dsc.prev = new_state; +#if LV_USE_ANIMATION lv_style_int_t t = lv_obj_get_style_transition_time(obj, LV_OBJ_PART_MAIN); +#else + lv_style_int_t t = 0; +#endif obj->state_dsc = dsc_ori; if(t == 0) { +#if LV_USE_ANIMATION lv_anim_del(obj, obj_state_anim_cb); +#endif obj->state_dsc.act = new_state; obj->state_dsc.prev = new_state; obj->state_dsc.anim = 0; lv_obj_refresh_style(obj); } else { - +#if LV_USE_ANIMATION bool was_anim = lv_anim_del(obj, obj_state_anim_cb); if(obj->state_dsc.anim == 0 && was_anim) { @@ -1442,7 +1450,7 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) lv_anim_set_values(&a, 0, 255); lv_anim_set_time(&a, t, 0); lv_anim_create(&a); - +#endif } } @@ -2193,6 +2201,7 @@ lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_ prop = (uint16_t)prop_ori + ((uint16_t)state->prev << LV_STYLE_STATE_POS); res = lv_style_list_get_color(dsc, prop, &value_prev); if(res == LV_RES_INV) value_prev = value_act; + if(value_act.full == value_prev.full) return value_act; return lv_color_mix(value_act, value_prev, state->anim); } } @@ -2350,7 +2359,7 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_ switch(prop) { case LV_STYLE_TEXT_FONT: case LV_STYLE_VALUE_FONT: - return LV_FONT_DEFAULT; + return LV_THEME_DEFAULT_FONT_NORMAL; } return NULL; @@ -3336,6 +3345,7 @@ static void base_dir_refr_children(lv_obj_t * obj) } } +#if LV_USE_ANIMATION static void obj_state_anim_cb(void * p, lv_anim_value_t value) { lv_obj_t * obj = p; @@ -3344,7 +3354,7 @@ static void obj_state_anim_cb(void * p, lv_anim_value_t value) lv_obj_refresh_style(obj); } - +#endif static void lv_event_mark_deleted(lv_obj_t * obj) { diff --git a/src/lv_core/lv_style.c b/src/lv_core/lv_style.c index f471013d0..e21047322 100644 --- a/src/lv_core/lv_style.c +++ b/src/lv_core/lv_style.c @@ -94,7 +94,7 @@ void lv_style_list_init(lv_style_list_t * list) list->style_list = NULL; list->style_cnt = 0; list->has_local = 0; - #if LV_USE_ASSERT_STYLE +#if LV_USE_ASSERT_STYLE list->sentinel = LV_DEBUG_STYLE_LIST_SENTINEL_VALUE; #endif } @@ -124,7 +124,7 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis list_dest->style_cnt = list_src->style_cnt - 1; lv_style_t * local_style = get_local_style(list_dest); - lv_style_copy(local_style, get_local_style((lv_style_t *)list_src)); + lv_style_copy(local_style, get_local_style((lv_style_list_t *)list_src)); } } diff --git a/src/lv_draw/lv_draw_label.c b/src/lv_draw/lv_draw_label.c index 4722101c0..c52092cc0 100644 --- a/src/lv_draw/lv_draw_label.c +++ b/src/lv_draw/lv_draw_label.c @@ -65,7 +65,7 @@ void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc) memset(dsc, 0x00, sizeof(lv_draw_label_dsc_t)); dsc->opa = LV_OPA_COVER; dsc->color = LV_COLOR_BLACK; - dsc->font = LV_FONT_DEFAULT; + dsc->font = LV_THEME_DEFAULT_FONT_NORMAL; dsc->sel_start = LV_DRAW_LABEL_NO_TXT_SEL; dsc->sel_end = LV_DRAW_LABEL_NO_TXT_SEL; dsc->sel_color = LV_COLOR_BLUE; @@ -669,7 +669,7 @@ static void draw_letter_subpx(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph_ vdb_buf_tmp->ch.blue}; #endif -#if LV_SUBPX_BGR +#if LV_FONT_SUBPX_BGR res_color.ch.blue = (uint326_t)((uint32_t)txt_rgb[0] * font_rgb[0] + (bg_rgb[0] * (255 - font_rgb[0]))) >> 8; res_color.ch.red = (uint32_t)((uint32_t)txt_rgb[2] * font_rgb[2] + (bg_rgb[2] * (255 - font_rgb[2]))) >> 8; #else diff --git a/src/lv_draw/lv_draw_rect.c b/src/lv_draw/lv_draw_rect.c index ec6b99fb1..ee8302e31 100644 --- a/src/lv_draw/lv_draw_rect.c +++ b/src/lv_draw/lv_draw_rect.c @@ -63,9 +63,9 @@ void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc) dsc->outline_opa = LV_OPA_COVER; dsc->border_opa = LV_OPA_COVER; dsc->pattern_opa = LV_OPA_COVER; - dsc->pattern_font = LV_FONT_DEFAULT; + dsc->pattern_font = LV_THEME_DEFAULT_FONT_NORMAL; dsc->value_opa = LV_OPA_COVER; - dsc->value_font = LV_FONT_DEFAULT; + dsc->value_font = LV_THEME_DEFAULT_FONT_NORMAL; dsc->shadow_opa = LV_OPA_COVER; dsc->border_side = LV_BORDER_SIDE_FULL; @@ -1314,6 +1314,7 @@ static void draw_pattern(const lv_area_t * coords, const lv_area_t * clip, lv_dr /*Trigger the error handler of image drawer*/ LV_LOG_WARN("lv_img_design: image source type is unknown"); lv_draw_img(coords, clip, NULL, NULL); + return; } lv_area_t coords_tmp; diff --git a/src/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c index 70a929b07..93053ea13 100644 --- a/src/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -49,14 +49,16 @@ static lv_font_t * _font_title; static lv_style_t scr; static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/ static lv_style_t btn; -static lv_style_t sb; +#if LV_USE_PAGE +static lv_style_t sb; +#endif #if LV_USE_BTNMATRIX static lv_style_t btnm_bg, btnm_btn; #endif -#if LV_USE_BTNMATRIX +#if LV_USE_KEYBOARD static lv_style_t kb_bg, kb_btn; #endif @@ -166,7 +168,7 @@ static void basic_init(void) lv_style_set_pad_inner(&panel, LV_STATE_NORMAL, LV_DPI / 5); lv_style_set_text_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_value_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); - lv_style_set_text_font(&panel, LV_STATE_NORMAL, &lv_font_roboto_16); + lv_style_set_text_font(&panel, LV_STATE_NORMAL, _font_normal); lv_style_set_image_recolor(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_line_color(&panel, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); lv_style_set_line_width(&panel, LV_STATE_NORMAL, 1); @@ -719,7 +721,7 @@ static void tabview_init(void) lv_style_set_border_width(&tabview_btns_bg, LV_STATE_NORMAL, LV_DPI / 30 > 0 ? LV_DPI / 30 : 1); lv_style_set_border_side(&tabview_btns_bg, LV_STATE_NORMAL , LV_BORDER_SIDE_BOTTOM); lv_style_set_text_color(&tabview_btns_bg, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); - lv_style_set_text_font(&tabview_btns_bg, LV_STATE_NORMAL, &lv_font_roboto_16); + lv_style_set_text_font(&tabview_btns_bg, LV_STATE_NORMAL, _font_normal); lv_style_set_image_recolor(&tabview_btns_bg, LV_STATE_NORMAL, lv_color_hex(0x979a9f)); @@ -840,15 +842,6 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s return &theme; } -/** - * Get a pointer to the theme - * @return pointer to the theme - */ -lv_theme_t * lv_theme_alien_get(void) -{ - return &theme; -} - void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name) { @@ -1345,6 +1338,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name) lv_style_list_add_style(list, &gauge_needle); break; #endif + default: + break; } diff --git a/src/lv_themes/lv_themes.mk b/src/lv_themes/lv_themes.mk index b2fc13088..daf690943 100644 --- a/src/lv_themes/lv_themes.mk +++ b/src/lv_themes/lv_themes.mk @@ -1,12 +1,5 @@ -CSRCS += lv_theme_alien.c CSRCS += lv_theme.c -CSRCS += lv_theme_default.c -CSRCS += lv_theme_night.c -CSRCS += lv_theme_templ.c -CSRCS += lv_theme_zen.c CSRCS += lv_theme_material.c -CSRCS += lv_theme_nemo.c -CSRCS += lv_theme_mono.c DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes diff --git a/src/lv_widgets/lv_bar.c b/src/lv_widgets/lv_bar.c index 46a23f7c2..9aa815b1b 100644 --- a/src/lv_widgets/lv_bar.c +++ b/src/lv_widgets/lv_bar.c @@ -625,10 +625,10 @@ static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param) bar->ext_draw_pad = LV_MATH_MAX(bar->ext_draw_pad, indic_size); } - if(sign == LV_SIGNAL_CLEANUP) { + lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); + lv_style_list_reset(&ext->style_indic); #if LV_USE_ANIMATION - lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar); lv_anim_del(&ext->cur_value_anim, NULL); lv_anim_del(&ext->start_value_anim, NULL); #endif diff --git a/src/lv_widgets/lv_btnmatrix.c b/src/lv_widgets/lv_btnmatrix.c index 51b4419cc..8d3707f8f 100644 --- a/src/lv_widgets/lv_btnmatrix.c +++ b/src/lv_widgets/lv_btnmatrix.c @@ -806,10 +806,13 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa ext->btn_id_act = btn_pr; invalidate_button_area(btnm, ext->btn_id_pr); /*Invalidate the new area*/ } - } else if(indev_type == LV_INDEV_TYPE_KEYPAD || (indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(btnm)))) { + } +#if LV_USE_GROUP + else if(indev_type == LV_INDEV_TYPE_KEYPAD || (indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(btnm)))) { ext->btn_id_pr = ext->btn_id_focused; invalidate_button_area(btnm, ext->btn_id_focused); } +#endif if(ext->btn_id_act != LV_BTNMATRIX_BTN_NONE) { if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_act]) == false && diff --git a/src/lv_widgets/lv_calendar.c b/src/lv_widgets/lv_calendar.c index b6c749032..2d88bf2c2 100644 --- a/src/lv_widgets/lv_calendar.c +++ b/src/lv_widgets/lv_calendar.c @@ -426,7 +426,10 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME); if(sign == LV_SIGNAL_CLEANUP) { - /*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/ + lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); + lv_style_list_reset(&ext->style_header); + lv_style_list_reset(&ext->style_day_names); + lv_style_list_reset(&ext->style_date_nums); } else if(sign == LV_SIGNAL_PRESSING) { lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); lv_area_t header_area; diff --git a/src/lv_widgets/lv_chart.c b/src/lv_widgets/lv_chart.c index a7e5b1711..608633de2 100644 --- a/src/lv_widgets/lv_chart.c +++ b/src/lv_widgets/lv_chart.c @@ -821,6 +821,7 @@ static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, co p1.x = 0 + x_ofs; p2.x = 0 + x_ofs; + p_act = start_point; p_prev = start_point; y_tmp = (int32_t)((int32_t)ser->points[p_prev] - ext->ymin) * h; y_tmp = y_tmp / (ext->ymax - ext->ymin); diff --git a/src/lv_widgets/lv_dropdown.c b/src/lv_widgets/lv_dropdown.c index ffe4ad06f..d6eed80d7 100644 --- a/src/lv_widgets/lv_dropdown.c +++ b/src/lv_widgets/lv_dropdown.c @@ -56,8 +56,10 @@ static void page_press_handler(lv_obj_t * page); static uint16_t get_id_on_point(lv_obj_t * ddlist, lv_coord_t x, lv_coord_t y); static void pos_selected(lv_obj_t * ddlist); static lv_obj_t * get_label(const lv_obj_t * ddlist); +#if LV_USE_ANIMATION static void list_anim(void * p, lv_anim_value_t v); static void close_anim_ready(lv_anim_t * a); +#endif /********************** * STATIC VARIABLES @@ -503,6 +505,7 @@ void lv_dropdown_open(lv_obj_t * ddlist, lv_anim_enable_t anim) } } +#if LV_USE_ANIMATION if(ext->dir != LV_DROPDOWN_DIR_UP) { lv_anim_t a; lv_anim_init(&a); @@ -511,6 +514,7 @@ void lv_dropdown_open(lv_obj_t * ddlist, lv_anim_enable_t anim) lv_anim_set_time(&a, ext->anim_time, 0); lv_anim_create(&a); } +#endif } /** @@ -532,16 +536,18 @@ void lv_dropdown_close(lv_obj_t * ddlist, lv_anim_enable_t anim) lv_obj_del(ext->page); ext->page = NULL; } else { -// if(dir != LV_DROPDOWN_DIR_UP) { - lv_anim_t a; - lv_anim_init(&a); - lv_anim_set_exec_cb(&a, ddlist, list_anim); - lv_anim_set_values(&a, lv_obj_get_height(ext->page), 0); - lv_anim_set_time(&a, ext->anim_time, 0); - lv_anim_set_ready_cb(&a, close_anim_ready); - lv_anim_create(&a); +#if LV_USE_ANIMATION + if(ext->dir != LV_DROPDOWN_DIR_UP) { + lv_anim_t a; + lv_anim_init(&a); + lv_anim_set_exec_cb(&a, ddlist, list_anim); + lv_anim_set_values(&a, lv_obj_get_height(ext->page), 0); + lv_anim_set_time(&a, ext->anim_time, 0); + lv_anim_set_ready_cb(&a, close_anim_ready); + lv_anim_create(&a); -// } + } +#endif } } @@ -628,7 +634,7 @@ static lv_design_res_t lv_dropdown_design(lv_obj_t * ddlist, const lv_area_t * c lv_draw_label(&txt_area, clip_area, &label_dsc, txt, NULL); } - if(ext->show_selected && ext->sel_opt_id_orig >= 0) { + if(ext->show_selected) { lv_mem_buf_release((char *)opt_txt); } @@ -1119,6 +1125,7 @@ static lv_obj_t * get_label(const lv_obj_t * ddlist) return lv_obj_get_child(lv_page_get_scrl(ext->page), NULL); } +#if LV_USE_ANIMATION static void list_anim(void * p, lv_anim_value_t v) { lv_obj_t * ddlist = p; @@ -1133,5 +1140,6 @@ static void close_anim_ready(lv_anim_t * a) lv_obj_del(ext->page); ext->page = NULL; } +#endif #endif diff --git a/src/lv_widgets/lv_list.c b/src/lv_widgets/lv_list.c index b4adb9159..b17db342e 100644 --- a/src/lv_widgets/lv_list.c +++ b/src/lv_widgets/lv_list.c @@ -86,8 +86,8 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy) #if LV_USE_GROUP ext->last_sel_btn = NULL; - ext->act_sel_btn = NULL; #endif + ext->act_sel_btn = NULL; lv_obj_set_signal_cb(list, lv_list_signal); @@ -255,8 +255,6 @@ bool lv_list_remove(const lv_obj_t * list, uint16_t index) * Setter functions *====================*/ -#if LV_USE_GROUP - /** * Make a button selected * @param list pointer to a list object @@ -273,10 +271,11 @@ void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn) /*Defocus the current button*/ if(ext->act_sel_btn) lv_obj_clear_state(ext->act_sel_btn, LV_STATE_FOCUSED); - +#if LV_USE_GROUP /*Don't forget which button was selected. * It will be restored when the list is focused again.*/ if(btn) ext->last_sel_btn = btn; +#endif /*Focus the new button*/ ext->act_sel_btn = btn; @@ -287,8 +286,6 @@ void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn) } } -#endif - /** * Set layout of a list * @param list pointer to a list object diff --git a/src/lv_widgets/lv_list.h b/src/lv_widgets/lv_list.h index 2dfeaee42..c7d5b9620 100644 --- a/src/lv_widgets/lv_list.h +++ b/src/lv_widgets/lv_list.h @@ -51,8 +51,8 @@ typedef struct #if LV_USE_GROUP lv_obj_t * last_sel_btn; /* The last selected button. It will be reverted when the list is focused again */ - lv_obj_t * act_sel_btn; /* The button is currently being selected*/ #endif + lv_obj_t * act_sel_btn; /* The button is currently being selected*/ } lv_list_ext_t; /** List styles. */ @@ -110,8 +110,6 @@ bool lv_list_remove(const lv_obj_t * list, uint16_t index); * Setter functions *====================*/ -#if LV_USE_GROUP - /** * Make a button selected * @param list pointer to a list object @@ -119,7 +117,6 @@ bool lv_list_remove(const lv_obj_t * list, uint16_t index); * NULL to not select any buttons */ void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn); -#endif /** * Set the scroll bar mode of a list diff --git a/src/lv_widgets/lv_page.c b/src/lv_widgets/lv_page.c index 15697aac0..79d8918c7 100644 --- a/src/lv_widgets/lv_page.c +++ b/src/lv_widgets/lv_page.c @@ -766,7 +766,9 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) } lv_style_list_reset(&ext->sb.style); +#if LV_USE_ANIMATION lv_style_list_reset(&ext->edge_flash.style); +#endif } /*Automatically move children to the scrollable object*/ else if(sign == LV_SIGNAL_CHILD_CHG) { diff --git a/src/lv_widgets/lv_slider.c b/src/lv_widgets/lv_slider.c index 368122c8d..876f66fd6 100644 --- a/src/lv_widgets/lv_slider.c +++ b/src/lv_widgets/lv_slider.c @@ -375,6 +375,8 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return res; } + } else if(sign == LV_SIGNAL_CLEANUP) { + lv_style_list_reset(&ext->style_knob); } else if(sign == LV_SIGNAL_GET_EDITABLE) { bool * editable = (bool *)param; *editable = true; diff --git a/src/lv_widgets/lv_preload.c b/src/lv_widgets/lv_spinner.c similarity index 99% rename from src/lv_widgets/lv_preload.c rename to src/lv_widgets/lv_spinner.c index e53b359dc..6f2ee86c2 100644 --- a/src/lv_widgets/lv_preload.c +++ b/src/lv_widgets/lv_spinner.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_preload.h" +#include "lv_spinner.h" #if LV_USE_SPINNER != 0 #include "../lv_core/lv_debug.h" diff --git a/src/lv_widgets/lv_preload.h b/src/lv_widgets/lv_spinner.h similarity index 100% rename from src/lv_widgets/lv_preload.h rename to src/lv_widgets/lv_spinner.h diff --git a/src/lv_widgets/lv_objx.mk b/src/lv_widgets/lv_widgets.mk similarity index 55% rename from src/lv_widgets/lv_objx.mk rename to src/lv_widgets/lv_widgets.mk index 97ae32aa5..e8835ae49 100644 --- a/src/lv_widgets/lv_objx.mk +++ b/src/lv_widgets/lv_widgets.mk @@ -1,12 +1,12 @@ CSRCS += lv_arc.c CSRCS += lv_bar.c -CSRCS += lv_cb.c +CSRCS += lv_checkbox.c CSRCS += lv_cpicker.c -CSRCS += lv_ddlist.c -CSRCS += lv_kb.c +CSRCS += lv_dropdown.c +CSRCS += lv_keyboard.c CSRCS += lv_line.c -CSRCS += lv_mbox.c -CSRCS += lv_preload.c +CSRCS += lv_msgbox.c +CSRCS += lv_spinner.c CSRCS += lv_roller.c CSRCS += lv_table.c CSRCS += lv_tabview.c @@ -19,20 +19,20 @@ CSRCS += lv_gauge.c CSRCS += lv_label.c CSRCS += lv_list.c CSRCS += lv_slider.c -CSRCS += lv_ta.c +CSRCS += lv_textarea.c CSRCS += lv_spinbox.c -CSRCS += lv_btnm.c +CSRCS += lv_btnmatrix.c CSRCS += lv_cont.c CSRCS += lv_img.c CSRCS += lv_imgbtn.c CSRCS += lv_led.c -CSRCS += lv_lmeter.c +CSRCS += lv_linemeter.c CSRCS += lv_page.c -CSRCS += lv_sw.c +CSRCS += lv_switch.c CSRCS += lv_win.c CSRCS += lv_objmask.c -DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_objx -VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_objx +DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets +VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets -CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_objx" +CFLAGS += "-I$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets" diff --git a/src/lv_widgets/lv_win.h b/src/lv_widgets/lv_win.h index e54af8d91..edfba1ce9 100644 --- a/src/lv_widgets/lv_win.h +++ b/src/lv_widgets/lv_win.h @@ -124,7 +124,6 @@ void lv_win_set_title(lv_obj_t * win, const char * title); */ void lv_win_set_header_height(lv_obj_t * win, lv_coord_t size); - /** * Set the size of the content area. * @param win pointer to a window object @@ -186,6 +185,13 @@ lv_obj_t * lv_win_get_content(const lv_obj_t * win); */ lv_coord_t lv_win_get_btn_size(const lv_obj_t * win); +/** + * Get the header height + * @param win pointer to a window object + * @return header height + */ +lv_coord_t lv_win_get_header_height(const lv_obj_t * win); + /** * Get the pointer of a widow from one of its control button. * It is useful in the action of the control buttons where only button is known. diff --git a/tests/Makefile b/tests/Makefile index f387968e6..d0c84cee5 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -21,6 +21,9 @@ MAINSRC = ./lv_test_main.c include ../lvgl.mk CSRCS += lv_test_assert.c +CSRCS += lv_test_core/lv_test_core.c +CSRCS += lv_test_core/lv_test_obj.c +CSRCS += lv_test_core/lv_test_style.c OBJEXT ?= .o diff --git a/tests/build.py b/tests/build.py index fadf38891..857154846 100644 --- a/tests/build.py +++ b/tests/build.py @@ -63,8 +63,16 @@ minimal_monochrome = { "LV_USE_FILESYSTEM":0, "LV_USE_USER_DATA":0, "LV_USE_LOG":0, + "LV_USE_THEME_MATERIAL":1, + "LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"", + "LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"", + "LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"", + "LV_THEME_DEFAULT_FLAGS" : "\\\"LV_THEME_MATERIAL_FLAG_NONE\\\"", + "LV_THEME_DEFAULT_FONT_SMALL" : "\\\"&lv_font_unscii_8\\\"", + "LV_THEME_DEFAULT_FONT_NORMAL" : "\\\"&lv_font_unscii_8\\\"", + "LV_THEME_DEFAULT_FONT_SUBTITLE" : "\\\"&lv_font_unscii_8\\\"", + "LV_THEME_DEFAULT_FONT_TITLE" : "\\\"&lv_font_unscii_8\\\"", "LV_USE_DEBUG":0, - "LV_THEME_LIVE_UPDATE":0, "LV_FONT_ROBOTO_12":0, "LV_FONT_ROBOTO_16":0, "LV_FONT_ROBOTO_22":0, @@ -72,7 +80,6 @@ minimal_monochrome = { "LV_FONT_ROBOTO_12_SUBPX":0, "LV_FONT_ROBOTO_28_COMPRESSED":0, "LV_FONT_UNSCII_8":1, - "LV_FONT_DEFAULT":"\\\"&lv_font_unscii_8\\\"", "LV_USE_BIDI": 0, "LV_USE_OBJ_REALIGN": 0, "LV_USE_ARC":0, @@ -81,29 +88,29 @@ minimal_monochrome = { "LV_USE_BTNM":0, "LV_USE_CALENDAR":0, "LV_USE_CANVAS":0, - "LV_USE_CB":0, + "LV_USE_CHECKBOX":0, "LV_USE_CHART":0, "LV_USE_CONT":1, "LV_USE_CPICKER":0, - "LV_USE_DDLIST":0, + "LV_USE_DROPDOWN":0, "LV_USE_GAUGE":0, "LV_USE_IMG":1, "LV_USE_IMGBTN":0, - "LV_USE_KB":0, + "LV_USE_KEYBOARD":0, "LV_USE_LABEL":1, "LV_USE_LED":0, "LV_USE_LINE":0, "LV_USE_LIST":0, - "LV_USE_LMETER":0, + "LV_USE_LINEMETER":0, "LV_USE_OBJMASK":0, "LV_USE_MBOX":0, "LV_USE_PAGE":0, - "LV_USE_PRELOAD":0, + "LV_USE_SPINNER":0, "LV_USE_ROLLER":0, "LV_USE_SLIDER":0, "LV_USE_SPINBOX":0, - "LV_USE_SW":0, - "LV_USE_TA":0, + "LV_USE_SWITCH":0, + "LV_USE_TEXTAREA":0, "LV_USE_TABLE":0, "LV_USE_TABVIEW":0, "LV_USE_TILEVIEW":0, @@ -123,8 +130,16 @@ all_obj_minimal_features = { "LV_USE_FILESYSTEM":0, "LV_USE_USER_DATA":0, "LV_USE_LOG":0, + "LV_USE_THEME_MATERIAL":1, + "LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"", + "LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"", + "LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"", + "LV_THEME_DEFAULT_FLAGS" : "\\\"LV_THEME_MATERIAL_FLAG_NONE\\\"", + "LV_THEME_DEFAULT_FONT_SMALL" : "\\\"&lv_font_roboto_16\\\"", + "LV_THEME_DEFAULT_FONT_NORMAL" : "\\\"&lv_font_roboto_16\\\"", + "LV_THEME_DEFAULT_FONT_SUBTITLE" : "\\\"&lv_font_roboto_16\\\"", + "LV_THEME_DEFAULT_FONT_TITLE" : "\\\"&lv_font_roboto_16\\\"", "LV_USE_DEBUG":0, - "LV_THEME_LIVE_UPDATE":0, "LV_FONT_ROBOTO_12":0, "LV_FONT_ROBOTO_16":1, "LV_FONT_ROBOTO_22":0, @@ -132,7 +147,6 @@ all_obj_minimal_features = { "LV_FONT_ROBOTO_12_SUBPX":0, "LV_FONT_ROBOTO_28_COMPRESSED":0, "LV_FONT_UNSCII_8":0, - "LV_FONT_DEFAULT":"\\\"&lv_font_roboto_16\\\"", "LV_USE_BIDI": 0, "LV_USE_OBJ_REALIGN": 0, "LV_USE_EXT_CLICK_AREA":"LV_EXT_CLICK_AREA_TINY", @@ -142,29 +156,29 @@ all_obj_minimal_features = { "LV_USE_BTNM":1, "LV_USE_CALENDAR":1, "LV_USE_CANVAS":1, - "LV_USE_CB":1, + "LV_USE_CHECKBOX":1, "LV_USE_CHART":1, "LV_USE_CONT":1, "LV_USE_CPICKER":1, - "LV_USE_DDLIST":1, + "LV_USE_DROPDOWN":1, "LV_USE_GAUGE":1, "LV_USE_IMG":1, "LV_USE_IMGBTN":1, - "LV_USE_KB":1, + "LV_USE_KEYBOARD":1, "LV_USE_LABEL":1, "LV_USE_LED":1, "LV_USE_LINE":1, "LV_USE_LIST":1, - "LV_USE_LMETER":1, + "LV_USE_LINEMETER":1, "LV_USE_OBJMASK":1, "LV_USE_MBOX":1, "LV_USE_PAGE":1, - "LV_USE_PRELOAD":0, #Disabled beacsue needs anim + "LV_USE_SPINNER":0, #Disabled beacsue needs anim "LV_USE_ROLLER":1, "LV_USE_SLIDER":1, "LV_USE_SPINBOX":1, - "LV_USE_SW":1, - "LV_USE_TA":1, + "LV_USE_SWITCH":1, + "LV_USE_TEXTAREA":1, "LV_USE_TABLE":1, "LV_USE_TABVIEW":1, "LV_USE_TILEVIEW":1, @@ -184,15 +198,15 @@ all_obj_all_features = { "LV_USE_FILESYSTEM":1, "LV_USE_USER_DATA":1, "LV_USE_LOG":1, - "LV_THEME_LIVE_UPDATE":1, - "LV_USE_THEME_TEMPL":1, - "LV_USE_THEME_DEFAULT":1, - "LV_USE_THEME_ALIEN":1, - "LV_USE_THEME_NIGHT":1, - "LV_USE_THEME_MONO":1, "LV_USE_THEME_MATERIAL":1, - "LV_USE_THEME_ZEN":1, - "LV_USE_THEME_NEMO": 1, + "LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"", + "LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"", + "LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"", + "LV_THEME_DEFAULT_FLAGS" : "\\\"LV_THEME_MATERIAL_FLAG_NONE\\\"", + "LV_THEME_DEFAULT_FONT_SMALL" : "\\\"&lv_font_roboto_12\\\"", + "LV_THEME_DEFAULT_FONT_NORMAL" : "\\\"&lv_font_roboto_16\\\"", + "LV_THEME_DEFAULT_FONT_SUBTITLE" : "\\\"&lv_font_roboto_22\\\"", + "LV_THEME_DEFAULT_FONT_TITLE" : "\\\"&lv_font_roboto_28\\\"", "LV_FONT_ROBOTO_12":1, "LV_FONT_ROBOTO_16":1, "LV_FONT_ROBOTO_22":1, @@ -200,36 +214,35 @@ all_obj_all_features = { "LV_FONT_ROBOTO_12_SUBPX":1, "LV_FONT_ROBOTO_28_COMPRESSED":1, "LV_FONT_UNSCII_8":1, - "LV_FONT_DEFAULT":"\\\"&lv_font_roboto_16\\\"", "LV_USE_ARC":1, "LV_USE_BAR":1, "LV_USE_BTN":1, "LV_USE_BTNM":1, "LV_USE_CALENDAR":1, "LV_USE_CANVAS":1, - "LV_USE_CB":1, + "LV_USE_CHECKBOX":1, "LV_USE_CHART":1, "LV_USE_CONT":1, "LV_USE_CPICKER":1, - "LV_USE_DDLIST":1, + "LV_USE_DROPDOWN":1, "LV_USE_GAUGE":1, "LV_USE_IMG":1, "LV_USE_IMGBTN":1, - "LV_USE_KB":1, + "LV_USE_KEYBOARD":1, "LV_USE_LABEL":1, "LV_USE_LED":1, "LV_USE_LINE":1, "LV_USE_LIST":1, - "LV_USE_LMETER":1, + "LV_USE_LINEMETER":1, "LV_USE_OBJMASK":1, "LV_USE_MBOX":1, "LV_USE_PAGE":1, - "LV_USE_PRELOAD":1, + "LV_USE_SPINNER":1, "LV_USE_ROLLER":1, "LV_USE_SLIDER":1, "LV_USE_SPINBOX":1, - "LV_USE_SW":1, - "LV_USE_TA":1, + "LV_USE_SWITCH":1, + "LV_USE_TEXTAREA":1, "LV_USE_TABLE":1, "LV_USE_TABVIEW":1, "LV_USE_TILEVIEW":1, @@ -253,6 +266,15 @@ advanced_features = { "LV_USE_USER_DATA":1, "LV_IMG_CACHE_DEF_SIZE":32, "LV_USE_LOG":1, + "LV_USE_THEME_MATERIAL":1, + "LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"", + "LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"", + "LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"", + "LV_THEME_DEFAULT_FLAGS" : "\\\"LV_THEME_MATERIAL_FLAG_NONE\\\"", + "LV_THEME_DEFAULT_FONT_SMALL" : "\\\"&lv_font_roboto_12\\\"", + "LV_THEME_DEFAULT_FONT_NORMAL" : "\\\"&lv_font_roboto_16\\\"", + "LV_THEME_DEFAULT_FONT_SUBTITLE" : "\\\"&lv_font_roboto_22\\\"", + "LV_THEME_DEFAULT_FONT_TITLE" : "\\\"&lv_font_roboto_28\\\"", "LV_LOG_PRINTF":1, "LV_USE_DEBUG":1, "LV_USE_ASSERT_NULL":1, @@ -260,15 +282,7 @@ advanced_features = { "LV_USE_ASSERT_STR":1, "LV_USE_ASSERT_OBJ":1, "LV_USE_ASSERT_STYLE":1, - "LV_THEME_LIVE_UPDATE":1, - "LV_USE_THEME_TEMPL":1, - "LV_USE_THEME_DEFAULT":1, - "LV_USE_THEME_ALIEN":1, - "LV_USE_THEME_NIGHT":1, - "LV_USE_THEME_MONO":1, "LV_USE_THEME_MATERIAL":1, - "LV_USE_THEME_ZEN":1, - "LV_USE_THEME_NEMO": 1, "LV_FONT_ROBOTO_12":1, "LV_FONT_ROBOTO_16":1, "LV_FONT_ROBOTO_22":1, @@ -276,7 +290,6 @@ advanced_features = { "LV_FONT_ROBOTO_12_SUBPX":1, "LV_FONT_ROBOTO_28_COMPRESSED":1, "LV_FONT_UNSCII_8":1, - "LV_FONT_DEFAULT":"\\\"&lv_font_roboto_16\\\"", "LV_USE_BIDI": 1, "LV_USE_OBJ_REALIGN": 1, "LV_FONT_FMT_TXT_LARGE":1, @@ -290,29 +303,29 @@ advanced_features = { "LV_USE_BTNM":1, "LV_USE_CALENDAR":1, "LV_USE_CANVAS":1, - "LV_USE_CB":1, + "LV_USE_CHECKBOX":1, "LV_USE_CHART":1, "LV_USE_CONT":1, "LV_USE_CPICKER":1, - "LV_USE_DDLIST":1, + "LV_USE_DROPDOWN":1, "LV_USE_GAUGE":1, "LV_USE_IMG":1, "LV_USE_IMGBTN":1, - "LV_USE_KB":1, + "LV_USE_KEYBOARD":1, "LV_USE_LABEL":1, "LV_USE_LED":1, "LV_USE_LINE":1, "LV_USE_LIST":1, - "LV_USE_LMETER":1, + "LV_USE_LINEMETER":1, "LV_USE_OBJMASK":1, "LV_USE_MBOX":1, "LV_USE_PAGE":1, - "LV_USE_PRELOAD":1, + "LV_USE_SPINNER":1, "LV_USE_ROLLER":1, "LV_USE_SLIDER":1, "LV_USE_SPINBOX":1, - "LV_USE_SW":1, - "LV_USE_TA":1, + "LV_USE_SWITCH":1, + "LV_USE_TEXTAREA":1, "LV_USE_TABLE":1, "LV_USE_TABVIEW":1, "LV_USE_TILEVIEW":1, diff --git a/tests/lv_test_assert.c b/tests/lv_test_assert.c index b5ffd2551..b59e06432 100644 --- a/tests/lv_test_assert.c +++ b/tests/lv_test_assert.c @@ -208,11 +208,10 @@ void read_png_file(png_img_t * p, const char* file_name) FILE *fp = fopen(file_name, "rb"); if (!fp) lv_test_exit("[read_png_file] File %s could not be opened for reading", file_name); - fread(header, 1, 8, fp); - if (png_sig_cmp((png_const_bytep)header, 0, 8)) + size_t rcnt = fread(header, 1, 8, fp); + if (rcnt != 8 || png_sig_cmp((png_const_bytep)header, 0, 8)) lv_test_exit("[read_png_file] File %s is not recognized as a PNG file", file_name); - /* initialize stuff */ p->png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); diff --git a/tests/lv_test_core/lv_test_core.h b/tests/lv_test_core/lv_test_core.h index 8513e4fc2..239b018e8 100644 --- a/tests/lv_test_core/lv_test_core.h +++ b/tests/lv_test_core/lv_test_core.h @@ -25,6 +25,7 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ +void lv_test_core(void); /********************** * MACROS diff --git a/tests/lv_test_core/lv_test_style.c b/tests/lv_test_core/lv_test_style.c index e3fb2d5e6..7588b45b2 100644 --- a/tests/lv_test_core/lv_test_style.c +++ b/tests/lv_test_core/lv_test_style.c @@ -126,10 +126,10 @@ static void add_remove_read_prop(void) lv_test_assert_int_eq(LV_RES_INV, found, "Get a non existing 'color' property"); lv_test_print("Set properties and read back the values"); - lv_style_set_int(&style, LV_STYLE_TEXT_LINE_SPACE, 5); - lv_style_set_opa(&style, LV_STYLE_BG_OPA, LV_OPA_50); - lv_style_set_ptr(&style, LV_STYLE_TEXT_FONT, LV_FONT_DEFAULT); - lv_style_set_color(&style, LV_STYLE_BG_COLOR, LV_COLOR_RED); + _lv_style_set_int(&style, LV_STYLE_TEXT_LINE_SPACE, 5); + _lv_style_set_opa(&style, LV_STYLE_BG_OPA, LV_OPA_50); + _lv_style_set_ptr(&style, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL); + _lv_style_set_color(&style, LV_STYLE_BG_COLOR, LV_COLOR_RED); found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value); lv_test_assert_int_eq(LV_RES_OK, found, "Get an existing 'int' property"); @@ -141,7 +141,7 @@ static void add_remove_read_prop(void) found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr); lv_test_assert_int_eq(LV_RES_OK, found, "Get an existing 'ptr' property"); - lv_test_assert_ptr_eq(LV_FONT_DEFAULT, ptr, "Get the value of a 'ptr' property"); + lv_test_assert_ptr_eq(LV_THEME_DEFAULT_FONT_NORMAL, ptr, "Get the value of a 'ptr' property"); found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get an existing 'color' property"); @@ -191,10 +191,10 @@ static void cascade(void) lv_test_print("Read properties set only in the firstly added style"); - lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE, 5); - lv_style_set_opa(&style_first, LV_STYLE_BG_OPA, LV_OPA_50); - lv_style_set_ptr(&style_first, LV_STYLE_TEXT_FONT, LV_FONT_DEFAULT); - lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, LV_COLOR_RED); + _lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE, 5); + _lv_style_set_opa(&style_first, LV_STYLE_BG_OPA, LV_OPA_50); + _lv_style_set_ptr(&style_first, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL); + _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, LV_COLOR_RED); found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'int' property"); @@ -206,7 +206,7 @@ static void cascade(void) found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'ptr' property"); - lv_test_assert_ptr_eq(LV_FONT_DEFAULT, ptr, "Get the value of a 'ptr' property"); + lv_test_assert_ptr_eq(LV_THEME_DEFAULT_FONT_NORMAL, ptr, "Get the value of a 'ptr' property"); found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'color' property"); @@ -214,10 +214,10 @@ static void cascade(void) lv_test_print("Overwrite the properties from the second style"); - lv_style_set_int(&style_second, LV_STYLE_TEXT_LINE_SPACE, 10); - lv_style_set_opa(&style_second, LV_STYLE_BG_OPA, LV_OPA_60); - lv_style_set_ptr(&style_second, LV_STYLE_TEXT_FONT, LV_FONT_DEFAULT + 1); - lv_style_set_color(&style_second, LV_STYLE_BG_COLOR, LV_COLOR_BLUE); + _lv_style_set_int(&style_second, LV_STYLE_TEXT_LINE_SPACE, 10); + _lv_style_set_opa(&style_second, LV_STYLE_BG_OPA, LV_OPA_60); + _lv_style_set_ptr(&style_second, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL + 1); + _lv_style_set_color(&style_second, LV_STYLE_BG_COLOR, LV_COLOR_BLUE); found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value); lv_test_assert_int_eq(LV_RES_OK, found, "Get an overwritten 'int' property"); @@ -229,7 +229,7 @@ static void cascade(void) found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr); lv_test_assert_int_eq(LV_RES_OK, found, "Get an overwritten 'ptr' property"); - lv_test_assert_ptr_eq(LV_FONT_DEFAULT + 1, ptr, "Get the value of an overwritten 'ptr' property"); + lv_test_assert_ptr_eq(LV_THEME_DEFAULT_FONT_NORMAL + 1, ptr, "Get the value of an overwritten 'ptr' property"); found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get an overwritten 'color' property"); @@ -239,7 +239,7 @@ static void cascade(void) lv_test_print("Overwrite the properties with the local style"); lv_style_list_set_local_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, 20); lv_style_list_set_local_opa(&style_list, LV_STYLE_BG_OPA, LV_OPA_70); - lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT, LV_FONT_DEFAULT + 2); + lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT, LV_THEME_DEFAULT_FONT_NORMAL + 2); lv_style_list_set_local_color(&style_list, LV_STYLE_BG_COLOR, LV_COLOR_LIME); found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE, &value); @@ -252,7 +252,7 @@ static void cascade(void) found = lv_style_list_get_ptr(&style_list, LV_STYLE_TEXT_FONT, &ptr); lv_test_assert_int_eq(LV_RES_OK, found, "Get a local 'ptr' property"); - lv_test_assert_ptr_eq(LV_FONT_DEFAULT + 2, ptr, "Get the value of a local'ptr' property"); + lv_test_assert_ptr_eq(LV_THEME_DEFAULT_FONT_NORMAL + 2, ptr, "Get the value of a local'ptr' property"); found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get a local 'color' property"); @@ -273,15 +273,16 @@ static void copy(void) lv_test_print("Copy a style"); lv_style_t style_src; lv_style_init(&style_src); - lv_style_set_int(&style_src, LV_STYLE_TEXT_LINE_SPACE, 5); + _lv_style_set_int(&style_src, LV_STYLE_TEXT_LINE_SPACE, 5); lv_style_t style_dest; + lv_style_init(&style_dest); lv_style_copy(&style_dest, &style_src); int16_t weight; lv_style_int_t value; - weight = lv_style_get_int(&style_dest, LV_STYLE_TEXT_LINE_SPACE, &value); + weight = _lv_style_get_int(&style_dest, LV_STYLE_TEXT_LINE_SPACE, &value); lv_test_assert_int_eq(0, weight, "Get a copied property from a style"); lv_test_assert_int_eq(5, value, "Get the value of a copied from a property"); @@ -329,9 +330,9 @@ static void states(void) lv_style_list_add_style(&style_list, &style_second); lv_test_print("Test state precedence in 1 style"); - lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE, 5); - lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE | LV_STYLE_STATE_CHECKED, 6); - lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE | LV_STYLE_STATE_PRESSED, 7); + _lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE, 5); + _lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE | (LV_STATE_CHECKED) << LV_STYLE_STATE_POS, 6); + _lv_style_set_int(&style_first, LV_STYLE_TEXT_LINE_SPACE | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, 7); lv_res_t found; lv_style_int_t value; @@ -340,25 +341,25 @@ static void states(void) lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'int' property in normal state"); lv_test_assert_int_eq(5, value, "Get the value of an 'int' property in normal state"); - found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE | LV_STYLE_STATE_CHECKED, &value); + found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE | (LV_STATE_CHECKED) << LV_STYLE_STATE_POS, &value); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'int' property in checked state"); lv_test_assert_int_eq(6, value, "Get the value of an 'int' in checked state"); - found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE | LV_STYLE_STATE_PRESSED, &value); + found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, &value); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'int' property in pressed state"); lv_test_assert_int_eq(7, value, "Get the value of an 'int' in pressed state"); - found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE | LV_STYLE_STATE_HOVER, &value); + found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE | (LV_STATE_HOVERED) << LV_STYLE_STATE_POS, &value); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'int' property in hover (unspecified) state"); lv_test_assert_int_eq(5, value, "Get the value of an 'int' in hover (unspecified) state"); - found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE | LV_STYLE_STATE_CHECKED | LV_STYLE_STATE_PRESSED | LV_STYLE_STATE_HOVER, &value); + found = lv_style_list_get_int(&style_list, LV_STYLE_TEXT_LINE_SPACE | (LV_STATE_CHECKED | LV_STATE_PRESSED | LV_STATE_HOVERED) << LV_STYLE_STATE_POS, &value); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'int' property in checked pressed hovered state"); lv_test_assert_int_eq(7, value, "Get the value of an 'int' in checked pressed hovered state"); lv_test_print("Test state precedence in 1 style with combined states"); - lv_style_set_opa(&style_first, LV_STYLE_BG_OPA, LV_OPA_50); - lv_style_set_opa(&style_first, LV_STYLE_BG_OPA | LV_STYLE_STATE_CHECKED | LV_STYLE_STATE_PRESSED, LV_OPA_60); + _lv_style_set_opa(&style_first, LV_STYLE_BG_OPA, LV_OPA_50); + _lv_style_set_opa(&style_first, LV_STYLE_BG_OPA | (LV_STATE_CHECKED | LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_OPA_60); lv_opa_t opa; @@ -366,24 +367,24 @@ static void states(void) lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'opa' property in normal state"); lv_test_assert_int_eq(LV_OPA_50, opa, "Get the value of an 'int' in normal state"); - found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA | LV_STYLE_STATE_CHECKED, &opa); + found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA | (LV_STATE_CHECKED) << LV_STYLE_STATE_POS, &opa); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'opa' property in checked (unspecified) state"); lv_test_assert_int_eq(LV_OPA_50, opa, "Get the value of an 'int' in checked (unspecified) state"); - found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA | LV_STYLE_STATE_CHECKED | LV_STYLE_STATE_PRESSED, &opa); + found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA | (LV_STATE_CHECKED | LV_STATE_PRESSED) << LV_STYLE_STATE_POS, &opa); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'opa' property in checked pressed state"); lv_test_assert_int_eq(LV_OPA_60, opa, "Get the value of an 'int' in checked pressed state"); - found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA | LV_STYLE_STATE_CHECKED | LV_STYLE_STATE_PRESSED | LV_STYLE_STATE_HOVER, &opa); + found = lv_style_list_get_opa(&style_list, LV_STYLE_BG_OPA | (LV_STATE_CHECKED | LV_STATE_PRESSED | LV_STATE_HOVERED) << LV_STYLE_STATE_POS, &opa); lv_test_assert_int_eq(LV_RES_OK, found, "Get an 'opa' property in checked pressed hovered state"); lv_test_assert_int_eq(LV_OPA_60, opa, "Get the value of an 'int' in checked pressed hovered state"); lv_test_print("Test state precedence in 2 styles"); - lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, LV_COLOR_YELLOW); - lv_style_set_color(&style_first, LV_STYLE_BG_COLOR | LV_STYLE_STATE_HOVER, LV_COLOR_RED); - lv_style_set_color(&style_second, LV_STYLE_BG_COLOR | LV_STYLE_STATE_CHECKED, LV_COLOR_LIME); - lv_style_set_color(&style_second, LV_STYLE_BG_COLOR | LV_STYLE_STATE_HOVER | LV_STYLE_STATE_PRESSED, LV_COLOR_BLUE); + _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR, LV_COLOR_YELLOW); + _lv_style_set_color(&style_first, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED) << LV_STYLE_STATE_POS, LV_COLOR_RED); + _lv_style_set_color(&style_second, LV_STYLE_BG_COLOR | (LV_STATE_CHECKED) << LV_STYLE_STATE_POS, LV_COLOR_LIME); + _lv_style_set_color(&style_second, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED | LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_COLOR_BLUE); lv_color_t color; @@ -391,23 +392,23 @@ static void states(void) lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in normal state"); lv_test_assert_color_eq(LV_COLOR_YELLOW, color, "Get the value of a 'color' property in normal state"); - found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | LV_STYLE_STATE_HOVER, &color); + found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED) << LV_STYLE_STATE_POS, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in hovered state"); lv_test_assert_color_eq(LV_COLOR_RED, color, "Get the value of a 'color' in hovered state"); - found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | LV_STYLE_STATE_CHECKED, &color); + found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_CHECKED) << LV_STYLE_STATE_POS, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in checked state"); lv_test_assert_color_eq(LV_COLOR_LIME, color, "Get the value of a 'color' in checked state"); - found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | LV_STYLE_STATE_HOVER | LV_STYLE_STATE_PRESSED, &color); + found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_HOVERED | LV_STATE_PRESSED) << LV_STYLE_STATE_POS, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in hover pressed state"); lv_test_assert_color_eq(LV_COLOR_BLUE, color, "Get the value of a 'color' in hover pressed state"); - found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | LV_STYLE_STATE_EDIT, &color); + found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_EDITED) << LV_STYLE_STATE_POS, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in edit (unspecified) state"); lv_test_assert_color_eq(LV_COLOR_YELLOW, color, "Get the value of a 'color' in edit (unspecified) state"); - found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | LV_STYLE_STATE_CHECKED | LV_STYLE_STATE_EDIT, &color); + found = lv_style_list_get_color(&style_list, LV_STYLE_BG_COLOR | (LV_STATE_CHECKED | LV_STATE_EDITED) << LV_STYLE_STATE_POS, &color); lv_test_assert_int_eq(LV_RES_OK, found, "Get a 'color' property in checked edit state"); lv_test_assert_color_eq(LV_COLOR_LIME, color, "Get the value of a 'color' in checked edit state"); @@ -443,16 +444,16 @@ static void mem_leak(void) lv_test_print("Set style properties"); lv_mem_monitor(&mon_start); for(i = 0; i < 100; i++) { - lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, LV_COLOR_RED); - lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, LV_COLOR_RED); - lv_style_set_color(&style3, LV_STYLE_LINE_COLOR | LV_STYLE_STATE_EDIT, LV_COLOR_BLUE); - lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, LV_COLOR_BLUE); - lv_style_set_color(&style3, LV_STYLE_LINE_COLOR | LV_STYLE_STATE_EDIT | LV_STYLE_STATE_FOCUS, LV_COLOR_GREEN); + _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED) << LV_STYLE_STATE_POS, LV_COLOR_BLUE); + _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, LV_COLOR_BLUE); + _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED | LV_STATE_FOCUSED) << LV_STYLE_STATE_POS, LV_COLOR_GREEN); - lv_style_set_color(&style3, LV_STYLE_BG_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style3, LV_STYLE_BG_COLOR, LV_COLOR_RED); - lv_style_set_color(&style3, LV_STYLE_IMAGE_RECOLOR, LV_COLOR_RED); + _lv_style_set_color(&style3, LV_STYLE_IMAGE_RECOLOR, LV_COLOR_RED); lv_style_reset(&style1); lv_style_reset(&style2); @@ -468,11 +469,11 @@ static void mem_leak(void) lv_test_print("Use local style"); lv_mem_monitor(&mon_start); for(i = 0; i < 100; i++) { - lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | LV_STYLE_STATE_PRESSED, LV_FONT_DEFAULT); + lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_THEME_DEFAULT_FONT_NORMAL); lv_style_list_reset(&style_list); - lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | LV_STYLE_STATE_PRESSED, NULL); + lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, NULL); lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK); lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK); lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK); @@ -493,9 +494,9 @@ static void mem_leak(void) lv_test_print("Add styles"); lv_mem_monitor(&mon_start); for(i = 0; i < 100; i++) { - lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_RED); - lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, LV_COLOR_RED); - lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, LV_COLOR_RED); lv_style_list_add_style(&style_list, &style1); lv_style_list_remove_style(&style_list, &style1); @@ -520,9 +521,9 @@ static void mem_leak(void) lv_test_print("Add styles and use local style"); lv_mem_monitor(&mon_start); for(i = 0; i < 100; i++) { - lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_RED); - lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, LV_COLOR_RED); - lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style2, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style3, LV_STYLE_LINE_COLOR, LV_COLOR_RED); if(i % 2 == 0) lv_style_list_set_local_color(&style_list, LV_STYLE_LINE_COLOR, LV_COLOR_RED); @@ -560,10 +561,10 @@ static void mem_leak(void) lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_CLOSE); } - lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_RED); - lv_style_set_color(&style1, LV_STYLE_LINE_COLOR | LV_STYLE_STATE_EDIT, LV_COLOR_BLUE); - lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_BLUE); - lv_style_set_color(&style1, LV_STYLE_LINE_COLOR | LV_STYLE_STATE_EDIT | LV_STYLE_STATE_FOCUS, LV_COLOR_GREEN); + _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_RED); + _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED) << LV_STYLE_STATE_POS, LV_COLOR_BLUE); + _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR, LV_COLOR_BLUE); + _lv_style_set_color(&style1, LV_STYLE_LINE_COLOR | (LV_STATE_EDITED | LV_STATE_FOCUSED) << LV_STYLE_STATE_POS, LV_COLOR_GREEN); lv_style_list_add_style(&style_list, &style1); @@ -574,12 +575,12 @@ static void mem_leak(void) lv_style_list_remove_style(&style_list, &style1); - lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_10); - lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_20); - lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_30); - lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_40); - lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_50); - lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_60); + _lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_10); + _lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_20); + _lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_30); + _lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_40); + _lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_50); + _lv_style_set_opa(&style2, LV_STYLE_TEXT_OPA, LV_OPA_60); lv_style_list_add_style(&style_list, &style2); @@ -593,17 +594,17 @@ static void mem_leak(void) lv_style_list_add_style(&style_list, &style2); lv_style_list_remove_style(&style_list, &style2); - lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 10); - lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 20); - lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 11); - lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 21); - lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 12); - lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 22); - lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 12); - lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 23); + _lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 10); + _lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 20); + _lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 11); + _lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 21); + _lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 12); + _lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 22); + _lv_style_set_int(&style3, LV_STYLE_PAD_LEFT, 12); + _lv_style_set_int(&style3, LV_STYLE_PAD_RIGHT, 23); - lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | LV_STYLE_STATE_PRESSED, LV_FONT_DEFAULT); - lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | LV_STYLE_STATE_PRESSED, NULL); + lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, LV_THEME_DEFAULT_FONT_NORMAL); + lv_style_list_set_local_ptr(&style_list, LV_STYLE_TEXT_FONT | (LV_STATE_PRESSED) << LV_STYLE_STATE_POS, NULL); lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK); lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK); lv_style_list_set_local_ptr(&style_list, LV_STYLE_PATTERN_IMAGE, LV_SYMBOL_OK); diff --git a/tests/lv_test_main.c b/tests/lv_test_main.c index 3d21857fb..ead72faac 100644 --- a/tests/lv_test_main.c +++ b/tests/lv_test_main.c @@ -1,14 +1,15 @@ #include "../lvgl.h" #include +#include #include +#include "lv_test_core/lv_test_core.h" #if LV_BUILD_TEST - static void hal_init(void); static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p); -int main2(void) +int main(void) { printf("Call lv_init...\n"); lv_init(); @@ -17,7 +18,6 @@ int main2(void) lv_test_core(); - printf("Exit with success!\n"); return 0; }