edje: add test for edje_object_part_box_insert_after()
authorJee-Yong Um <jc9.um@samsung.com>
Mon, 18 Apr 2016 23:17:45 +0000 (16:17 -0700)
committerCedric BAIL <cedric@osg.samsung.com>
Mon, 18 Apr 2016 23:21:07 +0000 (16:21 -0700)
Summary:
This test checks the validity of edje_object_part_box_insert_after().
It depends on D3733.

Reviewers: jpeg, cedric

Differential Revision: https://phab.enlightenment.org/D3833

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/Makefile_Edje.am
src/tests/edje/data/test_box.edc [new file with mode: 0644]
src/tests/edje/edje_test_edje.c

index 54bf1ce..a25592b 100644 (file)
@@ -255,6 +255,7 @@ tests/edje/data/test_snapshot.edc \
 tests/edje/data/test_size_class.edc \
 tests/edje/data/test_color_class.edc \
 tests/edje/data/test_swallows.edc \
+tests/edje/data/test_box.edc \
 tests/edje/data/filter.lua
 
 
@@ -299,7 +300,8 @@ EDJE_TEST_FILES = tests/edje/data/test_layout.edj \
                      tests/edje/data/test_snapshot.edj \
                      tests/edje/data/test_size_class.edj \
                      tests/edje/data/test_swallows.edj \
-                     tests/edje/data/test_color_class.edj
+                     tests/edje/data/test_color_class.edj \
+                    tests/edje/data/test_box.edj
 
 noinst_DATA += $(EDJE_TEST_FILES)
 CLEANFILES += $(EDJE_TEST_FILES)
diff --git a/src/tests/edje/data/test_box.edc b/src/tests/edje/data/test_box.edc
new file mode 100644 (file)
index 0000000..b89fa84
--- /dev/null
@@ -0,0 +1,14 @@
+collections {
+   group { "test_group";
+      parts {
+         part { name: "box";
+            type: BOX;
+            description { state: "default" 0.0;
+               box {
+                  layout: "horizontal";
+               }
+            }
+         }
+      }
+   }
+}
index 658f115..a576ac3 100644 (file)
@@ -381,6 +381,45 @@ START_TEST(edje_test_swallows)
 }
 END_TEST
 
+START_TEST(edje_test_box)
+{
+   Evas *evas;
+   Evas_Object *obj, *sobj, *sobjs[5];
+   const Evas_Object *box;
+   Eina_Iterator *it;
+   int i;
+
+   evas = EDJE_TEST_INIT_EVAS();
+
+   obj = edje_object_add(evas);
+   fail_unless(edje_object_file_set(obj, test_layout_get("test_box.edj"), "test_group"));
+
+   for (i = 0; i < 5; i++)
+     {
+        sobjs[i] = evas_object_rectangle_add(evas);
+        fail_if(!sobjs[i]);
+     }
+
+   edje_object_part_box_append(obj, "box", sobjs[3]);
+   edje_object_part_box_prepend(obj, "box", sobjs[1]);
+   edje_object_part_box_insert_before(obj, "box", sobjs[0], sobjs[1]);
+   edje_object_part_box_insert_after(obj, "box", sobjs[4], sobjs[3]);
+   edje_object_part_box_insert_at(obj, "box", sobjs[2], 2);
+
+   box = edje_object_part_object_get(obj, "box");
+   it = evas_object_box_iterator_new(box);
+
+   i = 0;
+   EINA_ITERATOR_FOREACH(it, sobj)
+     {
+        fail_if(sobj != sobjs[i++]);
+     }
+   eina_iterator_free(it);
+
+   EDJE_TEST_FREE_EVAS();
+}
+END_TEST
+
 void edje_test_edje(TCase *tc)
 {
    tcase_add_test(tc, edje_test_edje_init);
@@ -395,4 +434,5 @@ void edje_test_edje(TCase *tc)
    tcase_add_test(tc, edje_test_size_class);
    tcase_add_test(tc, edje_test_color_class);
    tcase_add_test(tc, edje_test_swallows);
+   tcase_add_test(tc, edje_test_box);
 }