summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Lopatka <n.lopatka@samsung.com>2013-03-13 15:23:23 +0900
committerCedric BAIL <cedric.bail@samsung.com>2013-03-13 16:47:53 +0900
commit3e07236148f8032f476c5928f9ef59487b11529a (patch)
tree56c975a044bc93103968d3f0485020f693b7c6d2
parent488ea9ec82a2f28d8af4b0e2dac6c4797b4cea28 (diff)
Edje: Add test for edje_object_file_set.
Signed-off-by: Cedric BAIL <cedric.bail@samsung.com>
-rw-r--r--src/Makefile_Edje.am33
-rw-r--r--src/tests/edje/data/test_layout.edc24
-rw-r--r--src/tests/edje/edje_test_edje.c35
3 files changed, 81 insertions, 11 deletions
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index 20ec55288b..94e05a33fe 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -196,6 +196,17 @@ tests/edje/edje_tests_helpers.h
196 196
197bin_SCRIPTS += bin/edje/edje_recc 197bin_SCRIPTS += bin/edje/edje_recc
198 198
199# Useful to other modules that generate EDJ
200EDJE_CC = EFL_RUN_IN_TREE=1 $(builddir)/bin/edje/edje_cc
201EDJE_CC_FLAGS_VERBOSE = $(EDJE_CC_FLAGS_VERBOSE_@AM_V@)
202EDJE_CC_FLAGS_VERBOSE_ = $(EDJE_CC_FLAGS_VERBOSE_@AM_DEFAULT_V@)
203EDJE_CC_FLAGS_VERBOSE_1 = -v
204EDJE_CC_FLAGS = $(EDJE_CC_FLAGS_VERBOSE) -id $(srcdir) -fd $(srcdir)
205
206AM_V_EDJ = $(am__v_EDJ_@AM_V@)
207am__v_EDJ_ = $(am__v_EDJ_@AM_DEFAULT_V@)
208am__v_EDJ_0 = @echo " EDJ " $@;
209
199### Unit tests 210### Unit tests
200 211
201if EFL_ENABLE_TESTS 212if EFL_ENABLE_TESTS
@@ -214,15 +225,17 @@ $(EDJE_COMMON_CPPFLAGS) \
214@CHECK_CFLAGS@ 225@CHECK_CFLAGS@
215tests_edje_edje_suite_LDADD = @CHECK_LIBS@ @USE_EDJE_LIBS@ 226tests_edje_edje_suite_LDADD = @CHECK_LIBS@ @USE_EDJE_LIBS@
216tests_edje_edje_suite_DEPENDENCIES = @USE_EDJE_INTERNAL_LIBS@ 227tests_edje_edje_suite_DEPENDENCIES = @USE_EDJE_INTERNAL_LIBS@
217endif
218 228
219# Useful to other modules that generate EDJ 229tests/edje/data/test_layout.edj: tests/edje/data/test_layout.edc bin/edje/edje_cc
220EDJE_CC = EFL_RUN_IN_TREE=1 $(builddir)/bin/edje/edje_cc 230 @$(MKDIR_P) tests/edje/data
221EDJE_CC_FLAGS_VERBOSE = $(EDJE_CC_FLAGS_VERBOSE_@AM_V@) 231 $(AM_V_EDJ)$(EDJE_CC) $(EDJE_CC_FLAGS) -id $(srcdir)/tests/edje/data $< $@
222EDJE_CC_FLAGS_VERBOSE_ = $(EDJE_CC_FLAGS_VERBOSE_@AM_DEFAULT_V@)
223EDJE_CC_FLAGS_VERBOSE_1 = -v
224EDJE_CC_FLAGS = $(EDJE_CC_FLAGS_VERBOSE) -id $(srcdir) -fd $(srcdir)
225 232
226AM_V_EDJ = $(am__v_EDJ_@AM_V@) 233EDJE_DATA_FILES = tests/edje/data/test_layout.edc
227am__v_EDJ_ = $(am__v_EDJ_@AM_DEFAULT_V@) 234
228am__v_EDJ_0 = @echo " EDJ " $@; 235edjedatafilesdir = $(datadir)/edje/data
236edjedatafiles_DATA = tests/edje/data/test_layout.edj
237CLEANFILES += tests/edje/data/test_layout.edj
238
239endif
240
241EXTRA_DIST += $(EDJE_DATA_FILES)
diff --git a/src/tests/edje/data/test_layout.edc b/src/tests/edje/data/test_layout.edc
new file mode 100644
index 0000000000..fe6ea011a6
--- /dev/null
+++ b/src/tests/edje/data/test_layout.edc
@@ -0,0 +1,24 @@
1collections {
2 group {
3 name: "test_group";
4
5 parts {
6 part {
7 name: "background";
8 type: RECT;
9 mouse_events: 0;
10
11 description {
12 state: "default" 0.0;
13 color: 255 255 255 255;
14
15 rel1 {
16 relative: 0.0 0.0;
17 }
18 rel2 {
19 relative: 1.0 1.0;
20 }
21 }
22 }
23 }
24}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index a15c8273da..c02419c446 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -38,8 +38,41 @@ START_TEST(edje_test_edje_load)
38} 38}
39END_TEST 39END_TEST
40 40
41void edje_test_edje(TCase *tc) 41static const char *
42test_layout_get(void)
43{
44 static int is_local = -1;
45 if (is_local == -1)
46 {
47 struct stat st;
48 is_local = (stat(PACKAGE_BUILD_DIR"/src/tests/edje/data/test_layout.edj", &st) == 0);
49 }
50
51 if (is_local)
52 return PACKAGE_BUILD_DIR"/src/tests/edje/data/test_layout.edj";
53 else
54 return PACKAGE_DATA_DIR"/data/test_layout.edj";
55}
56
57START_TEST(edje_test_load_simple_layout)
42{ 58{
59 Evas *evas = EDJE_TEST_INIT_EVAS();
60 Evas_Object *obj;
61
62 obj = edje_object_add(evas);
63 fail_unless(edje_object_file_set(obj, test_layout_get(), "test_group"));
64
65 fail_if(edje_object_part_exists(obj, "unexistant_part"));
66 fail_unless(edje_object_part_exists(obj, "background"));
67
68
69 EDJE_TEST_FREE_EVAS();
70}
71END_TEST
72
73void edje_test_edje(TCase *tc)
74{
43 tcase_add_test(tc, edje_test_edje_init); 75 tcase_add_test(tc, edje_test_edje_init);
76 tcase_add_test(tc,edje_test_load_simple_layout);
44 tcase_add_test(tc, edje_test_edje_load); 77 tcase_add_test(tc, edje_test_edje_load);
45} 78}