Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_win_tc2.c
1 /*
2  * Tested interface: AtkAction
3  *
4  * Tested AtkObject: EailWindow
5  *
6  * Description: Test "moved" signal emit by EailWindow
7  *
8  * Test input: accessible object representing EailWindow
9  *
10  * Expected test result: test should return 0 (success)
11  */
12
13 #include <Elementary.h>
14 #include <atk/atk.h>
15
16 #include "eail_test_utils.h"
17
18 INIT_TEST("EailWindow")
19
20 static int move_test_passed = 0;
21
22 static Evas_Object *global_win = NULL;
23 static Ecore_Timer *init_delay = NULL, *test_delay = NULL;
24
25 void move_callback()
26 {
27    move_test_passed = 1;
28 }
29
30 static void
31 _setup_signals(AtkObject *obj)
32 {
33    g_signal_connect(G_OBJECT(obj), "move",
34                     G_CALLBACK(move_callback), NULL);
35 }
36
37 static Eina_Bool
38 delayed_test_body(void *data)
39 {
40    _on_focus_in(NULL, NULL, NULL);
41
42    return EINA_FALSE;
43 }
44
45 static Eina_Bool
46 delayed_test_init(void *data)
47 {
48    AtkObject *root = atk_get_root();
49    AtkObject *atk_window = atk_object_ref_accessible_child(root, 0);
50
51    g_assert(atk_window);
52    _setup_signals(atk_window);
53
54    elm_win_center(global_win, EINA_TRUE, EINA_TRUE);
55
56    evas_object_move(global_win, 1, 1);
57
58    test_delay = ecore_timer_add(2, delayed_test_body, NULL);
59
60    return EINA_FALSE;
61 }
62
63 static void
64 _do_test(AtkObject *obj)
65 {
66    g_assert(move_test_passed);
67    eailu_test_code_called = 1;
68 }
69
70 EAPI_MAIN int
71 elm_main(int argc, char **argv)
72 {
73    Evas_Object *win;
74
75    win = eailu_create_test_window_with_glib_init(NULL, NULL);
76
77    init_delay = ecore_timer_add(1, delayed_test_init, NULL);
78    global_win = win;
79    evas_object_show(win);
80
81    elm_run();
82    elm_shutdown();
83
84    /* exit code */
85    return 0;
86 }
87 ELM_MAIN()