Revert "[Tizen] Add DALi Autofill implementation"
[platform/core/uifw/dali-adaptor.git] / automated-tests / src / dali-adaptor / utc-Dali-Watch.cpp
1 /*
2  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include <dali/dali.h>
19 #include <dali-test-suite-utils.h>
20
21 using namespace Dali;
22
23 void utc_dali_watchapplication_startup(void)
24 {
25   test_return_value = TET_UNDEF;
26 }
27
28 void utc_dali_watchapplication_cleanup(void)
29 {
30   test_return_value = TET_PASS;
31 }
32
33 namespace
34 {
35
36 struct MyTestApp : public ConnectionTracker
37 {
38   MyTestApp( WatchApplication& app)
39   : initCalled( false ),
40     mApplication( app )
41   {
42     mApplication.InitSignal().Connect( this, &MyTestApp::Create );
43   }
44
45   void Create(Application& app)
46   {
47     initCalled = true;
48   }
49
50   void Quit()
51   {
52     mApplication.Quit();
53   }
54
55   // Data
56   bool initCalled;
57   WatchApplication&  mApplication;
58 };
59
60 void WatchTimeSignalCallback( Application& app, const WatchTime& time)
61 {
62 }
63
64 void WatchChangedSignalCallback( Application& app, bool ambient)
65 {
66 }
67
68 } // unnamed namespace
69
70 int UtcDaliWatchApplicationNew01(void)
71 {
72   WatchApplication application = WatchApplication::New();
73
74   MyTestApp testApp( application );
75
76   DALI_TEST_CHECK( application );
77
78   END_TEST;
79 }
80
81 int UtcDaliWatchApplicationNew02(void)
82 {
83   int argc( 1 );
84   const char* argList[1] = { "program" };
85   char** argv = const_cast<char**>(argList);
86
87   WatchApplication application = WatchApplication::New( &argc, &argv );
88
89   MyTestApp testApp( application );
90
91   DALI_TEST_CHECK( application );
92
93   END_TEST;
94 }
95
96 int UtcDaliWatchApplicationNew03(void)
97 {
98   int argc( 1 );
99   const char* argList[1] = { "program" };
100   char** argv = const_cast<char**>(argList);
101
102   WatchApplication application = WatchApplication::New( &argc, &argv, "stylesheet" );
103
104   MyTestApp testApp( application );
105
106   DALI_TEST_CHECK( application );
107
108   END_TEST;
109 }
110
111 int UtcDaliWatchApplicationCopyAndAssignment(void)
112 {
113   WatchApplication application = WatchApplication::New();
114   WatchApplication copy( application );
115   DALI_TEST_CHECK( copy == application );
116
117   WatchApplication assigned;
118   DALI_TEST_CHECK( !assigned );
119   assigned = application;
120   DALI_TEST_CHECK( copy == assigned );
121
122   END_TEST;
123 }
124
125 int UtcDaliWatchApplicationTimeTickSignalP(void)
126 {
127   WatchApplication application = WatchApplication::New();
128   application.TimeTickSignal().Connect( &WatchTimeSignalCallback );
129   DALI_TEST_CHECK( application );
130
131   END_TEST;
132 }
133
134 int UtcDaliWatchApplicationTimeTickSignalN(void)
135 {
136   WatchApplication application;
137
138   try
139   {
140     application.TimeTickSignal().Connect( &WatchTimeSignalCallback );
141     DALI_TEST_CHECK( false ); // Should not get here
142   }
143   catch( ... )
144   {
145     DALI_TEST_CHECK( true );
146   }
147
148   END_TEST;
149 }
150
151 int UtcDaliWatchApplicationAmbientTickSignalP(void)
152 {
153   WatchApplication application = WatchApplication::New();
154   application.AmbientTickSignal().Connect( &WatchTimeSignalCallback );
155   DALI_TEST_CHECK( application );
156
157   END_TEST;
158 }
159
160 int UtcDaliWatchApplicationAmbientTickSignalN(void)
161 {
162   WatchApplication application;
163
164   try
165   {
166     application.AmbientTickSignal().Connect( &WatchTimeSignalCallback );
167     DALI_TEST_CHECK( false ); // Should not get here
168   }
169   catch( ... )
170   {
171     DALI_TEST_CHECK( true );
172   }
173
174   END_TEST;
175 }
176
177 int UtcDaliWatchApplicationAmbientChangedSignalP(void)
178 {
179   WatchApplication application = WatchApplication::New();
180   application.AmbientChangedSignal().Connect( &WatchChangedSignalCallback );
181   DALI_TEST_CHECK( application );
182
183   END_TEST;
184 }
185
186 int UtcDaliWatchApplicationAmbientChangedSignalN(void)
187 {
188   WatchApplication application;
189
190   try
191   {
192     application.AmbientChangedSignal().Connect( &WatchChangedSignalCallback );
193     DALI_TEST_CHECK( false ); // Should not get here
194   }
195   catch( ... )
196   {
197     DALI_TEST_CHECK( true );
198   }
199
200   END_TEST;
201 }
202