summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-24 13:16:58 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-29 16:06:22 +0200
commitd01885ec8b6fd039acc206e82d1bd805420e6eb9 (patch)
tree3be52c17455f5c912c6319e4e43803a318c4d141 /src/bin
parente1f2b9d23593302b3c7f1e05b933b551cee1bbbe (diff)
elm_test: add keybinds to rapidly flip between tests
when not using --test-win-only, allow opening new tests forward and backward with alt+. and alt+, Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9406
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/elementary/test.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 3222fad2c9..8856c7cab1 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -405,7 +405,7 @@ static void _list_udpate(void);
405 405
406static Evas_Object *win, *tbx, *entry; // TODO: refactoring 406static Evas_Object *win, *tbx, *entry; // TODO: refactoring
407static void *tt; 407static void *tt;
408static Eina_List *tests; 408static Eina_List *tests, *cur_test;;
409static Eina_Bool hide_legacy = EINA_FALSE; 409static Eina_Bool hide_legacy = EINA_FALSE;
410static Eina_Bool hide_beta = EINA_FALSE; 410static Eina_Bool hide_beta = EINA_FALSE;
411 411
@@ -643,6 +643,32 @@ _space_removed_string_get(const char *name)
643 return ret; 643 return ret;
644} 644}
645 645
646static Eina_Bool
647_my_win_key_up(void *d EINA_UNUSED, int type EINA_UNUSED, Ecore_Event_Key *ev)
648{
649 struct elm_test *t;
650
651 if (eina_streq(ev->key, "comma") && (ev->modifiers & ECORE_EVENT_MODIFIER_ALT))
652 {
653 if (cur_test)
654 cur_test = eina_list_prev(cur_test);
655 if (!cur_test)
656 cur_test = eina_list_last(tests);
657 t = eina_list_data_get(cur_test);
658 t->cb(NULL, NULL, NULL);
659 }
660 else if (eina_streq(ev->key, "period") && (ev->modifiers & ECORE_EVENT_MODIFIER_ALT))
661 {
662 if (cur_test)
663 cur_test = eina_list_next(cur_test);
664 if (!cur_test)
665 cur_test = tests;
666 t = eina_list_data_get(cur_test);
667 t->cb(NULL, NULL, NULL);
668 }
669 return ECORE_CALLBACK_RENEW;
670}
671
646static void 672static void
647my_win_main(const char *autorun, Eina_Bool test_win_only) 673my_win_main(const char *autorun, Eina_Bool test_win_only)
648{ 674{
@@ -1300,7 +1326,10 @@ add_tests:
1300 } 1326 }
1301 1327
1302 if (tests) 1328 if (tests)
1303 _menu_create(NULL); 1329 {
1330 _menu_create(NULL);
1331 ecore_event_handler_add(ECORE_EVENT_KEY_UP, (Ecore_Event_Handler_Cb)_my_win_key_up, NULL);
1332 }
1304 1333
1305 /* bring in autorun frame */ 1334 /* bring in autorun frame */
1306 if (autorun) 1335 if (autorun)