summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-07-13 17:39:01 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-08-04 10:24:03 +0900
commit0834511067a99faafc2c59f0aabcd58dab1cbc0b (patch)
tree632433d1a9f6aa4c0131100c3a952d19a53329e0 /src/tests/eo/suite
parent83a4c3e3e2c1503f32aff81b46cc9c486a35ebd2 (diff)
Eo: Allow multiple functions overrides
This allows two things: - adding new override functions on an object that already has overrides - resetting a specific function (or list of functions) to the parent class implementation by passing NULL as implementation Fixes T5580 @feature
Diffstat (limited to 'src/tests/eo/suite')
-rw-r--r--src/tests/eo/suite/eo_test_general.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index 0d6f322f1f..4ac8f22c54 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -79,6 +79,7 @@ START_TEST(efl_object_override_tests)
79 * make sure we don't cache. */ 79 * make sure we don't cache. */
80 ck_assert_int_eq(simple_a_get(obj), 0); 80 ck_assert_int_eq(simple_a_get(obj), 0);
81 81
82 /* Test override */
82 EFL_OPS_DEFINE( 83 EFL_OPS_DEFINE(
83 overrides, 84 overrides,
84 EFL_OBJECT_OP_FUNC(simple_a_get, _simple_obj_override_a_get)); 85 EFL_OBJECT_OP_FUNC(simple_a_get, _simple_obj_override_a_get));
@@ -86,7 +87,7 @@ START_TEST(efl_object_override_tests)
86 87
87 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A); 88 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A);
88 89
89 /* Check super works. */ 90 /* Check non-overriden functions work. */
90 simple_a_set(obj, OVERRIDE_A_SIMPLE); 91 simple_a_set(obj, OVERRIDE_A_SIMPLE);
91 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A + OVERRIDE_A_SIMPLE); 92 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A + OVERRIDE_A_SIMPLE);
92 93
@@ -100,22 +101,36 @@ START_TEST(efl_object_override_tests)
100 simple_a_set(obj, OVERRIDE_A_SIMPLE); 101 simple_a_set(obj, OVERRIDE_A_SIMPLE);
101 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A_SIMPLE * 2); 102 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A_SIMPLE * 2);
102 103
103 /* Try overriding again - not allowed by policy */ 104 /* Try overriding again, allowed since 1.21. */
104 fail_if(efl_object_override(obj, &overrides)); 105 fail_if(!efl_object_override(obj, &overrides));
105 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A_SIMPLE * 2); 106 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A + OVERRIDE_A_SIMPLE * 2);
106 107
107 /* Try introducing a new function */ 108 /* Try introducing a new function */
108 EFL_OPS_DEFINE( 109 EFL_OPS_DEFINE(
109 overrides3, 110 overrides3,
110 EFL_OBJECT_OP_FUNC(simple2_class_beef_get, _simple_obj_override_a_double_set)); 111 EFL_OBJECT_OP_FUNC(simple2_class_beef_get, _simple_obj_override_a_double_set));
112 fail_if(efl_object_override(obj, &overrides3));
111 fail_if(!efl_object_override(obj, NULL)); 113 fail_if(!efl_object_override(obj, NULL));
112 fail_if(efl_object_override(obj, &overrides3)); 114 fail_if(efl_object_override(obj, &overrides3));
113 115
114 /* Test override reset */ 116 /* Test override reset of all functions */
115 fail_if(!efl_object_override(obj, NULL)); 117 fail_if(!efl_object_override(obj, NULL));
116 simple_a_set(obj, 42 * OVERRIDE_A_SIMPLE); 118 simple_a_set(obj, 42 * OVERRIDE_A_SIMPLE);
117 ck_assert_int_eq(simple_a_get(obj), 42 * OVERRIDE_A_SIMPLE); 119 ck_assert_int_eq(simple_a_get(obj), 42 * OVERRIDE_A_SIMPLE);
118 120
121 /* Test override reset of a single functions, allowed since 1.21. */
122 EFL_OPS_DEFINE(
123 overrides4,
124 EFL_OBJECT_OP_FUNC(simple_a_get, NULL));
125 fail_if(!efl_object_override(obj, NULL));
126 simple_a_set(obj, 1337);
127 ck_assert_int_eq(simple_a_get(obj), 1337);
128 fail_if(!efl_object_override(obj, &overrides));
129 fail_if(!efl_object_override(obj, &overrides2));
130 ck_assert_int_eq(simple_a_get(obj), OVERRIDE_A + 1337);
131 fail_if(!efl_object_override(obj, &overrides4));
132 ck_assert_int_eq(simple_a_get(obj), 1337);
133
119 efl_unref(obj); 134 efl_unref(obj);
120 135
121 efl_object_shutdown(); 136 efl_object_shutdown();