summaryrefslogtreecommitdiff
path: root/src/tests/edje
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-06-23 12:38:32 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-06-25 14:36:09 +0900
commit6ca1ce305bc9043561f040d52c85dd2781aaec4d (patch)
treed96ff3f45dbbc328cf05b1e6d5ab3f8422be2597 /src/tests/edje
parent15afea293ffeeba7a7157b6663e0fdeb28c15e61 (diff)
Edje tests: Add test case for embedded text filters
Diffstat (limited to 'src/tests/edje')
-rw-r--r--src/tests/edje/data/filter.lua14
-rw-r--r--src/tests/edje/data/test_filters.edc62
-rw-r--r--src/tests/edje/edje_test_edje.c35
3 files changed, 111 insertions, 0 deletions
diff --git a/src/tests/edje/data/filter.lua b/src/tests/edje/data/filter.lua
new file mode 100644
index 0000000000..2ada51bdea
--- /dev/null
+++ b/src/tests/edje/data/filter.lua
@@ -0,0 +1,14 @@
1-- Evas filter program
2
3a = buffer { 'alpha' }
4b = buffer { src = 'mask' }
5
6padding_set(10)
7
8grow { 5, dst = a }
9blur { 6, src = a, color = state.color, ox = 1, oy = 1 }
10blur { 2, color = color({cc.r, cc.g, cc.b, cc.a }) }
11blend { color = mycolor, ox = 1, oy = 1 }
12
13mask { src = input, mask = b, color = 'cyan', fillmode = 'stretch_y_repeat_x' }
14
diff --git a/src/tests/edje/data/test_filters.edc b/src/tests/edje/data/test_filters.edc
new file mode 100644
index 0000000000..df84c48885
--- /dev/null
+++ b/src/tests/edje/data/test_filters.edc
@@ -0,0 +1,62 @@
1data {
2 file: "filterfile" "filter.lua";
3}
4color_classes {
5 color_class {
6 name: "cc1";
7 color: 0 0 255 255;
8 color2: 0 255 255 255;
9 color3: 0 0 255 255;
10 }
11}
12collections {
13 images {
14 // found in tests/emotion/data
15 image: "pnl.png" COMP;
16 }
17 group { name: "test_group";
18 parts {
19 part { name: "background";
20 type: RECT;
21 description { state: "default" 0.0;
22 color: 33 32 32 255;
23 rel1.relative: 0 0;
24 rel2.relative: 1 1;
25 max: 200 200;
26 }
27 }
28 part { name: "mask";
29 type: IMAGE;
30 no_render: 1;
31 description { state: "default" 0.0;
32 rel1.relative: 0 0;
33 rel2.relative: 1 1;
34 rel.to: "text";
35 max: 999 50;
36 image.normal: "pnl.png";
37 }
38 }
39 part { name: "text";
40 type: TEXT;
41 description { state: "default" 0.0;
42 rel1.relative: 0 0;
43 rel2.relative: 1 1;
44 rel1.to: "background";
45 rel2.to: "background";
46 text {
47 text: "FILTER";
48 font: "Sans";
49 size: 48;
50 }
51 filter {
52 code: "filterfile";
53 source: "mask";
54 data: "mycolor" "#f0f8";
55 data: "cc" "color_class('cc1')";
56 }
57 color: 255 80 0 200;
58 }
59 }
60 }
61 }
62}
diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c
index 88cc3fc20e..4c80b36186 100644
--- a/src/tests/edje/edje_test_edje.c
+++ b/src/tests/edje/edje_test_edje.c
@@ -203,6 +203,40 @@ START_TEST(edje_test_masking)
203} 203}
204END_TEST 204END_TEST
205 205
206START_TEST(edje_test_filters)
207{
208 Evas *evas = EDJE_TEST_INIT_EVAS();
209 const Evas_Object *text, *sub;
210 Evas_Object *obj, *src = NULL;
211 const char *prg, *name;
212 Eina_Bool b;
213
214 obj = edje_object_add(evas);
215 fail_unless(edje_object_file_set(obj, test_layout_get("test_filters.edj"), "test_group"));
216
217 evas_object_resize(obj, 200, 200);
218
219 /* check value of no_render flag as seen from evas land */
220 sub = edje_object_part_object_get(obj, "mask");
221 fail_if(!eo_do_ret(sub, b, evas_obj_no_render_get()));
222
223 /* text part: check filter status */
224 text = edje_object_part_object_get(obj, "text");
225 fail_if(!text);
226
227 eo_do(text, efl_gfx_filter_program_get(&prg, &name));
228 fail_if(!prg);
229 fail_if(!name || strcmp(name, "filterfile"));
230
231 eo_do(text, efl_gfx_filter_source_get("mask", &src));
232 fail_if(!src);
233
234 // TODO: Verify properly that the filter runs well
235
236 EDJE_TEST_FREE_EVAS();
237}
238END_TEST
239
206void edje_test_edje(TCase *tc) 240void edje_test_edje(TCase *tc)
207{ 241{
208 tcase_add_test(tc, edje_test_edje_init); 242 tcase_add_test(tc, edje_test_edje_init);
@@ -212,4 +246,5 @@ void edje_test_edje(TCase *tc)
212 tcase_add_test(tc, edje_test_complex_layout); 246 tcase_add_test(tc, edje_test_complex_layout);
213 tcase_add_test(tc, edje_test_calculate_parens); 247 tcase_add_test(tc, edje_test_calculate_parens);
214 tcase_add_test(tc, edje_test_masking); 248 tcase_add_test(tc, edje_test_masking);
249 tcase_add_test(tc, edje_test_filters);
215} 250}