2 #include <Elementary.h>
5 // For checking the result of the positive test case.
6 #define TET_CHECK_PASS(x1, y...) \
8 Elm_Multibuttonentry_Item *err = y; \
11 tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
12 tet_result(TET_FAIL); \
17 // For checking the result of the negative test case.
18 #define TET_CHECK_FAIL(x1, y...) \
20 Elm_Multibuttonentry_Item *err = y; \
23 tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
24 tet_result(TET_FAIL); \
30 Evas_Object *main_win;
32 static void startup(void);
33 static void cleanup(void);
35 void (*tet_startup)(void) = startup;
36 void (*tet_cleanup)(void) = cleanup;
38 static void utc_UIFW_elm_multibuttonentry_item_selected_get_func_01(void);
39 static void utc_UIFW_elm_multibuttonentry_item_selected_get_func_02(void);
42 POSITIVE_TC_IDX = 0x01,
46 struct tet_testlist tet_testlist[] = {
47 { utc_UIFW_elm_multibuttonentry_item_selected_get_func_01, POSITIVE_TC_IDX },
48 { utc_UIFW_elm_multibuttonentry_item_selected_get_func_02, NEGATIVE_TC_IDX },
52 // Declare the global variables
53 Evas_Object *main_win, *main_bg;
54 Evas_Object *test_win, *test_bg;
55 Evas_Object *test_eo = NULL;
56 // Declare internal functions
57 void _elm_precondition(void);
58 static void _win_del(void *data, Evas_Object *obj, void *event_info);
62 static void _win_del(void *data, Evas_Object *obj, void *event_info)
68 void _elm_precondition(void)
72 main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
73 elm_win_title_set(main_win, "Elementary Unit Test Suite");
74 evas_object_smart_callback_add(main_win, "delete,request", _win_del, NULL);
75 main_bg = elm_bg_add(main_win);
76 evas_object_size_hint_weight_set(main_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
77 elm_win_resize_object_add(main_win, main_bg);
78 evas_object_show(main_bg);
80 // set an initial window size
81 evas_object_resize(main_win, 320, 480);
83 evas_object_show(main_win);
88 // Start up function for each test purpose
92 tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
98 test_win = elm_win_add(NULL, "Multi Button Entry", ELM_WIN_BASIC);
99 elm_win_title_set(test_win, "Multi Button Entry");
100 elm_win_autodel_set(test_win, 1);
102 test_bg = elm_bg_add(test_win);
103 elm_win_resize_object_add(test_win, test_bg);
104 evas_object_size_hint_weight_set(test_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
105 evas_object_show(test_bg);
107 evas_object_resize(test_win, 480, 800);
108 evas_object_show(test_win);
110 tet_infoline("[[ TET_MSG ]]:: Completing startup");
113 // Clean up function for each test purpose
117 tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
119 // Clean up the used resources.
120 if ( NULL != main_win ) {
121 evas_object_del(main_win);
125 if ( NULL != main_bg ) {
126 evas_object_del(main_bg);
130 if ( NULL != test_win ) {
131 evas_object_del(test_win);
135 if ( NULL != test_bg ) {
136 evas_object_del(test_bg);
140 if ( NULL != test_eo ) {
141 evas_object_del(test_eo);
145 // clean up and shut down
148 tet_infoline("[[ TET_MSG ]]:: ========= TC COMPLETE ========== ");
153 * @brief Positive test case of elm_multibuttonentry_item_selected_get()
155 static void utc_UIFW_elm_multibuttonentry_item_selected_get_func_01(void)
157 Elm_Multibuttonentry_Item *added_item1 = NULL, *added_item2 = NULL, *selected_item = NULL;
159 test_eo = elm_multibuttonentry_add(test_win);
160 added_item1 = elm_multibuttonentry_item_add_end(test_eo, "item1", NULL);
161 added_item2 = elm_multibuttonentry_item_add_end(test_eo, "item2", NULL);
162 elm_multibuttonentry_item_selected_set(added_item1);
163 selected_item = elm_multibuttonentry_item_selected_get(test_eo);
164 if (selected_item != added_item1) {
165 tet_infoline("elm_multibuttonentry_item_selected_get() failed in positive test case");
166 tet_result(TET_FAIL);
170 tet_result(TET_PASS);
171 tet_infoline("[[ TET_MSG ]]::[ID]:TC_01, [TYPE]: Positive, [RESULT]:PASS, elm_multibuttonentry_item_selected_get().");
176 * @brief Negative test case of ug_init elm_multibuttonentry_item_selected_get()
178 static void utc_UIFW_elm_multibuttonentry_item_selected_get_func_02(void)
180 Elm_Multibuttonentry_Item *added_item1 = NULL, *added_item2 = NULL, *selected_item = NULL;
182 test_eo = elm_multibuttonentry_add(NULL);
183 added_item1 = elm_multibuttonentry_item_add_end(test_eo, "item1", NULL);
184 added_item2 = elm_multibuttonentry_item_add_end(test_eo, "item2", NULL);
185 selected_item = elm_multibuttonentry_item_selected_get(test_eo);
186 TET_CHECK_FAIL(NULL, selected_item);
188 tet_result(TET_PASS);
189 tet_infoline("[[ TET_MSG ]]::[ID]:TC_02, [TYPE]: Negative, [RESULT]:PASS, elm_multibuttonentry_item_selected_get().");