68bf77f9db4292f28da551220518ef97d7daeb6b
[framework/uifw/elementary.git] / TC / elm_ts / controlbar / utc_UIFW_elm_controlbar_item_del_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         Evas_Object *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         Evas_Object *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 Evas_Object *controlbar;
32 Evas_Object *button;
33 Elm_Controlbar_Item *item1;
34 Elm_Controlbar_Item *item2;
35 Elm_Controlbar_Item *item3;
36
37 static void startup(void);
38 static void cleanup(void);
39
40 void (*tet_startup)(void) = startup;
41 void (*tet_cleanup)(void) = cleanup;
42
43 static void utc_UIFW_elm_controlbar_item_del_func_01(void);
44 static void utc_UIFW_elm_controlbar_item_del_func_02(void);
45
46 enum {
47         POSITIVE_TC_IDX = 0x01,
48         NEGATIVE_TC_IDX,
49 };
50
51 struct tet_testlist tet_testlist[] = {
52         { utc_UIFW_elm_controlbar_item_del_func_01, POSITIVE_TC_IDX },
53         { utc_UIFW_elm_controlbar_item_del_func_02, NEGATIVE_TC_IDX },
54         { NULL, 0 }
55 };
56
57 static void startup(void)
58 {
59         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
60         elm_init(0, NULL);
61         main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
62         evas_object_show(main_win);
63
64         controlbar = elm_controlbar_add(main_win);
65         item1 = elm_controlbar_tab_item_append(controlbar, NULL, "Controlbar", NULL);
66         item2 = elm_controlbar_tool_item_append(controlbar, NULL, "Controlbar", NULL, NULL);
67         button = elm_button_add(controlbar);
68         elm_button_label_set(button, "button");
69         item3 = elm_controlbar_object_item_append(controlbar, button, 3);
70 }
71
72 static void cleanup(void)
73 {
74         if ( NULL != main_win ) {
75                 evas_object_del(main_win);
76                 main_win = NULL;
77         }
78         elm_shutdown();
79         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
80
81         evas_object_del(controlbar);
82         evas_object_del(button);
83 }
84
85 /**
86  * @brief Positive test case of elm_controlbar_item_del()
87  */
88 static void utc_UIFW_elm_controlbar_item_del_func_01(void)
89 {
90         elm_controlbar_item_del(item1);
91         elm_controlbar_item_del(item2);
92         elm_controlbar_item_del(item3);
93
94         tet_result(TET_PASS);
95 }
96
97 /**
98  * @brief Negative test case of ug_init elm_controlbar_item_del()
99  */
100 static void utc_UIFW_elm_controlbar_item_del_func_02(void)
101 {
102         elm_controlbar_item_del(NULL);
103         if (!item1 || !item2 || !item3) {
104                 tet_infoline("elm_controlbar_item_del() failed in negative test case");
105                 tet_result(TET_FAIL);
106                 return;
107         }
108         tet_result(TET_PASS);
109 }