[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 / Events / TSPanGesture.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/PanGesture")]
13     public class PublicPanGestureTest
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("Create a PanGesture object.")]
32         [Property("SPEC", "Tizen.NUI.PanGesture.PanGesture C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("COVPARAM", "")]
36         [Property("AUTHOR", "guowei.wang@samsung.com")]
37         public void PanGestureConstructor()
38         {
39             tlog.Debug(tag, $"PanGestureConstructor START");
40
41             var testingTarget = new PanGesture();
42             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
43             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
44
45             testingTarget.Dispose();
46             tlog.Debug(tag, $"PanGestureConstructor END (OK)");
47             Assert.Pass("PanGestureConstructor");
48         }
49
50         [Test]
51         [Category("P1")]
52         [Description("Create a PanGesture object.")]
53         [Property("SPEC", "Tizen.NUI.PanGesture.PanGesture C")]
54         [Property("SPEC_URL", "-")]
55         [Property("CRITERIA", "CONSTR")]
56         [Property("COVPARAM", "")]
57         [Property("AUTHOR", "guowei.wang@samsung.com")]
58         public void PanGestureConstructorWithState()
59         {
60             tlog.Debug(tag, $"PanGestureConstructorWithState START");
61
62             var testingTarget = new PanGesture(Gesture.StateType.Finished);
63             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
64             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
65
66             testingTarget.Dispose();
67             tlog.Debug(tag, $"PanGestureConstructorWithState END (OK)");
68             Assert.Pass("PanGestureConstructor");
69         }
70
71         [Test]
72         [Category("P1")]
73         [Description("Test Velocity property.")]
74         [Property("SPEC", "Tizen.NUI.PanGesture.Velocity A")]
75         [Property("SPEC_URL", "-")]
76         [Property("CRITERIA", "PRW")]
77         [Property("AUTHOR", "guowei.wang@samsung.com")]
78         public void PanGestureVelocity()
79         {
80             tlog.Debug(tag, $"PanGestureVelocity START");
81
82             var testingTarget = new PanGesture(Gesture.StateType.Finished);
83             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
84             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
85
86             tlog.Debug(tag, "Velocity : " + testingTarget.Velocity);
87
88             testingTarget.Dispose();
89             tlog.Debug(tag, $"PanGestureVelocity END (OK)");
90             Assert.Pass("PanGestureVelocity");
91         }
92
93         [Test]
94         [Category("P1")]
95         [Description("Test Displacement property.")]
96         [Property("SPEC", "Tizen.NUI.PanGesture.Displacement A")]
97         [Property("SPEC_URL", "-")]
98         [Property("CRITERIA", "PRW")]
99         [Property("AUTHOR", "guowei.wang@samsung.com")]
100         public void PanGestureDisplacement()
101         {
102             tlog.Debug(tag, $"PanGestureDisplacement START");
103
104             var testingTarget = new PanGesture(Gesture.StateType.Finished);
105             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
106             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
107
108             tlog.Debug(tag, "Displacement : " + testingTarget.Displacement);
109
110             testingTarget.Dispose();
111             tlog.Debug(tag, $"PanGestureDisplacement END (OK)");
112             Assert.Pass("PanGestureDisplacement");
113         }
114
115         [Test]
116         [Category("P1")]
117         [Description("Test Position property.")]
118         [Property("SPEC", "Tizen.NUI.PanGesture.Position A")]
119         [Property("SPEC_URL", "-")]
120         [Property("CRITERIA", "PRW")]
121         [Property("AUTHOR", "guowei.wang@samsung.com")]
122         public void PanGesturePosition()
123         {
124             tlog.Debug(tag, $"PanGesturePosition START");
125
126             var testingTarget = new PanGesture(Gesture.StateType.Finished);
127             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
128             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
129
130             tlog.Debug(tag, "Position : " + testingTarget.Position);
131
132             testingTarget.Dispose();
133             tlog.Debug(tag, $"PanGesturePosition END (OK)");
134             Assert.Pass("PanGesturePosition");
135         }
136
137         [Test]
138         [Category("P1")]
139         [Description("Test ScreenVelocity property.")]
140         [Property("SPEC", "Tizen.NUI.PanGesture.ScreenVelocity A")]
141         [Property("SPEC_URL", "-")]
142         [Property("CRITERIA", "PRW")]
143         [Property("AUTHOR", "guowei.wang@samsung.com")]
144         public void PanGestureScreenVelocity()
145         {
146             tlog.Debug(tag, $"PanGestureScreenVelocity START");
147
148             var testingTarget = new PanGesture(Gesture.StateType.Finished);
149             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
150             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
151
152             tlog.Debug(tag, "ScreenVelocity : " + testingTarget.ScreenVelocity);
153
154             testingTarget.Dispose();
155             tlog.Debug(tag, $"PanGestureScreenVelocity END (OK)");
156             Assert.Pass("PanGestureScreenVelocity");
157         }
158
159         [Test]
160         [Category("P1")]
161         [Description("Test ScreenDisplacement property.")]
162         [Property("SPEC", "Tizen.NUI.PanGesture.ScreenDisplacement A")]
163         [Property("SPEC_URL", "-")]
164         [Property("CRITERIA", "PRW")]
165         [Property("AUTHOR", "guowei.wang@samsung.com")]
166         public void PanGestureScreenDisplacement()
167         {
168             tlog.Debug(tag, $"PanGestureScreenDisplacement START");
169
170             var testingTarget = new PanGesture(Gesture.StateType.Finished);
171             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
172             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
173
174             tlog.Debug(tag, "ScreenDisplacement : " + testingTarget.ScreenDisplacement);
175
176             testingTarget.Dispose();
177             tlog.Debug(tag, $"PanGestureScreenDisplacement END (OK)");
178             Assert.Pass("PanGestureScreenDisplacement");
179         }
180
181         [Test]
182         [Category("P1")]
183         [Description("Test ScreenPosition property.")]
184         [Property("SPEC", "Tizen.NUI.PanGesture.ScreenPosition A")]
185         [Property("SPEC_URL", "-")]
186         [Property("CRITERIA", "PRW")]
187         [Property("AUTHOR", "guowei.wang@samsung.com")]
188         public void PanGestureScreenPosition()
189         {
190             tlog.Debug(tag, $"PanGestureScreenPosition START");
191
192             var testingTarget = new PanGesture(Gesture.StateType.Finished);
193             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
194             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
195
196             tlog.Debug(tag, "ScreenPosition : " + testingTarget.ScreenPosition);
197
198             testingTarget.Dispose();
199             tlog.Debug(tag, $"PanGestureScreenPosition END (OK)");
200             Assert.Pass("PanGestureScreenPosition");
201         }
202
203         [Test]
204         [Category("P1")]
205         [Description("Test NumberOfTouches property.")]
206         [Property("SPEC", "Tizen.NUI.PanGesture.NumberOfTouches A")]
207         [Property("SPEC_URL", "-")]
208         [Property("CRITERIA", "PRW")]
209         [Property("AUTHOR", "guowei.wang@samsung.com")]
210         public void PanGestureNumberOfTouches()
211         {
212             tlog.Debug(tag, $"PanGestureNumberOfTouches START");
213
214             var testingTarget = new PanGesture(Gesture.StateType.Finished);
215             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
216             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
217
218             tlog.Debug(tag, "NumberOfTouches : " + testingTarget.NumberOfTouches);
219
220             testingTarget.Dispose();
221             tlog.Debug(tag, $"PanGestureNumberOfTouches END (OK)");
222             Assert.Pass("PanGestureNumberOfTouches");
223         }
224
225         [Test]
226         [Category("P1")]
227         [Description("Test GetSpeed property.")]
228         [Property("SPEC", "Tizen.NUI.PanGesture.GetSpeed M")]
229         [Property("SPEC_URL", "-")]
230         [Property("CRITERIA", "MR")]
231         [Property("AUTHOR", "guowei.wang@samsung.com")]
232         public void PanGestureGetSpeed()
233         {
234             tlog.Debug(tag, $"PanGestureGetSpeed START");
235
236             var testingTarget = new PanGesture(Gesture.StateType.Finished);
237             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
238             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
239
240             tlog.Debug(tag, "GetSpeed : " + testingTarget.GetSpeed());
241
242             testingTarget.Dispose();
243             tlog.Debug(tag, $"PanGestureGetSpeed END (OK)");
244             Assert.Pass("PanGestureGetSpeed");
245         }
246
247         [Test]
248         [Category("P1")]
249         [Description("Test GetDistance property.")]
250         [Property("SPEC", "Tizen.NUI.PanGesture.GetDistance M")]
251         [Property("SPEC_URL", "-")]
252         [Property("CRITERIA", "MR")]
253         [Property("AUTHOR", "guowei.wang@samsung.com")]
254         public void PanGestureGetDistance()
255         {
256             tlog.Debug(tag, $"PanGestureGetDistance START");
257
258             var testingTarget = new PanGesture(Gesture.StateType.Finished);
259             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
260             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
261
262             tlog.Debug(tag, "GetDistance : " + testingTarget.GetDistance());
263
264             testingTarget.Dispose();
265             tlog.Debug(tag, $"PanGestureGetDistance END (OK)");
266             Assert.Pass("PanGestureGetDistance");
267         }
268
269         [Test]
270         [Category("P1")]
271         [Description("Test GetScreenSpeed property.")]
272         [Property("SPEC", "Tizen.NUI.PanGesture.GetScreenSpeed M")]
273         [Property("SPEC_URL", "-")]
274         [Property("CRITERIA", "MR")]
275         [Property("AUTHOR", "guowei.wang@samsung.com")]
276         public void PanGestureGetScreenSpeed()
277         {
278             tlog.Debug(tag, $"PanGestureGetScreenSpeed START");
279
280             var testingTarget = new PanGesture(Gesture.StateType.Finished);
281             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
282             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
283
284             tlog.Debug(tag, "GetScreenSpeed : " + testingTarget.GetScreenSpeed());
285
286             testingTarget.Dispose();
287             tlog.Debug(tag, $"PanGestureGetScreenSpeed END (OK)");
288             Assert.Pass("PanGestureGetScreenSpeed");
289         }
290
291         [Test]
292         [Category("P1")]
293         [Description("Test GetScreenDistance property.")]
294         [Property("SPEC", "Tizen.NUI.PanGesture.GetScreenDistance M")]
295         [Property("SPEC_URL", "-")]
296         [Property("CRITERIA", "MR")]
297         [Property("AUTHOR", "guowei.wang@samsung.com")]
298         public void PanGestureGetScreenDistance()
299         {
300             tlog.Debug(tag, $"PanGestureGetScreenDistance START");
301
302             var testingTarget = new PanGesture(Gesture.StateType.Finished);
303             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
304             Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
305
306             tlog.Debug(tag, "GetScreenDistance : " + testingTarget.GetScreenDistance());
307
308             testingTarget.Dispose();
309             tlog.Debug(tag, $"PanGestureGetScreenDistance END (OK)");
310             Assert.Pass("PanGestureGetScreenDistance");
311         }
312
313         [Test]
314         [Category("P1")]
315         [Description("Test getCPtr property.")]
316         [Property("SPEC", "Tizen.NUI.PanGesture.getCPtr M")]
317         [Property("SPEC_URL", "-")]
318         [Property("CRITERIA", "MR")]
319         [Property("AUTHOR", "guowei.wang@samsung.com")]
320         public void PanGesturegetCPtr()
321         {
322             tlog.Debug(tag, $"PanGesturegetCPtr START");
323
324             using (PanGesture gesture = new PanGesture())
325             {
326                 try
327                 {
328                     PanGesture.getCPtr(gesture);
329                 }
330                 catch (Exception e)
331                 {
332                     tlog.Debug(tag, e.Message.ToString());
333                     Assert.Fail("Caught Exception : Failed!");
334                 }
335             }
336
337             tlog.Debug(tag, $"PanGesturegetCPtr END (OK)");
338             Assert.Pass("PanGestureCPtr");
339         }
340
341         [Test]
342         [Category("P1")]
343         [Description("Test GetPanGestureFromPtr property.")]
344         [Property("SPEC", "Tizen.NUI.PanGesture.GetPanGestureFromPtr M")]
345         [Property("SPEC_URL", "-")]
346         [Property("CRITERIA", "MR")]
347         [Property("AUTHOR", "guowei.wang@samsung.com")]
348         public void PanGestureGetPanGestureFromPtr()
349         {
350             tlog.Debug(tag, $"PanGestureGetPanGestureFromPtr START");
351
352             using (PanGesture gesture = new PanGesture())
353             {
354                 var testingTarget = PanGesture.GetPanGestureFromPtr(PanGesture.getCPtr(gesture).Handle);
355                 Assert.IsNotNull(testingTarget, "Can't create success object Hover");
356                 Assert.IsInstanceOf<PanGesture>(testingTarget, "Should be an instance of PanGesture type.");
357
358                 testingTarget.Dispose();
359             }
360
361             tlog.Debug(tag, $"PanGestureGetPanGestureFromPtr END (OK)");
362             Assert.Pass("PanGestureGetPanGestureFromPtr");
363         }
364     }
365 }