tizen 2.3.1 release
[framework/uifw/elementary.git] / TC / elm_ts / stackedicon / utc_UIFW_elm_stackedicon_item_prepend_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 Evas_Object *main_win, *stackedicon;
30
31 static char *icon_path[] = {
32         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item1.jpg",
33         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item2.jpg",
34         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item3.jpg",
35         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item4.jpg",
36         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item5.jpg",
37         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item6.jpg",
38         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item7.jpg",
39         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item8.jpg",
40         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item9.jpg",
41         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item10.jpg",
42         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item11.jpg",
43         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item12.jpg",
44         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item13.jpg",
45         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item14.jpg",
46         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item15.jpg",
47         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item16.jpg",
48         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item17.jpg",
49         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item18.jpg",
50         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item19.jpg",
51         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item20.jpg",
52         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item21.jpg",
53         "/usr/share/beat_winset_test/icon/Albums_Item/Albums_Item22.jpg",
54 };
55
56 static void startup(void);
57 static void cleanup(void);
58
59 void (*tet_startup)(void) = startup;
60 void (*tet_cleanup)(void) = cleanup;
61
62 static void utc_UIFW_elm_stackedicon_item_prepend_func_01(void);
63 static void utc_UIFW_elm_stackedicon_item_prepend_func_02(void);
64
65 enum {
66         POSITIVE_TC_IDX = 0x01,
67         NEGATIVE_TC_IDX,
68 };
69
70 struct tet_testlist tet_testlist[] = {
71         { utc_UIFW_elm_stackedicon_item_prepend_func_01, POSITIVE_TC_IDX },
72         { utc_UIFW_elm_stackedicon_item_prepend_func_02, NEGATIVE_TC_IDX },
73         { NULL, 0 }
74 };
75
76 static void startup(void)
77 {
78         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
79         elm_init(0, NULL);
80         main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
81         evas_object_show(main_win);
82
83         stackedicon = elm_stackedicon_add(main_win);
84         evas_object_show(stackedicon);
85         elm_win_resize_object_add(main_win, stackedicon);
86         evas_object_size_hint_align_set(stackedicon, EVAS_HINT_FILL, EVAS_HINT_FILL);
87         evas_object_size_hint_weight_set(stackedicon, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
88 }
89
90 static void cleanup(void)
91 {
92         if ( NULL != stackedicon ) {
93                 evas_object_del(stackedicon);
94                 stackedicon = NULL;
95         }
96
97         if ( NULL != main_win ) {
98                 evas_object_del(main_win);
99             main_win = NULL;
100         }
101         elm_shutdown();
102         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
103 }
104
105 /**
106  * @brief Positive test case of elm_stackedicon_item_prepend()
107  */
108 static void utc_UIFW_elm_stackedicon_item_prepend_func_01(void)
109 {
110         Elm_Stackedicon_Item *it = NULL;
111
112         tet_infoline("[[ DEBUG :: Positive ]]");
113
114         it = elm_stackedicon_item_prepend(stackedicon, icon_path[0]);
115         if (!it) {
116                 tet_infoline("elm_stackedicon_item_prepend() failed in positive test case");
117                 tet_result(TET_FAIL);
118                 return;
119         }
120         tet_result(TET_PASS);
121         tet_infoline("[[ TET_MSG ]]::[ID]:TC_01, [TYPE]: Positive, [RESULT]:PASS, elm_stackedicon_item_prepend().");
122 }
123
124 /**
125  * @brief Negative test case of ug_init elm_stackedicon_item_prepend()
126  */
127 static void utc_UIFW_elm_stackedicon_item_prepend_func_02(void)
128 {
129         Elm_Imageslider_Item *it = NULL;
130
131         tet_infoline("[[ DEBUG:: Negative ]]");
132
133         it = elm_stackedicon_item_prepend(NULL, icon_path[1]);
134         if (it) {
135                 tet_infoline("elm_stackedicon_item_prepend() failed in negative test case");
136                 tet_result(TET_FAIL);
137                 return;
138         }
139         tet_result(TET_PASS);
140         tet_infoline("[[ TET_MSG ]]::[ID]:TC_02, [TYPE]: Negative, [RESULT]:PASS, elm_stackedicon_item_prepend().");
141 }