feat(deprecations): add log deprecated and mark deprecated symbols (#10244)
Arduino Lint / lint (push) Has been cancelled
Build Examples with C++ Compiler / build-examples (push) Has been cancelled
MicroPython CI / Build esp32 port (push) Has been cancelled
MicroPython CI / Build rp2 port (push) Has been cancelled
MicroPython CI / Build stm32 port (push) Has been cancelled
MicroPython CI / Build unix port (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_NORMAL_8BIT - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_SDL - Ubuntu (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_16BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_24BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - cl - Windows (push) Has been cancelled
C/C++ CI / Build OPTIONS_FULL_32BIT - gcc - Windows (push) Has been cancelled
C/C++ CI / Build ESP IDF ESP32S3 (push) Has been cancelled
C/C++ CI / Run tests with 32bit build (push) Has been cancelled
C/C++ CI / Run tests with 64bit build (push) Has been cancelled
BOM Check / bom-check (push) Has been cancelled
Verify that lv_conf_internal.h matches repository state / verify-conf-internal (push) Has been cancelled
Verify GDB constants are up-to-date / verify-gdb-consts (push) Has been cancelled
Verify the widget property name / verify-property-name (push) Has been cancelled
Verify code formatting / verify-formatting (push) Has been cancelled
Compare file templates with file names / template-check (push) Has been cancelled
Build Docs / build-and-deploy (push) Has been cancelled
Build .deb packages / build (push) Has been cancelled
Validate pkg-config and CMake config / cmake (linux) (push) Has been cancelled
Validate pkg-config and CMake config / pkgconfig (linux) (push) Has been cancelled
Validate pkg-config and CMake config / cmake (linux-3d) (push) Has been cancelled
Validate pkg-config and CMake config / pkgconfig (linux-3d) (push) Has been cancelled
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (private) (push) Has been cancelled
Install LVGL using CMake / build-examples (public) (push) Has been cancelled
Check Makefile / Build using Makefile (push) Has been cancelled
Check Makefile for UEFI / Build using Makefile for UEFI (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/benchmark_results_comment/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/filter_docker_logs/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Script Check (scripts/perf/tests/serialize_results/test.sh) (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 32b - lv_conf_perf32b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark 64b - lv_conf_perf64b (push) Has been cancelled
Emulated Performance Test / ARM Emulated Benchmark - Save PR Number (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_32B - Ubuntu (push) Has been cancelled
Performance Tests CI / Perf Tests OPTIONS_TEST_PERF_64B - Ubuntu (push) Has been cancelled
Port repo release update / run-release-branch-updater (push) Has been cancelled
Static Checks / Static Checks (push) Has been cancelled
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW Benchmark - Save PR Number (push) Has been cancelled

This commit is contained in:
André Costa
2026-06-22 09:33:50 +02:00
committed by GitHub
parent a9383ca3f3
commit d1a593f30f
20 changed files with 150 additions and 72 deletions
+19 -18
View File
@@ -439,17 +439,18 @@ void lv_obj_set_id(lv_obj_t * obj, void * id);
void * lv_obj_get_id(const lv_obj_t * obj);
/**
* DEPRECATED IDs are used only to print the widget trees.
* To find a widget use `lv_obj_find_by_name`
*
* Get the child object by its id.
* It will check children and grandchildren recursively.
* Function `lv_obj_id_compare` is used to matched obj id with given id.
*
* @deprecated IDs are used only to print the widget trees. To find a widget use `lv_obj_find_by_name`
*
* @param obj pointer to an object
* @param id the id of the child object
* @return pointer to the child object or NULL if not found
*/
LV_DEPRECATED("IDs are used only to print the widget trees. To find a widget use lv_obj_find_by_name")
lv_obj_t * lv_obj_find_by_id(const lv_obj_t * obj, const void * id);
/**
@@ -506,26 +507,26 @@ void lv_objid_builtin_destroy(void);
**********************/
#if LV_USE_ASSERT_OBJ
/**
* @deprecated Use `LV_CHECK_OBJ(obj, cls, return)` instead.
* `LV_ASSERT_OBJ` aborts on failure; `LV_CHECK_OBJ` logs a warning
* and executes the supplied action, which is safer in production.
*/
#define LV_ASSERT_OBJ(obj_p, obj_class) \
/**
* @deprecated Use `LV_CHECK_OBJ(obj, cls, return)` instead.
* `LV_ASSERT_OBJ` aborts on failure; `LV_CHECK_OBJ` logs a warning
* and executes the supplied action, which is safer in production.
*/
#define LV_ASSERT_OBJ(obj_p, obj_class) \
do { \
LV_DEPRECATED_MACRO_WARN("LV_ASSERT_OBJ is deprecated. Use LV_CHECK_OBJ instead."); \
LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \
LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \
LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?"); \
LV_DEPRECATED_MACRO_WARN("LV_ASSERT_OBJ is deprecated. Use LV_CHECK_OBJ instead."); \
LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \
LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \
LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?"); \
} while(0)
# else
/**
* @deprecated Use `LV_CHECK_OBJ(obj, return)` instead.
*/
#define LV_ASSERT_OBJ(obj_p, obj_class) \
/**
* @deprecated Use `LV_CHECK_OBJ(obj, cls, return)` instead.
*/
#define LV_ASSERT_OBJ(obj_p, obj_class) \
do { \
LV_DEPRECATED_MACRO_WARN("LV_ASSERT_OBJ is deprecated. Use LV_CHECK_OBJ instead."); \
LV_ASSERT_NULL(obj_p); \
LV_DEPRECATED_MACRO_WARN("LV_ASSERT_OBJ is deprecated. Use LV_CHECK_OBJ instead."); \
LV_ASSERT_NULL(obj_p); \
} while(0)
#endif
+2
View File
@@ -370,12 +370,14 @@ void lv_draw_buf_set_palette(lv_draw_buf_t * draw_buf, uint8_t index, lv_color32
/**
* @deprecated Use lv_draw_buf_set_palette instead.
*/
LV_DEPRECATED("Use lv_draw_buf_set_palette instead.")
void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c);
/**
* @deprecated Use lv_draw_buffer_create/destroy instead.
* Free the data pointer and dsc struct of an image.
*/
LV_DEPRECATED("Use lv_draw_buf_destroy instead.")
void lv_image_buf_free(lv_image_dsc_t * dsc);
/**********************
+2
View File
@@ -73,6 +73,7 @@ lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, l
* Free the snapshot image returned by @ref lv_snapshot_take
* @param dsc the image descriptor generated by lv_snapshot_take.
*/
LV_DEPRECATED("use lv_draw_buf_destroy directly")
void lv_snapshot_free(lv_image_dsc_t * dsc);
/**
@@ -85,6 +86,7 @@ void lv_snapshot_free(lv_image_dsc_t * dsc);
* @return LV_RESULT_OK on success, LV_RESULT_INVALID on error.
* @deprecated Use lv_snapshot_take_to_draw_buf instead.
*/
LV_DEPRECATED("use lv_snapshot_take_to_draw_buf instead.")
lv_result_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_color_format_t cf, lv_image_dsc_t * dsc,
void * buf,
uint32_t buf_size);
+22
View File
@@ -118,6 +118,25 @@ void lv_log_add(lv_log_level_t level, const char * file, int line,
# endif
#endif
#ifndef LV_LOG_WARN_ONCE
# if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN
# define LV_LOG_WARN_ONCE(...) do { \
static int warned = 0; \
if(!warned) { \
warned = 1; \
lv_log_add(LV_LOG_LEVEL_WARN, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__); \
} \
} while(0)
# else
# define LV_LOG_WARN_ONCE(...) do {}while(0)
# endif
#endif
#ifndef LV_LOG_DEPRECATED
#define LV_LOG_DEPRECATED(msg) LV_LOG_WARN_ONCE("Deprecated: " msg)
#endif
#ifndef LV_LOG_ERROR
# if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR
# define LV_LOG_ERROR(...) lv_log_add(LV_LOG_LEVEL_ERROR, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__)
@@ -151,10 +170,13 @@ void lv_log_add(lv_log_level_t level, const char * file, int line,
#define LV_LOG_TRACE(...) do {}while(0)
#define LV_LOG_INFO(...) do {}while(0)
#define LV_LOG_WARN(...) do {}while(0)
#define LV_LOG_WARN_ONCE(...) do {}while(0)
#define LV_LOG_ERROR(...) do {}while(0)
#define LV_LOG_USER(...) do {}while(0)
#define LV_LOG(...) do {}while(0)
#define LV_LOG_DEPRECATED(_) do {}while(0)
#endif /*LV_USE_LOG*/
#ifdef __cplusplus
+27 -5
View File
@@ -470,6 +470,28 @@ typedef struct _lv_draw_eve_unit_t lv_draw_eve_unit_t;
#endif
#endif /* LV_DEPRECATED not defined */
#ifndef LV_DEPRECATIONS_IGNORE_BEGIN
#if defined(PYCPARSER)
#define LV_DEPRECATIONS_IGNORE_BEGIN
#define LV_DEPRECATIONS_IGNORE_END
#elif defined(__IAR_SYSTEMS_ICC__)
#define LV_DEPRECATIONS_IGNORE_BEGIN _Pragma("diag_suppress=Pe1444")
#define LV_DEPRECATIONS_IGNORE_END _Pragma("diag_default=Pe1444")
#elif defined(__GNUC__) || defined(__clang__)
#define LV_DEPRECATIONS_IGNORE_BEGIN \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
#define LV_DEPRECATIONS_IGNORE_END \
_Pragma("GCC diagnostic pop")
#elif defined(_MSC_VER)
#define LV_DEPRECATIONS_IGNORE_BEGIN __pragma(warning(push)) __pragma(warning(disable: 4996))
#define LV_DEPRECATIONS_IGNORE_END __pragma(warning(pop))
#else
#define LV_DEPRECATIONS_IGNORE_BEGIN
#define LV_DEPRECATIONS_IGNORE_END
#endif
#endif /* LV_DEPRECATIONS_IGNORE_BEGIN */
/**
* Helper used inside deprecated macro bodies to emit a compiler warning at the
* expansion site in user code.
@@ -488,11 +510,11 @@ typedef struct _lv_draw_eve_unit_t lv_draw_eve_unit_t;
#define LV_DEPRECATED_MACRO_WARN(msg) ((void)0)
#elif defined(__GNUC__) || defined(__clang__) || defined(__IAR_SYSTEMS_ICC__)
#define LV_DEPRECATED_MACRO_WARN(msg) \
do { \
typedef int __attribute__((deprecated(msg))) __lv_deprecated_t; \
__lv_deprecated_t __lv_deprecated_dummy; \
(void)__lv_deprecated_dummy; \
} while(0)
do { \
typedef int __attribute__((deprecated(msg))) __lv_deprecated_t; \
__lv_deprecated_t __lv_deprecated_dummy; \
(void)__lv_deprecated_dummy; \
} while(0)
#else
/* Fallback: no warning, but the macro still compiles */
#define LV_DEPRECATED_MACRO_WARN(msg) ((void)0)
+1
View File
@@ -273,6 +273,7 @@ void lv_scale_set_section_max_value(lv_obj_t * scale, lv_scale_section_t * secti
* @param part the part of the Scale the style will apply to, e.g. LV_PART_INDICATOR
* @param section_part_style pointer to style to apply
*/
LV_DEPRECATED("use lv_scale_set_section_style_main/indicator/items instead")
void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style);
/**
+2
View File
@@ -176,6 +176,7 @@ void lv_spangroup_set_span_style(lv_obj_t * obj, lv_span_t * span, const lv_styl
* @param obj pointer to a spangroup object.
* @param align see lv_text_align_t for details.
*/
LV_DEPRECATED("Use text_align style property instead")
void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align);
/**
@@ -198,6 +199,7 @@ void lv_spangroup_set_indent(lv_obj_t * obj, int32_t indent);
* @param obj pointer to a spangroup object.
* @param mode see lv_span_mode_t for details.
*/
LV_DEPRECATED("set the width to LV_SIZE_CONTENT or fixed value to control expanding/wrapping")
void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode);
/**
+1
View File
@@ -206,6 +206,7 @@ void lv_textarea_set_password_show_time(lv_obj_t * obj, uint32_t time);
* @param obj pointer to a text area object
* @param align the align mode from ::lv_text_align_t
*/
LV_DEPRECATED("Use text_align style property instead")
void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align);
/*=====================
+20 -17
View File
@@ -78,6 +78,10 @@ static void call_delete_cb(lv_event_t * e);
static lv_point_t lv_obj_get_scroll_end_helper(lv_obj_t * obj);
#endif
#if LV_USE_OBJ_ID
static lv_obj_t * obj_find_by_id(const lv_obj_t * obj, const void * id);
#endif
/**********************
* STATIC VARIABLES
**********************/
@@ -549,25 +553,10 @@ void * lv_obj_get_id(const lv_obj_t * obj)
lv_obj_t * lv_obj_find_by_id(const lv_obj_t * obj, const void * id)
{
LV_CHECK_ARG(id != NULL, return NULL);
LV_LOG_WARN("DEPRECATED: IDs are used only to print the widget trees. To find a widget use obj_name");
LV_LOG_DEPRECATED("IDs are used only to print the widget trees. To find a widget use obj_name");
if(obj == NULL) obj = lv_display_get_screen_active(NULL);
if(obj == NULL) return NULL;
uint32_t i;
uint32_t child_cnt = lv_obj_get_child_count(obj);
for(i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_id_compare(child->id, id) == 0) return child;
lv_obj_t * found = lv_obj_find_by_id(child, id);
if(found != NULL) return found;
}
return NULL;
return obj_find_by_id(obj, id);
}
#endif
@@ -1470,3 +1459,17 @@ static lv_result_t lv_obj_get_any(const lv_obj_t * obj, lv_prop_id_t id, lv_prop
}
}
#endif /*LV_USE_OBJ_PROPERTY*/
#if LV_USE_OBJ_ID
static lv_obj_t * obj_find_by_id(const lv_obj_t * obj, const void * id)
{
uint32_t child_cnt = lv_obj_get_child_count(obj);
for(uint32_t i = 0; i < child_cnt; i++) {
lv_obj_t * child = obj->spec_attr->children[i];
if(lv_obj_id_compare(child->id, id) == 0) return child;
lv_obj_t * found = obj_find_by_id(child, id);
if(found != NULL) return found;
}
return NULL;
}
#endif
+2 -2
View File
@@ -535,13 +535,13 @@ void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img)
void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c)
{
LV_LOG_WARN("Deprecated API, use lv_draw_buf_set_palette instead.");
LV_LOG_DEPRECATED("Use lv_draw_buf_set_palette instead.");
lv_draw_buf_set_palette((lv_draw_buf_t *)dsc, id, c);
}
void lv_image_buf_free(lv_image_dsc_t * dsc)
{
LV_LOG_WARN("Deprecated API, use lv_draw_buf_destroy instead.");
LV_LOG_DEPRECATED("Use lv_draw_buf_destroy instead.");
if(dsc != NULL) {
if(dsc->data != NULL)
lv_free((void *)dsc->data);
+2 -2
View File
@@ -203,7 +203,7 @@ lv_draw_buf_t * lv_snapshot_take(lv_obj_t * obj, lv_color_format_t cf)
void lv_snapshot_free(lv_image_dsc_t * dsc)
{
LV_LOG_WARN("Deprecated API, use lv_draw_buf_destroy directly.");
LV_LOG_DEPRECATED("use lv_draw_buf_destroy directly");
lv_draw_buf_destroy((lv_draw_buf_t *)dsc);
}
@@ -212,7 +212,7 @@ lv_result_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_color_format_t cf, lv_ima
uint32_t buf_size)
{
lv_draw_buf_t draw_buf;
LV_LOG_WARN("Deprecated API, use lv_snapshot_take_to_draw_buf instead.");
LV_LOG_DEPRECATED("use lv_snapshot_take_to_draw_buf instead.");
lv_draw_buf_init(&draw_buf, 1, 1, cf, buf_size, buf, buf_size);
lv_result_t res = lv_snapshot_take_to_draw_buf(obj, cf, &draw_buf);
if(res == LV_RESULT_OK) {
+2 -2
View File
@@ -49,8 +49,8 @@ lv_display_t * lv_wayland_window_create(uint32_t hor_res, uint32_t ver_res, char
{
lv_wayland_init();
if(close_cb) {
LV_LOG_WARN("'lv_wayland_display_close_cb_t' is deprecated and will be removed in the next release. Instead bind an LV_EVENT_DELETE to the display\
Bind an LV_EVENT_DELETE to the display returned by `lv_wayland_window_create` instead.");
LV_LOG_DEPRECATED("'lv_wayland_display_close_cb_t' is deprecated and will be removed in the next release. "
"Bind an LV_EVENT_DELETE to the display returned by `lv_wayland_window_create` instead.");
}
lv_wl_window_t * window = lv_ll_ins_tail(&lv_wl_ctx.window_ll);
+1 -5
View File
@@ -68,11 +68,7 @@ uint32_t lv_layout_create(lv_layout_callbacks_t callbacks, void * user_data)
uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data)
{
static bool warned = false;
if(!warned) {
LV_LOG_WARN("`lv_layout_register` is deprecated and replaced by `lv_layout_create`.");
warned = true;
}
LV_LOG_DEPRECATED("`lv_layout_register` is deprecated and replaced by `lv_layout_create`.");
lv_layout_callbacks_t cbs = {.layout_update_cb = cb, . get_min_size_cb = NULL};
return lv_layout_create(cbs, user_data);
}
+1 -1
View File
@@ -23,7 +23,7 @@ static void cb_delete_assertion(lv_event_t * event);
lv_fragment_t * lv_fragment_create(const lv_fragment_class_t * cls, void * args)
{
LV_LOG_WARN("lv_fragment is deprecated and will be removed in an upcoming release.");
LV_LOG_DEPRECATED("lv_fragment is deprecated and will be removed in an upcoming release.");
LV_ASSERT_NULL(cls);
LV_ASSERT_NULL(cls->create_obj_cb);
LV_ASSERT(cls->instance_size >= sizeof(lv_fragment_t));
+1 -1
View File
@@ -504,7 +504,7 @@ void lv_scale_set_section_style_items(lv_obj_t * scale, lv_scale_section_t * sec
void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style)
{
LV_LOG_WARN("Deprecated, use lv_scale_set_section_style_main/indicator/items instead");
LV_LOG_DEPRECATED("use lv_scale_set_section_style_main/indicator/items instead");
if(NULL == section) return;
+4 -2
View File
@@ -89,6 +89,7 @@ static lv_span_coords_t make_span_coords(const lv_span_t * prev_span, const lv_s
**********************/
#if LV_USE_OBJ_PROPERTY
LV_DEPRECATIONS_IGNORE_BEGIN
static const lv_property_ops_t lv_span_properties[] = {
{
.id = LV_PROPERTY_SPAN_ALIGN,
@@ -116,6 +117,7 @@ static const lv_property_ops_t lv_span_properties[] = {
.getter = lv_spangroup_get_max_lines,
},
};
LV_DEPRECATIONS_IGNORE_END
#endif
const lv_obj_class_t lv_spangroup_class = {
@@ -342,7 +344,7 @@ void lv_spangroup_set_span_style(lv_obj_t * obj, lv_span_t * span, const lv_styl
void lv_spangroup_set_align(lv_obj_t * obj, lv_text_align_t align)
{
LV_LOG_WARN("DEPRECATED. Use the text_align style property instead");
LV_LOG_DEPRECATED("use the text_align style property instead");
lv_obj_set_style_text_align(obj, align, LV_PART_MAIN);
}
@@ -370,7 +372,7 @@ void lv_spangroup_set_indent(lv_obj_t * obj, int32_t indent)
void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode)
{
LV_LOG_WARN("DEPRECATED, set the width to LV_SIZE_CONTENT or fixed value to control expanding/wrapping");
LV_LOG_DEPRECATED("set the width to LV_SIZE_CONTENT or fixed value to control expanding/wrapping");
LV_CHECK_OBJ(obj, MY_CLASS, return);
if(mode >= LV_SPAN_MODE_LAST) return;
+1 -1
View File
@@ -542,7 +542,7 @@ void lv_textarea_set_password_show_time(lv_obj_t * obj, uint32_t time)
void lv_textarea_set_align(lv_obj_t * obj, lv_text_align_t align)
{
LV_LOG_WARN("Deprecated: use the normal text_align style property instead");
LV_LOG_DEPRECATED("Use text_align style property instead");
lv_obj_set_style_text_align(obj, align, 0);
switch(align) {
@@ -37,8 +37,10 @@ void test_obj_id_get_child(void)
lv_obj_set_id(child, (void *)(lv_uintptr_t)42);
lv_obj_set_id(grandchild, (void *)(lv_uintptr_t)43);
LV_DEPRECATIONS_IGNORE_BEGIN
TEST_ASSERT_EQUAL_PTR(child, lv_obj_find_by_id(NULL, (void *)(lv_uintptr_t)42));
TEST_ASSERT_EQUAL_PTR(grandchild, lv_obj_find_by_id(NULL, (void *)(lv_uintptr_t)43));
LV_DEPRECATIONS_IGNORE_END
}
#endif
+21 -16
View File
@@ -123,10 +123,12 @@ void test_span_set_text_static_with_previous_text_overwrites(void)
void test_spangroup_set_align(void)
{
LV_DEPRECATIONS_IGNORE_BEGIN
const lv_text_align_t align = LV_TEXT_ALIGN_CENTER;
lv_spangroup_set_align(spangroup, align);
TEST_ASSERT_EQUAL(align, lv_spangroup_get_align(spangroup));
LV_DEPRECATIONS_IGNORE_END
}
void test_spangroup_set_overflow(void)
@@ -156,6 +158,7 @@ void test_spangroup_set_indent(void)
void test_spangroup_set_mode(void)
{
LV_DEPRECATIONS_IGNORE_BEGIN
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_EXPAND);
TEST_ASSERT_EQUAL(LV_SPAN_MODE_EXPAND, lv_spangroup_get_mode(spangroup));
@@ -164,13 +167,16 @@ void test_spangroup_set_mode(void)
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_FIXED);
TEST_ASSERT_EQUAL(LV_SPAN_MODE_FIXED, lv_spangroup_get_mode(spangroup));
LV_DEPRECATIONS_IGNORE_END
}
void test_spangroup_set_mode_invalid_parameter_mode_not_changed(void)
{
LV_DEPRECATIONS_IGNORE_BEGIN
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_EXPAND);
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_LAST);
TEST_ASSERT_EQUAL(LV_SPAN_MODE_EXPAND, lv_spangroup_get_mode(spangroup));
LV_DEPRECATIONS_IGNORE_END
}
void test_spangroup_set_max_lines(void)
@@ -216,7 +222,7 @@ void test_spangroup_draw(void)
{
active_screen = lv_screen_active();
spangroup = lv_spangroup_create(active_screen);
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK);
lv_obj_set_height(spangroup, LV_SIZE_CONTENT);
lv_obj_set_width(spangroup, 100);
lv_span_t * span_1 = lv_spangroup_add_span(spangroup);
lv_span_set_text(span_1, "This text is over 100 pixels width");
@@ -229,15 +235,16 @@ void test_spangroup_draw(void)
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_02.png");
lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_CENTER);
lv_obj_set_style_text_align(spangroup, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_03.png");
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_EXPAND);
lv_obj_set_size(spangroup, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_04.png");
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_FIXED);
lv_obj_set_width(spangroup, 100);
lv_obj_set_content_height(spangroup, 100);
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_05.png");
}
@@ -324,8 +331,7 @@ void test_spangroup_chinese_break_line(void)
active_screen = lv_screen_active();
spangroup = lv_spangroup_create(active_screen);
lv_obj_set_size(spangroup, LV_PCT(100), LV_PCT(100));
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK);
lv_obj_set_size(spangroup, LV_PCT(100), LV_SIZE_CONTENT);
lv_obj_set_style_text_font(spangroup, font, 0);
lv_obj_set_style_border_width(spangroup, 2, 0);
@@ -388,7 +394,7 @@ void test_spangroup_get_span_coords(void)
/* Set styles and properties for the span group */
lv_obj_set_style_outline_width(spangroup, 1, 0);
lv_spangroup_set_indent(spangroup, 20);
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK);
lv_obj_set_height(spangroup, LV_SIZE_CONTENT);
lv_obj_set_width(spangroup, 300);
lv_obj_set_style_pad_all(spangroup, 20, LV_PART_MAIN);
@@ -489,7 +495,7 @@ void test_spangroup_set_right_align_on_overflow(void)
lv_obj_set_width(spangroup, 180);
lv_obj_set_height(spangroup, 30);
lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_RIGHT);
lv_obj_set_style_text_align(spangroup, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN);
lv_span_t * span = lv_spangroup_add_span(spangroup);
lv_span_set_text_static(span, "China is a beautiful country.");
@@ -527,7 +533,7 @@ void test_spangroup_rtl_mode_set_left_align(void)
lv_obj_set_style_text_font(spangroup, &lv_font_dejavu_16_persian_hebrew, 0);
lv_obj_set_style_base_dir(spangroup, LV_BASE_DIR_RTL, 0);
lv_obj_set_size(spangroup, 300, lv_font_dejavu_16_persian_hebrew.line_height);
lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_LEFT);
lv_obj_set_style_text_align(spangroup, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN);
lv_span_t * span = lv_spangroup_add_span(spangroup);
lv_span_set_text_static(span, message);
@@ -546,7 +552,7 @@ void test_spangroup_rtl_mode_set_center_align(void)
lv_obj_set_style_text_font(spangroup, &lv_font_dejavu_16_persian_hebrew, 0);
lv_obj_set_style_base_dir(spangroup, LV_BASE_DIR_RTL, 0);
lv_obj_set_size(spangroup, 300, lv_font_dejavu_16_persian_hebrew.line_height);
lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_CENTER);
lv_obj_set_style_text_align(spangroup, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
lv_span_t * span = lv_spangroup_add_span(spangroup);
lv_span_set_text_static(span, message);
@@ -571,9 +577,8 @@ void test_spangroup_set_line_space(void)
active_screen = lv_screen_active();
spangroup = lv_spangroup_create(active_screen);
lv_obj_set_y(spangroup, -26);
lv_obj_set_width(spangroup, 300);
lv_obj_set_size(spangroup, 300, LV_SIZE_CONTENT);
lv_obj_set_style_border_width(spangroup, 2, 0);
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK);
lv_obj_set_style_text_line_space(spangroup, 2, 0);
lv_obj_set_style_text_font(spangroup, font, 0);
@@ -668,7 +673,7 @@ void test_spangroup_ellipsis_not_shown_when_text_fits(void)
lv_obj_set_style_text_font(spangroup1, font, 0);
lv_obj_set_style_outline_width(spangroup1, 1, 0);
lv_spangroup_set_overflow(spangroup1, LV_SPAN_OVERFLOW_ELLIPSIS);
lv_spangroup_set_mode(spangroup1, LV_SPAN_MODE_BREAK);
lv_obj_set_height(spangroup1, LV_SIZE_CONTENT);
lv_span_t * span1 = lv_spangroup_add_span(spangroup1);
lv_span_set_text(span1, "消息免打扰");
@@ -683,7 +688,8 @@ void test_spangroup_ellipsis_not_shown_when_text_fits(void)
lv_obj_set_style_text_font(spangroup2, font, 0);
lv_obj_set_style_outline_width(spangroup2, 1, 0);
lv_spangroup_set_overflow(spangroup2, LV_SPAN_OVERFLOW_ELLIPSIS);
lv_spangroup_set_mode(spangroup2, LV_SPAN_MODE_BREAK);
lv_obj_set_height(spangroup2, LV_SIZE_CONTENT);
lv_obj_set_y(spangroup2, 40);
lv_obj_set_width(spangroup2, 250);
lv_obj_set_style_max_height(spangroup2, constrained_h, 0);
@@ -716,10 +722,9 @@ void test_spangroup_ellipsis_multiline_truncated(void)
int32_t line_h = lv_font_get_line_height(LV_FONT_DEFAULT);
lv_obj_set_style_outline_width(spangroup, 1, 0);
lv_obj_set_width(spangroup, 100);
lv_obj_set_size(spangroup, 100, LV_SIZE_CONTENT);
lv_obj_set_style_max_height(spangroup, line_h * 2, 0);
lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_ELLIPSIS);
lv_spangroup_set_mode(spangroup, LV_SPAN_MODE_BREAK);
lv_span_t * span = lv_spangroup_add_span(spangroup);
lv_span_set_text(span, "This text is long enough to wrap into three or more lines in a 100px container");
@@ -511,6 +511,7 @@ void test_textarea_set_password_show_time(void)
void test_textarea_set_align(void)
{
LV_DEPRECATIONS_IGNORE_BEGIN
lv_textarea_set_align(textarea, LV_TEXT_ALIGN_CENTER);
lv_textarea_set_text(textarea, "1234567890");
TEST_ASSERT_EQUAL_SCREENSHOT("textarea_align_center.png");
@@ -522,6 +523,22 @@ void test_textarea_set_align(void)
lv_textarea_set_align(textarea, LV_TEXT_ALIGN_RIGHT);
lv_textarea_set_text(textarea, "1234567890");
TEST_ASSERT_EQUAL_SCREENSHOT("textarea_align_right.png");
LV_DEPRECATIONS_IGNORE_END
}
void test_textarea_text_align(void)
{
lv_obj_set_style_text_align(textarea, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN);
lv_textarea_set_text(textarea, "1234567890");
TEST_ASSERT_EQUAL_SCREENSHOT("textarea_align_center.png");
lv_obj_set_style_text_align(textarea, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN);
lv_textarea_set_text(textarea, "1234567890");
TEST_ASSERT_EQUAL_SCREENSHOT("textarea_align_left.png");
lv_obj_set_style_text_align(textarea, LV_TEXT_ALIGN_RIGHT, LV_PART_MAIN);
lv_textarea_set_text(textarea, "1234567890");
TEST_ASSERT_EQUAL_SCREENSHOT("textarea_align_right.png");
}
void test_textarea_cursor_show(void)