2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <ui-gadget-module.h>
23 #include <Elementary.h>
26 static void startup(void);
27 static void cleanup(void);
29 void (*tet_startup)(void) = startup;
30 void (*tet_cleanup)(void) = cleanup;
32 static void utc_ApplicationFW_ug_send_result_func_01(void);
33 static void utc_ApplicationFW_ug_send_result_func_02(void);
36 POSITIVE_TC_IDX = 0x01,
40 struct tet_testlist tet_testlist[] = {
41 { utc_ApplicationFW_ug_send_result_func_01, POSITIVE_TC_IDX },
42 { utc_ApplicationFW_ug_send_result_func_02, NEGATIVE_TC_IDX },
46 #define TESTUG "helloUG-efl"
48 static void startup(void)
53 static void cleanup(void)
61 win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
63 tet_infoline("Cannot create window");
67 if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
68 tet_infoline("ug_init() failed");
74 static Eina_Bool tst01(void *data)
78 struct ui_gadget *ug = data;
80 result = bundle_create();
82 tet_infoline("bundle_create() failed");
83 tet_result(TET_UNINITIATED);
86 bundle_add(result, "test", "case");
88 r = ug_send_result(ug, result);
90 tet_infoline("ug_send_result() failed in positive test case");
101 static void result_cb(struct ui_gadget *ug, bundle *b, void *priv)
103 // dummy result callback
107 * @brief Positive test case of ug_send_result()
109 static void utc_ApplicationFW_ug_send_result_func_01(void)
111 struct ui_gadget *ug;
112 struct ug_cbs cbs = {0, };
115 tet_result(TET_UNINITIATED);
119 cbs.result_cb = result_cb;
121 ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, &cbs);
123 tet_infoline("ug_create() failed");
124 tet_result(TET_UNINITIATED);
127 ecore_idler_add(tst01, ug);
131 static Eina_Bool tst02(void *data)
135 struct ui_gadget *ug = data;
137 result = bundle_create();
139 tet_infoline("bundle_create() failed");
140 tet_result(TET_UNINITIATED);
143 bundle_add(result, "test", "case");
145 r = ug_send_result(NULL, NULL);
147 tet_infoline("ug_send_result() failed in negative test case");
148 tet_result(TET_FAIL);
152 r = ug_send_result(ug, NULL);
154 tet_infoline("ug_send_result() failed in negative test case");
155 tet_result(TET_FAIL);
159 r = ug_send_result(NULL, result);
161 tet_infoline("ug_send_result() failed in negative test case");
162 tet_result(TET_FAIL);
166 tet_result(TET_PASS);
174 * @brief Negative test case of ug_init ug_send_result()
176 static void utc_ApplicationFW_ug_send_result_func_02(void)
178 struct ui_gadget *ug;
181 tet_result(TET_UNINITIATED);
185 ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
187 tet_infoline("ug_create() failed");
188 tet_result(TET_UNINITIATED);
191 ecore_idler_add(tst02, ug);