mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-22 23:37:43 +08:00
feat(api_mapping): add ability to disable api mapping (#8745)
Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com> Co-authored-by: Liam Howatt <30486941+liamHowatt@users.noreply.github.com>
This commit is contained in:
@@ -109,7 +109,7 @@ uint8_t img_benchmark_avatar_map[] = {
|
||||
|
||||
};
|
||||
|
||||
const lv_img_dsc_t img_benchmark_avatar = {
|
||||
const lv_image_dsc_t img_benchmark_avatar = {
|
||||
.header.magic = LV_IMAGE_HEADER_MAGIC,
|
||||
.header.cf = LV_COLOR_FORMAT_ARGB8888,
|
||||
.header.flags = 0,
|
||||
|
||||
@@ -292,7 +292,7 @@ lv_obj_t * lv_demo_music_main_create(lv_obj_t * parent)
|
||||
LV_IMAGE_DECLARE(img_lv_demo_music_logo);
|
||||
lv_obj_t * logo = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(logo, &img_lv_demo_music_logo);
|
||||
lv_obj_move_foreground(logo);
|
||||
lv_obj_move_to_index(logo, -1);
|
||||
lv_obj_align_to(logo, spectrum_obj, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
#if LV_DEMO_MUSIC_SQUARE == 0 && LV_DEMO_MUSIC_ROUND == 0
|
||||
|
||||
@@ -85,7 +85,7 @@ uint8_t img_clothes_map[] = {
|
||||
|
||||
};
|
||||
|
||||
const lv_img_dsc_t img_clothes = {
|
||||
const lv_image_dsc_t img_clothes = {
|
||||
.header.magic = LV_IMAGE_HEADER_MAGIC,
|
||||
.header.cf = LV_COLOR_FORMAT_ARGB8888,
|
||||
.header.flags = 0,
|
||||
|
||||
@@ -183,7 +183,7 @@ uint8_t img_demo_widgets_avatar_map[] = {
|
||||
|
||||
};
|
||||
|
||||
const lv_img_dsc_t img_demo_widgets_avatar = {
|
||||
const lv_image_dsc_t img_demo_widgets_avatar = {
|
||||
.header.magic = LV_IMAGE_HEADER_MAGIC,
|
||||
.header.cf = LV_COLOR_FORMAT_ARGB8888,
|
||||
.header.flags = 0,
|
||||
|
||||
@@ -70,7 +70,7 @@ uint8_t img_lvgl_logo_map[] = {
|
||||
|
||||
};
|
||||
|
||||
const lv_img_dsc_t img_lvgl_logo = {
|
||||
const lv_image_dsc_t img_lvgl_logo = {
|
||||
.header.magic = LV_IMAGE_HEADER_MAGIC,
|
||||
.header.cf = LV_COLOR_FORMAT_ARGB8888,
|
||||
.header.flags = 0,
|
||||
|
||||
@@ -107,11 +107,11 @@ You can iterate through a parent Widget's children like this:
|
||||
:cpp:expr:`lv_obj_get_index(widget)` returns the index of the Widget in its parent.
|
||||
It is equivalent to the number of older children in the parent.
|
||||
|
||||
You can bring a Widget to the foreground or send it to the background with
|
||||
:cpp:expr:`lv_obj_move_foreground(widget)` and :cpp:expr:`lv_obj_move_background(widget)`.
|
||||
|
||||
You can change the index of a Widget in its parent using :cpp:expr:`lv_obj_move_to_index(widget, index)`.
|
||||
|
||||
You can bring a Widget to the foreground or send it to the background with
|
||||
:cpp:expr:`lv_obj_move_to_index(widget, -1)` and :cpp:expr:`lv_obj_move_to_index(widget, 0)`.
|
||||
|
||||
You can swap the position of two Widgets with :cpp:expr:`lv_obj_swap(widget1, widget2)`.
|
||||
|
||||
To get a Widget's Screen (highest-level parent) use :cpp:expr:`lv_obj_get_screen(widget)`.
|
||||
|
||||
@@ -59,10 +59,8 @@ its children.
|
||||
Changing Order
|
||||
--------------
|
||||
|
||||
There are four explicit ways to bring a Widget to the foreground:
|
||||
There are three explicit ways to bring a Widget to the foreground:
|
||||
|
||||
- Use :cpp:expr:`lv_obj_move_foreground(widget)` to bring a Widget to the foreground.
|
||||
Similarly, use :cpp:expr:`lv_obj_move_background(widget)` to move it to the background.
|
||||
- Use :cpp:expr:`lv_obj_move_to_index(widget, idx)` to move a Widget to a given index in the order of children.
|
||||
|
||||
- ``0``: background
|
||||
@@ -81,7 +79,6 @@ API
|
||||
***
|
||||
|
||||
.. API equals:
|
||||
lv_obj_move_foreground
|
||||
lv_obj_move_to_index
|
||||
lv_obj_swap
|
||||
lv_obj_set_parent
|
||||
|
||||
@@ -98,14 +98,14 @@ wider than the Label's width can be manipulated according to several
|
||||
long mode policies. Similarly, the policies can be applied if the height
|
||||
of the text is greater than the height of the Label.
|
||||
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_WRAP` Wrap lines that are too long. If the height is :c:macro:`LV_SIZE_CONTENT` the Label's
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_MODE_WRAP` Wrap lines that are too long. If the height is :c:macro:`LV_SIZE_CONTENT` the Label's
|
||||
height will be expanded, otherwise the text will be clipped. (Default)
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_DOT` Replaces the last 3 characters from bottom right corner of the Label with dots (``.``)
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_SCROLL` If the text is wider than the label, scroll it horizontally back and forth. If it's
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_MODE_DOTS` Replaces the last 3 characters from bottom right corner of the Label with dots (``.``)
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_MODE_SCROLL` If the text is wider than the label, scroll it horizontally back and forth. If it's
|
||||
higher, scroll vertically. Only one direction is scrolled and horizontal scrolling has higher precedence.
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_SCROLL_CIRCULAR` If the text is wider than the Label, scroll it horizontally continuously. If it's
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_MODE_SCROLL_CIRCULAR` If the text is wider than the Label, scroll it horizontally continuously. If it's
|
||||
higher, scroll vertically. Only one direction is scrolled and horizontal scrolling has higher precedence.
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_CLIP` Simply clip the parts of the text outside the Label.
|
||||
- :cpp:enumerator:`LV_LABEL_LONG_MODE_CLIP` Simply clip the parts of the text outside the Label.
|
||||
|
||||
You can specify the long mode with :cpp:expr:`lv_label_set_long_mode(label, LV_LABEL_LONG_...)`
|
||||
|
||||
|
||||
@@ -97,8 +97,8 @@ registered for each Widget. The XML parser for the label Widget looks like this:
|
||||
/* Helper to convert strings to enum values */
|
||||
static lv_label_long_mode_t long_mode_text_to_enum(const char * txt)
|
||||
{
|
||||
if(lv_streq("wrap", txt)) return LV_LABEL_LONG_WRAP;
|
||||
if(lv_streq("scroll", txt)) return LV_LABEL_LONG_SCROLL;
|
||||
if(lv_streq("wrap", txt)) return LV_LABEL_LONG_MODE_WRAP;
|
||||
if(lv_streq("scroll", txt)) return LV_LABEL_LONG_MODE_SCROLL;
|
||||
|
||||
LV_LOG_WARN("%s is an unknown value for label's long_mode", txt);
|
||||
return 0; /* Return 0 in the absence of a better option. */
|
||||
|
||||
@@ -128,7 +128,7 @@ static void ui_init(void)
|
||||
lv_obj_set_pos(btn, 10, 80);
|
||||
lv_obj_add_flag(btn, LV_OBJ_FLAG_CHECKABLE);
|
||||
lv_obj_bind_state_if_not_eq(btn, &auth_state_subject, LV_STATE_DISABLED, LOGGED_IN);
|
||||
lv_button_bind_checked(btn, &engine_subject);
|
||||
lv_obj_bind_checked(btn, &engine_subject);
|
||||
label = lv_label_create(btn);
|
||||
lv_label_set_text(label, "START ENGINE");
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ static void increment_thread_entry(void * user_data)
|
||||
uint32_t press_count = 0;
|
||||
|
||||
lv_lock();
|
||||
counter_label = lv_label_create(lv_scr_act());
|
||||
counter_label = lv_label_create(lv_screen_active());
|
||||
lv_obj_align(counter_label, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_label_set_text_fmt(counter_label, "Pressed %" LV_PRIu32 " times", press_count);
|
||||
lv_unlock();
|
||||
|
||||
@@ -79,7 +79,7 @@ void lv_example_scroll_1(void)
|
||||
lv_obj_center(label);
|
||||
|
||||
/* When LV_OBJ_FLAG_SCROLL_ELASTIC is cleared, scrolling does not go past edge boundaries. */
|
||||
/* lv_obj_clear_flag(panel, LV_OBJ_FLAG_SCROLL_ELASTIC); */
|
||||
/* lv_obj_remove_flag(panel, LV_OBJ_FLAG_SCROLL_ELASTIC); */
|
||||
|
||||
/* Call `scroll_update_cb` while panel is being scrolled. */
|
||||
lv_obj_add_event_cb(panel, scroll_update_cb, LV_EVENT_SCROLL, NULL);
|
||||
|
||||
@@ -15,7 +15,8 @@ static void float_button_event_cb(lv_event_t * e)
|
||||
lv_obj_t * list_btn = lv_list_add_button(list, LV_SYMBOL_AUDIO, buf);
|
||||
btn_cnt++;
|
||||
|
||||
lv_obj_move_foreground(float_btn);
|
||||
/* Move the button to the foreground*/
|
||||
lv_obj_move_to_index(float_btn, -1);
|
||||
|
||||
lv_obj_scroll_to_view(list_btn, LV_ANIM_ON);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ static void arc_click_cb(lv_event_t * e)
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, anim_back);
|
||||
lv_anim_set_exec_cb(&a, anim_move_cb);
|
||||
lv_anim_set_time(&a, 200);
|
||||
lv_anim_set_duration(&a, 200);
|
||||
lv_anim_set_values(&a, 0, 100);
|
||||
lv_anim_set_deleted_cb(&a, anim_cleanup_cb);
|
||||
lv_anim_start(&a);
|
||||
@@ -94,7 +94,7 @@ static void arc_click_cb(lv_event_t * e)
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, anim_data);
|
||||
lv_anim_set_exec_cb(&a, anim_move_cb);
|
||||
lv_anim_set_time(&a, 200);
|
||||
lv_anim_set_duration(&a, 200);
|
||||
lv_anim_set_values(&a, 0, 100);
|
||||
lv_anim_set_deleted_cb(&a, anim_cleanup_cb);
|
||||
lv_anim_start(&a);
|
||||
|
||||
@@ -38,7 +38,7 @@ static void event_handler_top(lv_event_t * e)
|
||||
lv_event_code_t code = lv_event_get_code(e);
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
if(currentButton == NULL) return;
|
||||
lv_obj_move_background(currentButton);
|
||||
lv_obj_move_to_index(currentButton, 0);
|
||||
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ static void event_handler_bottom(lv_event_t * e)
|
||||
const lv_event_code_t code = lv_event_get_code(e);
|
||||
if(code == LV_EVENT_CLICKED) {
|
||||
if(currentButton == NULL) return;
|
||||
lv_obj_move_foreground(currentButton);
|
||||
lv_obj_move_to_index(currentButton, -1);
|
||||
lv_obj_scroll_to_view(currentButton, LV_ANIM_ON);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ void lv_example_lottie_1(void)
|
||||
lv_lottie_set_buffer(lottie, 64, 64, buf);
|
||||
#else
|
||||
/*For GPUs and special alignment/strid setting use a draw_buf instead*/
|
||||
LV_DRAW_BUF_DEFINE(draw_buf, 64, 64, LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED);
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf, 64, 64, LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED);
|
||||
lv_lottie_set_draw_buf(lottie, &draw_buf);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ void lv_example_lottie_2(void)
|
||||
lv_lottie_set_buffer(lottie, 64, 64, buf);
|
||||
#else
|
||||
/*For GPUs and special alignment/strid setting use a draw_buf instead*/
|
||||
LV_DRAW_BUF_DEFINE(draw_buf, 64, 64, LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED);
|
||||
LV_DRAW_BUF_DEFINE_STATIC(draw_buf, 64, 64, LV_COLOR_FORMAT_ARGB8888_PREMULTIPLIED);
|
||||
lv_lottie_set_draw_buf(lottie, &draw_buf);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -134,13 +134,13 @@ void lv_example_scale_10(void)
|
||||
|
||||
lv_scale_set_line_needle_value(scale, needle_line, 0, current_hr);
|
||||
|
||||
lv_obj_t * circle = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * circle = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(circle, 130, 130);
|
||||
lv_obj_center(circle);
|
||||
|
||||
lv_obj_set_style_radius(circle, LV_RADIUS_CIRCLE, 0);
|
||||
|
||||
lv_obj_set_style_bg_color(circle, lv_obj_get_style_bg_color(lv_scr_act(), LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_bg_color(circle, lv_obj_get_style_bg_color(lv_screen_active(), LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_bg_opa(circle, LV_OPA_COVER, 0);
|
||||
lv_obj_set_style_border_width(circle, 0, LV_PART_MAIN);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_TEXTAREA && LV_USE_KEYBOARD && LV_BUILD_EXAMPLES
|
||||
|
||||
static void create_styled_textarea_cursor(const char * txt, lv_coord_t y_ofs, lv_style_t * cursor_style)
|
||||
static void create_styled_textarea_cursor(const char * txt, int32_t y_ofs, lv_style_t * cursor_style)
|
||||
{
|
||||
lv_obj_t * ta = lv_textarea_create(lv_screen_active());
|
||||
lv_textarea_set_text(ta, txt);
|
||||
|
||||
@@ -131,11 +131,15 @@ extern "C" {
|
||||
|
||||
#include "src/drivers/lv_drivers.h"
|
||||
|
||||
#include "src/lv_api_map_v8.h"
|
||||
#include "src/lv_api_map_v9_0.h"
|
||||
#include "src/lv_api_map_v9_1.h"
|
||||
#include "src/lv_api_map_v9_2.h"
|
||||
#include "src/lv_api_map_v9_3.h"
|
||||
/* Define LV_DISABLE_API_MAPPING using a compiler option
|
||||
* to make sure your application is not using deprecated names */
|
||||
#ifndef LV_DISABLE_API_MAPPING
|
||||
#include "src/lv_api_map_v8.h"
|
||||
#include "src/lv_api_map_v9_0.h"
|
||||
#include "src/lv_api_map_v9_1.h"
|
||||
#include "src/lv_api_map_v9_2.h"
|
||||
#include "src/lv_api_map_v9_3.h"
|
||||
#endif /*LV_DISABLE_API_MAPPING*/
|
||||
|
||||
#if LV_USE_PRIVATE_API
|
||||
#include "src/lvgl_private.h"
|
||||
|
||||
@@ -151,14 +151,14 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
|
||||
|
||||
lv_draw_buf_t * adjusted = lv_image_decoder_post_process(dsc, decoded);
|
||||
if(adjusted == NULL) {
|
||||
lv_draw_buf_destroy_user(image_cache_draw_buf_handlers, decoded);
|
||||
lv_draw_buf_destroy(decoded);
|
||||
LV_PROFILER_DECODER_END_TAG("lv_libpng_decoder_open");
|
||||
return LV_RESULT_INVALID;
|
||||
}
|
||||
|
||||
/*The adjusted draw buffer is newly allocated.*/
|
||||
if(adjusted != decoded) {
|
||||
lv_draw_buf_destroy_user(image_cache_draw_buf_handlers, decoded);
|
||||
lv_draw_buf_destroy(decoded);
|
||||
decoded = adjusted;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
|
||||
lv_cache_entry_t * entry = lv_image_decoder_add_to_cache(decoder, &search_key, decoded, NULL);
|
||||
|
||||
if(entry == NULL) {
|
||||
lv_draw_buf_destroy_user(image_cache_draw_buf_handlers, decoded);
|
||||
lv_draw_buf_destroy(decoded);
|
||||
LV_PROFILER_DECODER_END_TAG("lv_libpng_decoder_open");
|
||||
return LV_RESULT_INVALID;
|
||||
}
|
||||
@@ -202,7 +202,7 @@ static void decoder_close(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t *
|
||||
LV_UNUSED(decoder); /*Unused*/
|
||||
|
||||
if(dsc->args.no_cache ||
|
||||
!lv_image_cache_is_enabled()) lv_draw_buf_destroy_user(image_cache_draw_buf_handlers, (lv_draw_buf_t *)dsc->decoded);
|
||||
!lv_image_cache_is_enabled()) lv_draw_buf_destroy((lv_draw_buf_t *)dsc->decoded);
|
||||
}
|
||||
|
||||
static uint8_t * alloc_file(const char * filename, uint32_t * size)
|
||||
@@ -331,7 +331,7 @@ static lv_draw_buf_t * decode_png(lv_image_decoder_dsc_t * dsc)
|
||||
lv_free(png_data);
|
||||
if(!ret) {
|
||||
LV_LOG_ERROR("png decode failed: %s", image.message);
|
||||
lv_draw_buf_destroy_user(image_cache_draw_buf_handlers, decoded);
|
||||
lv_draw_buf_destroy(decoded);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -392,7 +392,7 @@ static void ttf_release_glyph_cb(const lv_font_t * font, lv_font_glyph_dsc_t * g
|
||||
|
||||
ttf_font_desc_t * dsc = (ttf_font_desc_t *)font->dsc;
|
||||
if(!dsc->cache_size) { /* no cache, do everything directly */
|
||||
lv_draw_buf_destroy_user(font_draw_buf_handlers, (lv_draw_buf_t *)g_dsc->entry);
|
||||
lv_draw_buf_destroy((lv_draw_buf_t *)g_dsc->entry);
|
||||
}
|
||||
else {
|
||||
if(g_dsc->entry == NULL) {
|
||||
|
||||
@@ -37,14 +37,14 @@ lv_obj_t * lv_xml_component_process(lv_xml_parser_state_t * state, const char *
|
||||
* Load the styles, constants, another data of the component. It needs to be called only once for each component.
|
||||
* @param name the name as the component will be referenced later in other components
|
||||
* @param xml_def the XML definition of the component as a NULL terminated string
|
||||
* @return LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
* @return LV_RESULT_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
*/
|
||||
lv_result_t lv_xml_component_register_from_data(const char * name, const char * xml_def);
|
||||
|
||||
/**
|
||||
* Load the styles, constants, another data of the component. It needs to be called only once for each component.
|
||||
* @param path path to an XML file
|
||||
* @return LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
* @return LV_RESULT_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
*/
|
||||
lv_result_t lv_xml_component_register_from_file(const char * path);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ typedef enum {
|
||||
* Load the styles, constants, another data of the test. It needs to be called only once for each test.
|
||||
* @param xml_def the XML definition of the test as a NULL terminated string
|
||||
* @param ref_image_path_prefix prefix for the path of reference images
|
||||
* @return LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
* @return LV_RESULT_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
*/
|
||||
lv_result_t lv_xml_test_register_from_data(const char * xml_def, const char * ref_image_path_prefix);
|
||||
|
||||
@@ -49,7 +49,7 @@ lv_result_t lv_xml_test_register_from_data(const char * xml_def, const char * re
|
||||
* Load the styles, constants, another data of the test. It needs to be called only once for each test.
|
||||
* @param path path to an XML file
|
||||
* @param ref_image_path_prefix prefix for the path of reference images
|
||||
* @return LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
* @return LV_RESULT_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
*/
|
||||
lv_result_t lv_xml_test_register_from_file(const char * path, const char * ref_image_path_prefix);
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@ extern "C" {
|
||||
/**
|
||||
* Register translations from an XML file
|
||||
* @param path path to an XML file (staring with a driver letter)
|
||||
* @return LV_RES_OK: no error
|
||||
* @return LV_RESULT_OK: no error
|
||||
*/
|
||||
lv_result_t lv_xml_translation_register_from_file(const char * path);
|
||||
|
||||
/**
|
||||
* Register translations from an XML string
|
||||
* @param xml_def the XML definition as a string
|
||||
* @return LV_RES_OK: no error
|
||||
* @return LV_RESULT_OK: no error
|
||||
*/
|
||||
lv_result_t lv_xml_translation_register_from_data(const char * xml_def);
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ extern "C" {
|
||||
/**
|
||||
* Load the styles, constants, another data of the component. It needs to be called only once for each component.
|
||||
* @param xml_def the XML definition of the component as a NULL terminated string
|
||||
* @return LV_RES_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
* @return LV_RESULT_OK: loaded successfully, LV_RES_INVALID: otherwise
|
||||
*/
|
||||
lv_result_t lv_xml_update_from_data(const char * xml_def);
|
||||
|
||||
|
||||
@@ -181,4 +181,6 @@
|
||||
|
||||
#define LV_USE_GESTURE_RECOGNITION 1
|
||||
|
||||
#define LV_DISABLE_API_MAPPING 1
|
||||
|
||||
#endif /* LV_TEST_CONF_FULL_H */
|
||||
|
||||
@@ -12,7 +12,7 @@ static lv_draw_buf_t * canvas_buf;
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
canvas = lv_canvas_create(lv_scr_act());
|
||||
canvas = lv_canvas_create(lv_screen_active());
|
||||
canvas_buf = lv_draw_buf_create(480, 480, LV_COLOR_FORMAT_ARGB8888, 0);
|
||||
TEST_ASSERT_NOT_NULL(canvas_buf);
|
||||
lv_canvas_set_draw_buf(canvas, canvas_buf);
|
||||
@@ -24,7 +24,7 @@ void tearDown(void)
|
||||
{
|
||||
lv_image_cache_drop(canvas_buf);
|
||||
lv_draw_buf_destroy(canvas_buf);
|
||||
lv_obj_del(canvas);
|
||||
lv_obj_delete(canvas);
|
||||
}
|
||||
|
||||
#if LV_USE_VECTOR_GRAPHIC && LV_USE_SVG
|
||||
|
||||
@@ -118,7 +118,7 @@ static void font_stress_label_delete(font_stress_ctx_t * ctx, lv_obj_t * label)
|
||||
{
|
||||
const lv_font_t * font = lv_obj_get_style_text_font(label, LV_PART_MAIN);
|
||||
TEST_ASSERT_NOT_NULL(font);
|
||||
lv_obj_del(label);
|
||||
lv_obj_delete(label);
|
||||
ctx->font_delete_cb(ctx, (lv_font_t *)font);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ void test_tiny_ttf_gpos(void)
|
||||
lv_font_set_kerning(font_none, LV_FONT_KERNING_NONE);
|
||||
|
||||
lv_obj_t * label_normal = lv_label_create(lv_screen_active());
|
||||
lv_label_set_long_mode(label_normal, LV_LABEL_LONG_WRAP);
|
||||
lv_label_set_long_mode(label_normal, LV_LABEL_LONG_MODE_WRAP);
|
||||
lv_label_set_text(label_normal, "ĄJ Ąg Ąģ Ąj Ąȷ Qȷ ąj ąȷ gȷ ģȷ ıȷ ųȷ vȷ Va Vá Vą Vf Vfl V.");
|
||||
lv_obj_set_style_text_font(label_normal, font_normal, LV_PART_MAIN);
|
||||
lv_obj_set_width(label_normal, 700);
|
||||
@@ -98,7 +98,7 @@ void test_tiny_ttf_gpos(void)
|
||||
lv_obj_align(label_normal, LV_ALIGN_CENTER, 0, -100);
|
||||
|
||||
lv_obj_t * label_none = lv_label_create(lv_screen_active());
|
||||
lv_label_set_long_mode(label_normal, LV_LABEL_LONG_WRAP);
|
||||
lv_label_set_long_mode(label_normal, LV_LABEL_LONG_MODE_WRAP);
|
||||
lv_label_set_text(label_none, "ĄJ Ąg Ąģ Ąj Ąȷ Qȷ ąj ąȷ gȷ ģȷ ıȷ ųȷ vȷ Va Vá Vą Vf Vfl V.");
|
||||
lv_obj_set_style_text_font(label_none, font_none, LV_PART_MAIN);
|
||||
lv_obj_set_width(label_none, 700);
|
||||
|
||||
@@ -67,7 +67,7 @@ void test_tjpgd_1(void)
|
||||
|
||||
static void create_image_2(void)
|
||||
{
|
||||
LV_IMG_DECLARE(test_img_lvgl_logo_jpg);
|
||||
LV_IMAGE_DECLARE(test_img_lvgl_logo_jpg);
|
||||
lv_obj_t * img = lv_image_create(lv_screen_active());
|
||||
lv_image_set_src(img, &test_img_lvgl_logo_jpg);
|
||||
lv_obj_center(img);
|
||||
|
||||
@@ -23,22 +23,22 @@ void test_screen_load_with_delete_no_crash(void)
|
||||
{
|
||||
/*Delete active screen and load new screen should not crash*/
|
||||
lv_obj_t * screen = lv_screen_active();
|
||||
lv_obj_del(screen);
|
||||
lv_obj_delete(screen);
|
||||
screen = lv_obj_create(NULL);
|
||||
lv_scr_load(screen);
|
||||
lv_screen_load(screen);
|
||||
|
||||
/*Consecutively loading multiple screens (while deleting one) with transition animations should not crash*/
|
||||
lv_obj_t * screen_with_anim_1 = lv_obj_create(NULL);
|
||||
lv_obj_t * screen_with_anim_2 = lv_obj_create(NULL);
|
||||
lv_obj_t * screen_with_anim_3 = lv_obj_create(NULL);
|
||||
|
||||
lv_scr_load_anim(screen_with_anim_1, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, false);
|
||||
lv_scr_load_anim(screen_with_anim_2, LV_SCREEN_LOAD_ANIM_OVER_RIGHT, 1000, 0, true);
|
||||
lv_screen_load_anim(screen_with_anim_1, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, false);
|
||||
lv_screen_load_anim(screen_with_anim_2, LV_SCREEN_LOAD_ANIM_OVER_RIGHT, 1000, 0, true);
|
||||
|
||||
/*Wait to trigger the animation start callbacks*/
|
||||
lv_test_wait(100);
|
||||
|
||||
lv_scr_load_anim(screen_with_anim_3, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 200, 0, true);
|
||||
lv_screen_load_anim(screen_with_anim_3, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 200, 0, true);
|
||||
|
||||
/*The active screen should be immediately replaced*/
|
||||
TEST_ASSERT_EQUAL(lv_screen_active(), screen_with_anim_2);
|
||||
@@ -55,9 +55,9 @@ void test_screen_load_with_delete_no_crash2(void)
|
||||
{
|
||||
/*Delete active screen and load new screen should not crash*/
|
||||
lv_obj_t * screen = lv_screen_active();
|
||||
lv_obj_del(screen);
|
||||
lv_obj_delete(screen);
|
||||
screen = lv_obj_create(NULL);
|
||||
lv_scr_load(screen);
|
||||
lv_screen_load(screen);
|
||||
|
||||
/*Consecutively loading multiple screens (while deleting one) with transition animations should not crash*/
|
||||
lv_obj_t * screen_with_anim_1 = lv_obj_create(NULL);
|
||||
@@ -65,14 +65,14 @@ void test_screen_load_with_delete_no_crash2(void)
|
||||
lv_obj_t * screen_with_anim_3 = lv_obj_create(NULL);
|
||||
lv_obj_t * screen_with_anim_4 = lv_obj_create(NULL);
|
||||
|
||||
lv_scr_load_anim(screen_with_anim_1, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, false);
|
||||
lv_scr_load_anim(screen_with_anim_2, LV_SCREEN_LOAD_ANIM_OVER_RIGHT, 1000, 0, true);
|
||||
lv_scr_load_anim(screen_with_anim_3, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, true);
|
||||
lv_screen_load_anim(screen_with_anim_1, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, false);
|
||||
lv_screen_load_anim(screen_with_anim_2, LV_SCREEN_LOAD_ANIM_OVER_RIGHT, 1000, 0, true);
|
||||
lv_screen_load_anim(screen_with_anim_3, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, true);
|
||||
|
||||
/*Wait to trigger the animation start callbacks*/
|
||||
lv_test_wait(100);
|
||||
|
||||
lv_scr_load_anim(screen_with_anim_4, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 200, 0, true);
|
||||
lv_screen_load_anim(screen_with_anim_4, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 200, 0, true);
|
||||
|
||||
/*The active screen should be immediately replaced*/
|
||||
TEST_ASSERT_EQUAL(lv_screen_active(), screen_with_anim_3);
|
||||
@@ -98,9 +98,9 @@ void test_screen_load_with_delete_event(void)
|
||||
{
|
||||
/*Delete active screen and load new screen should not crash*/
|
||||
lv_obj_t * screen = lv_screen_active();
|
||||
lv_obj_del(screen);
|
||||
lv_obj_delete(screen);
|
||||
screen = lv_obj_create(NULL);
|
||||
lv_scr_load(screen);
|
||||
lv_screen_load(screen);
|
||||
|
||||
/*Consecutively loading multiple screens (while deleting one) with transition animations should not crash*/
|
||||
lv_obj_t * screen_with_anim_1 = lv_obj_create(NULL);
|
||||
@@ -108,17 +108,17 @@ void test_screen_load_with_delete_event(void)
|
||||
lv_obj_t * screen_with_anim_3 = lv_obj_create(NULL);
|
||||
lv_obj_t * screen_with_anim_4 = lv_obj_create(NULL);
|
||||
|
||||
lv_scr_load_anim(screen_with_anim_1, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, false);
|
||||
lv_screen_load_anim(screen_with_anim_1, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, false);
|
||||
lv_obj_add_event_cb(screen_with_anim_1, screen_with_anim_1_unloaded_cb, LV_EVENT_SCREEN_UNLOADED, NULL);
|
||||
lv_scr_load_anim(screen_with_anim_2, LV_SCREEN_LOAD_ANIM_OVER_RIGHT, 1000, 0, true);
|
||||
lv_scr_load_anim(screen_with_anim_3, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, true);
|
||||
lv_screen_load_anim(screen_with_anim_2, LV_SCREEN_LOAD_ANIM_OVER_RIGHT, 1000, 0, true);
|
||||
lv_screen_load_anim(screen_with_anim_3, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 0, 0, true);
|
||||
|
||||
/*Wait to trigger the animation start callbacks*/
|
||||
lv_test_wait(100);
|
||||
|
||||
TEST_ASSERT_EQUAL(screen_1_unloaded_called, true);
|
||||
|
||||
lv_scr_load_anim(screen_with_anim_4, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 200, 0, true);
|
||||
lv_screen_load_anim(screen_with_anim_4, LV_SCREEN_LOAD_ANIM_OVER_LEFT, 200, 0, true);
|
||||
|
||||
/*The active screen should be immediately replaced*/
|
||||
TEST_ASSERT_EQUAL(lv_screen_active(), screen_with_anim_3);
|
||||
|
||||
@@ -174,7 +174,7 @@ void test_calendar_header_dropdown_create_gui(void)
|
||||
void test_calendar_header_dropdown_ascending_year_order(void)
|
||||
{
|
||||
const char * years = "2020\n2021\n2022\n2023\n2024\n";
|
||||
lv_calendar_header_dropdown_create(g_calendar);
|
||||
lv_calendar_add_header_dropdown(g_calendar);
|
||||
lv_calendar_header_dropdown_set_year_list(g_calendar, years);
|
||||
lv_calendar_set_month_shown(g_calendar, 2022, 9);
|
||||
|
||||
@@ -184,7 +184,7 @@ void test_calendar_header_dropdown_ascending_year_order(void)
|
||||
void test_calendar_header_dropdown_descending_year_order(void)
|
||||
{
|
||||
const char * years = "2024\n2023\n2022\n2021\n2020\n";
|
||||
lv_calendar_header_dropdown_create(g_calendar);
|
||||
lv_calendar_add_header_dropdown(g_calendar);
|
||||
lv_calendar_header_dropdown_set_year_list(g_calendar, years);
|
||||
lv_calendar_set_month_shown(g_calendar, 2022, 9);
|
||||
|
||||
|
||||
@@ -207,8 +207,8 @@ void test_chart_scatter(void)
|
||||
|
||||
lv_chart_set_type(chart, LV_CHART_TYPE_SCATTER);
|
||||
|
||||
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_X, 50, 100);
|
||||
lv_chart_set_range(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 20);
|
||||
lv_chart_set_axis_range(chart, LV_CHART_AXIS_PRIMARY_X, 50, 100);
|
||||
lv_chart_set_axis_range(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 20);
|
||||
|
||||
lv_chart_set_point_count(chart, 3);
|
||||
lv_chart_series_t * ser = lv_chart_add_series(chart, red_color, LV_CHART_AXIS_PRIMARY_Y);
|
||||
|
||||
@@ -163,7 +163,7 @@ void test_lottie_no_jump_when_visible_again(void)
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/lottie_1.png"); /*Empty screen*/
|
||||
|
||||
/*Should be on the same frame*/
|
||||
lv_obj_clear_flag(lottie, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_obj_remove_flag(lottie, LV_OBJ_FLAG_HIDDEN);
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/lottie_2.png");
|
||||
|
||||
lv_test_fast_forward(750);
|
||||
|
||||
@@ -20,7 +20,7 @@ void tearDown(void)
|
||||
*/
|
||||
void test_content_parent_pct_child_pos_1(void)
|
||||
{
|
||||
lv_obj_t * parent = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * parent = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_pos(parent, 20, 20);
|
||||
lv_obj_set_size(parent, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
lv_obj_set_style_pad_all(parent, 10, 0);
|
||||
@@ -53,7 +53,7 @@ void test_content_parent_pct_child_pos_1(void)
|
||||
|
||||
void test_style_min_size(void)
|
||||
{
|
||||
lv_obj_t * parent = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * parent = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(parent, LV_SIZE_CONTENT, LV_SIZE_CONTENT);
|
||||
// lv_obj_set_style_pad_all(parent, 10, 0);
|
||||
|
||||
|
||||
@@ -491,7 +491,7 @@ void test_spangroup_set_right_align_on_overflow(void)
|
||||
|
||||
lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_RIGHT);
|
||||
|
||||
lv_span_t * span = lv_spangroup_new_span(spangroup);
|
||||
lv_span_t * span = lv_spangroup_add_span(spangroup);
|
||||
lv_span_set_text_static(span, "China is a beautiful country.");
|
||||
lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_ELLIPSIS);
|
||||
|
||||
@@ -510,7 +510,7 @@ void test_spangroup_rtl_mode_set_default_align(void)
|
||||
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_span_t * span = lv_spangroup_new_span(spangroup);
|
||||
lv_span_t * span = lv_spangroup_add_span(spangroup);
|
||||
lv_span_set_text_static(span, message);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_11.png");
|
||||
@@ -529,7 +529,7 @@ void test_spangroup_rtl_mode_set_left_align(void)
|
||||
lv_obj_set_size(spangroup, 300, lv_font_dejavu_16_persian_hebrew.line_height);
|
||||
lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_LEFT);
|
||||
|
||||
lv_span_t * span = lv_spangroup_new_span(spangroup);
|
||||
lv_span_t * span = lv_spangroup_add_span(spangroup);
|
||||
lv_span_set_text_static(span, message);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_12.png");
|
||||
@@ -548,7 +548,7 @@ void test_spangroup_rtl_mode_set_center_align(void)
|
||||
lv_obj_set_size(spangroup, 300, lv_font_dejavu_16_persian_hebrew.line_height);
|
||||
lv_spangroup_set_align(spangroup, LV_TEXT_ALIGN_CENTER);
|
||||
|
||||
lv_span_t * span = lv_spangroup_new_span(spangroup);
|
||||
lv_span_t * span = lv_spangroup_add_span(spangroup);
|
||||
lv_span_set_text_static(span, message);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_13.png");
|
||||
@@ -577,7 +577,7 @@ void test_spangroup_set_line_space(void)
|
||||
lv_obj_set_style_text_line_space(spangroup, 2, 0);
|
||||
lv_obj_set_style_text_font(spangroup, font, 0);
|
||||
|
||||
lv_span_t * span = lv_spangroup_new_span(spangroup);
|
||||
lv_span_t * span = lv_spangroup_add_span(spangroup);
|
||||
lv_span_set_text(span, test_text);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("widgets/span_14.png");
|
||||
@@ -596,7 +596,7 @@ void test_spangroup_less_letter_overflow(void)
|
||||
lv_obj_set_width(spangroup, 25);
|
||||
lv_obj_set_height(spangroup, 20);
|
||||
|
||||
lv_span_t * span = lv_spangroup_new_span(spangroup);
|
||||
lv_span_t * span = lv_spangroup_add_span(spangroup);
|
||||
lv_span_set_text_static(span, "less");
|
||||
lv_spangroup_set_overflow(spangroup, LV_SPAN_OVERFLOW_ELLIPSIS);
|
||||
|
||||
|
||||
@@ -159,72 +159,72 @@ void test_textarea_properties(void)
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_TEXT;
|
||||
prop.ptr = "Hello World!";
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_STRING("Hello World!", lv_textarea_get_text(obj));
|
||||
TEST_ASSERT_EQUAL_STRING("Hello World!", lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_TEXT).ptr);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_PLACEHOLDER_TEXT;
|
||||
prop.ptr = "Hello!";
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_STRING("Hello!", lv_textarea_get_placeholder_text(obj));
|
||||
TEST_ASSERT_EQUAL_STRING("Hello!", lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_PLACEHOLDER_TEXT).ptr);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_CURSOR_POS;
|
||||
prop.num = 5;
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_INT(5, lv_textarea_get_cursor_pos(obj));
|
||||
TEST_ASSERT_EQUAL_INT(5, lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_CURSOR_POS).num);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_CURSOR_CLICK_POS;
|
||||
prop.num = 1;
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_INT(1, lv_textarea_get_cursor_click_pos(obj));
|
||||
TEST_ASSERT_EQUAL_INT(1, lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_CURSOR_CLICK_POS).num);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_PASSWORD_MODE;
|
||||
prop.num = true;
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_TRUE(lv_textarea_get_password_mode(obj));
|
||||
TEST_ASSERT_TRUE(lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_PASSWORD_MODE).num);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_PASSWORD_BULLET;
|
||||
prop.ptr = "password bullet";
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_STRING("password bullet", lv_textarea_get_password_bullet(obj));
|
||||
TEST_ASSERT_EQUAL_STRING("password bullet", lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_PASSWORD_BULLET).ptr);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_ONE_LINE;
|
||||
prop.enable = true;
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_INT(true, lv_textarea_get_one_line(obj));
|
||||
TEST_ASSERT_EQUAL_INT(true, lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_ONE_LINE).enable);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_ACCEPTED_CHARS;
|
||||
prop.ptr = "ABCDEF";
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_STRING("ABCDEF", lv_textarea_get_accepted_chars(obj));
|
||||
TEST_ASSERT_EQUAL_STRING("ABCDEF", lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_ACCEPTED_CHARS).ptr);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_MAX_LENGTH;
|
||||
prop.num = 10;
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_INT(10, lv_textarea_get_max_length(obj));
|
||||
TEST_ASSERT_EQUAL_INT(10, lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_MAX_LENGTH).num);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_INSERT_REPLACE;
|
||||
prop.ptr = "abcdef";
|
||||
/*No getter function for this property*/
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_TEXT_SELECTION;
|
||||
prop.num = true;
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_INT(true, lv_textarea_get_text_selection(obj));
|
||||
TEST_ASSERT_EQUAL_INT(true, lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_TEXT_SELECTION).enable);
|
||||
|
||||
prop.id = LV_PROPERTY_TEXTAREA_PASSWORD_SHOW_TIME;
|
||||
prop.num = 10;
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RES_OK);
|
||||
TEST_ASSERT_TRUE(lv_obj_set_property(obj, &prop) == LV_RESULT_OK);
|
||||
TEST_ASSERT_EQUAL_INT(10, lv_textarea_get_password_show_time(obj));
|
||||
TEST_ASSERT_EQUAL_INT(10, lv_obj_get_property(obj, LV_PROPERTY_TEXTAREA_PASSWORD_SHOW_TIME).num);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user