Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Window / TSGLWindowEvent.cs
1 using NUnit.Framework;
2
3 namespace Tizen.NUI.Devel.Tests
4 {
5     using tlog = Tizen.Log;
6
7     [TestFixture]
8     [Description("public/Window/GLWindowEvent")]
9     internal class PublicGLWindowEventTest
10     {
11         private const string tag = "NUITEST";
12
13         [SetUp]
14         public void Init()
15         {
16             tlog.Info(tag, "Init() is called!");
17         }
18
19         [TearDown]
20         public void Destroy()
21         {
22             tlog.Info(tag, "Destroy() is called!");
23         }
24
25         [Test]
26         [Category("P1")]
27         [Description("GLWindow FocusChanged")]
28         [Property("SPEC", "Tizen.NUI.GLWindow.FocusChanged A")]
29         [Property("SPEC_URL", "-")]
30         [Property("CRITERIA", "PRW")]
31         public void GLWindowFocusChanged()
32         {
33             tlog.Debug(tag, $"GLWindowFocusChanged START");
34             string name = "myGLWindow";
35             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
36             GLWindow a1 = new GLWindow(name, rectangle, true);
37
38             a1.FocusChanged += A1_FocusChanged;
39             a1.FocusChanged -= A1_FocusChanged;
40
41             GLWindow.FocusChangedEventArgs e1 = new GLWindow.FocusChangedEventArgs();
42             A1_FocusChanged(null, e1);
43
44             a1.Destroy();
45             tlog.Debug(tag, $"GLWindowFocusChanged END (OK)");
46             Assert.Pass("GLWindowFocusChanged");
47         }
48
49         private void A1_FocusChanged(object sender, GLWindow.FocusChangedEventArgs e)
50         {
51             bool c1 = e.FocusGained;
52             e.FocusGained = c1;
53
54             return;
55         }
56
57         [Test]
58         [Category("P1")]
59         [Description("GLWindow TouchEvent")]
60         [Property("SPEC", "Tizen.NUI.GLWindow.TouchEvent A")]
61         [Property("SPEC_URL", "-")]
62         [Property("CRITERIA", "PRW")]
63         public void GLWindowTouchEvent()
64         {
65             tlog.Debug(tag, $"GLWindowTouchEvent START");
66             string name = "myGLWindow";
67             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
68             GLWindow a1 = new GLWindow(name, rectangle, true);
69
70             a1.TouchEvent += A1_TouchEvent;
71             a1.TouchEvent -= A1_TouchEvent;
72
73             GLWindow.TouchEventArgs e1 = new GLWindow.TouchEventArgs();
74             A1_TouchEvent(null, e1);
75             a1.Destroy();
76             tlog.Debug(tag, $"GLWindowTouchEvent END (OK)");
77             Assert.Pass("GLWindowTouchEvent");
78         }
79
80         private void A1_TouchEvent(object sender, GLWindow.TouchEventArgs e)
81         {
82             Touch t1 = e.Touch;
83             e.Touch = t1;
84
85             return;
86         }
87
88         [Test]
89         [Category("P1")]
90         [Description("GLWindow KeyEvent")]
91         [Property("SPEC", "Tizen.NUI.GLWindow.KeyEvent A")]
92         [Property("SPEC_URL", "-")]
93         [Property("CRITERIA", "PRW")]
94         public void GLWindowKeyEvent()
95         {
96             tlog.Debug(tag, $"GLWindowKeyEvent START");
97             string name = "myGLWindow";
98             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
99             GLWindow a1 = new GLWindow(name, rectangle, true);
100
101             a1.KeyEvent += A1_KeyEvent;
102             a1.KeyEvent -= A1_KeyEvent;
103
104             GLWindow.KeyEventArgs e1 = new GLWindow.KeyEventArgs();
105             A1_KeyEvent(null, e1);
106
107             a1.Destroy();
108             tlog.Debug(tag, $"GLWindowKeyEvent END (OK)");
109             Assert.Pass("GLWindowKeyEvent");
110         }
111
112         private void A1_KeyEvent(object sender, GLWindow.KeyEventArgs e)
113         {
114             Key k1 = e.Key;
115             e.Key = k1;
116             return;
117         }
118
119         [Test]
120         [Category("P1")]
121         [Description("GLWindow Resized")]
122         [Property("SPEC", "Tizen.NUI.GLWindow.Resized A")]
123         [Property("SPEC_URL", "-")]
124         [Property("CRITERIA", "PRW")]
125         public void GLWindowResized()
126         {
127             tlog.Debug(tag, $"GLWindowResized START");
128             string name = "myGLWindow";
129             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
130             GLWindow a1 = new GLWindow(name, rectangle, true);
131
132             a1.Resized += A1_Resized;
133             a1.Resized -= A1_Resized;
134
135             GLWindow.ResizedEventArgs e1 = new GLWindow.ResizedEventArgs();
136             A1_Resized(null, e1);
137             a1.Destroy();
138             tlog.Debug(tag, $"GLWindowResized END (OK)");
139             Assert.Pass("GLWindowResized");
140         }
141
142         private void A1_Resized(object sender, GLWindow.ResizedEventArgs e)
143         {
144             Size2D s1 = e.WindowSize;
145             e.WindowSize = s1;
146             return;
147         }
148
149         [Test]
150         [Category("P1")]
151         [Description("GLWindow FocusChangedSignal")]
152         [Property("SPEC", "Tizen.NUI.GLWindow.FocusChangedSignal M")]
153         [Property("SPEC_URL", "-")]
154         [Property("CRITERIA", "MR")]
155         public void GLWindowFocusChangedSignal()
156         {
157             tlog.Debug(tag, $"GLWindowFocusChangedSignal START");
158             string name = "myGLWindow";
159             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
160             GLWindow a1 = new GLWindow(name, rectangle, true);
161
162             a1.FocusChangedSignal();
163
164             a1.Destroy();
165             tlog.Debug(tag, $"GLWindowFocusChangedSignal END (OK)");
166             Assert.Pass("GLWindowFocusChangedSignal");
167         }
168
169         [Test]
170         [Category("P1")]
171         [Description("GLWindow KeyEventSignal")]
172         [Property("SPEC", "Tizen.NUI.GLWindow.KeyEventSignal M")]
173         [Property("SPEC_URL", "-")]
174         [Property("CRITERIA", "MR")]
175         public void GLWindowKeyEventSignal()
176         {
177             tlog.Debug(tag, $"GLWindowKeyEventSignal START");
178             string name = "myGLWindow";
179             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
180             GLWindow a1 = new GLWindow(name, rectangle, true);
181
182             a1.KeyEventSignal();
183
184             a1.Destroy();
185             tlog.Debug(tag, $"GLWindowKeyEventSignal END (OK)");
186             Assert.Pass("GLWindowKeyEventSignal");
187         }
188
189         [Test]
190         [Category("P1")]
191         [Description("GLWindow TouchSignal")]
192         [Property("SPEC", "Tizen.NUI.GLWindow.TouchSignal M")]
193         [Property("SPEC_URL", "-")]
194         [Property("CRITERIA", "MR")]
195         public void GLWindowTouchSignal()
196         {
197             tlog.Debug(tag, $"GLWindowTouchSignal START");
198             string name = "myGLWindow";
199             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
200             GLWindow a1 = new GLWindow(name, rectangle, true);
201
202             a1.TouchSignal();
203
204             a1.Destroy();
205             tlog.Debug(tag, $"GLWindowTouchSignal END (OK)");
206             Assert.Pass("GLWindowTouchSignal");
207         }
208
209         [Test]
210         [Category("P1")]
211         [Description("GLWindow GLWindowResizedSignal")]
212         [Property("SPEC", "Tizen.NUI.GLWindow.GLWindowResizedSignal M")]
213         [Property("SPEC_URL", "-")]
214         [Property("CRITERIA", "MR")]
215         public void GLWindowGLWindowResizedSignal()
216         {
217             tlog.Debug(tag, $"GLWindowGLWindowResizedSignal START");
218             string name = "myGLWindow";
219             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
220             GLWindow a1 = new GLWindow(name, rectangle, true);
221
222             a1.GLWindowResizedSignal();
223
224             a1.Destroy();
225             tlog.Debug(tag, $"GLWindowGLWindowResizedSignal END (OK)");
226             Assert.Pass("GLWindowGLWindowResizedSignal");
227         }
228
229         [Test]
230         [Category("P1")]
231         [Description("GLWindow GLWindowDisconnectNativeSignals")]
232         [Property("SPEC", "Tizen.NUI.GLWindow.DisconnectNativeSignals M")]
233         [Property("SPEC_URL", "-")]
234         [Property("CRITERIA", "MR")]
235         public void GLWindowDisconnectNativeSignals()
236         {
237             tlog.Debug(tag, $"GLWindowDisconnectNativeSignals START");
238             string name = "myGLWindow";
239             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
240             GLWindow a1 = new GLWindow(name, rectangle, true);
241
242             a1.DisconnectNativeSignals();
243
244             a1.Destroy();
245             tlog.Debug(tag, $"GLWindowDisconnectNativeSignals END (OK)");
246             Assert.Pass("GLWindowDisconnectNativeSignals");
247         }
248
249         //[Test]
250         //[Category("P1")]
251         //[Description("GLWindow GLWindowVisibilityChanged")]
252         //[Property("SPEC", "Tizen.NUI.GLWindow.VisibilityChanged A")]
253         //[Property("SPEC_URL", "-")]
254         //[Property("CRITERIA", "PRW")]
255         //public void GLWindowVisibilityChanged()
256         //{
257         //    tlog.Debug(tag, $"GLWindowVisibilityChanged START");
258         //    string name = "myGLWindow";
259         //    Rectangle rectangle = new Rectangle(20, 20, 100, 100);
260         //    GLWindow a1 = new GLWindow(name, rectangle, true);
261
262         //    a1.VisibilityChanged += A1_VisibilityChanged;
263         //    a1.VisibilityChanged -= A1_VisibilityChanged;
264
265         //    a1.Destroy();
266         //    tlog.Debug(tag, $"GLWindowVisibilityChanged END (OK)");
267         //}
268
269         private void A1_VisibilityChanged(object sender, GLWindow.VisibilityChangedEventArgs e) { }
270
271         [Test]
272         [Category("P1")]
273         [Description("GLWindow GLWindowVisibiltyChangedSignalEmit")]
274         [Property("SPEC", "Tizen.NUI.GLWindow.VisibiltyChangedSignalEmit M")]
275         [Property("SPEC_URL", "-")]
276         [Property("CRITERIA", "MR")]
277         public void GLWindowVisibiltyChangedSignalEmit()
278         {
279             tlog.Debug(tag, $"GLWindowVisibiltyChangedSignalEmit START");
280             string name = "myGLWindow";
281             Rectangle rectangle = new Rectangle(20, 20, 100, 100);
282             GLWindow a1 = new GLWindow(name, rectangle, true);
283
284             a1.VisibiltyChangedSignalEmit(true);
285
286             a1.Destroy();
287             tlog.Debug(tag, $"GLWindowVisibiltyChangedSignalEmit END (OK)");
288             Assert.Pass("GLWindowVisibiltyChangedSignalEmit");
289         }
290     }
291 }
292