2 * Tested interface: AtkAction
4 * Tested AtkObject: EailActionSlider
6 * Description: Test AtkAction interface
7 * Test input: accessible object representing EailActionSlider
9 * Expected test result: test should return 0 (success)
12 #include <Elementary.h>
14 #include "eail_test_utils.h"
16 INIT_TEST("EailActionSlider")
19 _init_action_slider(Evas_Object *win)
21 Evas_Object *bg, *bx, *as;
24 elm_win_resize_object_add(win, bg);
25 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, 0);
28 bx = elm_box_add(win);
29 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0);
30 elm_win_resize_object_add(win, bx);
33 as = elm_actionslider_add(win);
34 evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
35 evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
36 elm_object_part_text_set(as, "left", "left1");
37 elm_object_part_text_set(as, "center", "center1");
38 elm_object_part_text_set(as, "right", "right1");
39 elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_LEFT);
41 elm_box_pack_end(bx, as);
43 as = elm_actionslider_add(win);
44 evas_object_size_hint_weight_set(as, EVAS_HINT_EXPAND, 0);
45 evas_object_size_hint_align_set(as, EVAS_HINT_FILL, 0);
46 elm_object_part_text_set(as, "center", "center2");
47 elm_object_part_text_set(as, "right", "right2");
48 elm_actionslider_enabled_pos_set(as, ELM_ACTIONSLIDER_CENTER | ELM_ACTIONSLIDER_RIGHT);
49 elm_actionslider_indicator_pos_set(as, ELM_ACTIONSLIDER_RIGHT);
51 elm_box_pack_end(bx, as);
55 _do_test(AtkObject *obj)
57 guint minimum, maximum, current, minimum_increment;
58 Elm_Actionslider_Pos pos_test_set = ELM_ACTIONSLIDER_CENTER;
59 static int test_count, test_1_count, test_2_count;
63 g_assert(ATK_IS_VALUE(obj));
65 GValue value = G_VALUE_INIT;
66 g_value_init(&value, G_TYPE_UINT);
68 atk_value_get_minimum_value(ATK_VALUE(obj), &value);
69 minimum = g_value_get_uint(&value);
71 atk_value_get_maximum_value(ATK_VALUE(obj), &value);
72 maximum = g_value_get_uint(&value);
74 atk_value_get_current_value(ATK_VALUE(obj), &value);
75 current = g_value_get_uint(&value);
77 atk_value_get_minimum_increment(ATK_VALUE(obj), &value);
78 minimum_increment = g_value_get_uint(&value);
80 g_assert(ELM_ACTIONSLIDER_NONE == minimum);
81 g_assert(ELM_ACTIONSLIDER_NONE == minimum_increment);
83 if (ELM_ACTIONSLIDER_LEFT == current)
87 g_assert(ELM_ACTIONSLIDER_ALL == maximum);
89 g_value_set_uint(&value, ELM_ACTIONSLIDER_ALL);
90 g_assert(!atk_value_set_current_value(ATK_VALUE(obj), &value));
92 else if (ELM_ACTIONSLIDER_RIGHT == current)
96 g_assert((ELM_ACTIONSLIDER_RIGHT | ELM_ACTIONSLIDER_CENTER) == maximum);
98 g_value_set_uint(&value, ELM_ACTIONSLIDER_LEFT);
99 g_assert(!atk_value_set_current_value(ATK_VALUE(obj), &value));
103 _printf("initialized values are different from returned by ATK");
107 g_value_set_uint(&value, pos_test_set);
108 g_assert(atk_value_set_current_value(ATK_VALUE(obj), &value));
110 atk_value_get_current_value(ATK_VALUE(obj), &value);
111 current = g_value_get_uint(&value);
112 g_assert(pos_test_set == current);
114 g_assert((test_1_count + test_2_count) == test_count);
116 eailu_test_code_called = 1;
120 elm_main(int argc, char **argv)
124 win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
126 _init_action_slider(win);
127 evas_object_show(win);