9050ce3853e2934f79221933a4712ea6f3d256a3
[framework/uifw/elementary.git] / TC / elm_ts / pagecontrol / utc_UIFW_elm_page_control_page_id_get_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
31 void _elm_precondition(void);
32 static void _win_del(void *data, Evas_Object *obj, void *event_info);
33
34 static void _win_del(void *data, Evas_Object *obj, void *event_info)
35 {
36         elm_exit();
37 }
38
39 void _elm_precondition(void)
40 {
41         elm_init(0, NULL);
42
43         main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
44         elm_win_title_set(main_win, "Elementary Unit Test Suite");
45         evas_object_smart_callback_add(main_win, "delete,request", _win_del, NULL);
46         main_bg = elm_bg_add(main_win);
47         evas_object_size_hint_weight_set(main_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48
49         evas_object_resize(main_win, 320, 480);
50         evas_object_show(main_win);     
51 }
52
53 static void startup(void);
54 static void cleanup(void);
55
56 void (*tet_startup)(void) = startup;
57 void (*tet_cleanup)(void) = cleanup;
58
59 static void utc_UIFW_elm_page_control_page_id_get_func_01(void);
60 static void utc_UIFW_elm_page_control_page_id_get_func_02(void);
61
62 enum {
63         POSITIVE_TC_IDX = 0x01,
64         NEGATIVE_TC_IDX,
65 };
66
67 struct tet_testlist tet_testlist[] = {
68         { utc_UIFW_elm_page_control_page_id_get_func_01, POSITIVE_TC_IDX },
69         { utc_UIFW_elm_page_control_page_id_get_func_02, NEGATIVE_TC_IDX },
70 };
71
72 static void startup(void)
73 {
74         tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ ");
75
76         _elm_precondition();
77
78         test_win = elm_win_add(NULL, "Page Control", ELM_WIN_BASIC);
79         elm_win_title_set(test_win, "Page Control");
80         elm_win_autodel_set(test_win, 1);
81         
82         test_bg = elm_bg_add(test_win);
83         elm_win_resize_object_add(test_win, test_bg);
84         evas_object_size_hint_weight_set(test_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
85         evas_object_show(test_bg);
86         
87         evas_object_resize(test_win, 480, 800);
88         evas_object_show(test_win);
89
90         test_eo = elm_page_control_add(test_win);
91         
92         tet_infoline("[[ TET_MSG ]]:: Completing startup");
93 }
94
95 static void cleanup(void)
96 {
97         if ( NULL != main_win ) {
98                 main_win = NULL;
99         }
100         
101         if ( NULL != main_bg ) {
102                 main_bg = NULL;
103         }
104         
105         if ( NULL != test_win ) {
106                 test_win = NULL;
107         }
108         
109         if ( NULL != test_bg ) {
110                 test_bg = NULL;
111         }
112         
113         if ( NULL != test_eo ) {
114                 test_eo = NULL;
115         }
116         
117         elm_exit();
118         
119         tet_infoline("[[ TET_MSG ]]:: ============ Cleanup ============ ");
120 }
121
122 static void utc_UIFW_elm_page_control_page_id_get_func_01(void)
123 {
124         int page_id = -1;
125         page_id = elm_page_control_page_id_get(test_eo);
126         TET_CHECK_PASS(-1, page_id);
127         
128         tet_result(TET_PASS);
129         tet_infoline("[[ TET_MSG ]]::[ID]:TC_01, [TYPE]: Positive, [RESULT]:PASS, elm_page_control_page_id_get");
130 }
131
132 static void utc_UIFW_elm_page_control_page_id_get_func_02(void)
133 {
134         int page_id = -1;
135         page_id = elm_page_control_page_id_get(NULL);
136         TET_CHECK_FAIL(-1, page_id);
137         
138         tet_result(TET_PASS);
139         tet_infoline("[[ TET_MSG ]]::[ID]:TC_02, [TYPE]: Negative, [RESULT]:PASS, elm_page_control_page_id_get");
140 }