forked from enlightenment/efl
Edje tests: Add test case for embedded text filters
This commit is contained in:
parent
15afea293f
commit
6ca1ce305b
|
@ -284,22 +284,29 @@ tests/edje/data/%.edj: tests/edje/data/%.edc bin/edje/edje_cc${EXEEXT}
|
|||
$(AM_V_EDJ) \
|
||||
$(MKDIR_P) tests/edje/data; \
|
||||
$(EDJE_CC) $(EDJE_CC_FLAGS) -id $(srcdir)/tests/edje/data \
|
||||
-id $(srcdir)/tests/emotion/data $< $@
|
||||
-id $(srcdir)/tests/emotion/data \
|
||||
-dd $(srcdir)/tests/edje/data \
|
||||
$< $@
|
||||
|
||||
EDJE_DATA_FILES = tests/edje/data/test_layout.edc \
|
||||
tests/edje/data/complex_layout.edc \
|
||||
tests/edje/data/test_parens.edc \
|
||||
tests/edje/data/test_masking.edc
|
||||
tests/edje/data/test_masking.edc \
|
||||
tests/edje/data/test_filters.edc \
|
||||
tests/edje/data/filter.lua
|
||||
|
||||
edjedatafilesdir = $(datadir)/edje/data
|
||||
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_masking.edj \
|
||||
tests/edje/data/test_filters.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_masking.edj \
|
||||
tests/edje/data/test_filters.edj
|
||||
|
||||
endif
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
-- Evas filter program
|
||||
|
||||
a = buffer { 'alpha' }
|
||||
b = buffer { src = 'mask' }
|
||||
|
||||
padding_set(10)
|
||||
|
||||
grow { 5, dst = a }
|
||||
blur { 6, src = a, color = state.color, ox = 1, oy = 1 }
|
||||
blur { 2, color = color({cc.r, cc.g, cc.b, cc.a }) }
|
||||
blend { color = mycolor, ox = 1, oy = 1 }
|
||||
|
||||
mask { src = input, mask = b, color = 'cyan', fillmode = 'stretch_y_repeat_x' }
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
data {
|
||||
file: "filterfile" "filter.lua";
|
||||
}
|
||||
color_classes {
|
||||
color_class {
|
||||
name: "cc1";
|
||||
color: 0 0 255 255;
|
||||
color2: 0 255 255 255;
|
||||
color3: 0 0 255 255;
|
||||
}
|
||||
}
|
||||
collections {
|
||||
images {
|
||||
// found in tests/emotion/data
|
||||
image: "pnl.png" COMP;
|
||||
}
|
||||
group { name: "test_group";
|
||||
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: 200 200;
|
||||
}
|
||||
}
|
||||
part { name: "mask";
|
||||
type: IMAGE;
|
||||
no_render: 1;
|
||||
description { state: "default" 0.0;
|
||||
rel1.relative: 0 0;
|
||||
rel2.relative: 1 1;
|
||||
rel.to: "text";
|
||||
max: 999 50;
|
||||
image.normal: "pnl.png";
|
||||
}
|
||||
}
|
||||
part { name: "text";
|
||||
type: TEXT;
|
||||
description { state: "default" 0.0;
|
||||
rel1.relative: 0 0;
|
||||
rel2.relative: 1 1;
|
||||
rel1.to: "background";
|
||||
rel2.to: "background";
|
||||
text {
|
||||
text: "FILTER";
|
||||
font: "Sans";
|
||||
size: 48;
|
||||
}
|
||||
filter {
|
||||
code: "filterfile";
|
||||
source: "mask";
|
||||
data: "mycolor" "#f0f8";
|
||||
data: "cc" "color_class('cc1')";
|
||||
}
|
||||
color: 255 80 0 200;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -203,6 +203,40 @@ START_TEST(edje_test_masking)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(edje_test_filters)
|
||||
{
|
||||
Evas *evas = EDJE_TEST_INIT_EVAS();
|
||||
const Evas_Object *text, *sub;
|
||||
Evas_Object *obj, *src = NULL;
|
||||
const char *prg, *name;
|
||||
Eina_Bool b;
|
||||
|
||||
obj = edje_object_add(evas);
|
||||
fail_unless(edje_object_file_set(obj, test_layout_get("test_filters.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, "mask");
|
||||
fail_if(!eo_do_ret(sub, b, evas_obj_no_render_get()));
|
||||
|
||||
/* text part: check filter status */
|
||||
text = edje_object_part_object_get(obj, "text");
|
||||
fail_if(!text);
|
||||
|
||||
eo_do(text, efl_gfx_filter_program_get(&prg, &name));
|
||||
fail_if(!prg);
|
||||
fail_if(!name || strcmp(name, "filterfile"));
|
||||
|
||||
eo_do(text, efl_gfx_filter_source_get("mask", &src));
|
||||
fail_if(!src);
|
||||
|
||||
// TODO: Verify properly that the filter runs well
|
||||
|
||||
EDJE_TEST_FREE_EVAS();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
void edje_test_edje(TCase *tc)
|
||||
{
|
||||
tcase_add_test(tc, edje_test_edje_init);
|
||||
|
@ -212,4 +246,5 @@ void edje_test_edje(TCase *tc)
|
|||
tcase_add_test(tc, edje_test_complex_layout);
|
||||
tcase_add_test(tc, edje_test_calculate_parens);
|
||||
tcase_add_test(tc, edje_test_masking);
|
||||
tcase_add_test(tc, edje_test_filters);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue