summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWooHyun Jung <wh0705.jung@samsung.com>2017-07-31 20:26:18 +0900
committerWooHyun Jung <wh0705.jung@samsung.com>2017-07-31 20:26:18 +0900
commit3502c3658e87fdb861c5724393c77db4d96f948a (patch)
tree45d7df28f58233ae2edcb24da54f98b27a7cc0dc
parent46c7350276857fc9cd205d0093a564b518f78186 (diff)
downloadefl-3502c3658e87fdb861c5724393c77db4d96f948a.tar.gz
tests: add elm_test_focus_legacy
In this test, you can add any test case which is based on legacy focus APIs with elementary widgets.
-rw-r--r--src/Makefile_Elementary.am3
-rw-r--r--src/tests/elementary/elm_suite.c1
-rw-r--r--src/tests/elementary/elm_suite.h1
-rw-r--r--src/tests/elementary/elm_test_focus.c85
-rw-r--r--src/tests/elementary/elm_test_focus_legacy.c88
5 files changed, 92 insertions, 86 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 993e13032e..625c353e5d 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -1353,7 +1353,8 @@ tests_elementary_elm_suite_SOURCES = \
tests/elementary/elm_test_focus_common.c \
tests/elementary/elm_test_focus_common.h \
tests/elementary/elm_test_focus.c \
- tests/elementary/elm_test_focus_sub.c
+ tests/elementary/elm_test_focus_sub.c \
+ tests/elementary/elm_test_focus_legacy.c
tests_elementary_elm_suite_CPPFLAGS = \
-DTESTS_BUILD_DIR=\"${top_builddir}/src/tests/elementary\" \
diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c
index 197a9d08db..2092b3e0d4 100644
--- a/src/tests/elementary/elm_suite.c
+++ b/src/tests/elementary/elm_suite.c
@@ -85,6 +85,7 @@ static const Efl_Test_Case etc[] = {
{ "elm_code_widget_undo", elm_code_test_widget_undo },
{ "elm_focus", elm_test_focus},
{ "elm_focus_sub", elm_test_focus_sub},
+ { "elm_focus_legacy", elm_test_focus_legacy},
{ NULL, NULL }
};
diff --git a/src/tests/elementary/elm_suite.h b/src/tests/elementary/elm_suite.h
index 2cae845284..635093a4d8 100644
--- a/src/tests/elementary/elm_suite.h
+++ b/src/tests/elementary/elm_suite.h
@@ -71,6 +71,7 @@ void elm_test_spinner(TCase *tc);
void elm_test_plug(TCase *tc);
void elm_test_focus(TCase *tc);
void elm_test_focus_sub(TCase *tc);
+void elm_test_focus_legacy(TCase *tc);
void elm_code_file_test_load(TCase *tc);
void elm_code_file_test_memory(TCase *tc);
diff --git a/src/tests/elementary/elm_test_focus.c b/src/tests/elementary/elm_test_focus.c
index f120c48b45..3908b40ed2 100644
--- a/src/tests/elementary/elm_test_focus.c
+++ b/src/tests/elementary/elm_test_focus.c
@@ -331,90 +331,6 @@ START_TEST(order_check)
elm_shutdown();
}
END_TEST
-
-// printf("[%s:%d] %p %p --- %p --- %p ----- JWH : %d\n", __func__, __LINE__,
-// btn[0], btn[1], obj, elm_object_focused_object_get(obj),
-// elm_object_focus_get(btn[0]));
-// fflush(stdout);
-
-static void __focused_cb(void *data, Evas_Object *obj, void *event_info)
-{
- Evas_Object **btn = (Evas_Object **)data;
- int i;
-
- elm_object_focus_set(btn[0], EINA_TRUE);
- ck_assert_int_eq(elm_object_focus_get(btn[0]), 1);
-
- elm_object_focus_next(obj, ELM_FOCUS_RIGHT);
- ck_assert(elm_object_focused_object_get(obj) == btn[1]);
-
- elm_object_focus_next(obj, ELM_FOCUS_DOWN);
- ck_assert(elm_object_focused_object_get(obj) == btn[2]);
-
- elm_object_focus_next(obj, ELM_FOCUS_DOWN);
- ck_assert(elm_object_focused_object_get(obj) == btn[4]);
-
- elm_object_focus_next(obj, ELM_FOCUS_RIGHT);
- ck_assert(elm_object_focused_object_get(obj) == btn[3]);
-
- elm_object_focus_next(obj, ELM_FOCUS_UP);
- ck_assert(elm_object_focused_object_get(obj) == btn[1]);
-
- elm_object_focus_next(obj, ELM_FOCUS_LEFT);
- ck_assert(elm_object_focused_object_get(obj) == btn[0]);
-
- elm_exit();
-}
-
-
-START_TEST(focus_next_test1)
-{
- Evas_Object *win, *btn[2];
- int i;
-
- elm_init(1, NULL);
-
- // creating window
- win = efl_add(EFL_UI_WIN_CLASS, NULL,
- efl_text_set(efl_added, "Focus Test1"),
- efl_ui_win_autodel_set(efl_added, EINA_TRUE));
-
- evas_object_smart_callback_add(win, "focused", __focused_cb, btn);
- efl_gfx_size_set(win, 500, 500);
- efl_gfx_visible_set(win, 1);
-
- // creating buttons
- //////////////////////////////////////////
- // //
- // btn1 btn2 //
- // //
- // //
- // btn3 //
- // //
- // btn4 //
- // //
- // btn5 //
- //////////////////////////////////////////
- {
- char *btn_str[5] = {"Button1", "Button2", "Button3", "Button4", "Button5"};
- int btn_loc[5][2] = {{50, 50}, {300, 50}, {100, 250}, {350, 350}, {150, 450}};
- int btn_w = 100, btn_h = 50;
-
- for (i = 0; i < 5; i++)
- {
- btn[i] = efl_add(EFL_UI_BUTTON_CLASS, win,
- efl_text_set(efl_added, btn_str[i]),
- efl_gfx_geometry_set(efl_added,
- btn_loc[i][0], btn_loc[i][1],
- btn_w, btn_h),
- efl_gfx_visible_set(efl_added, 1));
- }
- }
-
- elm_run();
- elm_shutdown();
-}
-END_TEST
void elm_test_focus(TCase *tc)
{
tcase_add_test(tc, focus_register_twice);
@@ -427,5 +343,4 @@ void elm_test_focus(TCase *tc)
tcase_add_test(tc, redirect_param);
tcase_add_test(tc, invalid_args_check);
tcase_add_test(tc, order_check);
- tcase_add_test(tc, focus_next_test1);
}
diff --git a/src/tests/elementary/elm_test_focus_legacy.c b/src/tests/elementary/elm_test_focus_legacy.c
new file mode 100644
index 0000000000..de63c0ebb5
--- /dev/null
+++ b/src/tests/elementary/elm_test_focus_legacy.c
@@ -0,0 +1,88 @@
+#include "elm_test_focus_common.h"
+
+// printf("[%s:%d] %p %p --- %p --- %p ----- JWH : %d\n", __func__, __LINE__,
+// btn[0], btn[1], obj, elm_object_focused_object_get(obj),
+// elm_object_focus_get(btn[0]));
+// fflush(stdout);
+
+static void __focused_cb(void *data, Evas_Object *obj, void *event_info)
+{
+ Evas_Object **btn = (Evas_Object **)data;
+ int i;
+
+ elm_object_focus_set(btn[0], EINA_TRUE);
+ ck_assert_int_eq(elm_object_focus_get(btn[0]), 1);
+
+ elm_object_focus_next(obj, ELM_FOCUS_RIGHT);
+ ck_assert(elm_object_focused_object_get(obj) == btn[1]);
+
+ elm_object_focus_next(obj, ELM_FOCUS_DOWN);
+ ck_assert(elm_object_focused_object_get(obj) == btn[2]);
+
+ elm_object_focus_next(obj, ELM_FOCUS_DOWN);
+ ck_assert(elm_object_focused_object_get(obj) == btn[4]);
+
+ elm_object_focus_next(obj, ELM_FOCUS_RIGHT);
+ ck_assert(elm_object_focused_object_get(obj) == btn[3]);
+
+ elm_object_focus_next(obj, ELM_FOCUS_UP);
+ ck_assert(elm_object_focused_object_get(obj) == btn[1]);
+
+ elm_object_focus_next(obj, ELM_FOCUS_LEFT);
+ ck_assert(elm_object_focused_object_get(obj) == btn[1]);
+
+ elm_exit();
+}
+
+START_TEST(focus_next_test1)
+{
+ Evas_Object *win, *btn[2];
+ int i;
+
+ elm_init(1, NULL);
+
+ // creating window
+ win = efl_add(EFL_UI_WIN_CLASS, NULL,
+ efl_text_set(efl_added, "Focus Test1"),
+ efl_ui_win_autodel_set(efl_added, EINA_TRUE));
+
+ evas_object_smart_callback_add(win, "focused", __focused_cb, btn);
+ efl_gfx_size_set(win, 500, 500);
+ efl_gfx_visible_set(win, 1);
+
+ // creating buttons
+ //////////////////////////////////////////
+ // //
+ // btn1 btn2 //
+ // //
+ // //
+ // btn3 //
+ // //
+ // btn4 //
+ // //
+ // btn5 //
+ //////////////////////////////////////////
+ {
+ char *btn_str[5] = {"Button1", "Button2", "Button3", "Button4", "Button5"};
+ int btn_loc[5][2] = {{50, 50}, {300, 50}, {100, 250}, {350, 350}, {150, 450}};
+ int btn_w = 100, btn_h = 50;
+
+ for (i = 0; i < 5; i++)
+ {
+ btn[i] = efl_add(EFL_UI_BUTTON_CLASS, win,
+ efl_text_set(efl_added, btn_str[i]),
+ efl_gfx_geometry_set(efl_added,
+ btn_loc[i][0], btn_loc[i][1],
+ btn_w, btn_h),
+ efl_gfx_visible_set(efl_added, 1));
+ }
+ }
+
+ elm_run();
+ elm_shutdown();
+}
+END_TEST
+void elm_test_focus_legacy(TCase *tc)
+{
+ tcase_add_test(tc, focus_next_test1);
+}