2 * Tested interface: AtkValue
4 * Tested AtkObject: EailColorselector
6 * Description: Test AtkValue interface
8 * Test input: accessible object representing EailColorselector
10 * Expected test result: test should return 0 (success)
13 #include <Elementary.h>
16 #include "eail_test_utils.h"
18 INIT_TEST("EailColorselector")
21 _init_colorselector(Evas_Object *obj)
23 Evas_Object *bx = NULL;
24 Evas_Object *cs = NULL;
25 Evas_Object *fr = NULL;
27 bx = elm_box_add(obj);
28 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
29 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
30 elm_win_resize_object_add(obj, bx);
33 fr = elm_frame_add(obj);
34 evas_object_size_hint_weight_set(fr, 1.0, 0.5);
35 evas_object_size_hint_align_set(fr, EVAS_HINT_FILL, EVAS_HINT_FILL);
36 elm_object_text_set(fr, "Color Selector");
37 elm_box_pack_end(bx, fr);
40 cs = elm_colorselector_add(obj);
41 elm_colorselector_palette_name_set(cs, "painting");
42 evas_object_size_hint_weight_set(cs, EVAS_HINT_EXPAND, 0.0);
43 evas_object_size_hint_align_set(cs, EVAS_HINT_FILL, 0.0);
44 elm_colorselector_color_set(cs, 100, 100, 100, 133);
46 elm_object_content_set(fr, cs);
48 evas_object_resize(obj, 320, 480);
52 _get_rgba(const GValue *color, int *r, int *g, int *b, int *a)
54 int col = g_value_get_int(color);
55 *a = (0xFF000000 & (guint)col) >> 24;
56 *r = (0x00FF0000 & col) >> 16;
57 *g = (0x0000FF00 & col) >> 8;
58 *b = 0x000000FF & col;
62 _set_rgba(GValue *color, int r, int g, int b, int a)
64 int col = (a << 24) | (r << 16) | (g << 8) | b;
65 g_value_set_int(color, col);
69 _do_test(AtkObject *obj)
75 GValue value = G_VALUE_INIT;
77 g_assert(ATK_IS_VALUE(obj));
79 atk_value_get_current_value(ATK_VALUE(obj), &value);
80 _get_rgba(&value, &r, &g, &b, &a);
81 g_assert(r == 100 && g == 100 && b == 100 && a == 133);
83 atk_value_get_maximum_value(ATK_VALUE(obj), &value);
84 _get_rgba(&value, &r, &g, &b, &a);
85 g_assert(r == 255 && g == 255 && b == 255 && a == 255);
87 _set_rgba(&value, 77, 88, 10, 180);
88 g_assert(atk_value_set_current_value(ATK_VALUE(obj), &value));
89 atk_value_get_current_value(ATK_VALUE(obj), &value);
90 _get_rgba(&value, &r, &g, &b, &a);
91 g_assert(r == 77 && g == 88 && b == 10 && a == 180);
93 atk_value_get_minimum_value(ATK_VALUE(obj), &value);
94 _get_rgba(&value, &r, &g, &b, &a);
95 g_assert(r == 0 && g == 0 && b == 0 && a == 0);
97 atk_value_get_minimum_increment(ATK_VALUE(obj), &value);
98 _get_rgba(&value, &r, &g, &b, &a);
99 g_assert(r == 1 && g == 1 && b == 1 && a == 1);
101 eailu_test_atk_focus(obj, TRUE);
103 eailu_test_code_called = 1;
107 elm_main(int argc, char **argv)
109 Evas_Object *win = NULL;
111 win = eailu_create_test_window_with_glib_init(NULL, _on_focus_in);
112 _init_colorselector(win);
113 evas_object_show(win);