0a2871e70ac68013527c4717661c0785fdfa3769
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Window / TSGLWindow.cs
1 using NUnit.Framework;
2 using System;
3 using System.Collections.Generic;
4
5 namespace Tizen.NUI.Devel.Tests
6 {
7     using tlog = Tizen.Log;
8
9     [TestFixture]
10     [Description("public/Window/GLWindow.cs")]
11     internal class PublicGLWindowTest
12     {
13         private const string tag = "NUITEST";
14
15         [SetUp]
16         public void Init()
17         {
18             tlog.Info(tag, "Init() is called!");
19         }
20
21         [TearDown]
22         public void Destroy()
23         {
24             tlog.Info(tag, "Destroy() is called!");
25         }
26
27         [Test]
28         [Category("P1")]
29         [Description("GLWindow constructor.")]
30         [Property("SPEC", "Tizen.NUI.GLWindow.GLWindow C")]
31         [Property("SPEC_URL", "-")]
32         [Property("CRITERIA", "CONSTR")]
33         [Property("COVPARAM", "")]
34         public void GLWindowConstructor()
35         {
36             tlog.Debug(tag, $"GLWindowConstructor START");
37
38             var testingTarget = new GLWindow();
39             Assert.IsNotNull(testingTarget, "should be not null");
40             Assert.IsInstanceOf<GLWindow>(testingTarget, "should be an instance of testing target class!");
41
42             testingTarget.Destroy();
43             tlog.Debug(tag, $"GLWindowConstructor END (OK)");
44         }
45
46         [Test]
47         [Category("P1")]
48         [Description("GLWindow constructor. With name.")]
49         [Property("SPEC", "Tizen.NUI.GLWindow.GLWindow C")]
50         [Property("SPEC_URL", "-")]
51         [Property("CRITERIA", "CONSTR")]
52         [Property("COVPARAM", "")]
53         public void GLWindowConstructorWithName()
54         {
55             tlog.Debug(tag, $"GLWindowConstructorWithName START");
56
57             string name = "myGLWindow";
58             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
59             GLWindow a1 = new GLWindow(name, rectangle, true);
60
61             a1.Destroy();
62             tlog.Debug(tag, $"GLWindowConstructorWithName END (OK)");
63         }
64
65         [Test]
66         [Category("P1")]
67         [Description("GLWindow constructor. With GLWindow.")]
68         [Property("SPEC", "Tizen.NUI.GLWindow.GLWindow C")]
69         [Property("SPEC_URL", "-")]
70         [Property("CRITERIA", "CONSTR")]
71         [Property("COVPARAM", "")]
72         public void GLWindowConstructorWithGLWindow()
73         {
74             tlog.Debug(tag, $"GLWindowConstructorWithGLWindow START");
75
76             using (GLWindow glwindow = new GLWindow())
77             {
78                 var testingTarget = new GLWindow(glwindow.SwigCPtr.Handle, false);
79                 Assert.IsNotNull(testingTarget, "should be not null");
80                 Assert.IsInstanceOf<GLWindow>(testingTarget, "should be an instance of testing target class!");
81
82                 testingTarget.Destroy();
83             }
84
85             tlog.Debug(tag, $"GLWindowConstructorWithGLWindow END (OK)");
86         }
87
88         [Test]
89         [Category("P1")]
90         [Description("GLWindow WindowSize")]
91         [Property("SPEC", "Tizen.NUI.GLWindow.WindowSize A")]
92         [Property("SPEC_URL", "-")]
93         [Property("CRITERIA", "PRW")]
94         public void GLWindowWindowSize()
95         {
96             tlog.Debug(tag, $"GLWindowWindowSize START");
97
98             var testingTarget = new GLWindow();
99             Assert.IsNotNull(testingTarget, "Can't create success object GLWindow");
100             Assert.IsInstanceOf<GLWindow>(testingTarget, "Should be an instance of GLWindow type.");
101
102             testingTarget.WindowSize = new Size2D(50, 30);
103             Assert.AreEqual(50, testingTarget.WindowSize.Width, "Should be equal!");
104             Assert.AreEqual(30, testingTarget.WindowSize.Height, "Should be equal!");
105
106             testingTarget.Destroy();
107             tlog.Debug(tag, $"GLWindowWindowSize END (OK)");
108         }
109
110         //[Test]
111         //[Category("P1")]
112         //[Description("GLWindow SetEglConfig")]
113         //[Property("SPEC", "Tizen.NUI.GLWindow.SetEglConfig M")]
114         //[Property("SPEC_URL", "-")]
115         //[Property("CRITERIA", "MR")]
116         //public void GLWindowSetEglConfig()
117         //{
118         //    tlog.Debug(tag, $"GLWindowSetEglConfig START");
119
120         //    var testingTarget = new GLWindow();
121         //    Assert.IsNotNull(testingTarget, "Can't create success object GLWindow");
122         //    Assert.IsInstanceOf<GLWindow>(testingTarget, "Should be an instance of GLWindow type.");
123
124         //    try
125         //    {
126         //        testingTarget.SetEglConfig(true, true, 10, GLESVersion.Version20);
127         //    }
128         //    catch (Exception e)
129         //    {
130         //        tlog.Debug(tag, e.Message.ToString());
131         //        Assert.Fail("Caught Exception: Failed!");
132         //    }
133
134         //    testingTarget.Destroy();
135         //    tlog.Debug(tag, $"GLWindowSetEglConfig END (OK)");
136         //}
137
138         [Test]
139         [Category("P1")]
140         [Description("GLWindow Show")]
141         [Property("SPEC", "Tizen.NUI.GLWindow.Show M")]
142         [Property("SPEC_URL", "-")]
143         [Property("CRITERIA", "MR")]
144         public void GLWindowShow()
145         {
146             tlog.Debug(tag, $"GLWindowShow START");
147             string name = "myGLWindow";
148             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
149             GLWindow a1 = new GLWindow(name, rectangle, true);
150
151             a1.Show();
152             a1.Destroy();
153             tlog.Debug(tag, $"GLWindowShow END (OK)");
154         }
155
156         [Test]
157         [Category("P1")]
158         [Description("GLWindow Hide")]
159         [Property("SPEC", "Tizen.NUI.GLWindow.Hide M")]
160         [Property("SPEC_URL", "-")]
161         [Property("CRITERIA", "MR")]
162         public void GLWindowHide()
163         {
164             tlog.Debug(tag, $"GLWindowHide START");
165             string name = "myGLWindow";
166             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
167             GLWindow a1 = new GLWindow(name, rectangle, true);
168
169             a1.Hide();
170
171             a1.Destroy();
172             tlog.Debug(tag, $"GLWindowHide END (OK)");
173         }
174
175
176         [Test]
177         [Category("P1")]
178         [Description("GLWindow Raise")]
179         [Property("SPEC", "Tizen.NUI.GLWindow.Raise M")]
180         [Property("SPEC_URL", "-")]
181         [Property("CRITERIA", "MR")]
182         public void GLWindowRaise()
183         {
184             tlog.Debug(tag, $"GLWindowRaise START");
185             string name = "myGLWindow";
186             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
187             GLWindow a1 = new GLWindow(name, rectangle, true);
188
189             a1.Raise();
190
191             a1.Destroy();
192             tlog.Debug(tag, $"GLWindowRaise END (OK)");
193         }
194
195         [Test]
196         [Category("P1")]
197         [Description("GLWindow Lower")]
198         [Property("SPEC", "Tizen.NUI.GLWindow.Lower M")]
199         [Property("SPEC_URL", "-")]
200         [Property("CRITERIA", "MR")]
201         public void GLWindowLower()
202         {
203             tlog.Debug(tag, $"GLWindowLower START");
204             string name = "myGLWindow";
205             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
206             GLWindow a1 = new GLWindow(name, rectangle, true);
207
208             a1.Lower();
209
210             a1.Destroy();
211             tlog.Debug(tag, $"GLWindowLower END (OK)");
212         }
213
214         [Test]
215         [Category("P1")]
216         [Description("GLWindow Activate")]
217         [Property("SPEC", "Tizen.NUI.GLWindow.Activate M")]
218         [Property("SPEC_URL", "-")]
219         [Property("CRITERIA", "MR")]
220         public void GLWindowActivate()
221         {
222             tlog.Debug(tag, $"GLWindowActivate START");
223             string name = "myGLWindow";
224             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
225             GLWindow a1 = new GLWindow(name, rectangle, true);
226
227             a1.Activate();
228
229             a1.Destroy();
230             tlog.Debug(tag, $"GLWindowActivate END (OK)");
231         }
232
233         [Test]
234         [Category("P1")]
235         [Description("GLWindow WindowPositionSize")]
236         [Property("SPEC", "Tizen.NUI.GLWindow.WindowPositionSize A")]
237         [Property("SPEC_URL", "-")]
238         [Property("CRITERIA", "PRW")]
239         public void GLWindowWindowPositionSize()
240         {
241             tlog.Debug(tag, $"GLWindowWindowPositionSize START");
242             string name = "myGLWindow";
243             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
244             GLWindow a1 = new GLWindow(name, rectangle, true);
245
246             a1.WindowPositionSize = new Rectangle(30, 40, 50, 60);
247             Assert.AreEqual(30, a1.WindowPositionSize.X, "Should be equal!");
248             Assert.AreEqual(40, a1.WindowPositionSize.Y, "Should be equal!");
249             Assert.AreEqual(50, a1.WindowPositionSize.Width, "Should be equal!");
250             Assert.AreEqual(60, a1.WindowPositionSize.Height, "Should be equal!");
251
252             a1.Destroy();
253             tlog.Debug(tag, $"GLWindowWindowPositionSize END (OK)");
254         }
255
256         [Test]
257         [Category("P1")]
258         [Description("GLWindow GetSupportedAuxiliaryHintCount")]
259         [Property("SPEC", "Tizen.NUI.GLWindow.GetSupportedAuxiliaryHintCount M")]
260         [Property("SPEC_URL", "-")]
261         [Property("CRITERIA", "MR")]
262         public void GLWindowGetSupportedAuxiliaryHintCount()
263         {
264             tlog.Debug(tag, $"GLWindowGetSupportedAuxiliaryHintCount START");
265             string name = "myGLWindow";
266             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
267             GLWindow a1 = new GLWindow(name, rectangle, true);
268
269             var result =  a1.GetSupportedAuxiliaryHintCount();
270             tlog.Debug(tag, "SupportedAuxiliaryHintCount : " + result);
271
272             a1.Destroy();
273             tlog.Debug(tag, $"GLWindowGetSupportedAuxiliaryHintCount END (OK)");
274         }
275
276         [Test]
277         [Category("P1")]
278         [Description("GLWindow GetSupportedAuxiliaryHint")]
279         [Property("SPEC", "Tizen.NUI.GLWindow.GetSupportedAuxiliaryHint M")]
280         [Property("SPEC_URL", "-")]
281         [Property("CRITERIA", "MR")]
282         public void GLWindowGetSupportedAuxiliaryHint()
283         {
284             tlog.Debug(tag, $"GLWindowGetSupportedAuxiliaryHint START");
285             string name = "myGLWindow";
286             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
287             GLWindow a1 = new GLWindow(name, rectangle, true);
288
289             var result = a1.GetSupportedAuxiliaryHint(1);
290             tlog.Debug(tag, "GetSupportedAuxiliaryHint : " + result);
291
292             a1.Destroy();
293             tlog.Debug(tag, $"GLWindowGetSupportedAuxiliaryHint END (OK)");
294         }
295
296         [Test]
297         [Category("P1")]
298         [Description("GLWindow AddAuxiliaryHint")]
299         [Property("SPEC", "Tizen.NUI.GLWindow.AddAuxiliaryHint M")]
300         [Property("SPEC_URL", "-")]
301         [Property("CRITERIA", "MR")]
302         public void GLWindowAddAuxiliaryHint()
303         {
304             tlog.Debug(tag, $"GLWindowAddAuxiliaryHint START");
305             string name = "myGLWindow";
306             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
307             GLWindow a1 = new GLWindow(name, rectangle, true);
308
309             a1.AddAuxiliaryHint("myHint", "myValue");
310
311             a1.Destroy();
312             tlog.Debug(tag, $"GLWindowAddAuxiliaryHint END (OK)");
313         }
314
315         [Test]
316         [Category("P1")]
317         [Description("GLWindow RemoveAuxiliaryHint")]
318         [Property("SPEC", "Tizen.NUI.GLWindow.RemoveAuxiliaryHint M")]
319         [Property("SPEC_URL", "-")]
320         [Property("CRITERIA", "MR")]
321         public void GLWindowRemoveAuxiliaryHint()
322         {
323             tlog.Debug(tag, $"GLWindowRemoveAuxiliaryHint START");
324             string name = "myGLWindow";
325             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
326             GLWindow a1 = new GLWindow(name, rectangle, true);
327
328             uint pos = a1.AddAuxiliaryHint("myHint", "myValue");
329             a1.RemoveAuxiliaryHint(pos);
330
331             a1.Destroy();
332             tlog.Debug(tag, $"GLWindowRemoveAuxiliaryHint END (OK)");
333         }
334
335         [Test]
336         [Category("P1")]
337         [Description("GLWindow SetAuxiliaryHintValue")]
338         [Property("SPEC", "Tizen.NUI.GLWindow.SetAuxiliaryHintValue M")]
339         [Property("SPEC_URL", "-")]
340         [Property("CRITERIA", "MR")]
341         public void GLWindowSetAuxiliaryHintValue()
342         {
343             tlog.Debug(tag, $"GLWindowSetAuxiliaryHintValue START");
344             string name = "myGLWindow";
345             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
346             GLWindow a1 = new GLWindow(name, rectangle, true);
347
348             uint pos = a1.AddAuxiliaryHint("myHint", "myValue");
349             a1.SetAuxiliaryHintValue(pos, "myValue");
350
351             a1.Destroy();
352             tlog.Debug(tag, $"GLWindowSetAuxiliaryHintValue END (OK)");
353         }
354
355         [Test]
356         [Category("P1")]
357         [Description("GLWindow GetAuxiliaryHintValue")]
358         [Property("SPEC", "Tizen.NUI.GLWindow.GetAuxiliaryHintValue M")]
359         [Property("SPEC_URL", "-")]
360         [Property("CRITERIA", "MR")]
361         public void GLWindowGetAuxiliaryHintValue()
362         {
363             tlog.Debug(tag, $"GLWindowGetAuxiliaryHintValue START");
364             string name = "myGLWindow";
365             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
366             GLWindow a1 = new GLWindow(name, rectangle, true);
367
368             uint pos = a1.AddAuxiliaryHint("myHint", "myValue");
369             a1.GetAuxiliaryHintValue(pos);
370
371             a1.Destroy();
372             tlog.Debug(tag, $"GLWindowGetAuxiliaryHintValue END (OK)");
373         }
374
375         [Test]
376         [Category("P1")]
377         [Description("GLWindow GetAuxiliaryHintId")]
378         [Property("SPEC", "Tizen.NUI.GLWindow.GetAuxiliaryHintId M")]
379         [Property("SPEC_URL", "-")]
380         [Property("CRITERIA", "MR")]
381         public void GLWindowGetAuxiliaryHintId()
382         {
383             tlog.Debug(tag, $"GLWindowGetAuxiliaryHintId START");
384             string name = "myGLWindow";
385             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
386             GLWindow a1 = new GLWindow(name, rectangle, true);
387
388             uint pos = a1.AddAuxiliaryHint("myHint", "myValue");
389             a1.GetAuxiliaryHintId("myHint");
390
391             a1.Destroy();
392             tlog.Debug(tag, $"GLWindowGetAuxiliaryHintId END (OK)");
393         }
394
395         [Test]
396         [Category("P1")]
397         [Description("GLWindow SetInputRegion")]
398         [Property("SPEC", "Tizen.NUI.GLWindow.SetInputRegion M")]
399         [Property("SPEC_URL", "-")]
400         [Property("CRITERIA", "MR")]
401         public void GLWindowSetInputRegion()
402         {
403             tlog.Debug(tag, $"GLWindowSetInputRegion START");
404             string name = "myGLWindow";
405             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
406             GLWindow a1 = new GLWindow(name, rectangle, true);
407
408             a1.SetInputRegion(rectangle);
409
410             a1.Destroy();
411             tlog.Debug(tag, $"GLWindowGetAuxiliaryHintId END (OK)");
412         }
413
414         [Test]
415         [Category("P1")]
416         [Description("GLWindow SetOpaqueState")]
417         [Property("SPEC", "Tizen.NUI.GLWindow.SetOpaqueState M")]
418         [Property("SPEC_URL", "-")]
419         [Property("CRITERIA", "MR")]
420         public void GLWindowSetOpaqueState()
421         {
422             tlog.Debug(tag, $"GLWindowSetOpaqueState START");
423             string name = "myGLWindow";
424             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
425             GLWindow a1 = new GLWindow(name, rectangle, true);
426
427             a1.SetOpaqueState(true);
428
429             a1.Destroy();
430             tlog.Debug(tag, $"GLWindowSetOpaqueState END (OK)");
431         }
432
433         [Test]
434         [Category("P1")]
435         [Description("GLWindow IsOpaqueState")]
436         [Property("SPEC", "Tizen.NUI.GLWindow.IsOpaqueState M")]
437         [Property("SPEC_URL", "-")]
438         [Property("CRITERIA", "MR")]
439         public void GLWindowIsOpaqueState()
440         {
441             tlog.Debug(tag, $"GLWindowIsOpaqueState START");
442             string name = "myGLWindow";
443             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
444             GLWindow a1 = new GLWindow(name, rectangle, true);
445
446             var result = a1.IsOpaqueState();
447             tlog.Debug(tag, "IsOpaqueState : " + result);
448
449             a1.Destroy();
450             tlog.Debug(tag, $"GLWindowIsOpaqueState END (OK)");
451         }
452
453         [Test]
454         [Category("P1")]
455         [Description("GLWindow SetPreferredOrientation")]
456         [Property("SPEC", "Tizen.NUI.GLWindow.SetPreferredOrientation M")]
457         [Property("SPEC_URL", "-")]
458         [Property("CRITERIA", "MR")]
459         public void GLWindowSetPreferredOrientation()
460         {
461             tlog.Debug(tag, $"GLWindowSetPreferredOrientation START");
462             string name = "myGLWindow";
463             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
464             GLWindow a1 = new GLWindow(name, rectangle, true);
465
466             GLWindow.GLWindowOrientation o1 = new GLWindow.GLWindowOrientation();
467             a1.SetPreferredOrientation(o1);
468
469             a1.Destroy();
470             tlog.Debug(tag, $"GLWindowSetPreferredOrientation END (OK)");
471         }
472
473         [Test]
474         [Category("P1")]
475         [Description("GLWindow GetCurrentOrientation")]
476         [Property("SPEC", "Tizen.NUI.GLWindow.GetCurrentOrientation M")]
477         [Property("SPEC_URL", "-")]
478         [Property("CRITERIA", "MR")]
479         public void GLWindowGetCurrentOrientation()
480         {
481             tlog.Debug(tag, $"GLWindowGetCurrentOrientation START");
482             string name = "myGLWindow";
483             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
484             GLWindow a1 = new GLWindow(name, rectangle, true);
485
486             var result =  a1.GetCurrentOrientation();
487             tlog.Debug(tag, "CurrentOrientation : " + result);
488
489             a1.Destroy();
490             tlog.Debug(tag, $"GLWindowGetCurrentOrientation END (OK)");
491         }
492
493         [Test]
494         [Category("P1")]
495         [Description("GLWindow SetAvailableOrientations")]
496         [Property("SPEC", "Tizen.NUI.GLWindow.SetAvailableOrientations M")]
497         [Property("SPEC_URL", "-")]
498         [Property("CRITERIA", "MR")]
499         public void GLWindowSetAvailableOrientations()
500         {
501             tlog.Debug(tag, $"GLWindowSetAvailableOrientations START");
502             string name = "myGLWindow";
503             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
504             GLWindow a1 = new GLWindow(name, rectangle, true);
505
506             GLWindow.GLWindowOrientation o1 = new GLWindow.GLWindowOrientation();
507             List<GLWindow.GLWindowOrientation> l1 = new List<GLWindow.GLWindowOrientation>
508             {
509                 o1
510             };
511
512             a1.SetAvailableOrientations(l1);
513
514             a1.Destroy();
515             tlog.Debug(tag, $"GLWindowSetAvailableOrientations END (OK)");
516         }
517
518         [Test]
519         [Category("P1")]
520         [Description("GLWindow RenderOnce")]
521         [Property("SPEC", "Tizen.NUI.GLWindow.RenderOnce M")]
522         [Property("SPEC_URL", "-")]
523         [Property("CRITERIA", "MR")]
524         public void GLWindowRenderOnce()
525         {
526             tlog.Debug(tag, $"GLWindowRenderOnce START");
527             string name = "myGLWindow";
528             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
529             GLWindow a1 = new GLWindow(name, rectangle, true);
530
531             a1.RenderOnce();
532
533             a1.Destroy();
534             tlog.Debug(tag, $"GLWindowRenderOnce END (OK)");
535         }
536
537         [Test]
538         [Category("P1")]
539         [Description("GLWindow RegisterGlCallback")]
540         [Property("SPEC", "Tizen.NUI.GLWindow.RegisterGlCallback M")]
541         [Property("SPEC_URL", "-")]
542         [Property("CRITERIA", "MR")]
543         public void GLWindowRegisterGlCallback()
544         {
545             tlog.Debug(tag, $"GLWindowRegisterGlCallback START");
546             string name = "myGLWindow";
547             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
548             GLWindow a1 = new GLWindow(name, rectangle, true);
549
550             a1.RegisterGlCallback(GLInit, GLRenderFrame, GLTerminate);
551
552             a1.Destroy();
553             tlog.Debug(tag, $"GLWindowRegisterGlCallback END (OK)");
554         }
555
556         public void GLInit() { }
557         public int GLRenderFrame() { return 0; }
558         public void GLTerminate() { }
559     }
560 }
561