efl_ui_layout: fix elm_layout_text_set behavior

Summary:
Since commit 649433560b, elm_layout_text_set didn't work on some widgets.
This patch fixes invisible text issues.

Test Plan:
1. make check
2. elementary_test -to 'popup'

Reviewers: zmike, segfaultxavi, bu5hm4n

Reviewed By: zmike

Subscribers: cedric, #reviewers, herb, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D8326
This commit is contained in:
Yeongjong Lee 2019-03-14 11:11:32 -04:00 committed by Mike Blumenkrantz
parent e43b644168
commit ba1c94d051
3 changed files with 49 additions and 1 deletions

View File

@ -2756,6 +2756,7 @@ elm_layout_table_clear(Eo *obj, const char *part, Eina_Bool clear)
EAPI Eina_Bool
elm_layout_text_set(Eo *obj, const char *part, const char *text)
{
Eo *part_obj;
if (!part)
{
part = efl_ui_widget_default_text_part_get(obj);
@ -2764,7 +2765,19 @@ elm_layout_text_set(Eo *obj, const char *part, const char *text)
else if (!_elm_layout_part_aliasing_eval(obj, &part, EINA_TRUE))
return EINA_FALSE;
efl_text_set(efl_part(obj, part), text);
part_obj = efl_ref(efl_part(obj, part));
if (!efl_isa(part_obj, EFL_TEXT_INTERFACE) ||
!efl_isa(part_obj, EFL_UI_LAYOUT_PART_CLASS))
{
efl_unref(part_obj);
return EINA_FALSE;
}
efl_text_set(part_obj, text);
efl_unref(part_obj);
return EINA_TRUE;
}

View File

@ -393,6 +393,25 @@ EFL_START_TEST(elm_atspi_role_get)
}
EFL_END_TEST
EFL_START_TEST(elm_entry_text_set)
{
Evas_Object *win, *entry;
const char *entry_text = "hello world";
const char *entry_text2 = "scrollable";
win = win_add(NULL, "entry", ELM_WIN_BASIC);
entry = elm_entry_add(win);
ck_assert(elm_layout_text_set(entry, NULL, entry_text));
ck_assert_str_eq(elm_object_text_get(entry), entry_text);
elm_entry_scrollable_set(entry, EINA_TRUE);
ck_assert(elm_layout_text_set(entry, NULL, entry_text2));
ck_assert_str_eq(elm_object_text_get(entry), entry_text2);
}
EFL_END_TEST
void elm_test_entry(TCase *tc)
{
tcase_add_test(tc, elm_entry_legacy_type_check);
@ -407,4 +426,5 @@ void elm_test_entry(TCase *tc)
tcase_add_test(tc, elm_entry_atspi_text_text_get);
tcase_add_test(tc, elm_entry_atspi_text_selections);
tcase_add_test(tc, elm_atspi_role_get);
tcase_add_test(tc, elm_entry_text_set);
}

View File

@ -70,9 +70,24 @@ EFL_START_TEST(elm_popup_focus_get)
}
EFL_END_TEST
EFL_START_TEST(elm_popup_text_set)
{
Evas_Object *win, *popup;
const char *popup_text = "hello world";
win = win_add(NULL, "popup", ELM_WIN_BASIC);
popup = elm_popup_add(win);
ck_assert(elm_layout_text_set(popup, NULL, popup_text));
ck_assert_str_eq(elm_object_text_get(popup), popup_text);
}
EFL_END_TEST
void elm_test_popup(TCase *tc)
{
tcase_add_test(tc, elm_popup_focus_get);
tcase_add_test(tc, elm_popup_legacy_type_check);
tcase_add_test(tc, elm_popup_text_set);
tcase_add_test(tc, elm_atspi_role_get);
}