2 * Tested interface: AtkValue
4 * Tested AtkObject: EailDatetime
6 * Description: Test AtkValue interface
8 * Test input: accessible object representing EailDatetime
10 * Expected test result: test should return 0 (success)
13 #include <Elementary.h>
15 #include "eail_test_utils.h"
17 static time_t time_min, time_max, time_current;
19 INIT_TEST("EailDatetime")
22 _init_datetime(Evas_Object *win)
24 Evas_Object *bg, *bx, *dt;
28 elm_win_resize_object_add(win, bg);
29 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
32 bx = elm_box_add(win);
33 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
34 elm_win_resize_object_add(win, bx);
35 elm_box_horizontal_set(bx, EINA_FALSE);
38 dt = elm_datetime_add(bx);
39 evas_object_size_hint_weight_set(dt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
40 evas_object_size_hint_align_set(dt, EVAS_HINT_FILL, 0.5);
42 time_min = time(NULL) - 3600;
43 localtime_r(&time_min, &tmp);
44 elm_datetime_value_min_set(dt, &tmp);
46 time_max = time(NULL) + 3600;
47 localtime_r(&time_max, &tmp);
48 elm_datetime_value_max_set(dt, &tmp);
50 time_current = time(NULL);
51 localtime_r(&time_current, &tmp);
52 elm_datetime_value_set(dt, &tmp);
54 elm_box_pack_end(bx, dt);
59 _do_test(AtkObject *obj)
63 g_assert(ATK_IS_VALUE(obj));
65 GValue value = G_VALUE_INIT;
67 atk_value_get_minimum_value(ATK_VALUE(obj), &value);
68 g_assert(g_value_get_int(&value) == time_min);
70 atk_value_get_maximum_value(ATK_VALUE(obj), &value);
71 g_assert(g_value_get_int(&value) == time_max);
73 atk_value_get_current_value(ATK_VALUE(obj), &value);
74 g_assert(g_value_get_int(&value) == time_current);
76 atk_value_get_minimum_increment(ATK_VALUE(obj), &value);
77 g_assert(g_value_get_int(&value) == 1);
79 time_set = time_current + 60;
81 g_value_set_int(&value, time_set);
83 atk_value_get_current_value(ATK_VALUE(obj), &value);
84 g_assert(g_value_get_int(&value) != time_set);
86 eailu_test_code_called = 1;
90 elm_main(int argc, char **argv)
94 win = eailu_create_test_window_with_glib_init(_on_done, _on_focus_in);
97 evas_object_show(win);