[NUI] Fix failed TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Events / TSTouch.cs
1 using NUnit.Framework;
2 using NUnit.Framework.TUnit;
3 using System;
4 using Tizen.NUI;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("public/Events/Touch")]
13     class PublicTouchTest
14     {
15         private const string tag = "NUITEST";
16
17         [SetUp]
18         public void Init()
19         {
20             tlog.Info(tag, "Init() is called!");
21         }
22
23         [TearDown]
24         public void Destroy()
25         {
26             tlog.Info(tag, "Destroy() is called!");
27         }
28
29         [Test]
30         [Category("P1")]
31         [Description("Touch constructor")]
32         [Property("SPEC", "Tizen.NUI.Touch.Touch C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void TouchConstructor()
37         {
38             tlog.Debug(tag, $"TouchConstructor START");
39
40             var testingTarget = new Touch();
41             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
42             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
43
44             testingTarget.Dispose();
45             tlog.Debug(tag, $"TouchConstructor END (OK)");
46             Assert.Pass("TouchConstructor");
47         }
48
49         //[Test]
50         //[Category("P1")]
51         //[Description("Touch constructor")]
52         //[Property("SPEC", "Tizen.NUI.Touch.Touch C")]
53         //[Property("SPEC_URL", "-")]
54         //[Property("CRITERIA", "CONSTR")]
55         //[Property("AUTHOR", "guowei.wang@samsung.com")]
56         //public void TouchConstructorWithTouch()
57         //{
58         //    tlog.Debug(tag, $"TouchConstructorWithTouch START");
59
60         //    using (Touch touch = new Touch())
61         //    {
62         //        var testingTarget = new Touch(touch);
63         //        Assert.IsNotNull(testingTarget, "Can't create success object Touch");
64         //        Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
65
66         //        testingTarget.Dispose();
67         //    }
68
69         //    tlog.Debug(tag, $"TouchConstructorWithTouch END (OK)");
70         //    Assert.Pass("TouchConstructor");
71         //}
72
73         //[Test]
74         //[Category("P1")]
75         //[Description("Touch GetTime")]
76         //[Property("SPEC", "Tizen.NUI.Touch.GetTime M")]
77         //[Property("SPEC_URL", "-")]
78         //[Property("CRITERIA", "MR")]
79         //[Property("AUTHOR", "guowei.wang@samsung.com")]
80         //public void TouchGetTime()
81         //{
82         //    tlog.Debug(tag, $"TouchGetTime START");
83
84         //    var testingTarget = new Touch();
85         //    Assert.IsNotNull(testingTarget, "Can't create success object Touch");
86         //    Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
87
88         //    try
89         //    {
90         //        testingTarget.GetTime();
91         //    }
92         //    catch (Exception e)
93         //    {
94         //        tlog.Debug(tag, e.Message.ToString());
95         //        Assert.Fail("Caught Exception : Failed!");
96         //    }
97
98         //    testingTarget.Dispose();
99         //    tlog.Debug(tag, $"TouchGetPointCount END (OK)");
100         //}
101
102         //[Test]
103         //[Category("P1")]
104         //[Description("Touch GetPointCount")]
105         //[Property("SPEC", "Tizen.NUI.Touch.GetPointCount M")]
106         //[Property("SPEC_URL", "-")]
107         //[Property("CRITERIA", "MR")]
108         //[Property("AUTHOR", "guowei.wang@samsung.com")]
109         //public void TouchGetPointCount()
110         //{
111         //    tlog.Debug(tag, $"TouchGetPointCount START");
112
113         //    var testingTarget = new Touch();
114         //    Assert.IsNotNull(testingTarget, "Can't create success object Touch");
115         //    Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
116
117         //    try
118         //    {
119         //        testingTarget.GetPointCount();
120         //    }
121         //    catch (Exception e)
122         //    {
123         //        tlog.Debug(tag, e.Message.ToString());
124         //        Assert.Fail("Caught Exception : Failed!");
125         //    }
126
127         //    testingTarget.Dispose();
128         //    tlog.Debug(tag, $"TouchGetPointCount END (OK)");
129         //}
130
131         [Test]
132         [Category("P1")]
133         [Description("Touch GetDeviceId")]
134         [Property("SPEC", "Tizen.NUI.Touch.GetDeviceId M")]
135         [Property("SPEC_URL", "-")]
136         [Property("CRITERIA", "MR")]
137         [Property("AUTHOR", "guowei.wang@samsung.com")]
138         public void TouchGetDeviceId()
139         {
140             tlog.Debug(tag, $"TouchGetDeviceId START");
141
142             var testingTarget = new Touch();
143             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
144             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
145
146             try
147             {
148                 testingTarget.GetDeviceId(0);
149             }
150             catch (Exception e)
151             {
152                 tlog.Debug(tag, e.Message.ToString());
153                 testingTarget.Dispose();
154                 tlog.Debug(tag, $"TouchGetDeviceId END (OK)");
155                 Assert.Pass("Caught Exception : Passed!");
156             }
157         }
158
159         [Test]
160         [Category("P1")]
161         [Description("Touch GetState")]
162         [Property("SPEC", "Tizen.NUI.Touch.GetState M")]
163         [Property("SPEC_URL", "-")]
164         [Property("CRITERIA", "MR")]
165         [Property("AUTHOR", "guowei.wang@samsung.com")]
166         public void TouchGetState()
167         {
168             tlog.Debug(tag, $"TouchGetState START");
169
170             var testingTarget = new Touch();
171             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
172             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
173
174             try
175             {
176                 testingTarget.GetState(0);
177             }
178             catch (Exception e)
179             {
180                 tlog.Debug(tag, e.Message.ToString());
181                 testingTarget.Dispose();
182                 tlog.Debug(tag, $"TouchGetState END (OK)");
183                 Assert.Pass("Caught Exception : Passed!");
184             }
185         }
186
187         [Test]
188         [Category("P1")]
189         [Description("Touch GetHitView")]
190         [Property("SPEC", "Tizen.NUI.Touch.GetHitView M")]
191         [Property("SPEC_URL", "-")]
192         [Property("CRITERIA", "MR")]
193         [Property("AUTHOR", "guowei.wang@samsung.com")]
194         public void TouchGetHitView()
195         {
196             tlog.Debug(tag, $"TouchGetHitView START");
197
198             var testingTarget = new Touch();
199             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
200             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
201
202             try
203             {
204                 testingTarget.GetHitView(0);
205             }
206             catch (Exception e)
207             {
208                 tlog.Debug(tag, e.Message.ToString());
209                 testingTarget.Dispose();
210                 tlog.Debug(tag, $"TouchGetHitView END (OK)");
211                 Assert.Pass("Caught Exception : Passed!");
212             }
213         }
214
215         [Test]
216         [Category("P1")]
217         [Description("Touch GetLocalPosition")]
218         [Property("SPEC", "Tizen.NUI.Touch.GetLocalPosition M")]
219         [Property("SPEC_URL", "-")]
220         [Property("CRITERIA", "MR")]
221         [Property("AUTHOR", "guowei.wang@samsung.com")]
222         public void TouchGetLocalPosition()
223         {
224             tlog.Debug(tag, $"TouchGetLocalPosition START");
225
226             var testingTarget = new Touch();
227             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
228             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
229
230             try
231             {
232                 testingTarget.GetLocalPosition(0);
233             }
234             catch (Exception e)
235             {
236                 tlog.Debug(tag, e.Message.ToString());
237                 testingTarget.Dispose();
238                 tlog.Debug(tag, $"TouchGetLocalPosition END (OK)");
239                 Assert.Pass("Caught Exception : Passed!");
240             }
241         }
242
243         [Test]
244         [Category("P1")]
245         [Description("Touch GetScreenPosition")]
246         [Property("SPEC", "Tizen.NUI.Touch.GetScreenPosition M")]
247         [Property("SPEC_URL", "-")]
248         [Property("CRITERIA", "MR")]
249         [Property("AUTHOR", "guowei.wang@samsung.com")]
250         public void TouchGetScreenPosition()
251         {
252             tlog.Debug(tag, $"TouchGetScreenPosition START");
253
254             var testingTarget = new Touch();
255             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
256             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
257
258             try
259             {
260                 testingTarget.GetScreenPosition(0);
261             }
262             catch (Exception e)
263             {
264                 tlog.Debug(tag, e.Message.ToString());
265                 testingTarget.Dispose();
266                 tlog.Debug(tag, $"TouchGetScreenPosition END (OK)");
267                 Assert.Pass("Caught Exception : Passed!");
268             }
269         }
270
271         [Test]
272         [Category("P1")]
273         [Description("Touch GetRadius")]
274         [Property("SPEC", "Tizen.NUI.Touch.GetRadius M")]
275         [Property("SPEC_URL", "-")]
276         [Property("CRITERIA", "MR")]
277         [Property("AUTHOR", "guowei.wang@samsung.com")]
278         public void TouchGetRadius()
279         {
280             tlog.Debug(tag, $"TouchGetRadius START");
281
282             var testingTarget = new Touch();
283             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
284             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
285
286             try
287             {
288                 testingTarget.GetRadius(0);
289             }
290             catch (Exception e)
291             {
292                 tlog.Debug(tag, e.Message.ToString());
293                 testingTarget.Dispose();
294                 tlog.Debug(tag, $"TouchGetRadius END (OK)");
295                 Assert.Pass("Caught Exception : Passed!");
296             }
297         }
298
299         [Test]
300         [Category("P1")]
301         [Description("Touch GetEllipseRadius")]
302         [Property("SPEC", "Tizen.NUI.Touch.GetEllipseRadius M")]
303         [Property("SPEC_URL", "-")]
304         [Property("CRITERIA", "MR")]
305         [Property("AUTHOR", "guowei.wang@samsung.com")]
306         public void TouchGetEllipseRadius()
307         {
308             tlog.Debug(tag, $"TouchGetEllipseRadius START");
309
310             var testingTarget = new Touch();
311             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
312             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
313
314             try
315             {
316                 testingTarget.GetEllipseRadius(0);
317             }
318             catch (Exception e)
319             {
320                 tlog.Debug(tag, e.Message.ToString());
321                 testingTarget.Dispose();
322                 tlog.Debug(tag, $"TouchGetEllipseRadius END (OK)");
323                 Assert.Pass("Caught Exception : Passed!");
324             }
325         }
326
327         [Test]
328         [Category("P1")]
329         [Description("Touch GetPressure")]
330         [Property("SPEC", "Tizen.NUI.Touch.GetPressure M")]
331         [Property("SPEC_URL", "-")]
332         [Property("CRITERIA", "MR")]
333         [Property("AUTHOR", "guowei.wang@samsung.com")]
334         public void TouchGetPressure()
335         {
336             tlog.Debug(tag, $"TouchGetPressure START");
337
338             var testingTarget = new Touch();
339             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
340             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
341
342             try
343             {
344                 testingTarget.GetPressure(0);
345             }
346             catch (Exception e)
347             {
348                 tlog.Debug(tag, e.Message.ToString());
349                 testingTarget.Dispose();
350                 tlog.Debug(tag, $"TouchGetPressure END (OK)");
351                 Assert.Pass("Caught Exception : Passed!");
352             }
353         }
354
355         [Test]
356         [Category("P1")]
357         [Description("Touch GetMouseButton")]
358         [Property("SPEC", "Tizen.NUI.Touch.GetMouseButton M")]
359         [Property("SPEC_URL", "-")]
360         [Property("CRITERIA", "MR")]
361         [Property("AUTHOR", "guowei.wang@samsung.com")]
362         public void TouchGetMouseButton()
363         {
364             tlog.Debug(tag, $"TouchGetMouseButton START");
365
366             var testingTarget = new Touch();
367             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
368             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
369
370             try
371             {
372                 testingTarget.GetMouseButton(0);
373             }
374             catch (Exception e)
375             {
376                 tlog.Debug(tag, e.Message.ToString());
377                 testingTarget.Dispose();
378                 tlog.Debug(tag, $"TouchGetMouseButton END (OK)");
379                 Assert.Pass("Caught Exception : Passed!");
380             }
381         }
382
383         [Test]
384         [Category("P1")]
385         [Description("Touch GetTouchFromPtr")]
386         [Property("SPEC", "Tizen.NUI.Touch.GetTouchFromPtr M")]
387         [Property("SPEC_URL", "-")]
388         [Property("CRITERIA", "MR")]
389         [Property("AUTHOR", "guowei.wang@samsung.com")]
390         public void TouchGetTouchFromPtr()
391         {
392             tlog.Debug(tag, $"TouchGetTouchFromPtr START");
393
394             using (Touch touch = new Touch())
395             {
396                 var testingTarget = Touch.GetTouchFromPtr(touch.SwigCPtr.Handle);
397                 Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
398
399                 testingTarget.Dispose();
400             }
401
402             tlog.Debug(tag, $"TouchGetTouchFromPtr END (OK)");
403         }
404
405         [Test]
406         [Category("P1")]
407         [Description("Touch GetAngle")]
408         [Property("SPEC", "Tizen.NUI.Touch.GetAngle M")]
409         [Property("SPEC_URL", "-")]
410         [Property("CRITERIA", "MR")]
411         [Property("AUTHOR", "guowei.wang@samsung.com")]
412         public void TouchGetAngle()
413         {
414             tlog.Debug(tag, $"TouchGetAngle START");
415
416             var testingTarget = new Touch();
417             Assert.IsNotNull(testingTarget, "Can't create success object Touch");
418             Assert.IsInstanceOf<Touch>(testingTarget, "Should be an instance of Touch type.");
419
420             try
421             {
422                 testingTarget.GetAngle(0);
423             }
424             catch (Exception e)
425             {
426                 tlog.Debug(tag, e.Message.ToString());
427                 testingTarget.Dispose();
428                 tlog.Debug(tag, $"TouchGetAngle END (OK)");
429                 Assert.Pass("Caught Exception : Passed!");
430             }
431         }
432     }
433
434 }