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