[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 / TSHover.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/Hover")]
13     internal class PublicHoverTest
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("Create a Hover object.")]
32         [Property("SPEC", "Tizen.NUI.Hover.Hover C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("COVPARAM", "")]
36         [Property("AUTHOR", "guowei.wang@samsung.com")]
37         public void HoverConstructor()
38         {
39             tlog.Debug(tag, $"HoverConstructor START");
40
41             var testingTarget = new Hover();
42             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
43             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
44
45             testingTarget.Dispose();
46             tlog.Debug(tag, $"HoverConstructor END (OK)");
47             Assert.Pass("HoverConstructor");
48         }
49
50         [Test]
51         [Category("P1")]
52         [Description("Create a Hover object.")]
53         [Property("SPEC", "Tizen.NUI.Hover.Hover C")]
54         [Property("SPEC_URL", "-")]
55         [Property("CRITERIA", "CONSTR")]
56         [Property("COVPARAM", "")]
57         [Property("AUTHOR", "guowei.wang@samsung.com")]
58         public void HoverConstructorWithTime()
59         {
60             tlog.Debug(tag, $"HoverConstructorWithTime START");
61
62             var testingTarget = new Hover(300);
63             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
64             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
65
66             testingTarget.Dispose();
67             tlog.Debug(tag, $"HoverConstructorWithTime END (OK)");
68             Assert.Pass("HoverConstructor");
69         }
70
71         [Test]
72         [Category("P1")]
73         [Description("Create a Hover object.")]
74         [Property("SPEC", "Tizen.NUI.Hover.Hover C")]
75         [Property("SPEC_URL", "-")]
76         [Property("CRITERIA", "CONSTR")]
77         [Property("COVPARAM", "")]
78         [Property("AUTHOR", "guowei.wang@samsung.com")]
79         public void HoverConstructorWithHover()
80         {
81             tlog.Debug(tag, $"HoverConstructorWithHover START");
82
83             using (Hover hover = new Hover(300))
84             {
85                 var testingTarget = new Hover(hover);
86                 Assert.IsNotNull(testingTarget, "Can't create success object Hover");
87                 Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
88
89                 testingTarget.Dispose();
90             }
91
92             tlog.Debug(tag, $"HoverConstructorWithHover END (OK)");
93             Assert.Pass("HoverConstructor");
94         }
95
96         [Test]
97         [Category("P1")]
98         [Description("Test Time property.")]
99         [Property("SPEC", "Tizen.NUI.Hover.Time A")]
100         [Property("SPEC_URL", "-")]
101         [Property("CRITERIA", "PRW")]
102         [Property("AUTHOR", "guowei.wang@samsung.com")]
103         public void HoverTime()
104         {
105             tlog.Debug(tag, $"HoverTime START");
106
107             var testingTarget = new Hover();
108             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
109             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
110
111             tlog.Debug(tag, "time : " + testingTarget.Time);
112             
113             testingTarget.Dispose();
114             tlog.Debug(tag, $"HoverTime END (OK)");
115             Assert.Pass("HoverTime");
116         }
117
118         [Test]
119         [Category("P1")]
120         [Description("Test GetDeviceId.")]
121         [Property("SPEC", "Tizen.NUI.Hover.GetDeviceId M")]
122         [Property("SPEC_URL", "-")]
123         [Property("CRITERIA", "MR")]
124         [Property("AUTHOR", "guowei.wang@samsung.com")]
125         public void HoverGetDeviceId()
126         {
127             tlog.Debug(tag, $"HoverGetDeviceId START");
128
129             var testingTarget = new Hover();
130             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
131             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
132
133             tlog.Debug(tag, "DeviceId : " + testingTarget.GetDeviceId(0));
134             
135             testingTarget.Dispose();
136             tlog.Debug(tag, $"HoverGetDeviceId END (OK)");
137             Assert.Pass("HoverGetDeviceId");
138         }
139
140         [Test]
141         [Category("P1")]
142         [Description("Test GetState.")]
143         [Property("SPEC", "Tizen.NUI.Hover.GetState M")]
144         [Property("SPEC_URL", "-")]
145         [Property("CRITERIA", "MR")]
146         [Property("AUTHOR", "guowei.wang@partner.samsung.com")]
147         public void HoverGetState()
148         {
149             tlog.Debug(tag, $"HoverGetState START");
150
151             var testingTarget = new Hover();
152             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
153             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
154
155             tlog.Debug(tag, "State : " + testingTarget.GetState(0));
156             
157             testingTarget.Dispose();
158             tlog.Debug(tag, $"HoverGetState END (OK)");
159             Assert.Pass("HoverGetState");
160         }
161
162         [Test]
163         [Category("P1")]
164         [Description("Test GetHitView.")]
165         [Property("SPEC", "Tizen.NUI.Hover.GetHitView M")]
166         [Property("SPEC_URL", "-")]
167         [Property("CRITERIA", "MR")]
168         [Property("AUTHOR", "guowei.wang@samsung.com")]
169         public void HoverGetHitView()
170         {
171             tlog.Debug(tag, $"HoverGetHitView START");
172
173             var testingTarget = new Hover();
174             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
175             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
176
177             tlog.Debug(tag, "HitView : " + testingTarget.GetHitView(0));
178             
179             testingTarget.Dispose();
180             tlog.Debug(tag, $"HoverGetHitView END (OK)");
181             Assert.Pass("HoverGetHitView");
182         }
183
184         [Test]
185         [Category("P1")]
186         [Description("Test GetLocalPosition.")]
187         [Property("SPEC", "Tizen.NUI.Hover.GetLocalPosition M")]
188         [Property("SPEC_URL", "-")]
189         [Property("CRITERIA", "MR")]
190         [Property("AUTHOR", "guowei.wang@samsung.com")]
191         public void HoverGetLocalPosition()
192         {
193             tlog.Debug(tag, $"HoverGetLocalPosition START");
194
195             var testingTarget = new Hover();
196             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
197             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
198
199             Assert.AreEqual(0.0f, testingTarget.GetLocalPosition(0).X, "Should be equals to the origin value of LocalPosition.X");
200             Assert.AreEqual(0.0f, testingTarget.GetLocalPosition(0).Y, "Should be equals to the origin value of LocalPosition.Y");
201             
202             testingTarget.Dispose();
203             tlog.Debug(tag, $"HoverGetLocalPosition END (OK)");
204             Assert.Pass("HoverGetLocalPosition");
205         }
206
207         [Test]
208         [Category("P1")]
209         [Description("Test GetScreenPosition.")]
210         [Property("SPEC", "Tizen.NUI.Hover.GetScreenPosition M")]
211         [Property("SPEC_URL", "-")]
212         [Property("CRITERIA", "MR")]
213         [Property("AUTHOR", "guowei.wang@samsung.com")]
214         public void HoverGetScreenPosition()
215         {
216             tlog.Debug(tag, $"HoverGetScreenPosition START");
217
218             var testingTarget = new Hover();
219             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
220             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
221
222             Assert.AreEqual(0.0f, testingTarget.GetScreenPosition(0).X, "Should be equals to the origin value of ScreenPosition.X");
223             Assert.AreEqual(0.0f, testingTarget.GetScreenPosition(0).Y, "Should be equals to the origin value of ScreenPosition.Y");
224             
225             testingTarget.Dispose();
226             tlog.Debug(tag, $"HoverGetScreenPosition END (OK)");
227             Assert.Pass("HoverGetScreenPosition");
228         }
229
230         [Test]
231         [Category("P1")]
232         [Description("Test GetPointCount.")]
233         [Property("SPEC", "Tizen.NUI.Hover.GetPointCount M")]
234         [Property("SPEC_URL", "-")]
235         [Property("CRITERIA", "MR")]
236         [Property("AUTHOR", "guowei.wang@samsung.com")]
237         public void HoverGetPointCount()
238         {
239             tlog.Debug(tag, $"HoverGetPointCount START");
240
241             var testingTarget = new Hover();
242             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
243             Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
244
245             tlog.Debug(tag, "PointCount : " + testingTarget.GetPointCount());
246             
247             tlog.Debug(tag, $"HoverGetPointCount END (OK)");
248             Assert.Pass("HoverGetPointCount");
249         }
250
251         [Test]
252         [Category("P1")]
253         [Description("Test GetCPtr.")]
254         [Property("SPEC", "Tizen.NUI.Hover.GetCPtr M")]
255         [Property("SPEC_URL", "-")]
256         [Property("CRITERIA", "MR")]
257         [Property("AUTHOR", "guowei.wang@samsung.com")]
258         public void HoverGetCPtr()
259         {
260             tlog.Debug(tag, $"HoverGetCPtr START");
261
262             using (Hover hover = new Hover())
263             {
264                 try
265                 {
266                     Hover.getCPtr(hover);
267                 }
268                 catch (Exception e)
269                 {
270                     tlog.Debug(tag, e.Message.ToString());
271                     Assert.Fail("Caught Exception : Failed!");
272                 }
273             }
274
275             tlog.Debug(tag, $"HoverGetCPtr END (OK)");
276             Assert.Pass("HoverGetCPtr");
277         }
278
279         [Test]
280         [Category("P1")]
281         [Description("Test GetHoverFromPtr.")]
282         [Property("SPEC", "Tizen.NUI.Hover.GetHoverFromPtr M")]
283         [Property("SPEC_URL", "-")]
284         [Property("CRITERIA", "MR")]
285         [Property("AUTHOR", "guowei.wang@samsung.com")]
286         public void HoverGetHoverFromPtr()
287         {
288             tlog.Debug(tag, $"HoverGetHoverFromPtr START");
289
290             using (Hover hover = new Hover(300))
291             {
292                 var testingTarget = Hover.GetHoverFromPtr(Hover.getCPtr(hover).Handle);
293                 Assert.IsNotNull(testingTarget, "Can't create success object Hover");
294                 Assert.IsInstanceOf<Hover>(testingTarget, "Should be an instance of Hover type.");
295
296                 testingTarget.Dispose();
297             }
298
299             tlog.Debug(tag, $"HoverGetHoverFromPtr END (OK)");
300             Assert.Pass("HoverGetHoverFromPtr");
301         }
302     }
303 }