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 getCPtr.")]
114 [Property("SPEC", "Tizen.NUI.WatchApplication.getCPtr M")]
115 [Property("SPEC_URL", "-")]
116 [Property("CRITERIA", "MR")]
117 [Property("AUTHOR", "guowei.wang@samsung.com")]
118 public void WatchApplicationgetCPtr()
120 tlog.Debug(tag, $"WatchApplicationgetCPtr START");
122 using (ImageView imageView = new ImageView())
124 var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
125 Assert.IsNotNull(testingTarget, "should be not null");
126 Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
130 WatchApplication.getCPtr(testingTarget);
134 tlog.Debug(tag, e.Message.ToString());
135 Assert.Fail("Caught Exception: Failed!");
138 testingTarget.Dispose();
141 tlog.Debug(tag, $"WatchApplicationgetCPtr END (OK)");
146 //[Description("WatchApplication ReleaseSwigCPtr.")]
147 //[Property("SPEC", "Tizen.NUI.WatchApplication.ReleaseSwigCPtr M")]
148 //[Property("SPEC_URL", "-")]
149 //[Property("CRITERIA", "MR")]
150 //[Property("AUTHOR", "guowei.wang@samsung.com")]
151 //public void WatchApplicationReleaseSwigCPtr()
153 // tlog.Debug(tag, $"WatchApplicationReleaseSwigCPtr START");
155 // using (ImageView imageView = new ImageView())
157 // var testingTarget = new MyWatchApplication(imageView.SwigCPtr.Handle, false);
158 // Assert.IsNotNull(testingTarget, "should be not null");
159 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
163 // testingTarget.OnReleaseSwigCPtr(imageView.SwigCPtr);
165 // catch (Exception e)
167 // /** Unable to find an entry point named 'CSharp_Dali_delete_WatchApplication' in shared library 'libdali2-csharp-binder.so' */
168 // tlog.Debug(tag, e.Message.ToString());
169 // Assert.Fail("Caught Exception: Failed!");
172 // testingTarget.Dispose();
175 // tlog.Debug(tag, $"WatchApplicationReleaseSwigCPtr END (OK)");
180 //[Description("WatchApplication NewWatchApplication.")]
181 //[Property("SPEC", "Tizen.NUI.WatchApplication.NewWatchApplication M")]
182 //[Property("SPEC_URL", "-")]
183 //[Property("CRITERIA", "MR")]
184 //[Property("AUTHOR", "guowei.wang@samsung.com")]
185 //public void WatchApplicationNewWatchApplication()
187 // tlog.Debug(tag, $"WatchApplicationNewWatchApplication START");
191 // var testingTarget = WatchApplication.NewWatchApplication();
192 // Assert.IsNotNull(testingTarget, "should be not null");
193 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
195 // catch (Exception e)
197 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_New__SWIG_0' in shared library 'libdali2-csharp-binder.so' */
198 // tlog.Debug(tag, e.Message.ToString());
199 // Assert.Fail("Caught Exception: Failed!");
202 // tlog.Debug(tag, $"WatchApplicationNewWatchApplication END (OK)");
207 //[Description("WatchApplication NewWatchApplication. With strings")]
208 //[Property("SPEC", "Tizen.NUI.WatchApplication.NewWatchApplication M")]
209 //[Property("SPEC_URL", "-")]
210 //[Property("CRITERIA", "MR")]
211 //[Property("AUTHOR", "guowei.wang@samsung.com")]
212 //public void WatchApplicationNewWatchApplicationWithStrings()
214 // tlog.Debug(tag, $"WatchApplicationNewWatchApplicationWithStrings START");
218 // var dummy = new string[3];
219 // var testingTarget = WatchApplication.NewWatchApplication(dummy);
220 // Assert.IsNotNull(testingTarget, "should be not null");
221 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
223 // testingTarget.Dispose();
225 // catch (Exception e)
227 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_New__SWIG_1' in shared library 'libdali2-csharp-binder.so' */
228 // tlog.Debug(tag, e.Message.ToString());
229 // Assert.Fail("Caught Exception: Failed!");
232 // tlog.Debug(tag, $"WatchApplicationNewWatchApplicationWithStrings END (OK)");
237 //[Description("WatchApplication NewWatchApplication. With strings and style.")]
238 //[Property("SPEC", "Tizen.NUI.WatchApplication.NewWatchApplication M")]
239 //[Property("SPEC_URL", "-")]
240 //[Property("CRITERIA", "MR")]
241 //[Property("AUTHOR", "guowei.wang@samsung.com")]
242 //public void WatchApplicationNewWithStringsAndStylesheet()
244 // tlog.Debug(tag, $"WatchApplicationNewWithStringsAndStylesheet START");
248 // var args = new string[] { "Dali-demo" };
249 // var stylesheet = resource + "style/Test_Style_Manager.json";
250 // var testingTarget = WatchApplication.NewWatchApplication(args, stylesheet);
251 // Assert.IsNotNull(testingTarget, "should be not null");
252 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
254 // testingTarget.Dispose();
256 // catch (Exception e)
258 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_New__SWIG_2' in shared library 'libdali2-csharp-binder.so' */
259 // tlog.Debug(tag, e.Message.ToString());
260 // Assert.Fail("Caught Exception: Failed!");
263 // tlog.Debug(tag, $"WatchApplicationNewWithStringsAndStylesheet END (OK)");
268 [Description("WatchApplication.TimeTickEventArgs. Application.")]
269 [Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickEventArgs.Application A")]
270 [Property("SPEC_URL", "-")]
271 [Property("CRITERIA", "PRW")]
272 [Property("AUTHOR", "guowei.wang@samsung.com")]
273 public void WatchApplicationTimeTickEventArgsApplication()
275 tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplication START");
277 var testingTarget = new TimeTickEventArgs();
278 Assert.IsNotNull(testingTarget, "should be not null");
279 Assert.IsInstanceOf<TimeTickEventArgs>(testingTarget, "should be an instance of testing target class!");
281 Widget widget = new Widget();
282 var application = new WidgetApplication(widget.GetIntPtr(), false);
283 testingTarget.Application = application;
284 Assert.IsNotNull(testingTarget.Application, "should be not null.");
288 tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsApplication END (OK)");
293 [Description("WatchApplication.TimeTickEventArgs. WatchTime.")]
294 [Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickEventArgs.WatchTime A")]
295 [Property("SPEC_URL", "-")]
296 [Property("CRITERIA", "PRW")]
297 [Property("AUTHOR", "guowei.wang@samsung.com")]
298 public void WatchApplicationTimeTickEventArgsWatchTime()
300 tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTime START");
302 var testingTarget = new TimeTickEventArgs();
303 Assert.IsNotNull(testingTarget, "should be not null");
304 Assert.IsInstanceOf<TimeTickEventArgs>(testingTarget, "should be an instance of testing target class!");
306 Widget widget = new Widget();
307 using (WatchTime time = new WatchTime(widget.GetIntPtr(), false))
309 testingTarget.WatchTime = time;
310 Assert.IsNotNull(testingTarget.WatchTime);
315 tlog.Debug(tag, $"WatchApplicationTimeTickEventArgsWatchTime END (OK)");
320 //[Description("WatchApplication.TimeTick.")]
321 //[Property("SPEC", "Tizen.NUI.WatchApplication.TimeTick A")]
322 //[Property("SPEC_URL", "-")]
323 //[Property("CRITERIA", "PRW")]
324 //[Property("AUTHOR", "guowei.wang@samsung.com")]
325 //public void WatchApplicationTimeTick()
327 // tlog.Debug(tag, $"WatchApplicationTimeTick START");
329 // using (ImageView imageView = new ImageView())
331 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
332 // Assert.IsNotNull(testingTarget, "should be not null");
333 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
335 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_TimeTickSignal' in shared library 'libdali2-csharp-binder.so' */
336 // testingTarget.TimeTick += MyOnTimeTick;
337 // testingTarget.TimeTick -= MyOnTimeTick;
339 // testingTarget.Dispose();
342 // tlog.Debug(tag, $"WatchApplicationTimeTick END (OK)");
347 //[Description("WatchApplication.TimeTickSignal.")]
348 //[Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickSignal A")]
349 //[Property("SPEC_URL", "-")]
350 //[Property("CRITERIA", "PRW")]
351 //[Property("AUTHOR", "guowei.wang@samsung.com")]
352 //public void WatchApplicationTimeTickSignal()
354 // tlog.Debug(tag, $"WatchApplicationTimeTickSignal START");
356 // using (ImageView imageView = new ImageView())
358 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
359 // Assert.IsNotNull(testingTarget, "should be not null");
360 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
364 // testingTarget.TimeTickSignal();
366 // catch (Exception e)
368 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_TimeTickSignal' in shared library 'libdali2-csharp-binder.so' */
369 // tlog.Debug(tag, e.Message.ToString());
370 // Assert.Fail("Caught Exception: Failed!");
374 // tlog.Debug(tag, $"WatchApplicationTimeTickSignal END (OK)");
377 private void MyOnTimeTick(object sender, TimeTickEventArgs e) { }
381 [Description("WatchApplication.AmbientTickEventArgs. Application.")]
382 [Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickEventArgs.Application A")]
383 [Property("SPEC_URL", "-")]
384 [Property("CRITERIA", "PRW")]
385 [Property("AUTHOR", "guowei.wang@samsung.com")]
386 public void WatchApplicationAmbientTickEventArgsApplication()
388 tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplication START");
390 var testingTarget = new AmbientTickEventArgs();
391 Assert.IsNotNull(testingTarget, "should be not null");
392 Assert.IsInstanceOf<AmbientTickEventArgs>(testingTarget, "should be an instance of AmbientTickEventArgs class!");
394 Widget widget = new Widget();
395 var application = new WidgetApplication(widget.GetIntPtr(), false);
396 testingTarget.Application = application;
397 Assert.IsNotNull(testingTarget.Application, "should be not null.");
401 tlog.Debug(tag, $"WatchApplicationAmbientTickEventArgsApplication END (OK)");
406 [Description("WatchApplication.AmbientTickEventArgs.WatchTime")]
407 [Property("SPEC", "Tizen.NUI.WatchApplication.AmbientTickEventArgs.WatchTime A")]
408 [Property("SPEC_URL", "-")]
409 [Property("CRITERIA", "PRW")]
410 [Property("AUTHOR", "guowei.wang@samsung.com")]
411 public void WatchApplicationAmbientTickArgsWatchTime()
413 tlog.Debug(tag, $"WatchApplicationAmbientTickArgsWatchTime START");
415 var testingTarget = new AmbientTickEventArgs();
416 Assert.IsNotNull(testingTarget, "should be not null");
417 Assert.IsInstanceOf<AmbientTickEventArgs>(testingTarget, "should be an instance of testing target class!");
419 Widget widget = new Widget();
420 using (WatchTime time = new WatchTime(widget.GetIntPtr(), false))
422 testingTarget.WatchTime = time;
423 Assert.IsNotNull(testingTarget.WatchTime);
428 tlog.Debug(tag, $"WatchApplicationAmbientTickArgsWatchTime END (OK)");
433 //[Description("WatchApplication.AmbientTick.")]
434 //[Property("SPEC", "Tizen.NUI.WatchApplication.AmbientTick A")]
435 //[Property("SPEC_URL", "-")]
436 //[Property("CRITERIA", "PRW")]
437 //[Property("AUTHOR", "guowei.wang@samsung.com")]
438 //public void WatchApplicationAmbientTick()
440 // tlog.Debug(tag, $"WatchApplicationAmbientTick START");
442 // using (ImageView imageView = new ImageView())
444 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
445 // Assert.IsNotNull(testingTarget, "should be not null");
446 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
448 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_AmbientTickSignal' in shared library 'libdali2-csharp-binder.so' */
449 // testingTarget.AmbientTick += MyOnAmbientTick;
450 // testingTarget.AmbientTick -= MyOnAmbientTick;
452 // testingTarget.Dispose();
455 // tlog.Debug(tag, $"WatchApplicationAmbientTick END (OK)");
458 //private void MyOnAmbientTick(object sender, AmbientTickEventArgs e) { }
462 //[Description("WatchApplication.AmbientTickSignal.")]
463 //[Property("SPEC", "Tizen.NUI.WatchApplication.AmbientTickSignal A")]
464 //[Property("SPEC_URL", "-")]
465 //[Property("CRITERIA", "PRW")]
466 //[Property("AUTHOR", "guowei.wang@samsung.com")]
467 //public void WatchApplicationAmbientTickSignal()
469 // tlog.Debug(tag, $"WatchApplicationAmbientTickSignal START");
471 // using (ImageView imageView = new ImageView())
473 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
474 // Assert.IsNotNull(testingTarget, "should be not null");
475 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
479 // testingTarget.AmbientTickSignal();
481 // catch (Exception e)
483 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_AmbientTickSignal' in shared library 'libdali2-csharp-binder.so' */
484 // tlog.Debug(tag, e.Message.ToString());
485 // Assert.Fail("Caught Exception: Failed!");
489 // tlog.Debug(tag, $"WatchApplicationAmbientTickSignal END (OK)");
494 [Description("WatchApplication.AmbientChangedEventArgs. Application.")]
495 [Property("SPEC", "Tizen.NUI.WatchApplication.TimeTickEventArgs.WatchTime A")]
496 [Property("SPEC_URL", "-")]
497 [Property("CRITERIA", "PRW")]
498 [Property("AUTHOR", "guowei.wang@samsung.com")]
499 public void WatchApplicationAmbientChangedEventArgsApplication()
501 tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplication START");
503 var testingTarget = new AmbientChangedEventArgs();
504 Assert.IsNotNull(testingTarget, "should be not null");
505 Assert.IsInstanceOf<AmbientChangedEventArgs>(testingTarget, "should be an instance of AmbientChangedEventArgs class!");
507 Widget widget = new Widget();
508 var application = new WidgetApplication(widget.GetIntPtr(), false);
509 testingTarget.Application = application;
510 Assert.IsNotNull(testingTarget.Application, "should be not null.");
514 tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsApplication END (OK)");
519 [Description("WatchApplication.AmbientChangedEventArgs. Changed.")]
520 [Property("SPEC", "Tizen.NUI.WatchApplication.AmbientChangedEventArgs.Changed A")]
521 [Property("SPEC_URL", "-")]
522 [Property("CRITERIA", "PRW")]
523 [Property("AUTHOR", "guowei.wang@samsung.com")]
524 public void WatchApplicationAmbientChangedEventArgsChangedSet()
526 tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedSet START");
528 var testingTarget = new AmbientChangedEventArgs();
529 Assert.IsNotNull(testingTarget, "should be not null");
530 Assert.IsInstanceOf<AmbientChangedEventArgs>(testingTarget, "should be an instance of AmbientChangedEventArgs class!");
532 testingTarget.Changed = true;
533 Assert.AreEqual(true, testingTarget.Changed, "Retrieved result should be equal to true. ");
535 testingTarget.Changed = false;
536 Assert.AreEqual(false, testingTarget.Changed, "Retrieved result should be equal to true. ");
538 tlog.Debug(tag, $"WatchApplicationAmbientChangedEventArgsChangedSet END (OK)");
543 //[Description("WatchApplication.AmbientChanged.")]
544 //[Property("SPEC", "Tizen.NUI.WatchApplication.AmbientChanged A")]
545 //[Property("SPEC_URL", "-")]
546 //[Property("CRITERIA", "PRW")]
547 //[Property("AUTHOR", "guowei.wang@samsung.com")]
548 //public void WatchApplicationAmbientChanged()
550 // tlog.Debug(tag, $"WatchApplicationAmbientChanged START");
552 // using (ImageView imageView = new ImageView())
554 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
555 // Assert.IsNotNull(testingTarget, "should be not null");
556 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
558 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_AmbientChangedSignal' in shared library 'libdali2-csharp-binder.so' */
559 // testingTarget.AmbientChanged += MyOnAmbientChanged;
560 // testingTarget.AmbientChanged -= MyOnAmbientChanged;
562 // testingTarget.Dispose();
565 // tlog.Debug(tag, $"WatchApplicationAmbientChanged END (OK)");
568 //private void MyOnAmbientChanged(object sender, AmbientChangedEventArgs e) { }
572 //[Description("WatchApplication.AmbientChangedSignal.")]
573 //[Property("SPEC", "Tizen.NUI.WatchApplication.AmbientChangedSignal A")]
574 //[Property("SPEC_URL", "-")]
575 //[Property("CRITERIA", "PRW")]
576 //[Property("AUTHOR", "guowei.wang@samsung.com")]
577 //public void WatchApplicationAmbientChangedSignal()
579 // tlog.Debug(tag, $"WatchApplicationAmbientChangedSignal START");
581 // using (ImageView imageView = new ImageView())
583 // var testingTarget = new WatchApplication(imageView.SwigCPtr.Handle, false);
584 // Assert.IsNotNull(testingTarget, "should be not null");
585 // Assert.IsInstanceOf<WatchApplication>(testingTarget, "should be an instance of testing target class!");
589 // testingTarget.AmbientChangedSignal();
591 // catch (Exception e)
593 // /** Unable to find an entry point named 'CSharp_Dali_WatchApplication_AmbientChangedSignal' in shared library 'libdali2-csharp-binder.so' */
594 // tlog.Debug(tag, e.Message.ToString());
595 // Assert.Fail("Caught Exception: Failed!");
599 // tlog.Debug(tag, $"WatchApplicationAmbientChangedSignal END (OK)");