diff options
author | Youngbok Shin <youngb.shin@samsung.com> | 2018-06-22 12:15:11 +0300 |
---|---|---|
committer | Daniel Hirt <hirt.danny@gmail.com> | 2018-06-22 12:30:59 +0300 |
commit | 69b5d67367b8ae16d6e98734d2b07e40725d4a0f (patch) | |
tree | 47d8b0fb4fe5ccfe82ee2816125829db9f6ef76a | |
parent | 59c2f78d79dab5096300263c616cbd61fde00ab9 (diff) |
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
-rw-r--r-- | src/Makefile_Edje.am | 2 | ||||
-rw-r--r-- | src/lib/edje/edje_util.c | 3 | ||||
-rw-r--r-- | src/tests/edje/data/test_textblock.edc | 20 | ||||
-rw-r--r-- | src/tests/edje/edje_test_edje.c | 20 |
4 files changed, 45 insertions, 0 deletions
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am index 87d67b5..745da03 100644 --- a/src/Makefile_Edje.am +++ b/src/Makefile_Edje.am | |||
@@ -300,6 +300,7 @@ tests/edje/data/test_messages.edc \ | |||
300 | tests/edje/data/test_signals.edc \ | 300 | tests/edje/data/test_signals.edc \ |
301 | tests/edje/data/test_signal_callback_del_full.edc \ | 301 | tests/edje/data/test_signal_callback_del_full.edc \ |
302 | tests/edje/data/test_text_cursor.edc \ | 302 | tests/edje/data/test_text_cursor.edc \ |
303 | tests/edje/data/test_textblock.edc \ | ||
303 | tests/edje/data/filter.lua | 304 | tests/edje/data/filter.lua |
304 | 305 | ||
305 | 306 | ||
@@ -344,6 +345,7 @@ EDJE_TEST_FILES = tests/edje/data/test_layout.edj \ | |||
344 | tests/edje/data/test_signals.edj \ | 345 | tests/edje/data/test_signals.edj \ |
345 | tests/edje/data/test_signal_callback_del_full.edj \ | 346 | tests/edje/data/test_signal_callback_del_full.edj \ |
346 | tests/edje/data/test_text_cursor.edj \ | 347 | tests/edje/data/test_text_cursor.edj \ |
348 | tests/edje/data/test_textblock.edj \ | ||
347 | $(NULL) | 349 | $(NULL) |
348 | 350 | ||
349 | CLEANFILES += $(EDJE_TEST_FILES) | 351 | CLEANFILES += $(EDJE_TEST_FILES) |
diff --git a/src/lib/edje/edje_util.c b/src/lib/edje/edje_util.c index 7ab54bb..98d6c78 100644 --- a/src/lib/edje/edje_util.c +++ b/src/lib/edje/edje_util.c | |||
@@ -2052,6 +2052,9 @@ _edje_efl_text_text_get(const Eo *obj EINA_UNUSED, Edje *ed, const char *part, | |||
2052 | 2052 | ||
2053 | if ((!ed) || (!part)) return NULL; | 2053 | if ((!ed) || (!part)) return NULL; |
2054 | 2054 | ||
2055 | /* Need to recalc before providing the object. */ | ||
2056 | _edje_recalc_do(ed); | ||
2057 | |||
2055 | rp = _edje_real_part_recursive_get(&ed, part); | 2058 | rp = _edje_real_part_recursive_get(&ed, part); |
2056 | if (!rp) return NULL; | 2059 | if (!rp) return NULL; |
2057 | if ((rp->type != EDJE_RP_TYPE_TEXT) || | 2060 | if ((rp->type != EDJE_RP_TYPE_TEXT) || |
diff --git a/src/tests/edje/data/test_textblock.edc b/src/tests/edje/data/test_textblock.edc new file mode 100644 index 0000000..e3569a6 --- /dev/null +++ b/src/tests/edje/data/test_textblock.edc | |||
@@ -0,0 +1,20 @@ | |||
1 | collections { | ||
2 | styles { | ||
3 | style { name: "tb_style"; | ||
4 | base: "font=Sans font_size=20 color=#fff"; | ||
5 | } | ||
6 | } | ||
7 | group { name: "test_textblock"; | ||
8 | parts { | ||
9 | part { name: "text"; | ||
10 | type: TEXTBLOCK; | ||
11 | description { state: "default" 0.0; | ||
12 | min: 300 300; | ||
13 | text { | ||
14 | style: "tb_style"; | ||
15 | } | ||
16 | } | ||
17 | } | ||
18 | } | ||
19 | } | ||
20 | } | ||
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c index 3a39bec..0f98e3c 100644 --- a/src/tests/edje/edje_test_edje.c +++ b/src/tests/edje/edje_test_edje.c | |||
@@ -1072,6 +1072,25 @@ EFL_START_TEST(edje_test_part_caching) | |||
1072 | } | 1072 | } |
1073 | EFL_END_TEST | 1073 | EFL_END_TEST |
1074 | 1074 | ||
1075 | EFL_START_TEST(edje_test_textblock) | ||
1076 | { | ||
1077 | Evas *evas; | ||
1078 | Evas_Object *obj; | ||
1079 | const char *buf = "Hello"; | ||
1080 | const char *txt; | ||
1081 | |||
1082 | evas = EDJE_TEST_INIT_EVAS(); | ||
1083 | |||
1084 | obj = edje_object_add(evas); | ||
1085 | fail_unless(edje_object_file_set(obj, test_layout_get("test_textblock.edj"), "test_textblock")); | ||
1086 | edje_object_part_text_set(obj, "text", buf); | ||
1087 | txt = edje_object_part_text_get(obj, "text"); | ||
1088 | fail_if(!txt || strcmp(txt, buf)); | ||
1089 | |||
1090 | EDJE_TEST_FREE_EVAS(); | ||
1091 | } | ||
1092 | EFL_END_TEST | ||
1093 | |||
1075 | void edje_test_edje(TCase *tc) | 1094 | void edje_test_edje(TCase *tc) |
1076 | { | 1095 | { |
1077 | tcase_add_test(tc, edje_test_edje_init); | 1096 | tcase_add_test(tc, edje_test_edje_init); |
@@ -1100,4 +1119,5 @@ void edje_test_edje(TCase *tc) | |||
1100 | tcase_add_test(tc, edje_test_signal_callback_del_full); | 1119 | tcase_add_test(tc, edje_test_signal_callback_del_full); |
1101 | tcase_add_test(tc, edje_test_text_cursor); | 1120 | tcase_add_test(tc, edje_test_text_cursor); |
1102 | tcase_add_test(tc, edje_test_part_caching); | 1121 | tcase_add_test(tc, edje_test_part_caching); |
1122 | tcase_add_test(tc, edje_test_textblock); | ||
1103 | } | 1123 | } |