From: Enlightenment S. <no-...@en...> - 2012-04-12 14:38:08
|
Log: Eobj: Added some more test scenarios. Author: tasn Date: 2012-04-12 07:37:57 -0700 (Thu, 12 Apr 2012) New Revision: 70147 Trac: http://trac.enlightenment.org/e/changeset/70147 Modified: trunk/PROTO/eobj/examples/composite_objects/comp.c trunk/PROTO/eobj/examples/composite_objects/main.c trunk/PROTO/eobj/tests/eobj_test_general.c Modified: trunk/PROTO/eobj/examples/composite_objects/comp.c =================================================================== --- trunk/PROTO/eobj/examples/composite_objects/comp.c 2012-04-12 14:37:52 UTC (rev 70146) +++ trunk/PROTO/eobj/examples/composite_objects/comp.c 2012-04-12 14:37:57 UTC (rev 70147) @@ -30,6 +30,8 @@ fail_if(eobj_composite_is(obj)); fail_if(!eobj_composite_is(simple)); + eobj_generic_data_set(obj, "simple-obj", simple); + eobj_unref(simple); } Modified: trunk/PROTO/eobj/examples/composite_objects/main.c =================================================================== --- trunk/PROTO/eobj/examples/composite_objects/main.c 2012-04-12 14:37:52 UTC (rev 70146) +++ trunk/PROTO/eobj/examples/composite_objects/main.c 2012-04-12 14:37:57 UTC (rev 70147) @@ -36,6 +36,22 @@ eobj_do(obj, SIMPLE_A_GET(&a)); fail_if(a != 1); + /* disable the callback forwarder, and fail if it's still called. */ + Eobj *simple = eobj_generic_data_get(obj, "simple-obj"); + eobj_ref(simple); + eobj_event_callback_forwarder_del(simple, SIG_A_CHANGED, obj); + + cb_called = EINA_FALSE; + eobj_do(obj, SIMPLE_A_SET(2)); + fail_if(cb_called); + + fail_if(!eobj_composite_is(simple)); + eobj_composite_object_detach(obj, simple); + fail_if(eobj_composite_is(simple)); + eobj_composite_object_attach(obj, simple); + fail_if(!eobj_composite_is(simple)); + + eobj_unref(simple); eobj_unref(obj); eobj_shutdown(); Modified: trunk/PROTO/eobj/tests/eobj_test_general.c =================================================================== --- trunk/PROTO/eobj/tests/eobj_test_general.c 2012-04-12 14:37:52 UTC (rev 70146) +++ trunk/PROTO/eobj/tests/eobj_test_general.c 2012-04-12 14:37:57 UTC (rev 70147) @@ -30,7 +30,21 @@ /* Ilegal class. */ fail_if(eobj_do(obj, 0x0F010111)); + fail_if(eobj_ref_get(obj) != 1); + + eobj_ref(obj); + fail_if(eobj_ref_get(obj) != 2); + + eobj_ref(obj); + fail_if(eobj_ref_get(obj) != 3); + eobj_unref(obj); + fail_if(eobj_ref_get(obj) != 2); + + eobj_unref(obj); + fail_if(eobj_ref_get(obj) != 1); + + eobj_unref(obj); eobj_shutdown(); } END_TEST |