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