mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-10 04:37:55 +08:00
fix(label): lv_label_mark_need_refr_text not invalidate area (#9176)
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 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
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (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
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW 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
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
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 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
Test API JSON generator / Test API JSON (push) Has been cancelled
Install LVGL using CMake / build-examples (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
Hardware Performance Test / Hardware Performance Benchmark (push) Has been cancelled
Hardware Performance Test / HW 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
Verify Font License / verify-font-license (push) Has been cancelled
Verify Kconfig / verify-kconfig (push) Has been cancelled
Close stale issues and PRs / stale (push) Has been cancelled
Signed-off-by: yushuailong1 <yushuailong1@xiaomi.com>
This commit is contained in:
@@ -159,7 +159,6 @@ void lv_label_set_text_vfmt(lv_obj_t * obj, const char * fmt, va_list args)
|
||||
LV_ASSERT_NULL(fmt);
|
||||
|
||||
remove_translation_tag(obj);
|
||||
lv_obj_invalidate(obj);
|
||||
lv_label_t * label = (lv_label_t *)obj;
|
||||
|
||||
lv_label_revert_dots(obj);
|
||||
@@ -707,8 +706,6 @@ void lv_label_ins_text(lv_obj_t * obj, uint32_t pos, const char * txt)
|
||||
/*Cannot append to static text*/
|
||||
if(label->static_txt != 0) return;
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
/*Allocate space for the new text*/
|
||||
size_t old_len = lv_strlen(label->text);
|
||||
size_t ins_len = lv_strlen(txt);
|
||||
@@ -733,8 +730,6 @@ void lv_label_cut_text(lv_obj_t * obj, uint32_t pos, uint32_t cnt)
|
||||
/*Cannot append to static text*/
|
||||
if(label->static_txt) return;
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
char * label_txt = lv_label_get_text(obj);
|
||||
/*Delete the characters*/
|
||||
lv_text_cut(label_txt, pos, cnt);
|
||||
@@ -1072,6 +1067,7 @@ static void lv_label_mark_need_refr_text(lv_obj_t * obj)
|
||||
label->invalid_size_cache = true;
|
||||
label->need_refr_text = true;
|
||||
|
||||
lv_obj_invalidate(obj);
|
||||
lv_obj_refresh_self_size(obj);
|
||||
|
||||
lv_obj_request_layout_complete_event(obj);
|
||||
|
||||
@@ -852,4 +852,60 @@ void test_label_setting_text_disables_translation(void)
|
||||
TEST_ASSERT_EQUAL_STRING(lv_label_get_text(label), "Der Tiger");
|
||||
}
|
||||
|
||||
static void display_invalidate_area_cb(lv_event_t * e)
|
||||
{
|
||||
int * i = lv_event_get_user_data(e);
|
||||
*i += 1;
|
||||
}
|
||||
|
||||
void test_label_invalidate_area(void)
|
||||
{
|
||||
int i = 0;
|
||||
label = lv_label_create(lv_screen_active());
|
||||
lv_display_add_event_cb(lv_display_get_default(), display_invalidate_area_cb, LV_EVENT_INVALIDATE_AREA, &i);
|
||||
i = 0;
|
||||
lv_label_set_text_static(label, "Hello world");
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
i = 0;
|
||||
lv_label_set_text(label, "Hello world");
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
i = 0;
|
||||
lv_label_set_text_fmt(label, "%s", "Hello world");
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
i = 0;
|
||||
lv_label_set_long_mode(label, LV_LABEL_LONG_MODE_SCROLL);
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
#if LV_LABEL_TEXT_SELECTION
|
||||
i = 0;
|
||||
lv_label_set_text_selection_start(label, 1);
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
i = 0;
|
||||
lv_label_set_text_selection_end(label, 1);
|
||||
TEST_ASSERT(i > 0);
|
||||
#endif
|
||||
|
||||
i = 0;
|
||||
lv_label_set_recolor(label, true);
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
i = 0;
|
||||
lv_label_ins_text(label, 5, " world");
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
i = 0;
|
||||
lv_label_cut_text(label, 5, 5);
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
i = 0;
|
||||
lv_obj_set_style_align(label, LV_ALIGN_CENTER, 0);
|
||||
TEST_ASSERT(i > 0);
|
||||
|
||||
lv_display_remove_event_cb_with_user_data(lv_display_get_default(), display_invalidate_area_cb, &i);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user