提交 64745eac 编写于 作者: 徐宪辉's avatar 徐宪辉

feat[ui]: Not clean all widgets in adding custom view

Signed-off-by: 徐宪辉's avatar徐宪辉 <xhxu@listenai.com>
上级 c3fc10be
流水线 #14924 已通过 ,包含阶段
in 3 minute 和 4 second
......@@ -249,6 +249,14 @@ void ui_common_set_confirm_btn_click_listener(ui_common_btn_click_listener liste
}
void ui_common_clean_all_widgets(void)
{
ui_mutex_lock();
clean_all_widgets_in_root_view();
ui_mutex_unlock();
}
int ui_common_add_custom_view(ui_common_custom_view_type_t type, ui_common_custom_view_func func)
{
int ret = -1;
......@@ -260,7 +268,6 @@ int ui_common_add_custom_view(ui_common_custom_view_type_t type, ui_common_custo
{
case UI_COMMON_CUSTOM_VIEW_TYPE_LVGL:
ui_mutex_lock();
clean_all_widgets_in_root_view();
func(lv_root_view);
ui_mutex_unlock();
break;
......
......@@ -68,6 +68,8 @@ void ui_common_set_cancel_btn_click_listener(ui_common_btn_click_listener listen
int ui_common_add_custom_view(ui_common_custom_view_type_t type, ui_common_custom_view_func func);
void ui_common_clean_all_widgets(void);
void ui_common_remove_confirm_btn_click_listener(void);
void ui_common_remove_cancel_btn_click_listener(void);
......
......@@ -111,7 +111,7 @@ ZTEST(ui_common, test_add_custom_view_called_ui_mutex)
zassert_equal(1, ui_mutex_unlock_fake.call_count, "actual size: %d", ui_mutex_unlock_fake.call_count);
}
ZTEST(ui_common, test_add_custom_view_called_lv_obj_clean)
ZTEST(ui_common, test_add_custom_view_not_called_lv_obj_clean)
{
int ret = 0;
......@@ -128,7 +128,45 @@ ZTEST(ui_common, test_add_custom_view_called_lv_obj_clean)
ret = ui_common_add_custom_view(type, custom_view_func);
zassert_equal(0, lv_obj_clean_fake.call_count, "actual size: %d", lv_obj_clean_fake.call_count);
}
ZTEST(ui_common, test_ui_common_clean_all_widgets_called_lv_obj_clean)
{
int ret = 0;
ui_common_config_t config = {
.texts.manual_check_test_result_label_text = "label",
.texts.manual_check_test_result_confirm_btn_text = "Yes",
.texts.manual_check_test_result_cancel_btn_text = "No",
};
ret = ui_common_create(&config);
mock_ui_mutex_reset();
ui_common_clean_all_widgets();
zassert_equal(1, lv_obj_clean_fake.call_count, "actual size: %d", lv_obj_clean_fake.call_count);
}
ZTEST(ui_common, test_ui_common_clean_all_widgets_called_ui_mutex)
{
int ret = 0;
ui_common_config_t config = {
.texts.manual_check_test_result_label_text = "label",
.texts.manual_check_test_result_confirm_btn_text = "Yes",
.texts.manual_check_test_result_cancel_btn_text = "No",
};
ret = ui_common_create(&config);
mock_ui_mutex_reset();
ui_common_clean_all_widgets();
zassert_equal(1, ui_mutex_lock_fake.call_count, "actual size: %d", ui_mutex_lock_fake.call_count);
zassert_equal(1, ui_mutex_unlock_fake.call_count, "actual size: %d", ui_mutex_unlock_fake.call_count);
}
ZTEST(ui_common, test_handle_progress_status_with_not_exist_type_not_clean_obj)
......
支持 Markdown
0% or
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册