1 using NUnit.Framework;
2 using NUnit.Framework.TUnit;
5 using Tizen.NUI.BaseComponents;
7 namespace Tizen.NUI.Devel.Tests
9 using tlog = Tizen.Log;
12 [Description("public/Events/GestureDetector")]
13 class PublicGestureDetectorTest
15 private const string tag = "NUITEST";
20 tlog.Info(tag, "Init() is called!");
26 tlog.Info(tag, "Destroy() is called!");
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()
38 tlog.Debug(tag, $"GestureDetectorConstructor START");
40 var testingTarget = new GestureDetector();
41 Assert.IsNotNull(testingTarget, "should be not null");
42 Assert.IsInstanceOf<GestureDetector>(testingTarget, "should be an instance of testing target class!");
44 testingTarget.Dispose();
45 tlog.Debug(tag, $"GestureDetectorConstructor END (OK)");
46 Assert.Pass("GestureDetectorConstructor");
51 //[Description("GestureDetector constructor")]
52 //[Property("SPEC", "Tizen.NUI.GestureDetector.GestureDetector C")]
53 //[Property("SPEC_URL", "-")]
54 //[Property("CRITERIA", "CONSTR")]
55 //[Property("AUTHOR", "guowei.wang@samsung.com")]
56 //public void GestureDetectorConstructorWithGestureDetector()
58 // tlog.Debug(tag, $"GestureDetectorConstructorWithGestureDetector START");
60 // using (GestureDetector detector = new GestureDetector())
62 // var testingTarget = new GestureDetector(detector);
63 // Assert.IsNotNull(testingTarget, "should be not null");
64 // Assert.IsInstanceOf<GestureDetector>(testingTarget, "should be an instance of testing target class!");
66 // testingTarget.Dispose();
69 // tlog.Debug(tag, $"GestureDetectorConstructorWithGestureDetector END (OK)");
70 // Assert.Pass("GestureDetectorConstructor");
75 [Description("GestureDetector Attach")]
76 [Property("SPEC", "Tizen.NUI.GestureDetector.Attach M")]
77 [Property("SPEC_URL", "-")]
78 [Property("CRITERIA", "MR")]
79 [Property("AUTHOR", "guowei.wang@samsung.com")]
80 public void GestureDetectorAttach()
82 tlog.Debug(tag, $"GestureDetectorAttach START");
84 var testingTarget = new LongPressGestureDetector();
85 Assert.IsNotNull(testingTarget, "should be not null");
86 Assert.IsInstanceOf<LongPressGestureDetector>(testingTarget, "should be an instance of testing target class!");
88 using (View view = new View())
90 Window.Instance.GetDefaultLayer().Add(view);
91 testingTarget.Attach(view);
92 testingTarget.Detach(view);
93 Window.Instance.GetDefaultLayer().Remove(view);
96 testingTarget.Dispose();
97 tlog.Debug(tag, $"GestureDetectorAttach END (OK)");
98 Assert.Pass("GestureDetectorAttach");
103 [Description("GestureDetector DetachAll")]
104 [Property("SPEC", "Tizen.NUI.GestureDetector.DetachAll M")]
105 [Property("SPEC_URL", "-")]
106 [Property("CRITERIA", "MR")]
107 [Property("AUTHOR", "guowei.wang@samsung.com")]
108 public void GestureDetectorDetachAll()
110 tlog.Debug(tag, $"GestureDetectorDetachAll START");
112 var testingTarget = new LongPressGestureDetector();
113 Assert.IsNotNull(testingTarget, "should be not null");
114 Assert.IsInstanceOf<LongPressGestureDetector>(testingTarget, "should be an instance of testing target class!");
116 using (View view = new View())
118 testingTarget.Attach(view);
119 testingTarget.DetachAll();
122 testingTarget.Dispose();
123 tlog.Debug(tag, $"GestureDetectorDetachAll END (OK)");
124 Assert.Pass("GestureDetectorDetachAll");
129 [Description("GestureDetector GetAttachedViewCount")]
130 [Property("SPEC", "Tizen.NUI.GestureDetector.GetAttachedViewCount M")]
131 [Property("SPEC_URL", "-")]
132 [Property("CRITERIA", "MR")]
133 [Property("AUTHOR", "guowei.wang@samsung.com")]
134 public void GestureDetectorGetAttachedViewCount()
136 tlog.Debug(tag, $"GestureDetectorGetAttachedViewCount START");
138 var testingTarget = new LongPressGestureDetector();
139 Assert.IsNotNull(testingTarget, "should be not null");
140 Assert.IsInstanceOf<LongPressGestureDetector>(testingTarget, "should be an instance of testing target class!");
142 using (View view = new View())
144 testingTarget.Attach(view);
145 tlog.Debug(tag, "AttachedViewCount : " + testingTarget.GetAttachedViewCount());
147 testingTarget.Detach(view);
150 testingTarget.Dispose();
151 tlog.Debug(tag, $"GestureDetectorGetAttachedViewCount END (OK)");
152 Assert.Pass("GestureDetectorGetAttachedViewCount");
157 [Description("GestureDetector GetAttachedView")]
158 [Property("SPEC", "Tizen.NUI.GestureDetector.GetAttachedView M")]
159 [Property("SPEC_URL", "-")]
160 [Property("CRITERIA", "MR")]
161 [Property("AUTHOR", "guowei.wang@samsung.com")]
162 public void GestureDetectorGetAttachedView()
164 tlog.Debug(tag, $"GestureDetectorGetAttachedView START");
166 var testingTarget = new LongPressGestureDetector();
167 Assert.IsNotNull(testingTarget, "should be not null");
168 Assert.IsInstanceOf<LongPressGestureDetector>(testingTarget, "should be an instance of testing target class!");
170 using (View view = new View())
172 testingTarget.Attach(view);
173 testingTarget.GetAttachedView(0);
174 testingTarget.Detach(view);
177 testingTarget.Dispose();
178 tlog.Debug(tag, $"GestureDetectorGetAttachedView END (OK)");
179 Assert.Pass("GestureDetectorGetAttachedView");
184 //[Description("GestureDetector Assign")]
185 //[Property("SPEC", "Tizen.NUI.GestureDetector.Assign M")]
186 //[Property("SPEC_URL", "-")]
187 //[Property("CRITERIA", "MR")]
188 //[Property("AUTHOR", "guowei.wang@samsung.com")]
189 //public void GestureDetectorAssign()
191 // tlog.Debug(tag, $"GestureDetectorAssign START");
193 // using (GestureDetector detector = new GestureDetector())
195 // var testingTarget = detector.Assign(detector);
196 // Assert.IsNotNull(testingTarget, "should be not null");
197 // Assert.IsInstanceOf<GestureDetector>(testingTarget, "should be an instance of testing target class!");
200 // tlog.Debug(tag, $"GestureDetectorAssign END (OK)");
201 // Assert.Pass("GestureDetectorAssign");
206 [Description("GestureDetector DownCast")]
207 [Property("SPEC", "Tizen.NUI.GestureDetector.DownCast M")]
208 [Property("SPEC_URL", "-")]
209 [Property("CRITERIA", "MR")]
210 [Property("AUTHOR", "guowei.wang@samsung.com")]
211 public void GestureDetectorDownCast()
213 tlog.Debug(tag, $"GestureDetectorDownCast START");
215 using (GestureDetector detector = new GestureDetector())
217 var testingTarget = GestureDetector.DownCast(detector);
218 Assert.IsInstanceOf<GestureDetector>(testingTarget, "should be an instance of testing target class!");
220 testingTarget.Dispose();
223 tlog.Debug(tag, $"GestureDetectorDownCast END (OK)");
224 Assert.Pass("GestureDetectorDownCast");
229 [Description("GestureDetector getCPtr")]
230 [Property("SPEC", "Tizen.NUI.GestureDetector.getCPtr M")]
231 [Property("SPEC_URL", "-")]
232 [Property("CRITERIA", "MR")]
233 [Property("AUTHOR", "guowei.wang@samsung.com")]
234 public void GestureDetectorgetCPtr()
236 tlog.Debug(tag, $"GestureDetectorgetCPtr START");
238 var testingTarget = new GestureDetector();
239 Assert.IsNotNull(testingTarget, "should be not null");
240 Assert.IsInstanceOf<GestureDetector>(testingTarget, "should be an instance of testing target class!");
244 GestureDetector.getCPtr(testingTarget);
248 tlog.Debug(tag, e.Message.ToString());
249 Assert.Fail("Caught Exception : Failed!");
252 testingTarget.Dispose();
253 tlog.Debug(tag, $"GestureDetectorgetCPtr END (OK)");
254 Assert.Pass("GestureDetectorgetCPtr");