summaryrefslogtreecommitdiff
path: root/src/tests/edje
diff options
context:
space:
mode:
authorSungtaek Hong <sth253.hong@samsung.com>2017-07-17 15:05:19 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-07-17 15:05:20 +0900
commitd545929845925997e8a8a4f0e4a43d7662e2a457 (patch)
tree575530e35c0cb004a63557e15bcb4e305aa698be /src/tests/edje
parent9baa8752a9170e68e9430474f26cc1e672677d8e (diff)
edje_signal: reduce member count when deleted edje_signal_callback is found
Summary: - when deleted callback is found _edje_signal_callback_move_last() is called in order to pack match array. - during _edje_signal_callback_move_last() index skips when another deleted callback is found, but does not reduce members_count. - this duplicates a remaining callback and calls the callback twice. Test Plan: 1. add multiple edje_signal_callback by edje_object_signal_callback_add() which have the same source, signal, func but different data. 2. delete first and last callback by edje_object_signal_callback_del/edje_object_signal_callback_del_full. 3. emit edje_signal. 4. observe one callback is called twice. Reviewers: SanghyeonLee, conr2d, jpeg Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4985
Diffstat (limited to 'src/tests/edje')
-rw-r--r--src/tests/edje/data/test_signal_callback_del_full.edc24
-rw-r--r--src/tests/edje/edje_test_edje.c44
2 files changed, 68 insertions, 0 deletions
diff --git a/src/tests/edje/data/test_signal_callback_del_full.edc b/src/tests/edje/data/test_signal_callback_del_full.edc
new file mode 100644
index 0000000..af9acc1
--- /dev/null
+++ b/src/tests/edje/data/test_signal_callback_del_full.edc
@@ -0,0 +1,24 @@
1// compile: edje_cc test_signal_callback_del_full.edc
2collections {
3 group {
4 name: "test";
5
6 parts {
7 part {
8 name: "event";
9 type: RECT;
10 description {
11 state: "default" 0.0;
12 rel1 {
13 relative: 0.0 0.0;
14 offset: 0 0;
15 }
16 rel2 {
17 relative: 1.0 1.0;
18 offset: -1 -1;
19 }
20 }
21 }
22 }
23 }
24}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index af88fa8..f7b0175 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -900,6 +900,49 @@ START_TEST(edje_test_signals)
900} 900}
901END_TEST 901END_TEST
902 902
903static int _signal_count;
904
905static void
906_signal_callback_count_cb(void *data, Evas_Object *obj EINA_UNUSED,
907 const char *emission EINA_UNUSED, const char *source EINA_UNUSED)
908{
909 int *_data = data;
910 _signal_count += *_data;
911}
912
913START_TEST(edje_test_signal_callback_del_full)
914{
915 Evas *evas;
916 Evas_Object *obj;
917 int data[4] = { 1, 2, 4, 8 };
918
919 evas = EDJE_TEST_INIT_EVAS();
920
921 obj = efl_add(EDJE_OBJECT_CLASS, evas,
922 efl_file_set(efl_added,
923 test_layout_get("test_signal_callback_del_full.edj"), "test"),
924 efl_gfx_size_set(efl_added, 320, 240),
925 efl_gfx_visible_set(efl_added, 1));
926
927 edje_object_signal_callback_add(obj, "some_signal", "event", _signal_callback_count_cb, &data[0]);
928 edje_object_signal_callback_add(obj, "some_signal", "event", _signal_callback_count_cb, &data[1]);
929 edje_object_signal_callback_add(obj, "some_signal", "event", _signal_callback_count_cb, &data[2]);
930 edje_object_signal_callback_add(obj, "some_signal", "event", _signal_callback_count_cb, &data[3]);
931
932 edje_object_signal_callback_del_full(obj, "some_signal", "event", _signal_callback_count_cb, &data[0]);
933 edje_object_signal_callback_del_full(obj, "some_signal", "event", _signal_callback_count_cb, &data[3]);
934
935 edje_object_signal_emit(obj, "some_signal", "event");
936
937 edje_object_message_signal_process(obj);
938 ck_assert_int_eq(_signal_count, (data[1] + data[2]));
939
940 efl_del(obj);
941
942 EDJE_TEST_FREE_EVAS();
943}
944END_TEST
945
903void edje_test_edje(TCase *tc) 946void edje_test_edje(TCase *tc)
904{ 947{
905 tcase_add_test(tc, edje_test_edje_init); 948 tcase_add_test(tc, edje_test_edje_init);
@@ -924,4 +967,5 @@ void edje_test_edje(TCase *tc)
924 tcase_add_test(tc, edje_test_message_send_legacy); 967 tcase_add_test(tc, edje_test_message_send_legacy);
925 tcase_add_test(tc, edje_test_message_send_eo); 968 tcase_add_test(tc, edje_test_message_send_eo);
926 tcase_add_test(tc, edje_test_signals); 969 tcase_add_test(tc, edje_test_signals);
970 tcase_add_test(tc, edje_test_signal_callback_del_full);
927} 971}