summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-06-11 17:46:50 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-15 16:59:41 +0900
commitf24b45a7d0e22689b321ab15276b9275b2309325 (patch)
tree6f78ebc6196efbb031abe362a772e23dc9357646
parent111e51a6ff35c3bf4dc835775b44b630e0191ba1 (diff)
Edje: Add test case for "no_render" and "clip_to" state flag
-rw-r--r--src/Makefile_Edje.am12
-rw-r--r--src/tests/edje/data/test_masking.edc82
-rw-r--r--src/tests/edje/edje_test_edje.c36
3 files changed, 126 insertions, 4 deletions
diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am
index e42f3c449b..596a02bd31 100644
--- a/src/Makefile_Edje.am
+++ b/src/Makefile_Edje.am
@@ -283,19 +283,23 @@ tests_edje_edje_suite_DEPENDENCIES = @USE_EDJE_INTERNAL_LIBS@
283tests/edje/data/%.edj: tests/edje/data/%.edc bin/edje/edje_cc${EXEEXT} 283tests/edje/data/%.edj: tests/edje/data/%.edc bin/edje/edje_cc${EXEEXT}
284 $(AM_V_EDJ) \ 284 $(AM_V_EDJ) \
285 $(MKDIR_P) tests/edje/data; \ 285 $(MKDIR_P) tests/edje/data; \
286 $(EDJE_CC) $(EDJE_CC_FLAGS) -id $(srcdir)/tests/edje/data $< $@ 286 $(EDJE_CC) $(EDJE_CC_FLAGS) -id $(srcdir)/tests/edje/data \
287 -id $(srcdir)/tests/emotion/data $< $@
287 288
288EDJE_DATA_FILES = tests/edje/data/test_layout.edc \ 289EDJE_DATA_FILES = tests/edje/data/test_layout.edc \
289 tests/edje/data/complex_layout.edc \ 290 tests/edje/data/complex_layout.edc \
290 tests/edje/data/test_parens.edc 291 tests/edje/data/test_parens.edc \
292 tests/edje/data/test_masking.edc
291 293
292edjedatafilesdir = $(datadir)/edje/data 294edjedatafilesdir = $(datadir)/edje/data
293edjedatafiles_DATA = tests/edje/data/test_layout.edj \ 295edjedatafiles_DATA = tests/edje/data/test_layout.edj \
294 tests/edje/data/complex_layout.edj \ 296 tests/edje/data/complex_layout.edj \
295 tests/edje/data/test_parens.edj 297 tests/edje/data/test_parens.edj \
298 tests/edje/data/test_masking.edj
296CLEANFILES += tests/edje/data/test_layout.edj \ 299CLEANFILES += tests/edje/data/test_layout.edj \
297 tests/edje/data/complex_layout.edj \ 300 tests/edje/data/complex_layout.edj \
298 tests/edje/data/test_parens.edj 301 tests/edje/data/test_parens.edj \
302 tests/edje/data/test_masking.edj
299 303
300endif 304endif
301 305
diff --git a/src/tests/edje/data/test_masking.edc b/src/tests/edje/data/test_masking.edc
new file mode 100644
index 0000000000..63938d9d8e
--- /dev/null
+++ b/src/tests/edje/data/test_masking.edc
@@ -0,0 +1,82 @@
1collections {
2 images {
3 // found in tests/emotion/data
4 image: "e_logo.png" COMP;
5 }
6 group { name: "test_group";
7 parts {
8 part { name: "background";
9 type: RECT;
10 description { state: "default" 0.0;
11 color: 33 32 32 255;
12 rel1.relative: 0 0;
13 rel2.relative: 1 1;
14 max: 200 200;
15 }
16 }
17 part { name: "clip1";
18 type: RECT;
19 no_render: 1;
20 description { state: "default" 0.0;
21 rel1.relative: 0 0;
22 rel2.relative: 1 1;
23 }
24 }
25 part { name: "clip2";
26 type: RECT;
27 no_render: 1;
28 description { state: "default" 0.0;
29 rel1.relative: 0 0;
30 rel2.relative: 1 1;
31 }
32 }
33 part { name: "mask";
34 type: IMAGE;
35 no_render: 1;
36 description { state: "default" 0.0;
37 rel1.relative: 0 0;
38 rel2.relative: 1 1;
39 rel1.to: "background";
40 rel2.to: "background";
41 image.normal: "e_logo.png";
42 }
43 }
44 part { name: "logo";
45 inherit: "mask";
46 type: IMAGE;
47 no_render: 0;
48 }
49 part { name: "text";
50 inherit: "mask";
51 type: TEXT;
52 description { state: "default" 0.0;
53 text {
54 text: "HELLO WORLD";
55 font: "Sans";
56 size: 16;
57 }
58 color: 255 0 0 255;
59 clip_to: "mask";
60 }
61 }
62 /* test clip_to override from desc */
63 part { name: "noclip";
64 type: TEXT;
65 clip_to: "clip1";
66 description { state: "default" 0.0;
67 text {
68 text: "HELLO WORLD";
69 font: "Sans";
70 size: 16;
71 }
72 rel1.relative: 0 0;
73 rel2.relative: 1 1;
74 rel1.to: "background";
75 rel2.to: "background";
76 color: 0 255 0 64;
77 clip_to: "clip2";
78 }
79 }
80 }
81 }
82}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index 9862ad96af..88cc3fc20e 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -168,6 +168,41 @@ START_TEST(edje_test_calculate_parens)
168} 168}
169END_TEST 169END_TEST
170 170
171START_TEST(edje_test_masking)
172{
173 int x, y, w, h;
174 Evas *evas = EDJE_TEST_INIT_EVAS();
175 const Evas_Object *sub, *clip2, *clip;
176 Evas_Object *obj;
177 Eina_Bool b;
178
179 obj = edje_object_add(evas);
180 fail_unless(edje_object_file_set(obj, test_layout_get("test_masking.edj"), "test_group"));
181
182 evas_object_resize(obj, 100, 100);
183 edje_object_part_geometry_get(obj, "background", &x, &y, &w, &h);
184 fail_if(x != 0 || y != 0 || w != 100 || h != 100);
185
186 clip = edje_object_part_object_get(obj, "clip2");
187 fail_if(!clip);
188
189 /* check value of no_render flag as seen from evas land */
190 sub = edje_object_part_object_get(obj, "mask");
191 fail_if(!eo_do_ret(sub, b, evas_obj_no_render_get()));
192
193 /* check that text has a clip (based on description.clip_to) */
194 sub = edje_object_part_object_get(obj, "text");
195 fail_if(!eo_do_ret(sub, clip2, evas_obj_clip_get()));
196
197 /* test description.clip_to override */
198 sub = edje_object_part_object_get(obj, "noclip");
199 clip2 = eo_do_ret(sub, clip2, evas_obj_clip_get());
200 fail_if(clip != clip2);
201
202 EDJE_TEST_FREE_EVAS();
203}
204END_TEST
205
171void edje_test_edje(TCase *tc) 206void edje_test_edje(TCase *tc)
172{ 207{
173 tcase_add_test(tc, edje_test_edje_init); 208 tcase_add_test(tc, edje_test_edje_init);
@@ -176,4 +211,5 @@ void edje_test_edje(TCase *tc)
176 tcase_add_test(tc, edje_test_simple_layout_geometry); 211 tcase_add_test(tc, edje_test_simple_layout_geometry);
177 tcase_add_test(tc, edje_test_complex_layout); 212 tcase_add_test(tc, edje_test_complex_layout);
178 tcase_add_test(tc, edje_test_calculate_parens); 213 tcase_add_test(tc, edje_test_calculate_parens);
214 tcase_add_test(tc, edje_test_masking);
179} 215}