From 35fe059ec8091a7635117abfddb5ed3f83e2101e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Mon, 7 Sep 2015 19:08:50 +0900 Subject: [PATCH] Edje: Add test case for SNAPSHOT This is mostly an edje_cc compilation test. --- src/Makefile_Edje.am | 8 +++-- src/tests/edje/data/test_snapshot.edc | 61 +++++++++++++++++++++++++++++++++++ src/tests/edje/edje_test_edje.c | 25 ++++++++++++++ 3 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 src/tests/edje/data/test_snapshot.edc diff --git a/src/Makefile_Edje.am b/src/Makefile_Edje.am index 6e99c85..1e5059f 100644 --- a/src/Makefile_Edje.am +++ b/src/Makefile_Edje.am @@ -254,6 +254,7 @@ tests/edje/data/test_layout.edc \ tests/edje/data/test_parens.edc \ tests/edje/data/test_masking.edc \ tests/edje/data/test_filters.edc \ +tests/edje/data/test_snapshot.edc \ tests/edje/data/filter.lua @@ -295,6 +296,7 @@ EDJE_DATA_FILES = tests/edje/data/test_layout.edc \ tests/edje/data/test_parens.edc \ tests/edje/data/test_masking.edc \ tests/edje/data/test_filters.edc \ + tests/edje/data/test_snapshot.edc \ tests/edje/data/filter.lua edjedatafilesdir = $(datadir)/edje/data @@ -302,13 +304,15 @@ edjedatafiles_DATA = tests/edje/data/test_layout.edj \ tests/edje/data/complex_layout.edj \ tests/edje/data/test_parens.edj \ tests/edje/data/test_masking.edj \ - tests/edje/data/test_filters.edj + tests/edje/data/test_filters.edj \ + tests/edje/data/test_snapshot.edj CLEANFILES += tests/edje/data/test_layout.edj \ tests/edje/data/complex_layout.edj \ tests/edje/data/test_parens.edj \ tests/edje/data/test_masking.edj \ - tests/edje/data/test_filters.edj + tests/edje/data/test_filters.edj \ + tests/edje/data/test_snapshot.edj endif diff --git a/src/tests/edje/data/test_snapshot.edc b/src/tests/edje/data/test_snapshot.edc new file mode 100644 index 0000000..a68c649 --- /dev/null +++ b/src/tests/edje/data/test_snapshot.edc @@ -0,0 +1,61 @@ +collections { + filters { + filter { + name: "filter"; + script { + padding_set(0) + blur { 10 } + } + } + } + images { + // found in tests/emotion/data + image: "e_logo.png" COMP; + } + group { name: "test_group"; + filters { + filter.file: "filter.lua"; + } + parts { + part { name: "background"; + type: RECT; + description { state: "default" 0.0; + color: 33 32 32 255; + rel1.relative: 0 0; + rel2.relative: 1 1; + max: 250 250; + } + } + image { "img"; + desc { "default"; + image.normal: "e_logo.png"; + fill.type: TILE; + rel.to: "background"; + } + } + part { name: "snap"; + type: SNAPSHOT; + desc { "default"; + rel.to: "background"; + rel1.relative: 0.25 0.25; + rel2.relative: 0.75 0.75; + filter.code: "filter"; + } + desc { "hid"; inherit: "default"; hid; + } + } + } + programs.program { + source: "*"; + signal: "mouse,in"; + action: STATE_SET "hid" 0.0; + targets: "snap"; + } + programs.program { + source: "*"; + signal: "mouse,out"; + action: STATE_SET "default" 0.0; + targets: "snap"; + } + } +} diff --git a/src/tests/edje/edje_test_edje.c b/src/tests/edje/edje_test_edje.c index bf32f6d..43eacdc 100644 --- a/src/tests/edje/edje_test_edje.c +++ b/src/tests/edje/edje_test_edje.c @@ -243,6 +243,30 @@ START_TEST(edje_test_filters) } END_TEST +START_TEST(edje_test_snapshot) +{ + Evas *evas = EDJE_TEST_INIT_EVAS(); + const Evas_Object *sub; + Evas_Object *obj, *src = NULL; + Eina_Bool b; + + setenv("EVAS_DATA_DIR", EVAS_DATA_DIR, 1); + + obj = edje_object_add(evas); + fail_unless(edje_object_file_set(obj, test_layout_get("test_snapshot.edj"), "test_group")); + + evas_object_resize(obj, 200, 200); + + /* check value of no_render flag as seen from evas land */ + sub = edje_object_part_object_get(obj, "snap"); + fail_if(!eo_do_ret(sub, b, evas_obj_image_snapshot_get())); + + // TODO: Verify that evas snapshot actually works (and has a filter) + + EDJE_TEST_FREE_EVAS(); +} +END_TEST + void edje_test_edje(TCase *tc) { tcase_add_test(tc, edje_test_edje_init); @@ -253,4 +277,5 @@ void edje_test_edje(TCase *tc) tcase_add_test(tc, edje_test_calculate_parens); tcase_add_test(tc, edje_test_masking); tcase_add_test(tc, edje_test_filters); + tcase_add_test(tc, edje_test_snapshot); } -- 2.7.4