summaryrefslogtreecommitdiff
path: root/src/tests/edje
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-06-10 16:30:07 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-06-10 17:01:33 +0200
commitd1e1adf0bc4fadb401c778f98110c9ee49540a2c (patch)
treee32888121f62eea63effe8eb071f7fdcc4219e07 /src/tests/edje
parent03e0310a82b440602c85424b36e1955e84c9ffab (diff)
edje: fix edje_part_helpers refcounting
Summary: the reference from efl_reuse was forgotten & the parent relation was not correctlty setted, which led to the fact that NOREF was never emitted. This caused that thte object never really was destructed probebly, and thus the del_interceptor_cb was not executed, and the object simply leaked. The test checks that those properties are correctly set, additionally a error is printed in the efl code when a part has not the expected reference properties. This also enforces errors when users are doing wrong things with objects returned by efl_part. Reviewers: ManMower, zmike Reviewed By: zmike Subscribers: cedric, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D6254
Diffstat (limited to 'src/tests/edje')
-rw-r--r--src/tests/edje/edje_test_edje.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index 103910d..3a39bec 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -1043,6 +1043,35 @@ EFL_START_TEST(edje_test_text_cursor)
1043} 1043}
1044EFL_END_TEST 1044EFL_END_TEST
1045 1045
1046EFL_START_TEST(edje_test_part_caching)
1047{
1048 Evas *evas = EDJE_TEST_INIT_EVAS();
1049 Evas_Object *ly, *o1, *global_p = NULL;
1050
1051 ly = efl_add(EFL_CANVAS_LAYOUT_CLASS, evas,
1052 efl_file_set(efl_added, test_layout_get("test_swallows.edj"), "test_group")
1053 );
1054
1055 for (int i = 0; i < 10; ++i)
1056 {
1057 Evas_Object *p;
1058
1059 p = efl_part(ly, "swallow");
1060 o1 = efl_content_get(p);
1061
1062 if (global_p)
1063 ck_assert_ptr_eq(global_p, p);
1064 global_p = p;
1065
1066 ck_assert_int_eq(efl_ref_count(p), 1);
1067 ck_assert_ptr_eq(efl_parent_get(p), NULL);
1068
1069 }
1070
1071 EDJE_TEST_FREE_EVAS();
1072}
1073EFL_END_TEST
1074
1046void edje_test_edje(TCase *tc) 1075void edje_test_edje(TCase *tc)
1047{ 1076{
1048 tcase_add_test(tc, edje_test_edje_init); 1077 tcase_add_test(tc, edje_test_edje_init);
@@ -1070,4 +1099,5 @@ void edje_test_edje(TCase *tc)
1070 tcase_add_test(tc, edje_test_signals); 1099 tcase_add_test(tc, edje_test_signals);
1071 tcase_add_test(tc, edje_test_signal_callback_del_full); 1100 tcase_add_test(tc, edje_test_signal_callback_del_full);
1072 tcase_add_test(tc, edje_test_text_cursor); 1101 tcase_add_test(tc, edje_test_text_cursor);
1102 tcase_add_test(tc, edje_test_part_caching);
1073} 1103}