Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_notify_tc1.c
1 /*
2  * Tested interface: AtkObject
3  *
4  * Tested AtkObject: EailNotify
5  *
6  * Description: Test AtkObject interface
7  *
8  * Test input: accessible object representing EailNotify
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_CHECK "EailNotify"
19 #define EAIL_TEST_LABEL_TITTLE "test label"
20
21 INIT_TEST("EailNotify")
22
23 static void
24 _do_test(AtkObject *obj)
25 {
26    int child_amount = 0;
27    AtkObject *nested_obj;
28
29    _printf("Testing notify instance....\n");
30    atk_object_set_description(obj, "test");
31    g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
32
33    atk_object_set_name(obj, "test name");
34    g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
35
36    child_amount = atk_object_get_n_accessible_children(obj);
37    /* we have to check if there is nested label in Notify */
38    g_assert(1 == child_amount);
39
40    /* test if notify child  is label-type*/
41    nested_obj = atk_object_ref_accessible_child(obj, 0);
42    g_assert(eailu_is_object_with_type(nested_obj, "EailLabel"));
43    g_assert(eailu_is_object_with_name(nested_obj, EAIL_TEST_LABEL_TITTLE));
44
45    /* For notify widget focusing doesn't work */
46    eailu_test_atk_focus(obj, FALSE);
47
48    _printf("Tests passed successfully\n");
49
50    eailu_test_code_called = 1;
51 }
52
53 static void
54 _init_notify(Evas_Object *win)
55 {
56    Evas_Object *notify, *box, *label;
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    label = elm_label_add(win);
64    elm_object_text_set(label, EAIL_TEST_LABEL_TITTLE);
65    evas_object_show(label);
66
67    notify = elm_notify_add(win);
68    elm_notify_allow_events_set(notify, EINA_FALSE);
69    elm_object_content_set(notify, label);
70    evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
71    evas_object_show(notify);
72    elm_box_pack_end(box, notify);
73 }
74
75 EAPI_MAIN int
76 elm_main(int argc, char **argv)
77 {
78    Evas_Object *win;
79
80    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
81    _init_notify(win);
82
83    evas_object_show(win);
84
85    elm_run();
86    elm_shutdown();
87
88    /* exit code */
89    return 0;
90 }
91 ELM_MAIN()