2 #include <Elementary.h>
5 // For checking the result of the positive test case.
6 #define TET_CHECK_PASS(x1, y...) \
10 tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
11 tet_result(TET_FAIL); \
16 // For checking the result of the negative test case.
17 #define TET_CHECK_FAIL(x1, y...) \
21 tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
22 tet_result(TET_FAIL); \
27 Evas_Object *main_win, *main_bg;
28 Evas_Object *test_win, *test_bg;
29 Evas_Object *test_eo = NULL;
30 Elm_Gengrid_Item_Class gic;
31 Elm_Gengrid_Item *item;
33 void _elm_precondition(void);
34 static void _win_del(void *data, Evas_Object *obj, void *event_info);
36 static void _win_del(void *data, Evas_Object *obj, void *event_info)
41 void _elm_precondition(void)
45 main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
46 elm_win_title_set(main_win, "Elementary Unit Test Suite");
47 evas_object_smart_callback_add(main_win, "delete,request", _win_del, NULL);
48 main_bg = elm_bg_add(main_win);
49 evas_object_size_hint_weight_set(main_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
51 evas_object_resize(main_win, 320, 480);
52 evas_object_show(main_win);
55 static void startup(void);
56 static void cleanup(void);
58 void (*tet_startup)(void) = startup;
59 void (*tet_cleanup)(void) = cleanup;
61 static void utc_UIFW_elm_gengrid_item_pos_get_func_01(void);
62 static void utc_UIFW_elm_gengrid_item_pos_get_func_02(void);
65 POSITIVE_TC_IDX = 0x01,
69 struct tet_testlist tet_testlist[] = {
70 { utc_UIFW_elm_gengrid_item_pos_get_func_01, POSITIVE_TC_IDX },
71 { utc_UIFW_elm_gengrid_item_pos_get_func_02, NEGATIVE_TC_IDX },
75 static Evas_Object * _icon_get(const void *data, Evas_Object *obj, const char *part)
77 if (!strcmp(part, "elm.swallow.icon"))
79 Evas_Object *icon = elm_icon_add(obj);
80 elm_icon_file_set(icon, "/usr/share/beat_winset_test/icon/grid_image/1_raw.jpg", NULL);
81 evas_object_size_hint_aspect_set(icon, EVAS_ASPECT_CONTROL_VERTICAL, 1, 1);
82 evas_object_show(icon);
89 static void startup(void)
91 tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
95 test_win = elm_win_add(NULL, "Page Control", ELM_WIN_BASIC);
96 elm_win_title_set(test_win, "Page Control");
97 elm_win_autodel_set(test_win, 1);
99 test_bg = elm_bg_add(test_win);
100 elm_win_resize_object_add(test_win, test_bg);
101 evas_object_size_hint_weight_set(test_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
102 evas_object_show(test_bg);
104 evas_object_resize(test_win, 480, 800);
105 evas_object_show(test_win);
107 test_eo = elm_gengrid_add(test_win);
108 elm_gengrid_item_size_set(test_eo, 120, 130);
109 elm_gengrid_align_set(test_eo, 0.5, 0.0);
110 elm_gengrid_horizontal_set(test_eo, EINA_FALSE);
111 elm_gengrid_bounce_set(test_eo, EINA_FALSE, EINA_TRUE);
112 elm_gengrid_multi_select_set(test_eo, EINA_TRUE);
114 gic.item_style = "default_grid";
115 gic.func.label_get = NULL;
116 gic.func.icon_get = _icon_get;
118 item = elm_gengrid_item_append(test_eo, &gic, test_bg, NULL, NULL);
120 tet_infoline("[[ TET_MSG ]]:: Completing startup");
123 static void cleanup(void)
125 if ( NULL != main_win ) {
129 if ( NULL != main_bg ) {
133 if ( NULL != test_win ) {
137 if ( NULL != test_bg ) {
141 if ( NULL != test_eo ) {
147 tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
150 static void utc_UIFW_elm_gengrid_item_pos_get_func_01(void)
155 elm_gengrid_item_pos_get(item, &x, &y);
157 TET_CHECK_PASS(-1, x);
158 TET_CHECK_PASS(-1, y);
160 tet_result(TET_PASS);
161 tet_infoline("[[ TET_MSG ]]::[ID]:TC_01, [TYPE]: Positive, [RESULT]:PASS, elm_gengrid_item_pos_get");
164 static void utc_UIFW_elm_gengrid_item_pos_get_func_02(void)
169 elm_gengrid_item_pos_get(NULL, &x, &y);
171 TET_CHECK_FAIL(-1, x);
172 TET_CHECK_FAIL(-1, y);
174 tet_result(TET_PASS);
175 tet_infoline("[[ TET_MSG ]]::[ID]:TC_02, [TYPE]: Negative, [RESULT]:PASS, elm_gengrid_item_pos_get");