aecc2092e898d3cfd1bc302161e02eea0fa4e79d
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Events / TSTapGestureDetector.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/TapGestureDetector")]
13     class PublicTapGestureDetectorTest
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("TapGestureDetector constructor")]
32         [Property("SPEC", "Tizen.NUI.TapGestureDetector.TapGestureDetector C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void TapGestureDetectorConstructor()
37         {
38             tlog.Debug(tag, $"TapGestureDetectorConstructor START");
39             
40             TapGestureDetector a1 = new TapGestureDetector();
41             TapGestureDetector a2 = new TapGestureDetector(4);
42             TapGestureDetector a3 = new TapGestureDetector(a2);
43             
44             a3.Dispose();
45             a2.Dispose();
46             a1.Dispose();
47             
48             tlog.Debug(tag, $"TapGestureDetectorConstructor END (OK)");
49             Assert.Pass("TapGestureDetectorConstructor");
50         }
51
52         [Test]
53         [Category("P1")]
54         [Description("TapGestureDetector SetMinimumTapsRequired")]
55         [Property("SPEC", "Tizen.NUI.TapGestureDetector.SetMinimumTapsRequired M")]
56         [Property("SPEC_URL", "-")]
57         [Property("CRITERIA", "MR")]
58         [Property("AUTHOR", "guowei.wang@samsung.com")]
59         public void TapGestureDetectorSetMinimumTapsRequired()
60         {
61             tlog.Debug(tag, $"TapGestureDetectorSetMinimumTapsRequired START");
62             TapGestureDetector a1 = new TapGestureDetector();
63             a1.SetMinimumTapsRequired(2);
64             a1.Dispose();
65             
66             tlog.Debug(tag, $"TapGestureDetectorSetMinimumTapsRequired END (OK)");
67             Assert.Pass("TapGestureDetectorSetMinimumTapsRequired");
68         }
69
70         [Test]
71         [Category("P1")]
72         [Description("TapGestureDetector SetMaximumTapsRequired")]
73         [Property("SPEC", "Tizen.NUI.TapGestureDetector.SetMaximumTapsRequired M")]
74         [Property("SPEC_URL", "-")]
75         [Property("CRITERIA", "MR")]
76         [Property("AUTHOR", "guowei.wang@samsung.com")]
77         public void TapGestureDetectorSetMaximumTapsRequired()
78         {
79             tlog.Debug(tag, $"TapGestureDetectorSetMaximumTapsRequired START");
80             TapGestureDetector a1 = new TapGestureDetector();
81             a1.SetMaximumTapsRequired(9);
82             a1.Dispose();
83             
84             tlog.Debug(tag, $"TapGestureDetectorSetMaximumTapsRequired END (OK)");
85             Assert.Pass("TapGestureDetectorSetMaximumTapsRequired");
86         }
87
88         [Test]
89         [Category("P1")]
90         [Description("TapGestureDetector GetMinimumTapsRequired")]
91         [Property("SPEC", "Tizen.NUI.TapGestureDetector.GetMinimumTapsRequired M")]
92         [Property("SPEC_URL", "-")]
93         [Property("CRITERIA", "MR")]
94         [Property("AUTHOR", "guowei.wang@samsung.com")]
95         public void TapGestureDetectorGetMinimumTapsRequired()
96         {
97             tlog.Debug(tag, $"TapGestureDetectorGetMinimumTapsRequired START");
98             TapGestureDetector a1 = new TapGestureDetector();
99             a1.SetMinimumTapsRequired(2);
100
101             a1.GetMinimumTapsRequired();
102             a1.Dispose();
103             
104             tlog.Debug(tag, $"TapGestureDetectorGetMinimumTapsRequired END (OK)");
105             Assert.Pass("TapGestureDetectorGetMinimumTapsRequired");
106         }
107
108         [Test]
109         [Category("P1")]
110         [Description("TapGestureDetector GetMaximumTapsRequired")]
111         [Property("SPEC", "Tizen.NUI.TapGestureDetector.GetMaximumTapsRequired M")]
112         [Property("SPEC_URL", "-")]
113         [Property("CRITERIA", "MR")]
114         [Property("AUTHOR", "guowei.wang@samsung.com")]
115         public void TapGestureDetectorGetMaximumTapsRequired()
116         {
117             tlog.Debug(tag, $"TapGestureDetectorGetMaximumTapsRequired START");
118             TapGestureDetector a1 = new TapGestureDetector();
119             a1.SetMaximumTapsRequired(9);
120
121             a1.GetMaximumTapsRequired();
122             a1.Dispose();
123             
124             tlog.Debug(tag, $"TapGestureDetectorGetMaximumTapsRequired END (OK)");
125             Assert.Pass("TapGestureDetectorGetMaximumTapsRequired");
126         }
127
128         [Test]
129         [Category("P1")]
130         [Description("TapGestureDetector DownCast")]
131         [Property("SPEC", "Tizen.NUI.TapGestureDetector.DownCast M")]
132         [Property("SPEC_URL", "-")]
133         [Property("CRITERIA", "MR")]
134         [Property("AUTHOR", "guowei.wang@samsung.com")]
135         public void TapGestureDetectorDownCast()
136         {
137             tlog.Debug(tag, $"TapGestureDetectorDownCast START");
138             BaseHandle handle = new BaseHandle();
139
140             TapGestureDetector a1 = TapGestureDetector.DownCast(handle);
141             
142             tlog.Debug(tag, $"TapGestureDetectorDownCast END (OK)");
143             Assert.Pass("TapGestureDetectorDownCast");
144         }
145
146         [Test]
147         [Category("P1")]
148         [Description("TapGestureDetector getCPtr")]
149         [Property("SPEC", "Tizen.NUI.TapGestureDetector.getCPtr M")]
150         [Property("SPEC_URL", "-")]
151         [Property("CRITERIA", "MR")]
152         [Property("AUTHOR", "guowei.wang@samsung.com")]
153         public void TapGestureDetectorgetCPtr()
154         {
155             tlog.Debug(tag, $"TapGestureDetectorgetCPtr START");
156             TapGestureDetector a1 = new TapGestureDetector();
157             global::System.Runtime.InteropServices.HandleRef p1 = TapGestureDetector.getCPtr(a1);
158             
159             tlog.Debug(tag, $"TapGestureDetectorgetCPtr END (OK)");
160             Assert.Pass("TapGestureDetectorgetCPtr");
161         }
162
163         [Test]
164         [Category("P1")]
165         [Description("TapGestureDetector GetTapGestureDetectorFromPtr")]
166         [Property("SPEC", "Tizen.NUI.TapGestureDetector.GetTapGestureDetectorFromPtr M")]
167         [Property("SPEC_URL", "-")]
168         [Property("CRITERIA", "MR")]
169         [Property("AUTHOR", "guowei.wang@samsung.com")]
170         public void TapGestureDetectorGetTapGestureDetectorFromPtr()
171         {
172             tlog.Debug(tag, $"TapGestureDetectorGetTapGestureDetectorFromPtr START");
173             TapGestureDetector a1 = new TapGestureDetector();
174                         
175             TapGestureDetector a2 = TapGestureDetector.GetTapGestureDetectorFromPtr(TapGestureDetector.getCPtr(a1).Handle);
176
177             a1.Dispose();
178             
179             tlog.Debug(tag, $"TapGestureDetectorGetTapGestureDetectorFromPtr END (OK)");
180             Assert.Pass("TapGestureDetectorGetTapGestureDetectorFromPtr");
181         }
182
183         [Test]
184         [Category("P1")]
185         [Description("TapGestureDetector DetectedSignal")]
186         [Property("SPEC", "Tizen.NUI.TapGestureDetector.DetectedSignal M")]
187         [Property("SPEC_URL", "-")]
188         [Property("CRITERIA", "MR")]
189         [Property("AUTHOR", "guowei.wang@samsung.com")]
190         public void TapGestureDetectorDetectedSignal()
191         {
192             tlog.Debug(tag, $"TapGestureDetectorDetectedSignal START");
193             TapGestureDetector a1 = new TapGestureDetector();
194             TapGestureDetectedSignal b1 = a1.DetectedSignal();
195          
196             tlog.Debug(tag, $"TapGestureDetectorDetectedSignal END (OK)");
197             Assert.Pass("TapGestureDetectorDetectedSignal");
198         }
199                 
200                 [Test]
201         [Category("P1")]
202         [Description("Test Detected property.")]
203         [Property("SPEC", "Tizen.NUI.TapGestureDetector.Detected A")]
204         [Property("SPEC_URL", "-")]
205         [Property("CRITERIA", "PRW")]
206         [Property("AUTHOR", "guowei.wang@samsung.com")]
207         public void TapGestureDetectorDetected()
208         {
209             tlog.Debug(tag, $"TapGestureDetectorDetected START");
210             TapGestureDetector a1 = new TapGestureDetector();
211                         
212             a1.Detected += OnDetected;
213             a1.Detected -= OnDetected;
214                         
215             TapGestureDetector.DetectedEventArgs e = new TapGestureDetector.DetectedEventArgs();
216             object o = new object();
217                         
218             OnDetected(o, e);
219                         
220             a1.Dispose();
221                         
222             tlog.Debug(tag, $"TapGestureDetectorDetected END (OK)");
223             Assert.Pass("TapGestureDetectorDetected");
224         }               
225                 
226                 private void OnDetected(object obj, TapGestureDetector.DetectedEventArgs e)
227                 {
228             View v1 = e.View;
229             e.View = v1;
230                         
231             TapGesture p1 = e.TapGesture;
232             e.TapGesture = p1;
233                 }       
234     }
235
236 }