ff01f1d2745398adb377713befb6ed6947edd9cb
[framework/uifw/elementary.git] / TC / elm_ts / gengrid / utc_UIFW_elm_gengrid_item_append_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         if (y == (x1)) \
9                 { \
10                         tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
11                         tet_result(TET_FAIL); \
12                         return; \
13                 } \
14 }
15
16 // For checking the result of the negative test case.
17 #define TET_CHECK_FAIL(x1, y...) \
18 { \
19         if (y != (x1)) \
20                 { \
21                         tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
22                         tet_result(TET_FAIL); \
23                         return; \
24                 } \
25 }
26
27 Evas_Object *main_win, *main_bg;
28 Evas_Object *test_win, *test_bg;
29 Evas_Object *test_eo = NULL;
30 Elm_Gengrid_Item_Class gic;
31
32 void _elm_precondition(void);
33 static void _win_del(void *data, Evas_Object *obj, void *event_info);
34
35 static void _win_del(void *data, Evas_Object *obj, void *event_info)
36 {
37         elm_exit();
38 }
39
40 void _elm_precondition(void)
41 {
42         elm_init(0, NULL);
43
44         main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
45         elm_win_title_set(main_win, "Elementary Unit Test Suite");
46         evas_object_smart_callback_add(main_win, "delete,request", _win_del, NULL);
47         main_bg = elm_bg_add(main_win);
48         evas_object_size_hint_weight_set(main_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
49
50         evas_object_resize(main_win, 320, 480);
51         evas_object_show(main_win);
52 }
53
54 static void startup(void);
55 static void cleanup(void);
56
57 void (*tet_startup)(void) = startup;
58 void (*tet_cleanup)(void) = cleanup;
59
60 static void utc_UIFW_elm_gengrid_item_append_func_01(void);
61 static void utc_UIFW_elm_gengrid_item_append_func_02(void);
62
63 enum {
64         POSITIVE_TC_IDX = 0x01,
65         NEGATIVE_TC_IDX,
66 };
67
68 struct tet_testlist tet_testlist[] = {
69         { utc_UIFW_elm_gengrid_item_append_func_01, POSITIVE_TC_IDX },
70         { utc_UIFW_elm_gengrid_item_append_func_02, NEGATIVE_TC_IDX },
71         { NULL, 0 }
72 };
73
74 static void startup(void)
75 {
76         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
77
78         _elm_precondition();
79
80         test_win = elm_win_add(NULL, "Page Control", ELM_WIN_BASIC);
81         elm_win_title_set(test_win, "Page Control");
82         elm_win_autodel_set(test_win, 1);
83
84         test_bg = elm_bg_add(test_win);
85         elm_win_resize_object_add(test_win, test_bg);
86         evas_object_size_hint_weight_set(test_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
87         evas_object_show(test_bg);
88
89         evas_object_resize(test_win, 480, 800);
90         evas_object_show(test_win);
91
92         test_eo = elm_gengrid_add(test_win);
93         gic.item_style = "default_grid";
94         gic.func.label_get = NULL;
95         gic.func.icon_get = NULL;
96
97         tet_infoline("[[ TET_MSG ]]:: Completing startup");
98 }
99
100 static void cleanup(void)
101 {
102         if ( NULL != main_win ) {
103                 main_win = NULL;
104         }
105
106         if ( NULL != main_bg ) {
107                 main_bg = NULL;
108         }
109
110         if ( NULL != test_win ) {
111                 test_win = NULL;
112         }
113
114         if ( NULL != test_bg ) {
115                 test_bg = NULL;
116         }
117
118         if ( NULL != test_eo ) {
119                 test_eo = NULL;
120         }
121
122         elm_exit();
123
124         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
125 }
126
127 static void utc_UIFW_elm_gengrid_item_append_func_01(void)
128 {
129         Elm_Gengrid_Item *item = NULL;
130
131         item = elm_gengrid_item_append(test_eo, &gic, NULL, NULL, NULL);
132         TET_CHECK_PASS(NULL, item);
133
134         tet_result(TET_PASS);
135         tet_infoline("[[ TET_MSG ]]::[ID]:TC_01, [TYPE]: Positive, [RESULT]:PASS, elm_gengrid_item_append");
136 }
137
138 static void utc_UIFW_elm_gengrid_item_append_func_02(void)
139 {
140         Elm_Gengrid_Item *item = NULL;
141
142         item = elm_gengrid_item_append(NULL, NULL, NULL, NULL, NULL);
143         TET_CHECK_FAIL(NULL, item);
144
145         tet_result(TET_PASS);
146         tet_infoline("[[ TET_MSG ]]::[ID]:TC_02, [TYPE]: Negative, [RESULT]:PASS, elm_gengrid_item_append");
147 }