Merge "[genlist] fixing minw at sizing_eval"
[framework/uifw/elementary.git] / TC / elm_ts / controlbar / utc_UIFW_elm_controlbar_item_view_get_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 Elm_Controlbar_Item *item1;
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_item_view_get_func_01(void);
42 static void utc_UIFW_elm_controlbar_item_view_get_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_item_view_get_func_01, POSITIVE_TC_IDX },
51         { utc_UIFW_elm_controlbar_item_view_get_func_02, NEGATIVE_TC_IDX },
52         { NULL, 0 }
53 };
54
55 static void startup(void)
56 {
57         char buf[255];
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         snprintf(buf, sizeof(buf), "%s/logo_small.png", ICON_DIR);
66         item1 = elm_controlbar_tab_item_append(controlbar, buf, "Controlbar", NULL);
67 }
68
69 static void cleanup(void)
70 {
71         if ( NULL != main_win ) {
72                 evas_object_del(main_win);
73                 main_win = NULL;
74         }
75         elm_shutdown();
76         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
77
78         evas_object_del(controlbar);
79 }
80
81 /**
82  * @brief Positive test case of elm_controlbar_item_view_get()
83  */
84 static void utc_UIFW_elm_controlbar_item_view_get_func_01(void)
85 {
86         Evas_Object *view = NULL;
87         Evas_Object *test_view = NULL;
88         view = elm_icon_add(controlbar);
89
90         elm_controlbar_item_view_set(item1, view);
91
92         test_view = elm_controlbar_item_view_get(item1);
93
94         if (test_view != view) {
95                 tet_infoline("elm_controlbar_item_view_get() failed in positive test case");
96                 tet_result(TET_FAIL);
97                 return;
98         }
99         tet_result(TET_PASS);
100 }
101
102 /**
103  * @brief Negative test case of ug_init elm_controlbar_item_view_get()
104  */
105 static void utc_UIFW_elm_controlbar_item_view_get_func_02(void)
106 {
107         Evas_Object *view = NULL;
108         Evas_Object *test_view = NULL;
109         view = elm_icon_add(controlbar);
110
111         elm_controlbar_item_view_set(item1, view);
112
113         test_view = elm_controlbar_item_view_get(NULL);
114
115         if (test_view) {
116                 tet_infoline("elm_controlbar_item_view_get() failed in negative test case");
117                 tet_result(TET_FAIL);
118                 return;
119         }
120         tet_result(TET_PASS);
121 }