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