summaryrefslogtreecommitdiff
path: root/src/tests/eo/suite
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-10-28 13:19:10 +0100
committerTom Hacohen <tom@stosb.com>2016-10-28 13:19:10 +0100
commitf736946d10d519fe959bef84914e4ca3d91e7db8 (patch)
tree7ca64ac9ad4c0ad57cf8ea322bcb7f687688e40c /src/tests/eo/suite
parentda04400c5d22aac0888ceb945c0afe28459af06c (diff)
Eo: Add a method to mark objects for reuse.
This informas eo an object is going to get reused/cached, so eo can reset the object appropriately. @feature.
Diffstat (limited to 'src/tests/eo/suite')
-rw-r--r--src/tests/eo/suite/eo_test_general.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index bb34b7dd98..b956eae53e 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -1230,6 +1230,12 @@ _del_intercept(Eo *obj)
1230 efl_del_intercept_set(obj, NULL); 1230 efl_del_intercept_set(obj, NULL);
1231 efl_unref(obj); 1231 efl_unref(obj);
1232} 1232}
1233
1234static void
1235_del_intercept_reuse(Eo *obj)
1236{
1237 efl_reuse(obj);
1238}
1233#endif 1239#endif
1234 1240
1235START_TEST(efl_del_intercept) 1241START_TEST(efl_del_intercept)
@@ -1270,6 +1276,21 @@ START_TEST(efl_del_intercept)
1270 fail_if(!intercepted); 1276 fail_if(!intercepted);
1271 fail_if(efl_isa(obj, klass)); 1277 fail_if(efl_isa(obj, klass));
1272 1278
1279 /* Check reuse works as expected. */
1280 Eo *parent = efl_add(SIMPLE_CLASS, NULL);
1281 obj = efl_add(klass, NULL);
1282 fail_if(!obj);
1283 ck_assert_int_eq(efl_ref_get(obj), 1);
1284 efl_parent_set(obj, parent);
1285 ck_assert_int_eq(efl_ref_get(obj), 1);
1286 efl_del_intercept_set(obj, _del_intercept_reuse);
1287 efl_del_intercept_set(obj, NULL);
1288 /* This essentially checks it get unsunk */
1289 ck_assert_int_eq(efl_ref_get(obj), 1);
1290 efl_parent_set(obj, parent);
1291 ck_assert_int_eq(efl_ref_get(obj), 1);
1292 efl_del(obj);
1293
1273 efl_object_shutdown(); 1294 efl_object_shutdown();
1274#endif 1295#endif
1275} 1296}