Merge "custom eail widget implementation" into tizen
[platform/core/uifw/eail.git] / tests / eail_bubble_tc2.c
1 /*
2  * Tested interface: AtkAction
3  *
4  * Tested AtkObject: EailBubble
5  *
6  * Description: Test AtkAction interface
7  *
8  * Test input: accessible object representing EailBubble
9  *
10  * Expected test result: test should return 0 (success)
11  */
12
13 #include <Elementary.h>
14 #include <atk/atk.h>
15
16 #define DEBUG 1
17
18 #include "eail_test_utils.h"
19
20 #define ACTIONS_NUMBER 1
21
22 INIT_TEST("EailBubble")
23
24 static void
25 _bubble_clicked(void *data, Evas_Object *obj, void *event_info)
26 {
27    static unsigned char counter = 0;
28
29    if (3 < counter)
30      counter = 0;
31
32    elm_bubble_pos_set(obj, counter);
33
34    counter++;
35 }
36
37 static void
38 _init_bubble(Evas_Object *win)
39 {
40    Evas_Object *bg, *label, *icon, *bubble;
41
42    bg = elm_bg_add(win);
43    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
44    elm_win_resize_object_add(win, bg);
45    evas_object_show(bg);
46
47    label = elm_label_add(win);
48    elm_object_text_set(label, "This is the CONTENT of our bubble");
49    evas_object_show(label);
50
51    icon = elm_icon_add(win);
52    elm_icon_order_lookup_set(icon, ELM_ICON_LOOKUP_THEME_FDO);
53    elm_icon_standard_set(icon, "home");
54    evas_object_show(icon);
55
56    bubble = elm_bubble_add(win);
57    elm_object_part_content_set(bubble, "icon", icon);
58    elm_object_part_text_set(bubble, "info", "INFO");
59    elm_object_text_set(bubble, "LABEL");
60    elm_object_content_set(bubble, label);
61    evas_object_smart_callback_add(bubble, "clicked", _bubble_clicked, NULL);
62    evas_object_resize(bubble, 300, 100);
63    evas_object_show(bubble);
64 }
65
66 static void
67 _do_test(AtkObject *obj)
68 {
69    g_assert(ATK_IS_ACTION(obj));
70
71    g_assert(ACTIONS_NUMBER == atk_action_get_n_actions(ATK_ACTION(obj)));
72
73    eailu_test_action_activate(ATK_ACTION(obj), "click");
74
75    g_assert(-1 == (eailu_get_action_number(ATK_ACTION(obj), "typo")));
76
77    eailu_test_action_description_all(ATK_ACTION(obj));
78
79    eailu_test_code_called = 1;
80 }
81
82 EAPI_MAIN int
83 elm_main(int argc, char **argv)
84 {
85    Evas_Object *win;
86
87    win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
88    g_assert(win);
89    _init_bubble(win);
90    evas_object_show(win);
91    elm_run();
92    elm_shutdown();
93
94    return 0;
95 }
96 ELM_MAIN()