[Refactoring] Removed trailing whitespaces.
[framework/uifw/elementary.git] / TC / elm_ts / template / uts_elm_imageslider_add_func.c
1
2 #include <Elementary.h>
3 //#include "winset_test.h"
4 //#include "winset_until.h"
5 #include "uts_elm_imageslider_add_test.h"
6
7 // Definitions
8 // For checking the result of the positive test case.
9 #define TET_CHECK_PASS(x1, y...) \
10 { \
11         Evas_Object *err = y; \
12         if (err == (x1)) \
13                 { \
14                         tet_printf("[TET_CHECK_PASS]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
15                         tet_result(TET_FAIL); \
16                         return; \
17                 } \
18 }
19
20 // For checking the result of the negative test case.
21 #define TET_CHECK_FAIL(x1, y...) \
22 { \
23         Evas_Object *err = y; \
24         if (err != (x1)) \
25                 { \
26                         tet_printf("[TET_CHECK_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__); \
27                         tet_result(TET_FAIL); \
28                         return; \
29                 } \
30 }
31
32 // Declare the global variables
33 Evas_Object *main_win, *main_bg;
34 Evas_Object *test_win, *test_bg;
35 Evas_Object *test_eo = NULL;
36 // Declare internal functions
37 void _elm_precondition(void);
38 static void _win_del(void *data, Evas_Object *obj, void *event_info);
39
40
41 // Delete main window
42 static void _win_del(void *data, Evas_Object *obj, void *event_info)
43 {
44         elm_exit();
45 }
46
47 // Do precondition.
48 void _elm_precondition(void)
49 {
50         elm_init(0, NULL);
51 \r
52         main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
53         elm_win_title_set(main_win, "Elementary Unit Test Suite");
54         evas_object_smart_callback_add(main_win, "delete,request", _win_del, NULL);
55         main_bg = elm_bg_add(main_win);
56         evas_object_size_hint_weight_set(main_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
57         elm_win_resize_object_add(main_win, main_bg);
58         evas_object_show(main_bg);
59
60         // set an initial window size
61         evas_object_resize(main_win, 320, 480);
62         // show the window
63         evas_object_show(main_win);
64
65         //elm_run();
66 }
67
68
69 // Start up function for each test purpose
70 static void
71 startup()
72 {
73         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
74
75         // Elm precondition
76         _elm_precondition();
77
78         // Test precondition
79         test_win = elm_win_add(NULL, "Image Silder", ELM_WIN_BASIC);
80         elm_win_title_set(test_win, "Image Slider");
81         elm_win_autodel_set(test_win, 1);
82
83         test_bg = elm_bg_add(test_win);
84         elm_win_resize_object_add(test_win, test_bg);
85         evas_object_size_hint_weight_set(test_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
86         evas_object_show(test_bg);
87
88         evas_object_resize(test_win, 480, 800);
89         evas_object_show(test_win);
90
91         tet_infoline("[[ TET_MSG ]]:: Completing startup");
92 }
93
94 // Clean up function for each test purpose
95 static void
96 cleanup()
97 {
98         // Clean up the used resources.
99         if ( NULL != main_win ) {
100                 main_win = NULL;
101         }
102
103         if ( NULL != main_bg ) {
104                 main_bg = NULL;
105         }
106
107         if ( NULL != test_win ) {
108                 test_win = NULL;
109         }
110
111         if ( NULL != test_bg ) {
112                 test_bg = NULL;
113         }
114
115         if ( NULL != test_eo ) {
116                 test_eo = NULL;
117         }
118
119         elm_exit();
120
121         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
122
123 }
124
125 // Positive test case.
126 void uts_elm_imageslider_add_test_001()
127 {
128         test_eo = elm_imageslider_add(test_win);
129         TET_CHECK_PASS(NULL, test_win);
130
131         tet_result(TET_PASS);
132         tet_infoline("[[ TET_MSG ]]::[ID]:TC_01, [TYPE]: Positive, [RESULT]:PASS, An Image Slider is added successfully.");
133
134 }
135
136
137 // Negative test case.
138 void uts_elm_imageslider_add_test_002()
139 {
140         test_eo = elm_imageslider_add(NULL);
141         TET_CHECK_FAIL(NULL, test_eo);
142
143         tet_result(TET_PASS);
144         tet_infoline("[[ TET_MSG ]]::[ID]:TC_02, [TYPE]: Negative, [RESULT]:PASS, Adding an Image Slider has failed.");
145 }
146
147