Remove unnecessary files
[framework/uifw/elementary.git] / TC / elm_ts / multibuttonentry / utc_UIFW_elm_multibuttonentry_item_insert_after_func.c
1 #include <tet_api.h>
2 #include <Elementary.h>
3
4 // Definitions
5 // For checking the result of the positive test case.
6 #define TET_CHECK_PASS(x1, y...) \
7 { \
8         Elm_Object_Item *err = y; \
9         if (err == (x1)) \
10                 { \
11                         tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
12                         tet_result(TET_FAIL); \
13                         return; \
14                 } \
15 }
16
17 // For checking the result of the negative test case.
18 #define TET_CHECK_FAIL(x1, y...) \
19 { \
20         Elm_Object_Item *err = y; \
21         if (err != (x1)) \
22                 { \
23                         tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
24                         tet_result(TET_FAIL); \
25                         return; \
26                 } \
27 }
28
29
30 Evas_Object *main_win;
31
32 static void startup(void);
33 static void cleanup(void);
34
35 void (*tet_startup)(void) = startup;
36 void (*tet_cleanup)(void) = cleanup;
37
38 static void utc_UIFW_elm_multibuttonentry_item_insert_after_func_01(void);
39 static void utc_UIFW_elm_multibuttonentry_item_insert_after_func_02(void);
40
41 enum {
42         POSITIVE_TC_IDX = 0x01,
43         NEGATIVE_TC_IDX,
44 };
45
46 struct tet_testlist tet_testlist[] = {
47         { utc_UIFW_elm_multibuttonentry_item_insert_after_func_01, POSITIVE_TC_IDX },
48         { utc_UIFW_elm_multibuttonentry_item_insert_after_func_02, NEGATIVE_TC_IDX },
49         { NULL, 0 }
50 };
51
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);
59
60
61 // Delete main window
62 static void _win_del(void *data, Evas_Object *obj, void *event_info)
63 {
64         elm_exit();
65 }
66
67 // Do precondition.
68 void _elm_precondition(void)
69 {
70         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
71         elm_init(0, NULL);
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);
79
80         // set an initial window size
81         evas_object_resize(main_win, 320, 480);
82         // show the window
83         evas_object_show(main_win);
84 }
85
86 // Start up function for each test purpose
87 static void
88 startup()
89 {
90         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
91
92         // Elm precondition
93         _elm_precondition();
94
95         // Test precondition
96         test_win = elm_win_add(NULL, "Multi Button Entry", ELM_WIN_BASIC);
97         elm_win_title_set(test_win, "Multi Button Entry");
98         elm_win_autodel_set(test_win, 1);
99
100         test_bg = elm_bg_add(test_win);
101         elm_win_resize_object_add(test_win, test_bg);
102         evas_object_size_hint_weight_set(test_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
103         evas_object_show(test_bg);
104
105         evas_object_resize(test_win, 480, 800);
106         evas_object_show(test_win);
107
108         tet_infoline("[[ TET_MSG ]]:: Completing startup");
109 }
110
111 // Clean up function for each test purpose
112 static void
113 cleanup()
114 {
115         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
116
117         // Clean up the used resources.
118         if ( NULL != main_win ) {
119                 evas_object_del(main_win);
120                 main_win = NULL;
121         }
122
123         if ( NULL != main_bg ) {
124                 evas_object_del(main_bg);
125                 main_bg = NULL;
126         }
127
128         if ( NULL != test_win ) {
129                 evas_object_del(test_win);
130                 test_win = NULL;
131         }
132
133         if ( NULL != test_bg ) {
134                 evas_object_del(test_bg);
135                 test_bg = NULL;
136         }
137
138         if ( NULL != test_eo ) {
139                 evas_object_del(test_eo);
140                 test_eo = NULL;
141         }
142
143         // clean up and shut down
144         elm_shutdown(); ;
145
146         tet_infoline("[[ TET_MSG ]]:: ========= TC COMPLETE  ========== ");
147 }
148
149 /**
150  * @brief Positive test case of elm_multibuttonentry_item_insert_after()
151  */
152 static void utc_UIFW_elm_multibuttonentry_item_insert_after_func_01(void)
153 {
154         Elm_Object_Item *added_item1 = NULL, *added_item2 = NULL, *after_item = NULL;
155
156         test_eo = elm_multibuttonentry_add(test_win);
157         added_item1 = elm_multibuttonentry_item_prepend(test_eo, "item1", NULL);
158         added_item2 = elm_multibuttonentry_item_insert_after(test_eo, added_item1, "item2", NULL);
159         TET_CHECK_PASS(NULL, added_item2);
160
161         after_item = elm_multibuttonentry_item_next_get(added_item1);
162         if (added_item2 != after_item) {
163                 tet_infoline("elm_multibuttonentry_item_insert_after() failed in positive test case");
164                 tet_result(TET_FAIL);
165                 return;
166         }
167         tet_result(TET_PASS);
168         tet_infoline("[[ TET_MSG ]]::[ID]:TC_01, [TYPE]: Positive, [RESULT]:PASS, elm_multibuttonentry_item_insert_after().");
169 }
170
171 /**
172  * @brief Negative test case of ug_init elm_multibuttonentry_item_insert_after()
173  */
174 static void utc_UIFW_elm_multibuttonentry_item_insert_after_func_02(void)
175 {
176         Elm_Object_Item *added_item1 = NULL, *added_item2 = NULL;
177
178         test_eo = elm_multibuttonentry_add(NULL);
179         added_item1 = elm_multibuttonentry_item_prepend(test_eo, "item1", NULL);
180         added_item2 = elm_multibuttonentry_item_insert_after(test_eo, added_item1, NULL, NULL);
181         TET_CHECK_FAIL(NULL, added_item2);
182
183         tet_result(TET_PASS);
184         tet_infoline("[[ TET_MSG ]]::[ID]:TC_02, [TYPE]: Negative, [RESULT]:PASS, elm_multibuttonentry_item_insert_after().");
185 }