edje: add test for omitting "name" keyword in color_classes.color_class block
authorJee-Yong Um <jc9.um@samsung.com>
Fri, 5 Feb 2016 06:51:31 +0000 (07:51 +0100)
committerCedric BAIL <cedric@osg.samsung.com>
Fri, 5 Feb 2016 06:51:34 +0000 (07:51 +0100)
Summary:
This test checks whether omitting "name" keyword in color_classes.color_class
block in EDC work normally.

Depends on D3598

Test Plan: make check

Reviewers: cedric, jpeg

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

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

index 4fa0ecf..57f73b0 100644 (file)
@@ -256,6 +256,7 @@ tests/edje/data/test_masking.edc \
 tests/edje/data/test_filters.edc \
 tests/edje/data/test_snapshot.edc \
 tests/edje/data/test_size_class.edc \
+tests/edje/data/test_color_class.edc \
 tests/edje/data/filter.lua
 
 
@@ -299,6 +300,7 @@ EDJE_DATA_FILES = tests/edje/data/test_layout.edc \
                   tests/edje/data/test_filters.edc \
                   tests/edje/data/test_snapshot.edc \
                   tests/edje/data/test_size_class.edc \
+                  tests/edje/data/test_color_class.edc \
                   tests/edje/data/filter.lua
 
 edjedatafilesdir = $(datadir)/edje/data
@@ -308,7 +310,8 @@ edjedatafiles_DATA = tests/edje/data/test_layout.edj \
                      tests/edje/data/test_masking.edj \
                      tests/edje/data/test_filters.edj \
                      tests/edje/data/test_snapshot.edj \
-                     tests/edje/data/test_size_class.edj
+                     tests/edje/data/test_size_class.edj \
+                     tests/edje/data/test_color_class.edj
 
 CLEANFILES += tests/edje/data/test_layout.edj \
               tests/edje/data/complex_layout.edj \
@@ -316,7 +319,8 @@ CLEANFILES += tests/edje/data/test_layout.edj \
               tests/edje/data/test_masking.edj \
               tests/edje/data/test_filters.edj \
               tests/edje/data/test_snapshot.edj \
-              tests/edje/data/test_size_class.edj
+              tests/edje/data/test_size_class.edj \
+              tests/edje/data/test_color_class.edj
 
 endif
 
diff --git a/src/tests/edje/data/test_color_class.edc b/src/tests/edje/data/test_color_class.edc
new file mode 100644 (file)
index 0000000..30c7b45
--- /dev/null
@@ -0,0 +1,17 @@
+collections {
+   color_classes {
+      color_class { "test_color_class";
+         color: 100 100 100 100;
+      }
+   }
+   group { name: "test_group";
+      parts {
+         rect { "rect";
+            desc { "default";
+               color_class: "test_color_class";
+            }
+         }
+      }
+   }
+}
+
index 536de1d..407ff9a 100644 (file)
@@ -327,6 +327,41 @@ START_TEST(edje_test_size_class)
 }
 END_TEST
 
+START_TEST(edje_test_color_class)
+{
+   Evas *evas = EDJE_TEST_INIT_EVAS();
+
+   Eina_File *f;
+   Eina_Iterator *it;
+   Edje_Color_Class *itcc, *cc = NULL;
+   char *filename;
+
+   filename = realpath(test_layout_get("test_color_class.edj"), NULL);
+   fail_if(!filename);
+
+   f = eina_file_open(filename, EINA_FALSE);
+   fail_if(!f);
+
+   it = edje_mmap_color_class_iterator_new(f);
+   fail_if(!it);
+   EINA_ITERATOR_FOREACH(it, itcc)
+     {
+        if (!strcmp(itcc->name, "test_color_class"))
+          {
+             cc = itcc;
+             break;
+          }
+     }
+   fail_if((!cc) || (cc->r != 100) || (cc->g != 100) || (cc->b != 100) || (cc->a != 100));
+
+   eina_iterator_free(it);
+   eina_file_close(f);
+   free(filename);
+
+   EDJE_TEST_FREE_EVAS();
+}
+END_TEST
+
 void edje_test_edje(TCase *tc)
 {    
    tcase_add_test(tc, edje_test_edje_init);
@@ -339,4 +374,5 @@ void edje_test_edje(TCase *tc)
    tcase_add_test(tc, edje_test_filters);
    tcase_add_test(tc, edje_test_snapshot);
    tcase_add_test(tc, edje_test_size_class);
+   tcase_add_test(tc, edje_test_color_class);
 }