summaryrefslogtreecommitdiff
path: root/src/tests/edje/edje_test_edje.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2016-04-29 13:19:20 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2016-04-29 13:32:01 +0900
commit0c2027b2af67f91dc4a203c177345e769ec07dec (patch)
treed75b4e01651f8f8e441506ec0405e8b755559380 /src/tests/edje/edje_test_edje.c
parent0bf8dabe024ad5b92485b7bbe7f7daa86611118d (diff)
Edje: Add test case showing lifecycle of proxy object
This is for efl_content_get proxy objects (BOX & TABLE).
Diffstat (limited to '')
-rw-r--r--src/tests/edje/edje_test_edje.c60
1 files changed, 58 insertions, 2 deletions
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index c9b42eb4ee..71969b0728 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -640,7 +640,7 @@ START_TEST(edje_test_table_eoapi)
640 Evas *evas; 640 Evas *evas;
641 Evas_Object *obj, *sobj, *sobjs[4]; 641 Evas_Object *obj, *sobj, *sobjs[4];
642 Eina_Iterator *it; 642 Eina_Iterator *it;
643 Eo *table; 643 Eo *table, *other;
644 int i, k, l, cs, rs, cols, rows; 644 int i, k, l, cs, rs, cols, rows;
645 645
646 evas = EDJE_TEST_INIT_EVAS(); 646 evas = EDJE_TEST_INIT_EVAS();
@@ -707,9 +707,65 @@ START_TEST(edje_test_table_eoapi)
707 fail_if(cols != 2); 707 fail_if(cols != 2);
708 fail_if(rows != 2); 708 fail_if(rows != 2);
709 709
710 /* release handle - not required */ 710
711 /* test proxy object references
712 * exact reference count is not part of API,
713 * only lifecycle of object matters
714 *
715 * very ugly code below - test case only!
716 */
717 i = eo_ref_get(table);
718 fail_if(i != 1);
711 eo_del(table); 719 eo_del(table);
712 720
721 /* this will generate eo errors */
722 k = eo_ref_get(table);
723 fail_if(k > 0);
724
725 cols = -1; rows = -1;
726 /* this will generate eo errors */
727 efl_pack_grid_size_get(table, &cols, &rows);
728 fail_if(cols != -1);
729 fail_if(rows != -1);
730
731 table = efl_content_get(obj, "table");
732 fail_if(!table);
733 other = efl_content_get(obj, "table");
734 fail_if(other != table);
735 fail_if(eo_ref_get(other) != 1);
736
737 /* delete edje and verify proxy died */
738 eo_del(obj);
739
740 /* this will generate eo errors */
741 fail_if(eo_ref_get(table) > 0);
742
743 cols = -1; rows = -1;
744 /* this will generate eo errors */
745 efl_pack_grid_size_get(table, &cols, &rows);
746 fail_if(cols != -1);
747 fail_if(rows != -1);
748
749 /* try again but keep a ref on proxy */
750 obj = edje_object_add(evas);
751 fail_unless(edje_object_file_set(obj, test_layout_get("test_table.edj"), "test_group"));
752
753 table = efl_content_get(obj, "table");
754 fail_if(!table);
755 eo_ref(table);
756 fflush(stderr);
757 eo_del(obj);
758 /* note: obj has > 0 refs because evas likes to keep objects around a bit */
759 fail_if(eo_ref_get(table) > 1);
760
761 cols = -1; rows = -1;
762 /* this will NOT generate eo errors (table is alive) */
763 efl_pack_grid_size_get(table, &cols, &rows);
764 fail_if(cols > 0);
765 fail_if(rows > 0);
766
767 eo_unref(table);
768
713 EDJE_TEST_FREE_EVAS(); 769 EDJE_TEST_FREE_EVAS();
714} 770}
715END_TEST 771END_TEST