2 * Tested interface: AtkObject
4 * Tested AtkObject: EailDatetime
6 * Description: Test AtkObject interface
8 * Test input: accessible object representing EailDatetime
10 * Expected test result: test should return 0 (success)
13 #include <Elementary.h>
16 #include "eail_test_utils.h"
18 static time_t time_min, time_max, time_current;
20 INIT_TEST("EailDatetime")
23 _changed_cb(void *data, Evas_Object *obj, void *event_info)
25 _printf("action: changed\n");
29 _printf_datetime_int(time_t atime, const char *str)
33 localtime_r(&atime, &tmp);
35 _printf("[%04d-%02d-%02d] [%02d:%02d:%02d] (%s)\n",
36 tmp.tm_year + 1900, tmp.tm_mon + 1, tmp.tm_mday,
37 tmp.tm_hour, tmp.tm_min, tmp.tm_sec, str);
41 _init_datetime(Evas_Object *win)
43 Evas_Object *bg, *bx, *dt;
47 elm_win_resize_object_add(win, bg);
48 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
51 bx = elm_box_add(win);
52 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
53 elm_win_resize_object_add(win, bx);
54 elm_box_horizontal_set(bx, EINA_FALSE);
57 dt = elm_datetime_add(bx);
58 evas_object_size_hint_weight_set(dt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
59 evas_object_size_hint_align_set(dt, EVAS_HINT_FILL, 0.5);
60 evas_object_smart_callback_add(dt, "changed", _changed_cb, NULL);
62 time_min = time(NULL) - 3600;
63 localtime_r(&time_min, &tmp);
64 elm_datetime_value_min_set(dt, &tmp);
65 _printf_datetime_int(time_min, "time_min");
67 time_max = time(NULL) + 3600;
68 localtime_r(&time_max, &tmp);
69 elm_datetime_value_max_set(dt, &tmp);
70 _printf_datetime_int(time_max, "time_max");
72 time_current = time(NULL);
73 localtime_r(&time_current, &tmp);
74 elm_datetime_value_set(dt, &tmp);
75 _printf_datetime_int(time_current, "time_current");
77 elm_box_pack_end(bx, dt);
82 _do_test(AtkObject *obj)
84 g_assert(ATK_IS_OBJECT(obj));
85 g_assert(atk_object_get_role(obj) == ATK_ROLE_DATE_EDITOR);
87 atk_object_set_description(obj, "test");
88 g_assert_cmpstr(atk_object_get_description(obj), ==, "test");
90 atk_object_set_name(obj, "test name");
91 g_assert_cmpstr(atk_object_get_name(obj), ==, "test name");
93 eailu_test_code_called = 1;
97 elm_main(int argc, char **argv)
101 win = eailu_create_test_window_with_glib_init(NULL, _on_focus_in);
105 evas_object_show(win);