[NUI] Add public window TCs
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Window / TSWindow.cs
1 using NUnit.Framework;
2 using System;
3 using System.Collections.Generic;
4 using static Tizen.NUI.Window;
5
6 namespace Tizen.NUI.Devel.Tests
7 {
8     using tlog = Tizen.Log;
9
10     [TestFixture]
11     [Description("public/Window/Window")]
12     internal class PublicWindowTest
13     {
14         private const string tag = "NUITEST";
15         private static Window myWin;
16         [SetUp]
17         public void Init()
18         {
19             Rectangle r1 = new Rectangle(0, 0, 20, 20);
20             myWin = new Window(r1);
21             tlog.Info(tag, "Init() is called!");
22         }
23
24         [TearDown]
25         public void Destroy()
26         {
27             if (myWin != null)
28             {
29                 myWin.Dispose();
30                 myWin = null;
31             }
32             tlog.Info(tag, "Destroy() is called!");
33         }
34
35         [Test]
36         [Category("P1")]
37         [Description("Window WindowPositionSize")]
38         [Property("SPEC", "Tizen.NUI.Window.WindowPositionSize A")]
39         [Property("SPEC_URL", "-")]
40         [Property("CRITERIA", "PRW")]
41         public void WindowWindowPositionSize()
42         {
43             tlog.Debug(tag, $"WindowWindowPositionSize START");
44             try
45             {
46                 Rectangle r1 = myWin.WindowPositionSize;
47                 myWin.WindowPositionSize = r1;
48             }
49             catch (Exception e)
50             {
51                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
52
53                 Assert.Fail("Caught Exception" + e.ToString());
54             }
55             tlog.Debug(tag, $"WindowWindowPositionSize END (OK)");
56             Assert.Pass("WindowWindowPositionSize");
57         }
58
59         [Test]
60         [Category("P1")]
61         [Description("Window DEFAULT_BACKGROUND_COLOR")]
62         [Property("SPEC", "Tizen.NUI.Window.DEFAULT_BACKGROUND_COLOR A")]
63         [Property("SPEC_URL", "-")]
64         [Property("CRITERIA", "PRW")]
65         public void WindowDEFAULT_BACKGROUND_COLOR()
66         {
67             tlog.Debug(tag, $"WindowDEFAULT_BACKGROUND_COLOR START");
68             try
69             {
70                 Vector4 v1 = Window.DEFAULT_BACKGROUND_COLOR;
71             }
72             catch (Exception e)
73             {
74                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
75
76                 Assert.Fail("Caught Exception" + e.ToString());
77             }
78             tlog.Debug(tag, $"WindowDEFAULT_BACKGROUND_COLOR END (OK)");
79             Assert.Pass("WindowDEFAULT_BACKGROUND_COLOR");
80         }
81
82         [Test]
83         [Category("P1")]
84         [Description("Window DEBUG_BACKGROUND_COLOR")]
85         [Property("SPEC", "Tizen.NUI.Window.DEBUG_BACKGROUND_COLOR A")]
86         [Property("SPEC_URL", "-")]
87         [Property("CRITERIA", "PRW")]
88         public void WindowDEBUG_BACKGROUND_COLOR()
89         {
90             tlog.Debug(tag, $"WindowDEBUG_BACKGROUND_COLOR START");
91             try
92             {
93                 Vector4 v1 = Window.DEBUG_BACKGROUND_COLOR;
94             }
95             catch (Exception e)
96             {
97                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
98
99                 Assert.Fail("Caught Exception" + e.ToString());
100             }
101             tlog.Debug(tag, $"WindowDEBUG_BACKGROUND_COLOR END (OK)");
102             Assert.Pass("WindowDEBUG_BACKGROUND_COLOR");
103         }
104
105         [Test]
106         [Category("P1")]
107         [Description("Window GetLayer")]
108         [Property("SPEC", "Tizen.NUI.Window.GetLayer M")]
109         [Property("SPEC_URL", "-")]
110         [Property("CRITERIA", "MR")]
111         public void WindowGetLayer()
112         {
113             tlog.Debug(tag, $"WindowGetLayer START");
114             try
115             {
116                 myWin.GetLayer(65535);
117             }
118             catch (Exception e)
119             {
120                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
121
122                 Assert.Fail("Caught Exception" + e.ToString());
123             }
124             tlog.Debug(tag, $"WindowGetLayer END (OK)");
125             Assert.Pass("WindowGetLayer");
126         }
127
128         [Test]
129         [Category("P1")]
130         [Description("Window Destroy")]
131         [Property("SPEC", "Tizen.NUI.Window.Destroy M")]
132         [Property("SPEC_URL", "-")]
133         [Property("CRITERIA", "MR")]
134         public void WindowDestroy()
135         {
136             tlog.Debug(tag, $"WindowDestroy START");
137             try
138             {
139                 Rectangle r2 = new Rectangle(0, 0, 20, 20);
140                 Window w1 = new Window(r2);
141
142                 w1.Destroy();
143                 w1 = null;
144             }
145             catch (Exception e)
146             {
147                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
148
149                 Assert.Fail("Caught Exception" + e.ToString());
150             }
151             tlog.Debug(tag, $"WindowDestroy END (OK)");
152             Assert.Pass("WindowDestroy");
153         }
154
155         [Test]
156         [Category("P1")]
157         [Description("Window GetCurrentOrientation")]
158         [Property("SPEC", "Tizen.NUI.Window.GetCurrentOrientation M")]
159         [Property("SPEC_URL", "-")]
160         [Property("CRITERIA", "MR")]
161         public void WindowGetCurrentOrientation()
162         {
163             tlog.Debug(tag, $"WindowGetCurrentOrientation START");
164             try
165             {
166                 myWin.GetCurrentOrientation();
167             }
168             catch (Exception e)
169             {
170                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
171
172                 Assert.Fail("Caught Exception" + e.ToString());
173             }
174             tlog.Debug(tag, $"WindowGetCurrentOrientation END (OK)");
175             Assert.Pass("WindowGetCurrentOrientation");
176         }
177
178         [Test]
179         [Category("P1")]
180         [Description("Window SetAvailableOrientations")]
181         [Property("SPEC", "Tizen.NUI.Window.SetAvailableOrientations M")]
182         [Property("SPEC_URL", "-")]
183         [Property("CRITERIA", "MR")]
184         public void WindowSetAvailableOrientations()
185         {
186             tlog.Debug(tag, $"WindowSetAvailableOrientations START");
187             try
188             {
189                 List<Window.WindowOrientation> l1 = new List<Window.WindowOrientation>();
190                 Window.WindowOrientation o1 = new Window.WindowOrientation();
191
192                 l1.Add(o1);
193                 myWin.SetAvailableOrientations(l1);
194             }
195             catch (Exception e)
196             {
197                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
198
199                 Assert.Fail("Caught Exception" + e.ToString());
200             }
201             tlog.Debug(tag, $"WindowSetAvailableOrientations END (OK)");
202             Assert.Pass("WindowSetAvailableOrientations");
203         }
204
205         [Test]
206         [Category("P1")]
207         [Description("Window GetNativeId")]
208         [Property("SPEC", "Tizen.NUI.Window.GetNativeId M")]
209         [Property("SPEC_URL", "-")]
210         [Property("CRITERIA", "MR")]
211         public void WindowGetNativeId()
212         {
213             tlog.Debug(tag, $"WindowGetNativeId START");
214             try
215             {
216                 myWin.GetNativeId();
217             }
218             catch (Exception e)
219             {
220                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
221
222                 Assert.Fail("Caught Exception" + e.ToString());
223             }
224             tlog.Debug(tag, $"WindowGetNativeId END (OK)");
225             Assert.Pass("WindowGetNativeId");
226         }
227
228         [Test]
229         [Category("P1")]
230         [Description("Window GetNativeHandle")]
231         [Property("SPEC", "Tizen.NUI.Window.GetNativeHandle M")]
232         [Property("SPEC_URL", "-")]
233         [Property("CRITERIA", "MR")]
234         public void WindowGetNativeHandle()
235         {
236             tlog.Debug(tag, $"WindowGetNativeHandle START");
237             try
238             {
239                 myWin.GetNativeHandle();
240             }
241             catch (Exception e)
242             {
243                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
244
245                 Assert.Fail("Caught Exception" + e.ToString());
246             }
247             tlog.Debug(tag, $"WindowGetNativeHandle END (OK)");
248             Assert.Pass("WindowGetNativeHandle");
249         }
250
251         [Test]
252         [Category("P1")]
253         [Description("Window Add")]
254         [Property("SPEC", "Tizen.NUI.Window.Add M")]
255         [Property("SPEC_URL", "-")]
256         [Property("CRITERIA", "MR")]
257         public void WindowAdd()
258         {
259             tlog.Debug(tag, $"WindowAdd START");
260             try
261             {
262                 Layer layer = null;
263                 myWin.Add(layer);
264             }
265             catch (Exception e)
266             {
267                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
268
269                 Assert.Fail("Caught Exception" + e.ToString());
270             }
271             tlog.Debug(tag, $"WindowAdd END (OK)");
272             Assert.Pass("WindowAdd");
273         }
274
275         [Test]
276         [Category("P1")]
277         [Description("Window Remove")]
278         [Property("SPEC", "Tizen.NUI.Window.Remove M")]
279         [Property("SPEC_URL", "-")]
280         [Property("CRITERIA", "MR")]
281         public void WindowRemove()
282         {
283             tlog.Debug(tag, $"WindowRemove START");
284             try
285             {
286                 Layer layer = null;
287                 myWin.Remove(layer);
288             }
289             catch (Exception e)
290             {
291                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
292
293                 Assert.Fail("Caught Exception" + e.ToString());
294             }
295             tlog.Debug(tag, $"WindowRemove END (OK)");
296             Assert.Pass("WindowRemove");
297         }
298
299         [Test]
300         [Category("P1")]
301         [Description("Window GetRenderTaskList")]
302         [Property("SPEC", "Tizen.NUI.Window.GetRenderTaskList M")]
303         [Property("SPEC_URL", "-")]
304         [Property("CRITERIA", "MR")]
305         public void WindowGetRenderTaskList()
306         {
307             tlog.Debug(tag, $"WindowGetRenderTaskList START");
308             try
309             {
310                 myWin.GetRenderTaskList();
311             }
312             catch (Exception e)
313             {
314                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
315
316                 Assert.Fail("Caught Exception" + e.ToString());
317             }
318             tlog.Debug(tag, $"WindowGetRenderTaskList END (OK)");
319             Assert.Pass("WindowGetRenderTaskList");
320         }
321
322         [Test]
323         [Category("P1")]
324         [Description("Window GetObjectRegistry")]
325         [Property("SPEC", "Tizen.NUI.Window.GetObjectRegistry M")]
326         [Property("SPEC_URL", "-")]
327         [Property("CRITERIA", "MR")]
328         public void WindowGetObjectRegistry()
329         {
330             tlog.Debug(tag, $"WindowGetObjectRegistry START");
331             try
332             {
333                 myWin.GetObjectRegistry();
334             }
335             catch (Exception e)
336             {
337                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
338
339                 Assert.Fail("Caught Exception" + e.ToString());
340             }
341             tlog.Debug(tag, $"WindowGetObjectRegistry END (OK)");
342             Assert.Pass("WindowGetObjectRegistry");
343         }
344
345         [Test]
346         [Category("P1")]
347         [Description("Window SetWindowSize")]
348         [Property("SPEC", "Tizen.NUI.Window.SetWindowSize M")]
349         [Property("SPEC_URL", "-")]
350         [Property("CRITERIA", "MR")]
351         public void WindowSetWindowSize()
352         {
353             tlog.Debug(tag, $"WindowSetWindowSize START");
354             try
355             {
356                 Size2D s1 = null;
357                 myWin.SetWindowSize(s1);
358             }
359             catch (Exception e)
360             {
361                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
362
363                 Assert.Fail("Caught Exception" + e.ToString());
364             }
365             tlog.Debug(tag, $"WindowSetWindowSize END (OK)");
366             Assert.Pass("WindowSetWindowSize");
367         }
368
369         [Test]
370         [Category("P1")]
371         [Description("Window SetPosition")]
372         [Property("SPEC", "Tizen.NUI.Window.SetPosition M")]
373         [Property("SPEC_URL", "-")]
374         [Property("CRITERIA", "MR")]
375         public void WindowSetPosition()
376         {
377             tlog.Debug(tag, $"WindowSetPosition START");
378             try
379             {
380                 Position2D p1 = null;
381                 myWin.SetPosition(p1);
382             }
383             catch (Exception e)
384             {
385                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
386
387                 Assert.Fail("Caught Exception" + e.ToString());
388             }
389             tlog.Debug(tag, $"WindowSetPosition END (OK)");
390             Assert.Pass("WindowSetPosition");
391         }
392
393         [Test]
394         [Category("P1")]
395         [Description("Window SetPositionSize")]
396         [Property("SPEC", "Tizen.NUI.Window.SetPositionSize M")]
397         [Property("SPEC_URL", "-")]
398         [Property("CRITERIA", "MR")]
399         public void WindowSetPositionSize()
400         {
401             tlog.Debug(tag, $"WindowSetPositionSize START");
402             try
403             {
404                 Rectangle r1 = new Rectangle(0, 0, 20, 20);
405                 myWin.SetPositionSize(r1);
406             }
407             catch (Exception e)
408             {
409                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
410
411                 Assert.Fail("Caught Exception" + e.ToString());
412             }
413             tlog.Debug(tag, $"WindowSetPositionSize END (OK)");
414             Assert.Pass("WindowSetPositionSize");
415         }
416
417         [Test]
418         [Category("P1")]
419         [Description("Window AddFrameUpdateCallback")]
420         [Property("SPEC", "Tizen.NUI.Window.AddFrameUpdateCallback M")]
421         [Property("SPEC_URL", "-")]
422         [Property("CRITERIA", "MR")]
423         public void WindowAddFrameUpdateCallback()
424         {
425             tlog.Debug(tag, $"WindowAddFrameUpdateCallback START");
426             try
427             {
428                 FrameUpdateCallbackInterface f1 = new FrameUpdateCallbackInterface();
429                 myWin.AddFrameUpdateCallback(f1);
430             }
431             catch (Exception e)
432             {
433                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
434
435                 Assert.Fail("Caught Exception" + e.ToString());
436             }
437             tlog.Debug(tag, $"WindowAddFrameUpdateCallback END (OK)");
438             Assert.Pass("WindowAddFrameUpdateCallback");
439         }
440
441         [Test]
442         [Category("P1")]
443         [Description("Window RemoveFrameUpdateCallback")]
444         [Property("SPEC", "Tizen.NUI.Window.RemoveFrameUpdateCallback M")]
445         [Property("SPEC_URL", "-")]
446         [Property("CRITERIA", "MR")]
447         public void WindowRemoveFrameUpdateCallback()
448         {
449             tlog.Debug(tag, $"WindowRemoveFrameUpdateCallback START");
450             try
451             {
452                 FrameUpdateCallbackInterface f1 = new FrameUpdateCallbackInterface();
453                 myWin.RemoveFrameUpdateCallback(f1);
454             }
455             catch (Exception e)
456             {
457                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
458
459                 Assert.Fail("Caught Exception" + e.ToString());
460             }
461             tlog.Debug(tag, $"WindowRemoveFrameUpdateCallback END (OK)");
462             Assert.Pass("WindowRemoveFrameUpdateCallback");
463         }
464
465         [Test]
466         [Category("P1")]
467         [Description("Window AddFrameRenderedCallback")]
468         [Property("SPEC", "Tizen.NUI.Window.AddFrameRenderedCallback M")]
469         [Property("SPEC_URL", "-")]
470         [Property("CRITERIA", "MR")]
471         public void WindowAddFrameRenderedCallback()
472         {
473             tlog.Debug(tag, $"WindowAddFrameRenderedCallback START");
474             try
475             {
476                 FrameCallbackType f1 = null;
477                 myWin.AddFrameRenderedCallback(f1, 1);
478             }
479             catch (Exception e)
480             {
481                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
482
483                 Assert.Fail("Caught Exception" + e.ToString());
484             }
485             tlog.Debug(tag, $"WindowAddFrameRenderedCallback END (OK)");
486             Assert.Pass("WindowAddFrameRenderedCallback");
487         }
488
489         [Test]
490         [Category("P1")]
491         [Description("Window AddFramePresentedCallback")]
492         [Property("SPEC", "Tizen.NUI.Window.AddFramePresentedCallback M")]
493         [Property("SPEC_URL", "-")]
494         [Property("CRITERIA", "MR")]
495         public void WindowAddFramePresentedCallback()
496         {
497             tlog.Debug(tag, $"WindowAddFramePresentedCallback START");
498             try
499             {
500                 FrameCallbackType f1 = null;
501                 myWin.AddFramePresentedCallback(f1, 1);
502             }
503             catch (Exception e)
504             {
505                 Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
506
507                 Assert.Fail("Caught Exception" + e.ToString());
508             }
509             tlog.Debug(tag, $"WindowAddFramePresentedCallback END (OK)");
510             Assert.Pass("WindowAddFramePresentedCallback");
511         }
512     }
513 }