elm_test: Add a filter to the code entry

Just because I can. It's the filter code editor after all, deserves
a filter of its own. Plus, it tests that we can embed a filter
in the default style, and edit text with a filter and everything
works as expected. Yay!
This commit is contained in:
Jean-Philippe Andre 2017-01-10 19:04:46 +09:00
parent f616b3ee15
commit 277ca9c0fc
1 changed files with 17 additions and 0 deletions

View File

@ -494,13 +494,30 @@ test_gfx_filters(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
}
{
const char *code_filter =
"a = buffer { 'alpha' }"
"grow { 2, dst = a } "
"blur { 6, ox = 1, oy = 1, src = a, color = '#004' }"
"blur { 3, ox = 1, oy = 1, color = 'black' }"
"blend { color = 'lime' }";
Eina_Strbuf *buf;
o = code = efl_add(EFL_UI_TEXT_EDITABLE_CLASS, win,
efl_gfx_size_hint_weight_set(efl_added, 1.0, 1.0),
efl_gfx_size_hint_align_set(efl_added, -1.0, -1.0),
efl_ui_text_scrollable_set(efl_added, 1));
efl_event_callback_add(o, EFL_UI_TEXT_EVENT_CHANGED_USER, _code_changed, win);
// Insert filter code inside style string: DEFAULT='blah blah <here>'
buf = eina_strbuf_new();
eina_strbuf_append(buf, efl_canvas_text_style_get(o, NULL));
eina_strbuf_insert(buf, " gfx_filter=code", eina_strbuf_length_get(buf) - 1);
efl_gfx_filter_program_set(o, code_filter, "code");
efl_canvas_text_style_set(o, NULL, eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
// FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
// Efl.Ui.Text doesn't seem to trigger the proper events during edit
efl_event_callback_add(o, EFL_EVENT_KEY_DOWN, _code_changed_hack, win);
efl_content_set(efl_part(split, "bottom"), code);