3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Devel.Tests
9 using static Tizen.NUI.WatchApplication;
10 using tlog = Tizen.Log;
13 [Description("internal/Application/WatchApplication")]
14 public class InternalWatchApplicationTest
16 private const string tag = "NUITEST";
17 private string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource;
19 internal class MyWatchApplication : WatchApplication
21 public MyWatchApplication(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
24 public void OnReleaseSwigCPtr(global::System.Runtime.InteropServices.HandleRef swigCPtr)
26 base.ReleaseSwigCPtr(swigCPtr);
30 private bool IsWearable()
33 var result = Tizen.System.Information.TryGetValue("tizen.org/feature/profile", out value);
34 if (result && value.Equals("wearable"))
45 tlog.Info(tag, "Init() is called!");
51 tlog.Info(tag, "Destroy() is called!");
56 [Description("WatchApplication constructor.")]
57 [Property("SPEC", "Tizen.NUI.WatchApplication.WatchApplication C")]
58 [Property("SPEC_URL", "-")]
59 [Property("CRITERIA", "CONSTR")]
60 [Property("AUTHOR", "guowei.wang@samsung.com")]
61 public void WatchApplicationConstructor()
63 tlog.Debug(tag, $"WatchApplicationConstructor START");
65 using (ImageView imageView = new ImageView())
67 var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
68 Assert.IsNotNull(testingTarget, "should be not null");
69 Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
71 testingTarget.Dispose();
74 tlog.Debug(tag, $"WatchApplicationConstructor END (OK)");
79 //[Description("WatchApplication constructor. With WatchApplication.")]
80 //[Property("SPEC", "Tizen.NUI.WatchApplication.WatchApplication C")]
81 //[Property("SPEC_URL", "-")]
82 //[Property("CRITERIA", "CONSTR")]
83 //[Property("AUTHOR", "guowei.wang@samsung.com")]
84 //public void WatchApplicationConstructorWithApplication()
86 // tlog.Debug(tag, $"WatchApplicationConstructorWithApplication START");
88 // using (ImageView imageView = new ImageView())
90 // WatchApplication watchApplication = new WatchApplication(imageView.SwigCPtr.Handle, false);
91 // Assert.IsNotNull(watchApplication, "should be not null");
92 // Assert.IsInstanceOf<WatchApplication>(watchApplication, "should be an instance of testing target class!");
96 // new WatchApplication(watchApplication);
98 // catch (Exception e)
100 // /** Unable to find an entry point named 'CSharp_Dali_new_WatchApplication__SWIG_1' in shared library 'libdali2-csharp-binder.so' */
101 // tlog.Debug(tag, e.Message.ToString());
102 // Assert.Fail("Caught Exception: Failed!");
105 // watchApplication.Dispose();
108 // tlog.Debug(tag, $"WatchApplicationConstructorWithApplication END (OK)");
113 [Description("WatchApplication.TimeTickEventArgs. Application.")]
114 [Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickEventArgs.Application A")]
115 [Property("SPEC_URL", "-")]
116 [Property("CRITERIA", "PRW")]
117 [Property("AUTHOR", "guowei.wang@samsung.com")]
118 public void WatchApplicationTimeTickEventArgsApplication()
120 tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplication START");
122 var testingTarget = new TimeTickEventArgs();
123 Assert.IsNotNull(testingTarget, "should be not null");
124 Assert.IsInstanceOf<TimeTickEventArgs>(testingTarget, "should be an instance of testing target class!");
126 Widget widget = new Widget();
127 var application = new WidgetApplication(widget.GetIntPtr(), false);
128 testingTarget.Application = application;
129 Assert.IsNotNull(testingTarget.Application, "should be not null.");
133 tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplication END (OK)");
138 [Description("WatchApplication.TimeTickEventArgs. WatchTime.")]
139 [Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickEventArgs.WatchTime A")]
140 [Property("SPEC_URL", "-")]
141 [Property("CRITERIA", "PRW")]
142 [Property("AUTHOR", "guowei.wang@samsung.com")]
143 public void WatchApplicationTimeTickEventArgsWatchTime()
145 tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTime START");
147 var testingTarget = new TimeTickEventArgs();
148 Assert.IsNotNull(testingTarget, "should be not null");
149 Assert.IsInstanceOf<TimeTickEventArgs>(testingTarget, "should be an instance of testing target class!");
151 Widget widget = new Widget();
152 using (WatchTime time = new WatchTime(widget.GetIntPtr(), false))
154 testingTarget.WatchTime = time;
155 Assert.IsNotNull(testingTarget.WatchTime);
160 tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTime END (OK)");
165 //[Description("WatchApplication.TimeTick.")]
166 //[Property("SPEC", "Tizen.NUI.WatchApplication.TimeTick A")]
167 //[Property("SPEC_URL", "-")]
168 //[Property("CRITERIA", "PRW")]
169 //[Property("AUTHOR", "guowei.wang@samsung.com")]
170 //public void WatchApplicationTimeTick()
172 // tlog.Debug(tag, $"WatchApplicationTimeTick START");
174 // using (ImageView imageView = new ImageView())
176 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
177 // Assert.IsNotNull(testingTarget, "should be not null");
178 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
180 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_TimeTickSignal' in shared library 'libdali2-csharp-binder.so' */
181 // testingTarget.TimeTick += MyOnTimeTick;
182 // testingTarget.TimeTick -= MyOnTimeTick;
184 // testingTarget.Dispose();
187 // tlog.Debug(tag, $"WatchApplicationTimeTick END (OK)");
192 //[Description("WatchApplication.TimeTickSignal.")]
193 //[Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickSignal A")]
194 //[Property("SPEC_URL", "-")]
195 //[Property("CRITERIA", "PRW")]
196 //[Property("AUTHOR", "guowei.wang@samsung.com")]
197 //public void WatchApplicationTimeTickSignal()
199 // tlog.Debug(tag, $"WatchApplicationTimeTickSignal START");
201 // using (ImageView imageView = new ImageView())
203 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
204 // Assert.IsNotNull(testingTarget, "should be not null");
205 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
209 // testingTarget.TimeTickSignal();
211 // catch (Exception e)
213 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_TimeTickSignal' in shared library 'libdali2-csharp-binder.so' */
214 // tlog.Debug(tag, e.Message.ToString());
215 // Assert.Fail("Caught Exception: Failed!");
219 // tlog.Debug(tag, $"WatchApplicationTimeTickSignal END (OK)");
222 private void MyOnTimeTick(object sender, TimeTickEventArgs e) { }
226 [Description("WatchApplication.AmbientTickEventArgs. Application.")]
227 [Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickEventArgs.Application A")]
228 [Property("SPEC_URL", "-")]
229 [Property("CRITERIA", "PRW")]
230 [Property("AUTHOR", "guowei.wang@samsung.com")]
231 public void WatchApplicationAmbientTickEventArgsApplication()
233 tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplication START");
235 var testingTarget = new AmbientTickEventArgs();
236 Assert.IsNotNull(testingTarget, "should be not null");
237 Assert.IsInstanceOf<AmbientTickEventArgs>(testingTarget, "should be an instance of AmbientTickEventArgs class!");
239 Widget widget = new Widget();
240 var application = new WidgetApplication(widget.GetIntPtr(), false);
241 testingTarget.Application = application;
242 Assert.IsNotNull(testingTarget.Application, "should be not null.");
246 tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplication END (OK)");
251 [Description("WatchApplication.AmbientTickEventArgs.WatchTime")]
252 [Property("SPEC", "Tizen.NUI.WatchApplication.AmbientTickEventArgs.WatchTime A")]
253 [Property("SPEC_URL", "-")]
254 [Property("CRITERIA", "PRW")]
255 [Property("AUTHOR", "guowei.wang@samsung.com")]
256 public void WatchApplicationAmbientTickArgsWatchTime()
258 tlog.Debug(tag, $"WatchApplicationAmbientTickArgsWatchTime START");
260 var testingTarget = new AmbientTickEventArgs();
261 Assert.IsNotNull(testingTarget, "should be not null");
262 Assert.IsInstanceOf<AmbientTickEventArgs>(testingTarget, "should be an instance of testing target class!");
264 Widget widget = new Widget();
265 using (WatchTime time = new WatchTime(widget.GetIntPtr(), false))
267 testingTarget.WatchTime = time;
268 Assert.IsNotNull(testingTarget.WatchTime);
273 tlog.Debug(tag, $"WatchApplicationAmbientTickArgsWatchTime END (OK)");
278 //[Description("WatchApplication.AmbientTick.")]
279 //[Property("SPEC", "Tizen.NUI.WatchApplication.AmbientTick A")]
280 //[Property("SPEC_URL", "-")]
281 //[Property("CRITERIA", "PRW")]
282 //[Property("AUTHOR", "guowei.wang@samsung.com")]
283 //public void WatchApplicationAmbientTick()
285 // tlog.Debug(tag, $"WatchApplicationAmbientTick START");
287 // using (ImageView imageView = new ImageView())
289 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
290 // Assert.IsNotNull(testingTarget, "should be not null");
291 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
293 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_AmbientTickSignal' in shared library 'libdali2-csharp-binder.so' */
294 // testingTarget.AmbientTick += MyOnAmbientTick;
295 // testingTarget.AmbientTick -= MyOnAmbientTick;
297 // testingTarget.Dispose();
300 // tlog.Debug(tag, $"WatchApplicationAmbientTick END (OK)");
303 //private void MyOnAmbientTick(object sender, AmbientTickEventArgs e) { }
307 //[Description("WatchApplication.AmbientTickSignal.")]
308 //[Property("SPEC", "Tizen.NUI.WatchApplication.AmbientTickSignal A")]
309 //[Property("SPEC_URL", "-")]
310 //[Property("CRITERIA", "PRW")]
311 //[Property("AUTHOR", "guowei.wang@samsung.com")]
312 //public void WatchApplicationAmbientTickSignal()
314 // tlog.Debug(tag, $"WatchApplicationAmbientTickSignal START");
316 // using (ImageView imageView = new ImageView())
318 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
319 // Assert.IsNotNull(testingTarget, "should be not null");
320 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
324 // testingTarget.AmbientTickSignal();
326 // catch (Exception e)
328 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_AmbientTickSignal' in shared library 'libdali2-csharp-binder.so' */
329 // tlog.Debug(tag, e.Message.ToString());
330 // Assert.Fail("Caught Exception: Failed!");
334 // tlog.Debug(tag, $"WatchApplicationAmbientTickSignal END (OK)");
339 [Description("WatchApplication.AmbientChangedEventArgs. Application.")]
340 [Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickEventArgs.WatchTime A")]
341 [Property("SPEC_URL", "-")]
342 [Property("CRITERIA", "PRW")]
343 [Property("AUTHOR", "guowei.wang@samsung.com")]
344 public void WatchApplicationAmbientChangedEventArgsApplication()
346 tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplication START");
348 var testingTarget = new AmbientChangedEventArgs();
349 Assert.IsNotNull(testingTarget, "should be not null");
350 Assert.IsInstanceOf<AmbientChangedEventArgs>(testingTarget, "should be an instance of AmbientChangedEventArgs class!");
352 Widget widget = new Widget();
353 var application = new WidgetApplication(widget.GetIntPtr(), false);
354 testingTarget.Application = application;
355 Assert.IsNotNull(testingTarget.Application, "should be not null.");
359 tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplication END (OK)");
364 [Description("WatchApplication.AmbientChangedEventArgs. Changed.")]
365 [Property("SPEC", "Tizen.NUI.WatchApplication.AmbientChangedEventArgs.Changed A")]
366 [Property("SPEC_URL", "-")]
367 [Property("CRITERIA", "PRW")]
368 [Property("AUTHOR", "guowei.wang@samsung.com")]
369 public void WatchApplicationAmbientChangedEventArgsChangedSet()
371 tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedSet START");
373 var testingTarget = new AmbientChangedEventArgs();
374 Assert.IsNotNull(testingTarget, "should be not null");
375 Assert.IsInstanceOf<AmbientChangedEventArgs>(testingTarget, "should be an instance of AmbientChangedEventArgs class!");
377 testingTarget.Changed = true;
378 Assert.AreEqual(true, testingTarget.Changed, "Retrieved result should be equal to true. ");
380 testingTarget.Changed = false;
381 Assert.AreEqual(false, testingTarget.Changed, "Retrieved result should be equal to true. ");
383 tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedSet END (OK)");
388 //[Description("WatchApplication.AmbientChanged.")]
389 //[Property("SPEC", "Tizen.NUI.WatchApplication.AmbientChanged A")]
390 //[Property("SPEC_URL", "-")]
391 //[Property("CRITERIA", "PRW")]
392 //[Property("AUTHOR", "guowei.wang@samsung.com")]
393 //public void WatchApplicationAmbientChanged()
395 // tlog.Debug(tag, $"WatchApplicationAmbientChanged START");
397 // using (ImageView imageView = new ImageView())
399 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
400 // Assert.IsNotNull(testingTarget, "should be not null");
401 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
403 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_AmbientChangedSignal' in shared library 'libdali2-csharp-binder.so' */
404 // testingTarget.AmbientChanged += MyOnAmbientChanged;
405 // testingTarget.AmbientChanged -= MyOnAmbientChanged;
407 // testingTarget.Dispose();
410 // tlog.Debug(tag, $"WatchApplicationAmbientChanged END (OK)");
413 //private void MyOnAmbientChanged(object sender, AmbientChangedEventArgs e) { }
417 //[Description("WatchApplication.AmbientChangedSignal.")]
418 //[Property("SPEC", "Tizen.NUI.WatchApplication.AmbientChangedSignal A")]
419 //[Property("SPEC_URL", "-")]
420 //[Property("CRITERIA", "PRW")]
421 //[Property("AUTHOR", "guowei.wang@samsung.com")]
422 //public void WatchApplicationAmbientChangedSignal()
424 // tlog.Debug(tag, $"WatchApplicationAmbientChangedSignal START");
426 // using (ImageView imageView = new ImageView())
428 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
429 // Assert.IsNotNull(testingTarget, "should be not null");
430 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
434 // testingTarget.AmbientChangedSignal();
436 // catch (Exception e)
438 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_AmbientChangedSignal' in shared library 'libdali2-csharp-binder.so' */
439 // tlog.Debug(tag, e.Message.ToString());
440 // Assert.Fail("Caught Exception: Failed!");
444 // tlog.Debug(tag, $"WatchApplicationAmbientChangedSignal END (OK)");