Package upload
[framework/uifw/elementary.git] / TC / elm_ts / controlbar / utc_UIFW_elm_controlbar_tab_item_insert_after_func.c
1 #include <tet_api.h>
2 #include <Elementary.h>
3 #define ICON_DIR "usr/share/elementary/images"
4
5 // Definitions
6 // For checking the result of the positive test case.
7 #define TET_CHECK_PASS(x1, y...) \
8 { \
9         Evas_Object *err = y; \
10         if (err == (x1)) \
11                 { \
12                         tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
13                         tet_result(TET_FAIL); \
14                         return; \
15                 } \
16 }
17
18 // For checking the result of the negative test case.
19 #define TET_CHECK_FAIL(x1, y...) \
20 { \
21         Evas_Object *err = y; \
22         if (err != (x1)) \
23                 { \
24                         tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
25                         tet_result(TET_FAIL); \
26                         return; \
27                 } \
28 }
29
30
31 Evas_Object *main_win;
32 Evas_Object *controlbar;
33 Evas_Object *view;
34
35 static void startup(void);
36 static void cleanup(void);
37
38 void (*tet_startup)(void) = startup;
39 void (*tet_cleanup)(void) = cleanup;
40
41 static void utc_UIFW_elm_controlbar_tab_item_insert_after_func_01(void);
42 static void utc_UIFW_elm_controlbar_tab_item_insert_after_func_02(void);
43
44 enum {
45         POSITIVE_TC_IDX = 0x01,
46         NEGATIVE_TC_IDX,
47 };
48
49 struct tet_testlist tet_testlist[] = {
50         { utc_UIFW_elm_controlbar_tab_item_insert_after_func_01, POSITIVE_TC_IDX },
51         { utc_UIFW_elm_controlbar_tab_item_insert_after_func_02, NEGATIVE_TC_IDX },
52         { NULL, 0 }
53 };
54
55 static void startup(void)
56 {
57         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
58         elm_init(0, NULL);
59         main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
60         evas_object_show(main_win);
61
62         controlbar = elm_controlbar_add(main_win);
63
64         view = elm_layout_add(controlbar);
65 }
66
67 static void cleanup(void)
68 {
69         if ( NULL != main_win ) {
70                 evas_object_del(main_win);
71                 main_win = NULL;
72         }
73         if ( NULL != controlbar ) {
74                 evas_object_del(controlbar);
75                 controlbar = NULL;
76         }
77         if ( NULL != view ) {
78                 evas_object_del(view);
79                 view = NULL;
80         }
81
82         elm_shutdown();
83         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
84 }
85
86 /**
87  * @brief Positive test case of elm_controlbar_tab_item_insert_after()
88  */
89 static void utc_UIFW_elm_controlbar_tab_item_insert_after_func_01(void)
90 {
91         char buf[255];
92
93         Elm_Controlbar_Item *item = NULL;
94         Elm_Controlbar_Item *item2 = NULL;
95         snprintf(buf, sizeof(buf), "%s/logo_small.png", ICON_DIR);
96         item = elm_controlbar_tab_item_append(controlbar, buf, "Songs", view);
97         item2 = elm_controlbar_tab_item_insert_after(controlbar, item, buf, "Songs", view);
98
99         if (!item2) {
100                 tet_infoline("elm_controlbar_tab_item_insert_after() failed in positive test case");
101                 tet_result(TET_FAIL);
102                 return;
103         }
104         tet_result(TET_PASS);
105 }
106
107 /**
108  * @brief Negative test case of ug_init elm_controlbar_tab_item_insert_after()
109  */
110 static void utc_UIFW_elm_controlbar_tab_item_insert_after_func_02(void)
111 {
112         char buf[255];
113
114         Elm_Controlbar_Item *item = NULL;
115         Elm_Controlbar_Item *item2 = NULL;
116         snprintf(buf, sizeof(buf), "%s/logo_small.png", ICON_DIR);
117         item = elm_controlbar_tab_item_append(controlbar, buf, "Songs", view);
118         item2 = elm_controlbar_tab_item_insert_after(controlbar, NULL, buf, "Songs", view);
119
120         if (item2) {
121                 tet_infoline("elm_controlbar_tab_item_insert_after() failed in negative test case");
122                 tet_result(TET_FAIL);
123                 return;
124         }
125         tet_result(TET_PASS);
126 }