summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2017-08-04 17:31:19 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2017-08-04 17:31:19 +0900
commit58663230229c74f10e51c2e1e8d63adf7859f172 (patch)
tree36ebe8b939663fb5d0cf0382f17de37810bf490c
parentfe18465267b4ef69ec86f16f1deda516e44cd535 (diff)
tests: making infra to cover all focus testsdevs/woohyun/focus_tests
-rw-r--r--src/tests/elementary/elm_test_focus_legacy.c66
1 files changed, 45 insertions, 21 deletions
diff --git a/src/tests/elementary/elm_test_focus_legacy.c b/src/tests/elementary/elm_test_focus_legacy.c
index de63c0ebb5..8459c20ab0 100644
--- a/src/tests/elementary/elm_test_focus_legacy.c
+++ b/src/tests/elementary/elm_test_focus_legacy.c
@@ -5,35 +5,64 @@
5// elm_object_focus_get(btn[0])); 5// elm_object_focus_get(btn[0]));
6// fflush(stdout); 6// fflush(stdout);
7 7
8static void __focused_cb(void *data, Evas_Object *obj, void *event_info) 8
9// Create a window
10static Evas_Object *_win_create(Evas_Object *parent, int w, int h, Eina_Bool visible);
11// Window focused callback function. This should be the start point of the focus tests
12static void _win_focused_cb(void *data, Evas_Object *obj, void *event_info);
13// Focus Test functions
14static void focus_test_next(Evas_Object *top, Evas_Object *next, Elm_Object_Item *next_item, Elm_Focus_Direction dir);
15
16
17static void focus_test_next(Evas_Object *top, Evas_Object *next, Elm_Object_Item *next_item, Elm_Focus_Direction dir)
18{
19 elm_object_focus_next(top, dir);
20 ck_assert(elm_object_focused_object_get(top) == next);
21
22 if (next_item)
23 ck_assert(elm_object_item_focus_get(next_item) == EINA_TRUE);
24}
25
26static void _win_focused_cb(void *data, Evas_Object *obj, void *event_info)
9{ 27{
10 Evas_Object **btn = (Evas_Object **)data; 28 Evas_Object **btn = (Evas_Object **)data;
11 int i;
12 29
13 elm_object_focus_set(btn[0], EINA_TRUE); 30 elm_object_focus_set(btn[0], EINA_TRUE);
14 ck_assert_int_eq(elm_object_focus_get(btn[0]), 1); 31 ck_assert_int_eq(elm_object_focus_get(btn[0]), 1);
15 32
16 elm_object_focus_next(obj, ELM_FOCUS_RIGHT); 33 // Focus Set test
17 ck_assert(elm_object_focused_object_get(obj) == btn[1]);
18 34
19 elm_object_focus_next(obj, ELM_FOCUS_DOWN); 35 // Focus Next with API test
20 ck_assert(elm_object_focused_object_get(obj) == btn[2]); 36 focus_test_next(obj, btn[1], NULL, ELM_FOCUS_RIGHT);
37 focus_test_next(obj, btn[2], NULL, ELM_FOCUS_DOWN);
38 focus_test_next(obj, btn[4], NULL, ELM_FOCUS_DOWN);
39 focus_test_next(obj, btn[3], NULL, ELM_FOCUS_RIGHT);
40 focus_test_next(obj, btn[1], NULL, ELM_FOCUS_UP);
41 focus_test_next(obj, btn[0], NULL, ELM_FOCUS_LEFT);
21 42
22 elm_object_focus_next(obj, ELM_FOCUS_DOWN); 43 // Focus Next with Key event test
23 ck_assert(elm_object_focused_object_get(obj) == btn[4]);
24 44
25 elm_object_focus_next(obj, ELM_FOCUS_RIGHT); 45 // Focus Revert test with new win show/hide
26 ck_assert(elm_object_focused_object_get(obj) == btn[3]);
27 46
28 elm_object_focus_next(obj, ELM_FOCUS_UP); 47 // Focus Revert test with focused object delete
29 ck_assert(elm_object_focused_object_get(obj) == btn[1]);
30 48
31 elm_object_focus_next(obj, ELM_FOCUS_LEFT);
32 ck_assert(elm_object_focused_object_get(obj) == btn[1]);
33 49
34 elm_exit(); 50 elm_exit();
35} 51}
36 52
53static Evas_Object *_win_create(Evas_Object *parent, int w, int h, Eina_Bool visible)
54{
55 Evas_Object *win;
56
57 win = efl_add(EFL_UI_WIN_CLASS, NULL,
58 efl_text_set(efl_added, "Focus Test1"),
59 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
60 efl_gfx_size_set(win, w, h);
61 efl_gfx_visible_set(win, visible);
62
63 return win;
64}
65
37START_TEST(focus_next_test1) 66START_TEST(focus_next_test1)
38{ 67{
39 Evas_Object *win, *btn[2]; 68 Evas_Object *win, *btn[2];
@@ -42,13 +71,8 @@ START_TEST(focus_next_test1)
42 elm_init(1, NULL); 71 elm_init(1, NULL);
43 72
44 // creating window 73 // creating window
45 win = efl_add(EFL_UI_WIN_CLASS, NULL, 74 win = _win_create(NULL, 500, 500, EINA_TRUE);
46 efl_text_set(efl_added, "Focus Test1"), 75 evas_object_smart_callback_add(win, "focused", _win_focused_cb, btn);
47 efl_ui_win_autodel_set(efl_added, EINA_TRUE));
48
49 evas_object_smart_callback_add(win, "focused", __focused_cb, btn);
50 efl_gfx_size_set(win, 500, 500);
51 efl_gfx_visible_set(win, 1);
52 76
53 // creating buttons 77 // creating buttons
54 ////////////////////////////////////////// 78 //////////////////////////////////////////