1d8a5767560861bc1593e7e96118749d8b7195d8
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Events / TSGestureDetector.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/GestureDetector")]
13     class PublicGestureDetectorTest
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("GestureDetector constructor")]
32         [Property("SPEC", "Tizen.NUI.GestureDetector.GestureDetector C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void GestureDetectorConstructor()
37         {
38             tlog.Debug(tag, $"GestureDetectorConstructor START");
39                         
40             GestureDetector ret = new GestureDetector();
41             Assert.IsNotNull(ret, "should be not null");
42             Assert.IsInstanceOf<GestureDetector>(ret, "should be an instance of testing target class!");
43
44             GestureDetector newOne = new GestureDetector(ret);
45             Assert.IsNotNull(newOne, "should be not null");
46             Assert.IsInstanceOf<GestureDetector>(newOne, "should be an instance of testing target class!");
47            
48             GestureDetector newTwo = new GestureDetector(GestureDetector.getCPtr(ret).Handle, true);
49             Assert.IsNotNull(newTwo, "should be not null");
50             Assert.IsInstanceOf<GestureDetector>(newTwo, "should be an instance of testing target class!");
51
52             ret.Dispose();
53             newOne.Dispose();
54             newTwo.Dispose();
55             tlog.Debug(tag, $"GestureDetectorConstructor END (OK)");
56             Assert.Pass("GestureDetectorConstructor");
57         }
58
59         [Test]
60         [Category("P1")]
61         [Description("GestureDetector Attach")]
62         [Property("SPEC", "Tizen.NUI.GestureDetector.Attach M")]
63         [Property("SPEC_URL", "-")]
64         [Property("CRITERIA", "MR")]
65         [Property("AUTHOR", "guowei.wang@samsung.com")]
66         public void GestureDetectorAttach()
67         {
68             tlog.Debug(tag, $"GestureDetectorAttach START");
69
70             LongPressGestureDetector ret = new LongPressGestureDetector();
71             Assert.IsNotNull(ret, "should be not null");
72             Assert.IsInstanceOf<GestureDetector>(ret, "should be an instance of testing target class!");
73
74             View view = new View();
75             ret.Attach(view);
76
77             ret.Detach(view);
78             ret.Dispose();
79             
80             tlog.Debug(tag, $"GestureDetectorAttach END (OK)");
81             Assert.Pass("GestureDetectorAttach");
82         }
83
84         [Test]
85         [Category("P1")]
86         [Description("GestureDetector Detach")]
87         [Property("SPEC", "Tizen.NUI.GestureDetector.Detach M")]
88         [Property("SPEC_URL", "-")]
89         [Property("CRITERIA", "MR")]
90         [Property("AUTHOR", "guowei.wang@samsung.com")]
91         public void GestureDetectorDetach()
92         {
93             tlog.Debug(tag, $"GestureDetectorDetach START");
94             LongPressGestureDetector ret = new LongPressGestureDetector();
95
96             Assert.IsNotNull(ret, "should be not null");
97             Assert.IsInstanceOf<GestureDetector>(ret, "should be an instance of testing target class!");
98
99             View view = new View();
100
101             ret.Attach(view);
102             ret.Detach(view);
103             ret.Dispose();
104             
105             tlog.Debug(tag, $"GestureDetectorDetach END (OK)");
106             Assert.Pass("GestureDetectorDetach");
107         }
108
109         [Test]
110         [Category("P1")]
111         [Description("GestureDetector DetachAll")]
112         [Property("SPEC", "Tizen.NUI.GestureDetector.DetachAll M")]
113         [Property("SPEC_URL", "-")]
114         [Property("CRITERIA", "MR")]
115         [Property("AUTHOR", "guowei.wang@samsung.com")]
116         public void GestureDetectorDetachAll()
117         {
118             tlog.Debug(tag, $"GestureDetectorDetachAll START");
119             LongPressGestureDetector ret = new LongPressGestureDetector();
120             Assert.IsNotNull(ret, "should be not null");
121             Assert.IsInstanceOf<GestureDetector>(ret, "should be an instance of testing target class!");
122
123             View view = new View();
124             ret.Attach(view);
125
126             ret.DetachAll();
127             ret.Dispose();
128             
129             tlog.Debug(tag, $"GestureDetectorDetachAll END (OK)");
130             Assert.Pass("GestureDetectorDetachAll");
131         }
132
133         [Test]
134         [Category("P1")]
135         [Description("GestureDetector GetAttachedViewCount")]
136         [Property("SPEC", "Tizen.NUI.GestureDetector.GetAttachedViewCount M")]
137         [Property("SPEC_URL", "-")]
138         [Property("CRITERIA", "MR")]
139         [Property("AUTHOR", "guowei.wang@samsung.com")]
140         public void GestureDetectorGetAttachedViewCount()
141         {
142             tlog.Debug(tag, $"GestureDetectorGetAttachedViewCount START");
143             LongPressGestureDetector ret = new LongPressGestureDetector();
144             Assert.IsNotNull(ret, "should be not null");
145             Assert.IsInstanceOf<GestureDetector>(ret, "should be an instance of testing target class!");
146
147             View view = new View();
148             ret.Attach(view);
149
150             ret.GetAttachedViewCount();
151
152             ret.Detach(view);
153             ret.Dispose();
154             
155             tlog.Debug(tag, $"GestureDetectorGetAttachedViewCount END (OK)");
156             Assert.Pass("GestureDetectorGetAttachedViewCount");
157         }
158
159         [Test]
160         [Category("P1")]
161         [Description("GestureDetector GetAttachedView")]
162         [Property("SPEC", "Tizen.NUI.GestureDetector.GetAttachedView M")]
163         [Property("SPEC_URL", "-")]
164         [Property("CRITERIA", "MR")]
165         [Property("AUTHOR", "guowei.wang@samsung.com")]
166         public void GestureDetectorGetAttachedView()
167         {
168             tlog.Debug(tag, $"GestureDetectorGetAttachedView START");
169             LongPressGestureDetector ret = new LongPressGestureDetector();
170             Assert.IsNotNull(ret, "should be not null");
171             Assert.IsInstanceOf<GestureDetector>(ret, "should be an instance of testing target class!");
172
173             View view = new View();
174             ret.Attach(view);
175
176             ret.GetAttachedView(0);
177
178             ret.Detach(view);
179             ret.Dispose();
180             
181             tlog.Debug(tag, $"GestureDetectorGetAttachedView END (OK)");
182             Assert.Pass("GestureDetectorGetAttachedView");
183         }
184
185         [Test]
186         [Category("P1")]
187         [Description("GestureDetector Assign")]
188         [Property("SPEC", "Tizen.NUI.GestureDetector.Assign M")]
189         [Property("SPEC_URL", "-")]
190         [Property("CRITERIA", "MR")]
191         [Property("AUTHOR", "guowei.wang@samsung.com")]
192         public void GestureDetectorAssign()
193         {
194             tlog.Debug(tag, $"GestureDetectorAssign START");
195             GestureDetector ret = new GestureDetector();
196             GestureDetector newOne = new GestureDetector();
197             
198             newOne = ret;
199             ret.Dispose();
200             newOne.Dispose();
201             tlog.Debug(tag, $"GestureDetectorAssign END (OK)");
202             Assert.Pass("GestureDetectorAssign");
203         }
204
205         [Test]
206         [Category("P1")]
207         [Description("GestureDetector DownCast")]
208         [Property("SPEC", "Tizen.NUI.GestureDetector.DownCast M")]
209         [Property("SPEC_URL", "-")]
210         [Property("CRITERIA", "MR")]
211         [Property("AUTHOR", "guowei.wang@samsung.com")]
212         public void GestureDetectorDownCast()
213         {
214             tlog.Debug(tag, $"GestureDetectorDownCast START");
215             BaseHandle handle = new BaseHandle();
216             GestureDetector ret = GestureDetector.DownCast(handle);
217
218             Assert.IsNotNull(ret, "should be not null");
219             Assert.IsInstanceOf<GestureDetector>(ret, "should be an instance of testing target class!");
220             tlog.Debug(tag, $"GestureDetectorDownCast END (OK)");
221             Assert.Pass("GestureDetectorDownCast");
222         }
223
224         [Test]
225         [Category("P1")]
226         [Description("GestureDetector getCPtr")]
227         [Property("SPEC", "Tizen.NUI.GestureDetector.getCPtr M")]
228         [Property("SPEC_URL", "-")]
229         [Property("CRITERIA", "MR")]
230         [Property("AUTHOR", "guowei.wang@samsung.com")]
231         public void GestureDetectorgetCPtr()
232         {
233             tlog.Debug(tag, $"GestureDetectorgetCPtr START");
234             GestureDetector ret = new GestureDetector();
235             Assert.IsNotNull(ret, "should be not null");
236             Assert.IsInstanceOf<GestureDetector>(ret, "should be an instance of testing target class!");
237
238             global::System.Runtime.InteropServices.HandleRef ptr = GestureDetector.getCPtr(ret);
239
240             GestureDetector newOne = null;
241             ptr = GestureDetector.getCPtr(newOne);
242
243             ret.Dispose();
244             
245             tlog.Debug(tag, $"GestureDetectorgetCPtr END (OK)");
246             Assert.Pass("GestureDetectorgetCPtr");
247         }
248     }
249 }