Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_dayselector_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailDayselector
5  *
6  * Description: Test AtkObject interface
7  *
8  * Test input: accessible object representing EailDayselector
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 #define EAIL_TYPE_FOR_DAY_SELECTOR "EailDayselector"
19 #define EAIL_TYPE_FOR_CHECK "EailCheck"
20
21 INIT_TEST("EailDayselector")
22
23 static void
24 _do_test(AtkObject *obj)
25 {
26    int child_count = 0;
27    int i;
28
29    atk_object_set_description(obj, "test");
30    g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
31
32    atk_object_set_name(obj, "test name");
33    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
34
35    child_count =  atk_object_get_n_accessible_children(obj);
36    g_assert(child_count == 7);
37
38    /* all fields have to be CHECK type*/
39    for (i = 0; i < child_count; i++)
40     {
41        AtkObject *child = atk_object_ref_accessible_child(obj, i);
42        g_assert(ATK_IS_OBJECT(child));
43        g_assert(eailu_is_object_with_type(child, EAIL_TYPE_FOR_CHECK));
44
45        g_object_unref(child);
46      }
47
48    eailu_test_atk_focus(obj, TRUE);
49
50    eailu_test_code_called = 1;
51 }
52
53 static void
54 _init_dayselector(Evas_Object *win)
55 {
56    Evas_Object *dayselector, *box;
57
58    box = elm_box_add(win);
59    evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
60    elm_win_resize_object_add(win, box);
61    evas_object_show(box);
62
63    dayselector = elm_dayselector_add(win);
64    evas_object_size_hint_weight_set(dayselector, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65    evas_object_size_hint_align_set(dayselector, EVAS_HINT_FILL, 0.5);
66
67    elm_box_pack_end(box, dayselector);
68    evas_object_show(dayselector);
69 }
70
71 EAPI_MAIN int
72 elm_main(int argc, char **argv)
73 {
74    Evas_Object *win;
75
76    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
77    _init_dayselector(win);
78
79    evas_object_show(win);
80    elm_run();
81    elm_shutdown();
82
83    /* exit code */
84    return 0;
85 }
86 ELM_MAIN()