summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYoungbok Shin <youngb.shin@samsung.com>2018-06-22 12:15:11 +0300
committerDaniel Hirt <hirt.danny@gmail.com>2018-06-22 12:30:59 +0300
commit69b5d67367b8ae16d6e98734d2b07e40725d4a0f (patch)
tree47d8b0fb4fe5ccfe82ee2816125829db9f6ef76a /src
parent59c2f78d79dab5096300263c616cbd61fde00ab9 (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
Diffstat (limited to 'src')
-rw-r--r--src/Makefile_Edje.am2
-rw-r--r--src/lib/edje/edje_util.c3
-rw-r--r--src/tests/edje/data/test_textblock.edc20
-rw-r--r--src/tests/edje/edje_test_edje.c20
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 \
300tests/edje/data/test_signals.edc \ 300tests/edje/data/test_signals.edc \
301tests/edje/data/test_signal_callback_del_full.edc \ 301tests/edje/data/test_signal_callback_del_full.edc \
302tests/edje/data/test_text_cursor.edc \ 302tests/edje/data/test_text_cursor.edc \
303tests/edje/data/test_textblock.edc \
303tests/edje/data/filter.lua 304tests/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
349CLEANFILES += $(EDJE_TEST_FILES) 351CLEANFILES += $(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 @@
1collections {
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}
1073EFL_END_TEST 1073EFL_END_TEST
1074 1074
1075EFL_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}
1092EFL_END_TEST
1093
1075void edje_test_edje(TCase *tc) 1094void 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}