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