d140506cd221a4eb10e6dad4da5fef271d792cf7
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Events / TSPanGestureDetector.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/PanGestureDetector")]
13     class PublicPanGestureDetectorTest
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 PanGestureDetector object. Check whether PanGestureDetector is successfully created or not.")]
32         [Property("SPEC", "Tizen.NUI.PanGestureDetector.PanGestureDetector C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("COVPARAM", "")]
36         [Property("AUTHOR", "guowei.wang@samsung.com")]
37         public void PanGestureDetectorConstructor()
38         {
39             tlog.Debug(tag, $"PanGestureDetectorConstructor START");
40             PanGestureDetector a1 = new PanGestureDetector();
41             PanGestureDetector a2 = new PanGestureDetector(a1);
42
43             a1.Dispose();
44             a2.Dispose();
45
46             tlog.Debug(tag, $"PanGestureDetectorConstructor END (OK)");
47             Assert.Pass("PanGestureDetectorConstructor");
48         }
49
50         [Test]
51         [Category("P1")]
52         [Description("Test DirectionLeft property.")]
53         [Property("SPEC", "Tizen.NUI.PanGestureDetector.DirectionLeft A")]
54         [Property("SPEC_URL", "-")]
55         [Property("CRITERIA", "PRW")]
56         [Property("AUTHOR", "guowei.wang@samsung.com")]
57         public void PanGestureDetectorDirectionLeft()
58         {
59             tlog.Debug(tag, $"PanGestureDetectorDirectionLeft START");
60             Radian r1 = PanGestureDetector.DirectionLeft;
61             
62             tlog.Debug(tag, $"PanGestureDetectorDirectionLeft END (OK)");
63             Assert.Pass("PanGestureDetectorDirectionLeft");
64         }
65
66         [Test]
67         [Category("P1")]
68         [Description("Test DirectionRight property.")]
69         [Property("SPEC", "Tizen.NUI.PanGestureDetector.DirectionRight A")]
70         [Property("SPEC_URL", "-")]
71         [Property("CRITERIA", "PRW")]
72         [Property("AUTHOR", "guowei.wang@samsung.com")]
73         public void PanGestureDetectorDirectionRight()
74         {
75             tlog.Debug(tag, $"PanGestureDetectorDirectionRight START");
76             Radian r1 = PanGestureDetector.DirectionRight;
77             
78             tlog.Debug(tag, $"PanGestureDetectorDirectionRight END (OK)");
79             Assert.Pass("PanGestureDetectorDirectionLeft");
80         }
81
82         [Test]
83         [Category("P1")]
84         [Description("Test DirectionUp property.")]
85         [Property("SPEC", "Tizen.NUI.PanGestureDetector.DirectionUp A")]
86         [Property("SPEC_URL", "-")]
87         [Property("CRITERIA", "PRW")]
88         [Property("AUTHOR", "guowei.wang@samsung.com")]
89         public void PanGestureDetectorDirectionUp()
90         {
91             tlog.Debug(tag, $"PanGestureDetectorDirectionUp START");
92             Radian r1 = PanGestureDetector.DirectionUp;
93             
94             tlog.Debug(tag, $"PanGestureDetectorDirectionUp END (OK)");
95             Assert.Pass("PanGestureDetectorDirectionUp");
96         }
97
98         [Test]
99         [Category("P1")]
100         [Description("Test DirectionDown property.")]
101         [Property("SPEC", "Tizen.NUI.PanGestureDetector.DirectionDown A")]
102         [Property("SPEC_URL", "-")]
103         [Property("CRITERIA", "PRW")]
104         [Property("AUTHOR", "guowei.wang@samsung.com")]
105         public void PanGestureDetectorDirectionDown()
106         {
107             tlog.Debug(tag, $"PanGestureDetectorDirectionDown START");
108             Radian r1 = PanGestureDetector.DirectionDown;
109             
110             tlog.Debug(tag, $"PanGestureDetectorDirectionDown END (OK)");
111             Assert.Pass("PanGestureDetectorDirectionDown");
112         }
113
114         [Test]
115         [Category("P1")]
116         [Description("Test DirectionHorizontal property.")]
117         [Property("SPEC", "Tizen.NUI.PanGestureDetector.DirectionHorizontal A")]
118         [Property("SPEC_URL", "-")]
119         [Property("CRITERIA", "PRW")]
120         [Property("AUTHOR", "guowei.wang@samsung.com")]
121         public void PanGestureDetectorDirectionHorizontal()
122         {
123             tlog.Debug(tag, $"PanGestureDetectorDirectionHorizontal START");
124             Radian r1 = PanGestureDetector.DirectionHorizontal;
125             
126             tlog.Debug(tag, $"PanGestureDetectorDirectionHorizontal END (OK)");
127             Assert.Pass("PanGestureDetectorDirectionHorizontal");
128         }
129
130         [Test]
131         [Category("P1")]
132         [Description("Test DirectionVertical property.")]
133         [Property("SPEC", "Tizen.NUI.PanGestureDetector.DirectionVertical A")]
134         [Property("SPEC_URL", "-")]
135         [Property("CRITERIA", "PRW")]
136         [Property("AUTHOR", "guowei.wang@samsung.com")]
137         public void PanGestureDetectorDirectionVertical()
138         {
139             tlog.Debug(tag, $"PanGestureDetectorDirectionVertical START");
140             Radian r1 = PanGestureDetector.DirectionVertical;
141             
142             tlog.Debug(tag, $"PanGestureDetectorDirectionVertical END (OK)");
143             Assert.Pass("PanGestureDetectorDirectionVertical");
144         }
145
146         [Test]
147         [Category("P1")]
148         [Description("Test DefaultThreshold property.")]
149         [Property("SPEC", "Tizen.NUI.PanGestureDetector.DefaultThreshold A")]
150         [Property("SPEC_URL", "-")]
151         [Property("CRITERIA", "PRW")]
152         [Property("AUTHOR", "guowei.wang@samsung.com")]
153         public void PanGestureDetectorDefaultThreshold()
154         {
155             tlog.Debug(tag, $"PanGestureDetectorDefaultThreshold START");
156             Radian r1 = PanGestureDetector.DefaultThreshold;
157             
158             tlog.Debug(tag, $"PanGestureDetectorDefaultThreshold END (OK)");
159             Assert.Pass("PanGestureDetectorDefaultThreshold");
160         }
161
162         [Test]
163         [Category("P1")]
164         [Description("Test ScreenPosition property.")]
165         [Property("SPEC", "Tizen.NUI.PanGestureDetector.ScreenPosition A")]
166         [Property("SPEC_URL", "-")]
167         [Property("CRITERIA", "PRW")]
168         [Property("AUTHOR", "guowei.wang@samsung.com")]
169         public void PanGestureDetectorScreenPosition()
170         {
171             tlog.Debug(tag, $"PanGestureDetectorScreenPosition START");
172             PanGestureDetector a1 = new PanGestureDetector();
173             Vector2 v1 = a1.ScreenPosition;
174             
175             tlog.Debug(tag, $"PanGestureDetectorScreenPosition END (OK)");
176             Assert.Pass("PanGestureDetectorScreenPosition");
177         }
178
179         [Test]
180         [Category("P1")]
181         [Description("Test ScreenDisplacement property.")]
182         [Property("SPEC", "Tizen.NUI.PanGestureDetector.ScreenDisplacement A")]
183         [Property("SPEC_URL", "-")]
184         [Property("CRITERIA", "PRW")]
185         [Property("AUTHOR", "guowei.wang@samsung.com")]
186         public void PanGestureDetectorScreenDisplacement()
187         {
188             tlog.Debug(tag, $"PanGestureDetectorScreenDisplacement START");
189             PanGestureDetector a1 = new PanGestureDetector();
190             Vector2 v1 = a1.ScreenDisplacement;
191             
192             tlog.Debug(tag, $"PanGestureDetectorScreenDisplacement END (OK)");
193             Assert.Pass("PanGestureDetectorScreenDisplacement");
194         }
195
196         [Test]
197         [Category("P1")]
198         [Description("Test ScreenVelocity property.")]
199         [Property("SPEC", "Tizen.NUI.PanGestureDetector.ScreenVelocity A")]
200         [Property("SPEC_URL", "-")]
201         [Property("CRITERIA", "PRW")]
202         [Property("AUTHOR", "guowei.wang@samsung.com")]
203         public void PanGestureDetectorScreenVelocity()
204         {
205             tlog.Debug(tag, $"PanGestureDetectorScreenVelocity START");
206             PanGestureDetector a1 = new PanGestureDetector();
207             Vector2 v1 = a1.ScreenVelocity;
208             
209             tlog.Debug(tag, $"PanGestureDetectorScreenVelocity END (OK)");
210             Assert.Pass("PanGestureDetectorScreenVelocity");
211         }
212
213         [Test]
214         [Category("P1")]
215         [Description("Test LocalPosition property.")]
216         [Property("SPEC", "Tizen.NUI.PanGestureDetector.LocalPosition A")]
217         [Property("SPEC_URL", "-")]
218         [Property("CRITERIA", "PRW")]
219         [Property("AUTHOR", "guowei.wang@samsung.com")]
220         public void PanGestureDetectorLocalPosition()
221         {
222             tlog.Debug(tag, $"PanGestureDetectorLocalPosition START");
223             PanGestureDetector a1 = new PanGestureDetector();
224             Vector2 v1 = a1.LocalPosition;
225             
226             tlog.Debug(tag, $"PanGestureDetectorLocalPosition END (OK)");
227             Assert.Pass("PanGestureDetectorLocalPosition");
228         }
229
230         [Test]
231         [Category("P1")]
232         [Description("Test LocalDisplacement property.")]
233         [Property("SPEC", "Tizen.NUI.PanGestureDetector.LocalDisplacement A")]
234         [Property("SPEC_URL", "-")]
235         [Property("CRITERIA", "PRW")]
236         [Property("AUTHOR", "guowei.wang@samsung.com")]
237         public void PanGestureDetectorLocalDisplacement()
238         {
239             tlog.Debug(tag, $"PanGestureDetectorLocalDisplacement START");
240             PanGestureDetector a1 = new PanGestureDetector();
241             Vector2 v1 = a1.LocalDisplacement;
242             
243             tlog.Debug(tag, $"PanGestureDetectorLocalDisplacement END (OK)");
244             Assert.Pass("PanGestureDetectorLocalDisplacement");
245         }
246
247         [Test]
248         [Category("P1")]
249         [Description("Test LocalVelocity property.")]
250         [Property("SPEC", "Tizen.NUI.PanGestureDetector.LocalVelocity A")]
251         [Property("SPEC_URL", "-")]
252         [Property("CRITERIA", "PRW")]
253         [Property("AUTHOR", "guowei.wang@samsung.com")]
254         public void PanGestureDetectorLocalVelocity()
255         {
256             tlog.Debug(tag, $"PanGestureDetectorLocalVelocity START");
257             PanGestureDetector a1 = new PanGestureDetector();
258             Vector2 v1 = a1.LocalVelocity;
259             
260             tlog.Debug(tag, $"PanGestureDetectorLocalVelocity END (OK)");
261             Assert.Pass("PanGestureDetectorLocalVelocity");
262         }
263
264         [Test]
265         [Category("P1")]
266         [Description("Test Panning property.")]
267         [Property("SPEC", "Tizen.NUI.PanGestureDetector.Panning A")]
268         [Property("SPEC_URL", "-")]
269         [Property("CRITERIA", "PRW")]
270         [Property("AUTHOR", "guowei.wang@samsung.com")]
271         public void PanGestureDetectorPanning()
272         {
273             tlog.Debug(tag, $"PanGestureDetectorPanning START");
274             PanGestureDetector a1 = new PanGestureDetector();
275             bool b1 = a1.Panning;
276             
277             tlog.Debug(tag, $"PanGestureDetectorPanning END (OK)");
278             Assert.Pass("PanGestureDetectorPanning");
279         }
280
281         [Test]
282         [Category("P1")]
283         [Description("Test SetMinimumTouchesRequired property.")]
284         [Property("SPEC", "Tizen.NUI.PanGestureDetector.SetMinimumTouchesRequired M")]
285         [Property("SPEC_URL", "-")]
286         [Property("CRITERIA", "MR")]
287         [Property("AUTHOR", "guowei.wang@samsung.com")]
288         public void PanGestureDetectorSetMinimumTouchesRequired()
289         {
290             tlog.Debug(tag, $"PanGestureDetectorSetMinimumTouchesRequired START");
291             PanGestureDetector a1 = new PanGestureDetector();
292
293             a1.SetMinimumTouchesRequired(2);
294             
295             tlog.Debug(tag, $"PanGestureDetectorSetMinimumTouchesRequired END (OK)");
296             Assert.Pass("PanGestureDetectorSetMinimumTouchesRequired");
297         }
298
299         [Test]
300         [Category("P1")]
301         [Description("Test SetMaximumTouchesRequired property.")]
302         [Property("SPEC", "Tizen.NUI.PanGestureDetector.SetMaximumTouchesRequired M")]
303         [Property("SPEC_URL", "-")]
304         [Property("CRITERIA", "MR")]
305         [Property("AUTHOR", "guowei.wang@samsung.com")]
306         public void PanGestureDetectorSetMaximumTouchesRequired()
307         {
308             tlog.Debug(tag, $"PanGestureDetectorSetMaximumTouchesRequired START");
309             PanGestureDetector a1 = new PanGestureDetector();
310             a1.SetMaximumTouchesRequired(4);
311             
312             tlog.Debug(tag, $"PanGestureDetectorSetMaximumTouchesRequired END (OK)");
313             Assert.Pass("PanGestureDetectorSetMaximumTouchesRequired");
314         }
315
316         [Test]
317         [Category("P1")]
318         [Description("Test GetMinimumTouchesRequired property.")]
319         [Property("SPEC", "Tizen.NUI.PanGestureDetector.GetMinimumTouchesRequired M")]
320         [Property("SPEC_URL", "-")]
321         [Property("CRITERIA", "MR")]
322         [Property("AUTHOR", "guowei.wang@samsung.com")]
323         public void PanGestureDetectorGetMinimumTouchesRequired()
324         {
325             tlog.Debug(tag, $"PanGestureDetectorGetMinimumTouchesRequired START");
326             PanGestureDetector a1 = new PanGestureDetector();
327             a1.SetMinimumTouchesRequired(4);
328
329             a1.GetMinimumTouchesRequired();
330             
331             tlog.Debug(tag, $"PanGestureDetectorGetMinimumTouchesRequired END (OK)");
332             Assert.Pass("PanGestureDetectorSetMaximumTouchesRequired");
333         }
334
335         [Test]
336         [Category("P1")]
337         [Description("Test GetMaximumTouchesRequired property.")]
338         [Property("SPEC", "Tizen.NUI.PanGestureDetector.GetMaximumTouchesRequired M")]
339         [Property("SPEC_URL", "-")]
340         [Property("CRITERIA", "MR")]
341         [Property("AUTHOR", "guowei.wang@samsung.com")]
342         public void PanGestureDetectorGetMaximumTouchesRequired()
343         {
344             tlog.Debug(tag, $"PanGestureDetectorGetMaximumTouchesRequired START");
345             PanGestureDetector a1 = new PanGestureDetector();
346             a1.SetMaximumTouchesRequired(4);
347
348             a1.GetMaximumTouchesRequired();
349             
350             tlog.Debug(tag, $"PanGestureDetectorGetMaximumTouchesRequired END (OK)");
351             Assert.Pass("PanGestureDetectorSetMaximumTouchesRequired");
352         }
353
354         [Test]
355         [Category("P1")]
356         [Description("Test AddAngle property.")]
357         [Property("SPEC", "Tizen.NUI.PanGestureDetector.AddAngle M")]
358         [Property("SPEC_URL", "-")]
359         [Property("CRITERIA", "MR")]
360         [Property("AUTHOR", "guowei.wang@samsung.com")]
361         public void PanGestureDetectorAddAngle()
362         {
363             tlog.Debug(tag, $"PanGestureDetectorAddAngle START");
364             PanGestureDetector a1 = new PanGestureDetector();
365             Radian angle = new Radian(4);
366             Radian threshold = new Radian(15);
367             a1.AddAngle(angle);
368             a1.AddAngle(angle, threshold);
369             tlog.Debug(tag, $"PanGestureDetectorAddAngle END (OK)");
370             Assert.Pass("PanGestureDetectorAddAngle");
371         }
372
373         [Test]
374         [Category("P1")]
375         [Description("Test AddDirection property.")]
376         [Property("SPEC", "Tizen.NUI.PanGestureDetector.AddDirection M")]
377         [Property("SPEC_URL", "-")]
378         [Property("CRITERIA", "MR")]
379         [Property("AUTHOR", "guowei.wang@samsung.com")]
380         public void PanGestureDetectorAddDirection()
381         {
382             tlog.Debug(tag, $"PanGestureDetectorAddDirection START");
383             PanGestureDetector a1 = new PanGestureDetector();
384
385             Radian angle = new Radian(4);
386             Radian threshold = new Radian(15);
387             a1.AddDirection(angle);
388
389             a1.AddDirection(angle, threshold);
390
391             
392             tlog.Debug(tag, $"PanGestureDetectorAddDirection END (OK)");
393             Assert.Pass("PanGestureDetectorAddDirection");
394         }
395
396         [Test]
397         [Category("P1")]
398         [Description("Test GetAngleCount property.")]
399         [Property("SPEC", "Tizen.NUI.PanGestureDetector.GetAngleCount M")]
400         [Property("SPEC_URL", "-")]
401         [Property("CRITERIA", "MR")]
402         [Property("AUTHOR", "guowei.wang@samsung.com")]
403         public void PanGestureDetectorGetAngleCount()
404         {
405             tlog.Debug(tag, $"PanGestureDetectorGetAngleCount START");
406             PanGestureDetector a1 = new PanGestureDetector();
407
408             Radian angle = new Radian(4);
409             a1.AddAngle(angle);
410
411             a1.GetAngleCount();
412             
413             tlog.Debug(tag, $"PanGestureDetectorGetAngleCount END (OK)");
414             Assert.Pass("PanGestureDetectorAddDirection");
415         }
416
417         [Test]
418         [Category("P1")]
419         [Description("Test ClearAngles property.")]
420         [Property("SPEC", "Tizen.NUI.PanGestureDetector.ClearAngles M")]
421         [Property("SPEC_URL", "-")]
422         [Property("CRITERIA", "MR")]
423         [Property("AUTHOR", "guowei.wang@samsung.com")]
424         public void PanGestureDetectorClearAngles()
425         {
426             tlog.Debug(tag, $"PanGestureDetectorClearAngles START");
427             PanGestureDetector a1 = new PanGestureDetector();
428
429             Radian angle = new Radian(4);
430             a1.AddAngle(angle);
431
432             a1.ClearAngles();
433             
434             tlog.Debug(tag, $"PanGestureDetectorClearAngles END (OK)");
435             Assert.Pass("PanGestureDetectorClearAngles");
436         }
437
438         [Test]
439         [Category("P1")]
440         [Description("Test RemoveAngle property.")]
441         [Property("SPEC", "Tizen.NUI.PanGestureDetector.RemoveAngle M")]
442         [Property("SPEC_URL", "-")]
443         [Property("CRITERIA", "MR")]
444         [Property("AUTHOR", "guowei.wang@samsung.com")]
445         public void PanGestureDetectorRemoveAngle()
446         {
447             tlog.Debug(tag, $"PanGestureDetectorRemoveAngle START");
448             PanGestureDetector a1 = new PanGestureDetector();
449
450             Radian angle = new Radian(4);
451             a1.AddAngle(angle);
452
453             a1.RemoveAngle(angle);
454             
455             tlog.Debug(tag, $"PanGestureDetectorRemoveAngle END (OK)");
456             Assert.Pass("PanGestureDetectorClearAngles");
457         }
458
459
460         [Test]
461         [Category("P1")]
462         [Description("Test RemoveDirection property.")]
463         [Property("SPEC", "Tizen.NUI.PanGestureDetector.RemoveDirection M")]
464         [Property("SPEC_URL", "-")]
465         [Property("CRITERIA", "MR")]
466         [Property("AUTHOR", "guowei.wang@samsung.com")]
467         public void PanGestureDetectorRemoveDirection()
468         {
469             tlog.Debug(tag, $"PanGestureDetectorRemoveDirection START");
470             PanGestureDetector a1 = new PanGestureDetector();
471
472             Radian angle = new Radian(4);
473             a1.AddDirection(angle);
474
475             a1.RemoveDirection(angle);
476             
477             tlog.Debug(tag, $"PanGestureDetectorRemoveDirection END (OK)");
478             Assert.Pass("PanGestureDetectorClearAngles");
479         }
480
481         [Test]
482         [Category("P1")]
483         [Description("Test SetPanGestureProperties property.")]
484         [Property("SPEC", "Tizen.NUI.PanGestureDetector.SetPanGestureProperties M")]
485         [Property("SPEC_URL", "-")]
486         [Property("CRITERIA", "MR")]
487         [Property("AUTHOR", "guowei.wang@samsung.com")]
488         public void PanGestureDetectorSetPanGestureProperties()
489         {
490             tlog.Debug(tag, $"PanGestureDetectorSetPanGestureProperties START");
491             PanGesture pan = new PanGesture();
492
493             PanGestureDetector.SetPanGestureProperties(pan);
494             
495             tlog.Debug(tag, $"PanGestureDetectorSetPanGestureProperties END (OK)");
496             Assert.Pass("PanGestureDetectorClearAngles");
497         }
498
499         [Test]
500         [Category("P1")]
501         [Description("Test GetPanGestureDetectorFromPtr property.")]
502         [Property("SPEC", "Tizen.NUI.PanGestureDetector.GetPanGestureDetectorFromPtr M")]
503         [Property("SPEC_URL", "-")]
504         [Property("CRITERIA", "MR")]
505         [Property("AUTHOR", "guowei.wang@samsung.com")]
506         public void PanGestureDetectorGetPanGestureDetectorFromPtr()
507         {
508             tlog.Debug(tag, $"PanGestureDetectorGetPanGestureDetectorFromPtr START");
509             PanGestureDetector a1 = new PanGestureDetector();
510                                    
511             PanGestureDetector.GetPanGestureDetectorFromPtr(PanGestureDetector.getCPtr(a1).Handle);
512             a1.Dispose();
513                                         
514             tlog.Debug(tag, $"PanGestureDetectorGetPanGestureDetectorFromPtr END (OK)");
515             Assert.Pass("PanGestureDetectorGetPanGestureDetectorFromPtr");
516         }
517                 
518                 [Test]
519         [Category("P1")]
520         [Description("Test Detected property.")]
521         [Property("SPEC", "Tizen.NUI.PanGestureDetector.Detected A")]
522         [Property("SPEC_URL", "-")]
523         [Property("CRITERIA", "PRW")]
524         [Property("AUTHOR", "guowei.wang@samsung.com")]
525         public void PanGestureDetectorDetected()
526         {
527             tlog.Debug(tag, $"PanGestureDetectorDetected START");
528             PanGestureDetector a1 = new PanGestureDetector();
529                         
530             a1.Detected += OnDetected;
531             a1.Detected -= OnDetected;
532
533             PanGestureDetector.DetectedEventArgs e = new PanGestureDetector.DetectedEventArgs();
534             object o = new object();
535                         
536             OnDetected(o, e);
537                         
538             a1.Dispose();
539                         
540             tlog.Debug(tag, $"PanGestureDetectorDetected END (OK)");
541             Assert.Pass("PanGestureDetectorDetected");
542         }               
543                 
544                 private void OnDetected(object obj, PanGestureDetector.DetectedEventArgs e)
545                 {
546             View v1 = e.View;
547             e.View = v1;
548                         
549             PanGesture p1 = e.PanGesture;
550             e.PanGesture = p1;
551                 }
552     }
553
554 }