1 using NUnit.Framework;
3 using System.Collections.Generic;
4 using static Tizen.NUI.Window;
6 namespace Tizen.NUI.Devel.Tests
8 using tlog = Tizen.Log;
11 [Description("public/Window/Window")]
12 internal class PublicWindowTest
14 private const string tag = "NUITEST";
15 private Window win = null;
16 private Rectangle rec = null;
21 tlog.Info(tag, "Init() is called!");
23 rec = new Rectangle(0, 0, 2, 2);
24 win = new Window(rec);
37 tlog.Info(tag, "Destroy() is called!");
42 [Description("Window WindowPositionSize")]
43 [Property("SPEC", "Tizen.NUI.Window.WindowPositionSize A")]
44 [Property("SPEC_URL", "-")]
45 [Property("CRITERIA", "PRW")]
46 public void WindowWindowPositionSize()
48 tlog.Debug(tag, $"WindowWindowPositionSize START");
52 using (Rectangle size = new Rectangle(1, 2, 3, 4))
54 win.WindowPositionSize = size;
55 tlog.Debug(tag, "WindowPositionSize : " + win.WindowPositionSize);
60 tlog.Debug(tag, e.Message.ToString());
61 Assert.Fail("Caught Exception : Failed!");
64 tlog.Debug(tag, $"WindowWindowPositionSize END (OK)");
69 //[Description("Window DEFAULT_BACKGROUND_COLOR")]
70 //[Property("SPEC", "Tizen.NUI.Window.DEFAULT_BACKGROUND_COLOR A")]
71 //[Property("SPEC_URL", "-")]
72 //[Property("CRITERIA", "PRW")]
73 //public void WindowDEFAULT_BACKGROUND_COLOR()
75 // tlog.Debug(tag, $"WindowDEFAULT_BACKGROUND_COLOR START");
78 // Vector4 v1 = Window.DEFAULT_BACKGROUND_COLOR;
80 // catch (Exception e)
82 // Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
84 // Assert.Fail("Caught Exception" + e.ToString());
86 // tlog.Debug(tag, $"WindowDEFAULT_BACKGROUND_COLOR END (OK)");
87 // Assert.Pass("WindowDEFAULT_BACKGROUND_COLOR");
92 //[Description("Window DEBUG_BACKGROUND_COLOR")]
93 //[Property("SPEC", "Tizen.NUI.Window.DEBUG_BACKGROUND_COLOR A")]
94 //[Property("SPEC_URL", "-")]
95 //[Property("CRITERIA", "PRW")]
96 //public void WindowDEBUG_BACKGROUND_COLOR()
98 // tlog.Debug(tag, $"WindowDEBUG_BACKGROUND_COLOR START");
101 // Vector4 v1 = Window.DEBUG_BACKGROUND_COLOR;
103 // catch (Exception e)
105 // Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
107 // Assert.Fail("Caught Exception" + e.ToString());
109 // tlog.Debug(tag, $"WindowDEBUG_BACKGROUND_COLOR END (OK)");
110 // Assert.Pass("WindowDEBUG_BACKGROUND_COLOR");
115 [Description("Window GetLayer")]
116 [Property("SPEC", "Tizen.NUI.Window.GetLayer M")]
117 [Property("SPEC_URL", "-")]
118 [Property("CRITERIA", "MR")]
119 public void WindowGetLayer()
121 tlog.Debug(tag, $"WindowGetLayer START");
129 tlog.Debug(tag, e.Message.ToString());
130 Assert.Fail("Caught Exception : Failed!");
132 tlog.Debug(tag, $"WindowGetLayer END (OK)");
137 [Description("Window GetCurrentOrientation")]
138 [Property("SPEC", "Tizen.NUI.Window.GetCurrentOrientation M")]
139 [Property("SPEC_URL", "-")]
140 [Property("CRITERIA", "MR")]
141 public void WindowGetCurrentOrientation()
143 tlog.Debug(tag, $"WindowGetCurrentOrientation START");
147 win.GetCurrentOrientation();
151 tlog.Debug(tag, e.Message.ToString());
152 Assert.Fail("Caught Exception : Failed!");
155 tlog.Debug(tag, $"WindowGetCurrentOrientation END (OK)");
160 [Description("Window SetAvailableOrientations")]
161 [Property("SPEC", "Tizen.NUI.Window.SetAvailableOrientations M")]
162 [Property("SPEC_URL", "-")]
163 [Property("CRITERIA", "MR")]
164 public void WindowSetAvailableOrientations()
166 tlog.Debug(tag, $"WindowSetAvailableOrientations START");
169 List<Window.WindowOrientation> list = new List<Window.WindowOrientation>();
171 list.Add(Window.WindowOrientation.Landscape);
172 list.Add(Window.WindowOrientation.LandscapeInverse);
173 list.Add(Window.WindowOrientation.NoOrientationPreference);
174 list.Add(Window.WindowOrientation.Portrait);
175 list.Add(Window.WindowOrientation.PortraitInverse);
177 win.SetAvailableOrientations(list);
181 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
182 Assert.Fail("Caught Exception" + e.ToString());
185 tlog.Debug(tag, $"WindowSetAvailableOrientations END (OK)");
186 Assert.Pass("WindowSetAvailableOrientations");
191 [Description("Window SetAvailableOrientations")]
192 [Property("SPEC", "Tizen.NUI.Window.SetAvailableOrientations M")]
193 [Property("SPEC_URL", "-")]
194 [Property("CRITERIA", "MR")]
195 public void WindowSetAvailableOrientationsWithNullList()
197 tlog.Debug(tag, $"WindowSetAvailableOrientationsWithNullList START");
199 List<Window.WindowOrientation> list = null;
203 win.SetAvailableOrientations(list);
205 catch (ArgumentNullException e)
207 tlog.Debug(tag, e.Message.ToString());
208 tlog.Debug(tag, $"WindowSetAvailableOrientationsWithNullList END (OK)");
209 Assert.Pass("Caught ArgumentNullException : Passed!");
215 [Description("Window SetPositionSizeWithOrientation")]
216 [Property("SPEC", "Tizen.NUI.Window.SetPositionSizeWithOrientation M")]
217 [Property("SPEC_URL", "-")]
218 [Property("CRITERIA", "MR")]
219 public void WindowSetPositionSizeWithOrientation()
221 tlog.Debug(tag, $"WindowSetPositionSizeWithOrientation START");
225 using (Rectangle positionSize = new Rectangle(1, 2, 3, 4))
227 win.SetPositionSizeWithOrientation(positionSize, Window.WindowOrientation.Landscape);
232 tlog.Debug(tag, e.Message.ToString());
233 Assert.Fail("Caught Exception : Failed!");
236 tlog.Debug(tag, $"WindowSetPositionSizeWithOrientation END (OK)");
241 [Description("Window GetNativeId")]
242 [Property("SPEC", "Tizen.NUI.Window.GetNativeId M")]
243 [Property("SPEC_URL", "-")]
244 [Property("CRITERIA", "MR")]
245 public void WindowGetNativeId()
247 tlog.Debug(tag, $"WindowGetNativeId START");
255 tlog.Debug(tag, e.Message.ToString());
256 Assert.Fail("Caught Exception : Failed!");
259 tlog.Debug(tag, $"WindowGetNativeId END (OK)");
264 [Description("Window GetNativeHandle")]
265 [Property("SPEC", "Tizen.NUI.Window.GetNativeHandle M")]
266 [Property("SPEC_URL", "-")]
267 [Property("CRITERIA", "MR")]
268 public void WindowGetNativeHandle()
270 tlog.Debug(tag, $"WindowGetNativeHandle START");
274 win.GetNativeHandle();
278 tlog.Debug(tag, e.Message.ToString());
279 Assert.Fail("Caught Exception : Failed!");
282 tlog.Debug(tag, $"WindowGetNativeHandle END (OK)");
287 [Description("Window Add")]
288 [Property("SPEC", "Tizen.NUI.Window.Add M")]
289 [Property("SPEC_URL", "-")]
290 [Property("CRITERIA", "MR")]
291 public void WindowAdd()
293 tlog.Debug(tag, $"WindowAdd START");
300 catch (ArgumentNullException e)
302 tlog.Debug(tag, e.Message.ToString());
303 tlog.Debug(tag, $"WindowAdd END (OK)");
304 Assert.Pass("Caught ArgumentNullException : Passed!");
310 [Description("Window Remove")]
311 [Property("SPEC", "Tizen.NUI.Window.Remove M")]
312 [Property("SPEC_URL", "-")]
313 [Property("CRITERIA", "MR")]
314 public void WindowRemove()
316 tlog.Debug(tag, $"WindowRemove START");
323 catch (ArgumentNullException e)
325 tlog.Debug(tag, e.Message.ToString());
326 tlog.Debug(tag, $"WindowRemove END (OK)");
327 Assert.Pass("Caught ArgumentNullException : Passed!");
333 [Description("Window GetRenderTaskList")]
334 [Property("SPEC", "Tizen.NUI.Window.GetRenderTaskList M")]
335 [Property("SPEC_URL", "-")]
336 [Property("CRITERIA", "MR")]
337 public void WindowGetRenderTaskList()
339 tlog.Debug(tag, $"WindowGetRenderTaskList START");
342 win.GetRenderTaskList();
346 tlog.Debug(tag, e.Message.ToString());
347 Assert.Fail("Caught Exception : Failed!");
350 tlog.Debug(tag, $"WindowGetRenderTaskList END (OK)");
355 //[Description("Window GetObjectRegistry")]
356 //[Property("SPEC", "Tizen.NUI.Window.GetObjectRegistry M")]
357 //[Property("SPEC_URL", "-")]
358 //[Property("CRITERIA", "MR")]
359 //public void WindowGetObjectRegistry()
361 // tlog.Debug(tag, $"WindowGetObjectRegistry START");
364 // win.GetObjectRegistry();
366 // catch (Exception e)
368 // Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
370 // Assert.Fail("Caught Exception" + e.ToString());
372 // tlog.Debug(tag, $"WindowGetObjectRegistry END (OK)");
373 // Assert.Pass("WindowGetObjectRegistry");
378 [Description("Window SetWindowSize")]
379 [Property("SPEC", "Tizen.NUI.Window.SetWindowSize M")]
380 [Property("SPEC_URL", "-")]
381 [Property("CRITERIA", "MR")]
382 public void WindowSetWindowSize()
384 tlog.Debug(tag, $"WindowSetWindowSize START");
389 win.SetWindowSize(s1);
391 catch (ArgumentNullException e)
393 tlog.Debug(tag, e.Message.ToString());
394 tlog.Debug(tag, $"WindowSetWindowSize END (OK)");
395 Assert.Pass("Caught ArgumentNullException : Passed!");
401 [Description("Window SetPosition")]
402 [Property("SPEC", "Tizen.NUI.Window.SetPosition M")]
403 [Property("SPEC_URL", "-")]
404 [Property("CRITERIA", "MR")]
405 public void WindowSetPosition()
407 tlog.Debug(tag, $"WindowSetPosition START");
411 Position2D p1 = null;
414 catch (ArgumentNullException e)
416 tlog.Debug(tag, e.Message.ToString());
417 tlog.Debug(tag, $"WindowSetPosition END (OK)");
418 Assert.Pass("Caught ArgumentNullException : Passed!");
424 [Description("Window SetPositionSize")]
425 [Property("SPEC", "Tizen.NUI.Window.SetPositionSize M")]
426 [Property("SPEC_URL", "-")]
427 [Property("CRITERIA", "MR")]
428 public void WindowSetPositionSize()
430 tlog.Debug(tag, $"WindowSetPositionSize START");
433 Rectangle r1 = new Rectangle(0, 0, 20, 20);
434 win.SetPositionSize(r1);
438 tlog.Debug(tag, e.Message.ToString());
439 Assert.Fail("Caught Exception : Failed!");
441 tlog.Debug(tag, $"WindowSetPositionSize END (OK)");
446 [Description("Window AddFrameUpdateCallback")]
447 [Property("SPEC", "Tizen.NUI.Window.AddFrameUpdateCallback M")]
448 [Property("SPEC_URL", "-")]
449 [Property("CRITERIA", "MR")]
450 public void WindowAddFrameUpdateCallback()
452 tlog.Debug(tag, $"WindowAddFrameUpdateCallback START");
455 FrameUpdateCallbackInterface f1 = new FrameUpdateCallbackInterface();
456 win.AddFrameUpdateCallback(f1);
460 tlog.Debug(tag, e.Message.ToString());
461 Assert.Fail("Caught Exception : Failed!");
464 tlog.Debug(tag, $"WindowAddFrameUpdateCallback END (OK)");
469 [Description("Window RemoveFrameUpdateCallback")]
470 [Property("SPEC", "Tizen.NUI.Window.RemoveFrameUpdateCallback M")]
471 [Property("SPEC_URL", "-")]
472 [Property("CRITERIA", "MR")]
473 public void WindowRemoveFrameUpdateCallback()
475 tlog.Debug(tag, $"WindowRemoveFrameUpdateCallback START");
478 FrameUpdateCallbackInterface f1 = new FrameUpdateCallbackInterface();
479 win.RemoveFrameUpdateCallback(f1);
483 tlog.Debug(tag, e.Message.ToString());
484 Assert.Fail("Caught Exception : Failed!");
487 tlog.Debug(tag, $"WindowRemoveFrameUpdateCallback END (OK)");
492 [Description("Window AddFrameRenderedCallback")]
493 [Property("SPEC", "Tizen.NUI.Window.AddFrameRenderedCallback M")]
494 [Property("SPEC_URL", "-")]
495 [Property("CRITERIA", "MR")]
496 public void WindowAddFrameRenderedCallback()
498 tlog.Debug(tag, $"WindowAddFrameRenderedCallback START");
502 FrameCallbackType f1 = null;
503 win.AddFrameRenderedCallback(f1, 1);
505 catch (ArgumentNullException e)
507 tlog.Debug(tag, e.Message.ToString());
508 tlog.Debug(tag, $"WindowAddFrameRenderedCallback END (OK)");
509 Assert.Pass("Caught ArgumentNullException : Passed!");
515 [Description("Window AddFramePresentedCallback")]
516 [Property("SPEC", "Tizen.NUI.Window.AddFramePresentedCallback M")]
517 [Property("SPEC_URL", "-")]
518 [Property("CRITERIA", "MR")]
519 public void WindowAddFramePresentedCallback()
521 tlog.Debug(tag, $"WindowAddFramePresentedCallback START");
525 FrameCallbackType f1 = null;
526 win.AddFramePresentedCallback(f1, 1);
528 catch (ArgumentNullException e)
530 tlog.Debug(tag, e.Message.ToString());
531 tlog.Debug(tag, $"WindowAddFramePresentedCallback END (OK)");
532 Assert.Pass("Caught ArgumentNullException : Passed!");
538 [Description("Window Get")]
539 [Property("SPEC", "Tizen.NUI.Window.Get M")]
540 [Property("SPEC_URL", "-")]
541 [Property("CRITERIA", "MR")]
542 public void WindowGet()
544 tlog.Debug(tag, $"WindowGet START");
546 using (NUI.BaseComponents.View view = new NUI.BaseComponents.View() { Color = Color.Cyan })
548 NUIApplication.GetDefaultWindow().Add(view);
552 var result = Window.Get(view);
556 tlog.Debug(tag, e.Message.ToString());
557 Assert.Fail("Caught Exception : Failed!");
560 NUIApplication.GetDefaultWindow().Remove(view);
563 tlog.Debug(tag, $"WindowGet END (OK)");
568 [Description("Window EnableFloatingMode")]
569 [Property("SPEC", "Tizen.NUI.Window.EnableFloatingMode M")]
570 [Property("SPEC_URL", "-")]
571 [Property("CRITERIA", "MR")]
572 public void WindowEnableFloatingMode()
574 tlog.Debug(tag, $"WindowEnableFloatingMode START");
578 Window.Instance.EnableFloatingMode(true);
582 tlog.Debug(tag, e.Message.ToString());
583 Assert.Fail("Caught Exception : Failed!");
586 tlog.Debug(tag, $"WindowEnableFloatingMode END (OK)");
591 [Description("Window RequestMoveToServer")]
592 [Property("SPEC", "Tizen.NUI.Window.RequestMoveToServer M")]
593 [Property("SPEC_URL", "-")]
594 [Property("CRITERIA", "MR")]
595 public void WindowRequestMoveToServer()
597 tlog.Debug(tag, $"WindowRequestMoveToServer START");
601 Window.Instance.RequestMoveToServer();
605 tlog.Debug(tag, e.Message.ToString());
606 Assert.Fail("Caught Exception : Failed!");
609 tlog.Debug(tag, $"WindowRequestMoveToServer END (OK)");
614 [Description("Window RequestResizeToServer")]
615 [Property("SPEC", "Tizen.NUI.Window.RequestResizeToServer M")]
616 [Property("SPEC_URL", "-")]
617 [Property("CRITERIA", "MR")]
618 public void WindowRequestResizeToServer()
620 tlog.Debug(tag, $"WindowRequestResizeToServer START");
624 Window.Instance.RequestResizeToServer(ResizeDirection.Top);
628 tlog.Debug(tag, e.Message.ToString());
629 Assert.Fail("Caught Exception : Failed!");
632 tlog.Debug(tag, $"WindowRequestResizeToServer END (OK)");