2823fbd9021c6102d8ff7fb10d0f6c0f0ec2aca7
[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. Check whether LongPressGestureDetector is successfully created or not.")]
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             LongPressGestureDetector a1 = new LongPressGestureDetector();
42             LongPressGestureDetector a2 = new LongPressGestureDetector(7);
43             LongPressGestureDetector a3 = new LongPressGestureDetector(3, 7);
44             LongPressGestureDetector a4 = new LongPressGestureDetector(a3);
45
46             a1.Dispose();
47             a2.Dispose();
48             a3.Dispose();
49             a4.Dispose();
50             tlog.Debug(tag, $"LongPressGestureDetectorConstructor END (OK)");
51             Assert.Pass("LongPressGestureDetectorConstructor");
52         }
53
54         [Test]
55         [Category("P1")]
56         [Description("LongPressGestureDetector SetTouchesRequired")]
57         [Property("SPEC", "Tizen.NUI.LongPressGestureDetector.SetTouchesRequired M")]
58         [Property("SPEC_URL", "-")]
59         [Property("CRITERIA", "MR")]
60         [Property("AUTHOR", "guowei.wang@samsung.com")]
61         public void LongPressGestureDetectorSetTouchesRequired()
62         {
63             tlog.Debug(tag, $"LongPressGestureDetectorSetTouchesRequired START");
64             LongPressGestureDetector a1 = new LongPressGestureDetector(7);
65
66             a1.SetTouchesRequired(3);
67             a1.SetTouchesRequired(1, 5);
68
69             a1.Dispose();
70                         
71             tlog.Debug(tag, $"LongPressGestureDetectorSetTouchesRequired END (OK)");
72             Assert.Pass("SetTouchesRequired");
73         }
74
75         [Test]
76         [Category("P1")]
77         [Description("LongPressGestureDetector GetMinimumTouchesRequired")]
78         [Property("SPEC", "Tizen.NUI.LongPressGestureDetector.GetMinimumTouchesRequired M")]
79         [Property("SPEC_URL", "-")]
80         [Property("CRITERIA", "MR")]
81         [Property("AUTHOR", "guowei.wang@samsung.com")]
82         public void LongPressGestureDetectorGetMinimumTouchesRequired()
83         {
84             tlog.Debug(tag, $"LongPressGestureDetectorGetMinimumTouchesRequired START");
85             LongPressGestureDetector a1 = new LongPressGestureDetector(3, 7);
86             uint b1 = a1.GetMinimumTouchesRequired();
87
88             a1.Dispose();
89                         
90             tlog.Debug(tag, $"LongPressGestureDetectorGetMinimumTouchesRequired END (OK)");
91             Assert.Pass("GetMinimumTouchesRequired");
92         }
93
94         [Test]
95         [Category("P1")]
96         [Description("LongPressGestureDetector GetMaximumTouchesRequired")]
97         [Property("SPEC", "Tizen.NUI.LongPressGestureDetector.GetMaximumTouchesRequired M")]
98         [Property("SPEC_URL", "-")]
99         [Property("CRITERIA", "MR")]
100         [Property("AUTHOR", "guowei.wang@samsung.com")]
101         public void LongPressGestureDetectorGetMaximumTouchesRequired()
102         {
103             tlog.Debug(tag, $"LongPressGestureDetectorGetMaximumTouchesRequired START");
104             LongPressGestureDetector a1 = new LongPressGestureDetector(3, 7);
105             uint b1 = a1.GetMaximumTouchesRequired();
106
107             a1.Dispose();
108                         
109             tlog.Debug(tag, $"LongPressGestureDetectorGetMaximumTouchesRequired END (OK)");
110             Assert.Pass("GetMaximumTouchesRequired");
111         }
112
113         [Test]
114         [Category("P1")]
115         [Description("LongPressGestureDetector GetLongPressGestureDetectorFromPtr")]
116         [Property("SPEC", "Tizen.NUI.LongPressGestureDetector.GetLongPressGestureDetectorFromPtr M")]
117         [Property("SPEC_URL", "-")]
118         [Property("CRITERIA", "MR")]
119         [Property("AUTHOR", "guowei.wang@samsung.com")]
120         public void LongPressGestureDetectorGetLongPressGestureDetectorFromPtr()
121         {
122             tlog.Debug(tag, $"LongPressGestureDetectorGetLongPressGestureDetectorFromPtr START");
123             LongPressGestureDetector a1 = new LongPressGestureDetector();
124             LongPressGestureDetector a2 = LongPressGestureDetector.GetLongPressGestureDetectorFromPtr(LongPressGestureDetector.getCPtr(a1).Handle);
125
126             a1.Dispose();
127                         
128             tlog.Debug(tag, $"LongPressGestureDetectorGetLongPressGestureDetectorFromPtr END (OK)");
129             Assert.Pass("GetLongPressGestureDetectorFromPtr");
130         }
131
132         [Test]
133         [Category("P1")]
134         [Description("LongPressGestureDetector DownCast")]
135         [Property("SPEC", "Tizen.NUI.LongPressGestureDetector.DownCast M")]
136         [Property("SPEC_URL", "-")]
137         [Property("CRITERIA", "MR")]
138         [Property("AUTHOR", "guowei.wang@samsung.com")]
139         public void LongPressGestureDetectorDownCast()
140         {
141             tlog.Debug(tag, $"LongPressGestureDetectorDownCast START");
142             BaseHandle handle = new BaseHandle();
143             LongPressGestureDetector a1 = LongPressGestureDetector.DownCast(handle);
144                         
145             tlog.Debug(tag, $"LongPressGestureDetectorDownCast END (OK)");
146             Assert.Pass("LongPressGestureDetectorDownCast");
147         }
148
149         [Test]
150         [Category("P1")]
151         [Description("LongPressGestureDetector DetectedSignal")]
152         [Property("SPEC", "Tizen.NUI.LongPressGestureDetector.DetectedSignal M")]
153         [Property("SPEC_URL", "-")]
154         [Property("CRITERIA", "MR")]
155         [Property("AUTHOR", "guowei.wang@samsung.com")]
156         public void LongPressGestureDetectorDetectedSignal()
157         {
158             tlog.Debug(tag, $"LongPressGestureDetectorDetectedSignal START");
159             LongPressGestureDetector a1 = new LongPressGestureDetector();
160             LongPressGestureDetectedSignal b1 = a1.DetectedSignal();
161
162             a1.Dispose();
163                         
164             tlog.Debug(tag, $"LongPressGestureDetectorDetectedSignal END (OK)");
165             Assert.Pass("LongPressGestureDetectorDetectedSignal");
166         }
167
168         [Test]
169         [Category("P1")]
170         [Description("LongPressGestureDetector getCPtr")]
171         [Property("SPEC", "Tizen.NUI.LongPressGestureDetector.getCPtr M")]
172         [Property("SPEC_URL", "-")]
173         [Property("CRITERIA", "MR")]
174         [Property("AUTHOR", "guowei.wang@samsung.com")]
175         public void LongPressGestureDetectorgetCPtr()
176         {
177             tlog.Debug(tag, $"LongPressGestureDetectorgetCPtr START");
178             LongPressGestureDetector a1 = new LongPressGestureDetector();
179             global::System.Runtime.InteropServices.HandleRef c1 = LongPressGestureDetector.getCPtr(a1);
180
181             a1.Dispose();
182                                 
183                         
184             tlog.Debug(tag, $"LongPressGestureDetectorgetCPtr END (OK)");
185             Assert.Pass("LongPressGestureDetectorgetCPtr");
186         }
187                 
188         [Test]
189         [Category("P1")]
190         [Description("Test Detected property.")]
191         [Property("SPEC", "Tizen.NUI.LongPressGestureDetector.Detected A")]
192         [Property("SPEC_URL", "-")]
193         [Property("CRITERIA", "PRW")]
194         [Property("AUTHOR", "guowei.wang@samsung.com")]
195         public void LongPressGestureDetectorDetected()
196         {
197             tlog.Debug(tag, $"LongPressGestureDetectorDetected START");
198             LongPressGestureDetector a1 = new LongPressGestureDetector();
199                         
200             a1.Detected += OnDetected;
201             a1.Detected -= OnDetected;
202                         
203             LongPressGestureDetector.DetectedEventArgs e = new LongPressGestureDetector.DetectedEventArgs();
204             object o = new object();
205                         
206             OnDetected(o, e);
207                         
208             a1.Dispose();
209                         
210             tlog.Debug(tag, $"LongPressGestureDetectorDetected END (OK)");
211             Assert.Pass("LongPressGestureDetectorDetected");
212         }               
213                 
214         private void OnDetected(object obj, LongPressGestureDetector.DetectedEventArgs e)
215         {
216             View v1 = e.View;
217             e.View = v1;
218                         
219             LongPressGesture p1 = e.LongPressGesture;
220             e.LongPressGesture = p1;
221         }
222         }
223 }