From e9d7ca78bf06d52cd658bd36db34da2a2da5f47e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Wed, 26 Oct 2016 14:01:43 +0900 Subject: [PATCH] elm_test: Add minor hack to run test when Enter is pressed If there's only one filtered out button in the list after searching by name, Enter should activate the entry and run the test case. --- src/bin/elementary/test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 3a9d630d40..0c3fa6c01d 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -449,6 +449,24 @@ _entry_changed_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EIN _menu_create(str); } +static void +_entry_activated_cb(void *data EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED) +{ + const char *str = elm_entry_entry_get(obj); + struct elm_test *t, *found = NULL; + Eina_List *l; + + if (!str) return; + EINA_LIST_FOREACH(tests, l, t) + { + if (!strcasestr(t->name, str)) continue; + if (found) return; + found = t; + } + if (!found) return; + evas_object_smart_callback_call(found->btn, "clicked", NULL); +} + static char * _space_removed_string_get(const char *name) { @@ -584,6 +602,7 @@ my_win_main(const char *autorun, Eina_Bool test_win_only) evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_smart_callback_add(en, "changed,user", _entry_changed_cb, NULL); + evas_object_smart_callback_add(en, "activated", _entry_activated_cb, NULL); elm_box_pack_end(bx1, en); evas_object_show(en); elm_object_focus_set(en, EINA_TRUE);