Add default Smack manifest for ui-gadget.spec
[pkgs/u/ui-gadget.git] / TC / unit / utc_ApplicationFW_ug_send_event_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 void startup(void);
27 static void cleanup(void);
28
29 void (*tet_startup)(void) = startup;
30 void (*tet_cleanup)(void) = cleanup;
31
32 static void utc_ApplicationFW_ug_send_event_func_01(void);
33 static void utc_ApplicationFW_ug_send_event_func_02(void);
34
35 enum {
36         POSITIVE_TC_IDX = 0x01,
37         NEGATIVE_TC_IDX = 0x01,
38 };
39
40 struct tet_testlist tet_testlist[] = {
41         { utc_ApplicationFW_ug_send_event_func_01, POSITIVE_TC_IDX },
42         { utc_ApplicationFW_ug_send_event_func_02, NEGATIVE_TC_IDX },
43         { NULL, 0},
44 };
45
46 #define TESTUG "helloUG-efl"
47
48 static void startup(void)
49 {
50         char *err;
51         Evas_Object *win;
52         struct ui_gadget *ug;
53
54         elm_init(0, NULL);
55         win = elm_win_add(NULL, "UI gadget test", ELM_WIN_BASIC);
56         if (!win) {
57                 err = "Cannot create window";
58                 goto startup_err;
59         }
60
61         if (UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE)) {
62                 err = "ug_init() failed";
63                 goto startup_err;
64         }
65
66         ug = ug_create(NULL, TESTUG, UG_MODE_FULLVIEW, NULL, NULL);
67         if (!ug) {
68                 err = "ug_create() failed";
69                 goto startup_err;
70         }
71
72         return;
73
74 startup_err:
75         tet_infoline(err);
76         tet_delete(POSITIVE_TC_IDX, err);
77         tet_delete(NEGATIVE_TC_IDX, err);
78 }
79
80 static void cleanup(void)
81 {
82         elm_shutdown();
83 }
84
85 /**
86  * @brief Positive test case of ug_send_event()
87  */
88 static void utc_ApplicationFW_ug_send_event_func_01(void)
89 {
90         int r = 0;
91         enum ug_event evt;
92
93         for (evt = UG_EVENT_LOW_MEMORY; evt < UG_EVENT_MAX; evt++) {
94                 r = ug_send_event(evt);
95                 if (r) {
96                         tet_infoline("ug_send_event() failed in positive test case");
97                         tet_result(TET_FAIL);
98                         return;
99                 }
100         }
101         tet_result(TET_PASS);
102 }
103
104 /**
105  * @brief Negative test case of ug_send_event()
106  */
107 static void utc_ApplicationFW_ug_send_event_func_02(void)
108 {
109         int r = 0;
110
111         r = ug_send_event(UG_EVENT_NONE);
112         if (!r) {
113                 tet_infoline("ug_send_event() failed in negative test case");
114                 tet_result(TET_FAIL);
115                 return;
116         }
117
118         r = ug_send_event(UG_EVENT_MAX);
119         if (!r) {
120                 tet_infoline("ug_send_event() failed in negative test case");
121                 tet_result(TET_FAIL);
122                 return;
123         }
124
125         tet_result(TET_PASS);
126 }
127