2 * Tested interface: AtkObject
4 * Tested AtkObject: EailRadio
6 * Description: Test whether accessible object is successfully registered
7 * in GObject type system and is visible in AtkObject tree.
9 * Test input: accessible object representing EailRadio
11 * Expected test result: test should return 0 (success)
14 #include <Elementary.h>
17 #include "eail_test_utils.h"
22 #define RADIO1 "Radio 1"
23 #define RADIO2 "Radio 2"
24 #define RADIO3 "Radio 3"
25 #define TEST_NAME "Test Name"
30 static void _init_radio(Evas_Object *win);
32 INIT_TEST("EailRadioButton")
35 elm_main(int argc, char **argv)
39 win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
42 evas_object_show(win);
51 _init_radio(Evas_Object *win)
53 Evas_Object *bg, *radio, *group, *bx, *ic;
55 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
56 elm_win_autodel_set(win, EINA_TRUE);
59 elm_win_resize_object_add(win, bg);
62 bx = elm_box_add(win);
63 elm_box_horizontal_set(bx, EINA_TRUE);
64 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
65 elm_win_resize_object_add(win, bx);
68 group = radio = elm_radio_add(win);
69 elm_object_text_set(radio, RADIO1);
70 elm_radio_state_value_set(radio, 1);
71 elm_radio_value_pointer_set(radio, &val);
72 ic = elm_icon_add(win);
73 elm_icon_standard_set(ic, "home");
74 elm_object_part_content_set(radio, "icon", ic);
75 elm_box_pack_end(bx, radio);
76 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
77 evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
78 evas_object_show(radio);
80 radio = elm_radio_add(win);
81 elm_object_text_set(radio, RADIO2);
82 elm_radio_state_value_set(radio, 2);
83 elm_radio_value_pointer_set(radio, &val);
84 elm_radio_group_add(radio, group);
85 ic = elm_icon_add(win);
86 elm_icon_standard_set(ic, "file");
87 elm_object_part_content_set(radio, "icon", ic);
88 elm_box_pack_end(bx, radio);
89 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
90 evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
91 evas_object_show(radio);
93 radio = elm_radio_add(win);
94 elm_object_text_set(radio, RADIO3);
95 elm_radio_state_value_set(radio, 3);
96 elm_radio_value_pointer_set(radio, &val);
97 elm_radio_group_add(radio, group);
98 elm_box_pack_end(bx, radio);
99 evas_object_size_hint_weight_set(radio, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
100 evas_object_size_hint_align_set(radio, EVAS_HINT_FILL, EVAS_HINT_FILL);
101 evas_object_show(radio);
103 elm_radio_value_set(radio, RADIO2_SEL);
107 _do_test(AtkObject *obj)
109 AtkStateSet *state_set = atk_object_ref_state_set(obj);
112 g_assert(ATK_IS_OBJECT(obj));
113 g_assert(atk_object_get_role(obj) == ATK_ROLE_RADIO_BUTTON);
115 atk_object_set_description(obj, "test");
116 g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
118 name = atk_object_get_name(obj);
120 if (!strcmp(name, RADIO1))
122 state_set = atk_object_ref_state_set(obj);
123 g_assert(!atk_state_set_contains_state(state_set, ATK_STATE_CHECKED));
124 g_object_unref(state_set);
127 atk_object_set_name(obj, TEST_NAME);
128 g_assert_cmpstr(atk_object_get_name(obj), ==, TEST_NAME);
130 else if (!strcmp(name, RADIO2))
132 state_set = atk_object_ref_state_set(obj);
133 g_assert(atk_state_set_contains_state(state_set, ATK_STATE_CHECKED));
134 g_object_unref(state_set);
136 g_assert(name_test_passed == 2);
138 atk_object_set_name(obj, TEST_NAME);
139 g_assert_cmpstr(atk_object_get_name(obj), ==, TEST_NAME);
141 else if (!strcmp(name, RADIO3))
143 state_set = atk_object_ref_state_set(obj);
144 g_assert(!atk_state_set_contains_state(state_set, ATK_STATE_CHECKED));
145 g_object_unref(state_set);
147 g_assert(name_test_passed == 3);
149 atk_object_set_name(obj, TEST_NAME);
150 g_assert_cmpstr(atk_object_get_name(obj), ==, TEST_NAME);
157 eailu_test_code_called = 1;