edje: fix text set/get issue without edje calculation

Summary:
Some changes broke really basical function behavior of text.
I couldn't get text from an edje object which I just set to the given edje object.
In the past code, edje called recalc function before trying to get text.
So, this patch bring that code to fix this issue.
@fix

Test Plan: Included. Run "make check"

Reviewers: herdsman, raster, cedric, woohyun, devilhorns

Subscribers: #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6364
This commit is contained in:
Youngbok Shin 2018-06-22 12:15:11 +03:00 committed by Daniel Hirt
parent 59c2f78d79
commit 69b5d67367
4 changed files with 45 additions and 0 deletions

View File

@ -300,6 +300,7 @@ tests/edje/data/test_messages.edc \
tests/edje/data/test_signals.edc \
tests/edje/data/test_signal_callback_del_full.edc \
tests/edje/data/test_text_cursor.edc \
tests/edje/data/test_textblock.edc \
tests/edje/data/filter.lua
@ -344,6 +345,7 @@ EDJE_TEST_FILES = tests/edje/data/test_layout.edj \
tests/edje/data/test_signals.edj \
tests/edje/data/test_signal_callback_del_full.edj \
tests/edje/data/test_text_cursor.edj \
tests/edje/data/test_textblock.edj \
$(NULL)
CLEANFILES += $(EDJE_TEST_FILES)

View File

@ -2052,6 +2052,9 @@ _edje_efl_text_text_get(const Eo *obj EINA_UNUSED, Edje *ed, const char *part,
if ((!ed) || (!part)) return NULL;
/* Need to recalc before providing the object. */
_edje_recalc_do(ed);
rp = _edje_real_part_recursive_get(&ed, part);
if (!rp) return NULL;
if ((rp->type != EDJE_RP_TYPE_TEXT) ||

View File

@ -0,0 +1,20 @@
collections {
styles {
style { name: "tb_style";
base: "font=Sans font_size=20 color=#fff";
}
}
group { name: "test_textblock";
parts {
part { name: "text";
type: TEXTBLOCK;
description { state: "default" 0.0;
min: 300 300;
text {
style: "tb_style";
}
}
}
}
}
}

View File

@ -1072,6 +1072,25 @@ EFL_START_TEST(edje_test_part_caching)
}
EFL_END_TEST
EFL_START_TEST(edje_test_textblock)
{
Evas *evas;
Evas_Object *obj;
const char *buf = "Hello";
const char *txt;
evas = EDJE_TEST_INIT_EVAS();
obj = edje_object_add(evas);
fail_unless(edje_object_file_set(obj, test_layout_get("test_textblock.edj"), "test_textblock"));
edje_object_part_text_set(obj, "text", buf);
txt = edje_object_part_text_get(obj, "text");
fail_if(!txt || strcmp(txt, buf));
EDJE_TEST_FREE_EVAS();
}
EFL_END_TEST
void edje_test_edje(TCase *tc)
{
tcase_add_test(tc, edje_test_edje_init);
@ -1100,4 +1119,5 @@ void edje_test_edje(TCase *tc)
tcase_add_test(tc, edje_test_signal_callback_del_full);
tcase_add_test(tc, edje_test_text_cursor);
tcase_add_test(tc, edje_test_part_caching);
tcase_add_test(tc, edje_test_textblock);
}