8d43bfd9c3bae7047cecc38570db4a4b50664c4f
[pkgs/u/ui-gadget.git] / TC / unit / utc_ApplicationFW_ug_init_func.c
1 /*
2  * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * This file is part of the UI Gadget
5  * Written by Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
6  *
7  * PROPRIETARY/CONFIDENTIAL
8  *
9  * This software is the confidential and proprietary information of
10  * SAMSUNG ELECTRONICS (Confidential Information).
11  * You shall not disclose such Confidential Information and shall
12  * use it only in accordance with the terms of the license agreement
13  * you entered into with SAMSUNG ELECTRONICS.  SAMSUNG make no
14  * representations or warranties about the suitability
15  * of the software, either express or implied, including but not
16  * limited to the implied warranties of merchantability, fitness for a particular purpose, or non-
17  * infringement. SAMSUNG shall not be liable for any damages suffered by licensee as
18  * a result of using, modifying or distributing this software or its derivatives.
19  *
20  */
21 #include <tet_api.h>
22 #include <ui-gadget.h>
23 #include <Elementary.h>
24 #include <Ecore_X.h>
25
26 static Evas_Object *win;
27
28 static void startup(void);
29 static void cleanup(void);
30
31 static void utc_ApplicationFW_ug_init_func_01(void);
32 static void utc_ApplicationFW_ug_init_func_02(void);
33
34 void (*tet_startup)(void) = startup;
35 void (*tet_cleanup)(void) = cleanup;
36
37 enum {
38         POSITIVE_TC_IDX = 0x01,
39         NEGATIVE_TC_IDX,
40 };
41
42 struct tet_testlist tet_testlist[] = {
43         { utc_ApplicationFW_ug_init_func_01, POSITIVE_TC_IDX },
44         { utc_ApplicationFW_ug_init_func_02, NEGATIVE_TC_IDX },
45         { NULL, 0},
46 };
47
48 static void startup(void)
49 {
50         char *err;
51         elm_init(0, NULL);
52         win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
53         if (!win) {
54                 err = "Cannot create window";
55                 tet_infoline(err);
56                 tet_delete(POSITIVE_TC_IDX, err);
57         }
58 }
59
60 static void cleanup(void)
61 {
62         if (win)
63                 evas_object_del(win);
64         elm_shutdown();
65 }
66
67 /**
68  * @brief Positive test case of ug_init API
69  */
70 static void utc_ApplicationFW_ug_init_func_01(void)
71 {
72         int r;
73         enum ug_option opt;
74
75         for (opt = UG_OPT_INDICATOR_ENABLE; opt < UG_OPT_MAX; opt++) {
76                 r = UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE);
77                 if (r) {
78                         tet_infoline("ug_init() failed in positive test case");
79                         tet_result(TET_FAIL);
80                         return;
81                 }
82         }
83         tet_result(TET_PASS);
84 }
85
86 /**
87  * @brief Negative test case of ug_init API
88  */
89 static void utc_ApplicationFW_ug_init_func_02(void)
90 {
91         int r;
92
93         r = UG_INIT_EFL(win, -1);
94         if (!r) {
95                 tet_infoline("ug_init() failed in negative test case");
96                 tet_result(TET_FAIL);
97                 return;
98         }
99
100         r = UG_INIT_EFL(win, UG_OPT_MAX);
101         if (!r) {
102                 tet_infoline("ug_init() failed in negative test case");
103                 tet_result(TET_FAIL);
104                 return;
105         }
106
107         tet_result(TET_PASS);
108 }