9787fabadf1726d24ad7bf8a160355fd977613dd
[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. Check whether Hover is successfully created or not.")]
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             var hover1 = new Hover();
41             Assert.IsNotNull(hover1, "Can't create success object Hover");
42             Assert.IsInstanceOf<Hover>(hover1, "Should be an instance of Hover type.");
43
44             var hover2 = new Hover(2);
45
46             var hover3 = new Hover(hover2);                     
47             
48             var hover4 = new Hover(Hover.getCPtr(hover3).Handle, true); 
49                         
50             //hover4.Dispose();
51             hover3.Dispose();
52             hover2.Dispose();
53             hover1.Dispose();
54             tlog.Debug(tag, $"HoverConstructor END (OK)");
55             Assert.Pass("HoverConstructor");
56         }
57
58         [Test]
59         [Category("P1")]
60         [Description("Test Time property. Check whether Time returns the value expected.")]
61         [Property("SPEC", "Tizen.NUI.Hover.Time A")]
62         [Property("SPEC_URL", "-")]
63         [Property("CRITERIA", "PRW")]
64         [Property("AUTHOR", "guowei.wang@samsung.com")]
65         public void HoverTime()
66         {
67             tlog.Debug(tag, $"HoverTime START");
68             /* TEST CODE */
69             Hover hover = new Hover();
70             Assert.AreEqual(0u, hover.Time, "Should be equals to the origin value of Time");
71             hover.Dispose();
72             tlog.Debug(tag, $"HoverTime END (OK)");
73             Assert.Pass("HoverTime");
74         }
75
76         [Test]
77         [Category("P1")]
78         [Description("Test GetDeviceId.Check whether GetDeviceId returns the value expected.")]
79         [Property("SPEC", "Tizen.NUI.Hover.GetDeviceId M")]
80         [Property("SPEC_URL", "-")]
81         [Property("CRITERIA", "MR")]
82         [Property("AUTHOR", "guowei.wang@samsung.com")]
83         public void HoverGetDeviceId()
84         {
85             tlog.Debug(tag, $"HoverGetDeviceId START");
86             /* TEST CODE */
87             Hover hover = new Hover();
88             Assert.AreEqual(-1, hover.GetDeviceId(0), "Should be equals to the origin value of DeviceId");
89             hover.Dispose();
90             tlog.Debug(tag, $"HoverGetDeviceId END (OK)");
91             Assert.Pass("HoverGetDeviceId");
92         }
93
94         [Test]
95         [Category("P1")]
96         [Description("Test GetState.Check whether GetState returns the value expected.")]
97         [Property("SPEC", "Tizen.NUI.Hover.GetState M")]
98         [Property("SPEC_URL", "-")]
99         [Property("CRITERIA", "MR")]
100         [Property("AUTHOR", "guowei.wang@partner.samsung.com")]
101         public void HoverGetState()
102         {
103             tlog.Debug(tag, $"HoverGetState START");
104             /* TEST CODE */
105             Hover hover = new Hover();
106             Assert.AreEqual(PointStateType.Finished, hover.GetState(0), "Should be equals to the origin value of state");
107             hover.Dispose();
108             tlog.Debug(tag, $"HoverGetState END (OK)");
109             Assert.Pass("HoverGetState");
110         }
111
112         [Test]
113         [Category("P1")]
114         [Description("Test GetHitView.Check whether GetHitView returns the value expected.")]
115         [Property("SPEC", "Tizen.NUI.Hover.GetHitView M")]
116         [Property("SPEC_URL", "-")]
117         [Property("CRITERIA", "MR")]
118         [Property("AUTHOR", "guowei.wang@samsung.com")]
119         public void HoverGetHitView()
120         {
121             tlog.Debug(tag, $"HoverGetHitView START");
122             /* TEST CODE */
123             Hover hover = new Hover();
124
125             Assert.IsNotInstanceOf<View>(hover.GetHitView(0), "non-existent point returns an empty handle");
126             hover.Dispose();
127             tlog.Debug(tag, $"HoverGetHitView END (OK)");
128             Assert.Pass("HoverGetHitView");
129         }
130
131         [Test]
132         [Category("P1")]
133         [Description("Test GetLocalPosition.Check whether GetLocalPosition returns the value expected.")]
134         [Property("SPEC", "Tizen.NUI.Hover.GetLocalPosition M")]
135         [Property("SPEC_URL", "-")]
136         [Property("CRITERIA", "MR")]
137         [Property("AUTHOR", "guowei.wang@samsung.com")]
138         public void HoverGetLocalPosition()
139         {
140             tlog.Debug(tag, $"HoverGetLocalPosition START");
141             /* TEST CODE */
142             Hover hover = new Hover();
143             Assert.AreEqual(0.0f, hover.GetLocalPosition(0).X, "Should be equals to the origin value of LocalPosition.X");
144             Assert.AreEqual(0.0f, hover.GetLocalPosition(0).Y, "Should be equals to the origin value of LocalPosition.Y");
145             hover.Dispose();
146             tlog.Debug(tag, $"HoverGetLocalPosition END (OK)");
147             Assert.Pass("HoverGetLocalPosition");
148         }
149
150         [Test]
151         [Category("P1")]
152         [Description("Test GetScreenPosition.Check whether GetScreenPosition returns the value expected.")]
153         [Property("SPEC", "Tizen.NUI.Hover.GetScreenPosition M")]
154         [Property("SPEC_URL", "-")]
155         [Property("CRITERIA", "MR")]
156         [Property("AUTHOR", "guowei.wang@samsung.com")]
157         public void HoverGetScreenPosition()
158         {
159             tlog.Debug(tag, $"HoverGetScreenPosition START");
160             /* TEST CODE */
161             Hover hover = new Hover();
162             Assert.AreEqual(0.0f, hover.GetScreenPosition(0).X, "Should be equals to the origin value of ScreenPosition.X");
163             Assert.AreEqual(0.0f, hover.GetScreenPosition(0).Y, "Should be equals to the origin value of ScreenPosition.Y");
164             hover.Dispose();
165             tlog.Debug(tag, $"HoverGetScreenPosition END (OK)");
166             Assert.Pass("HoverGetScreenPosition");
167         }
168
169         [Test]
170         [Category("P1")]
171         [Description("Test GetPointCount.Check whether GetPointCount returns the value expected.")]
172         [Property("SPEC", "Tizen.NUI.Hover.GetPointCount M")]
173         [Property("SPEC_URL", "-")]
174         [Property("CRITERIA", "MR")]
175         [Property("AUTHOR", "guowei.wang@samsung.com")]
176         public void HoverGetPointCount()
177         {
178             tlog.Debug(tag, $"HoverGetPointCount START");
179             /* TEST CODE */
180             Hover hover = new Hover();
181             Assert.AreEqual(0, hover.GetPointCount(), "Should be equals to the origin value of pointCount");
182             tlog.Debug(tag, $"HoverGetPointCount END (OK)");
183             Assert.Pass("HoverGetPointCount");
184         }
185
186         [Test]
187         [Category("P1")]
188         [Description("Test GetCPtr.")]
189         [Property("SPEC", "Tizen.NUI.Hover.GetCPtr M")]
190         [Property("SPEC_URL", "-")]
191         [Property("CRITERIA", "MR")]
192         [Property("AUTHOR", "guowei.wang@samsung.com")]
193         public void HoverGetCPtr()
194         {
195             tlog.Debug(tag, $"HoverGetCPtr START");
196             Hover hover = new Hover();
197             Hover.getCPtr(hover);
198             Assert.Pass("HoverGetCPtr");
199             tlog.Debug(tag, $"HoverGetCPtr END (OK)");
200             Assert.Pass("HoverGetCPtr");
201         }
202
203         [Test]
204         [Category("P1")]
205         [Description("Test GetHoverFromPtr.")]
206         [Property("SPEC", "Tizen.NUI.Hover.GetHoverFromPtr M")]
207         [Property("SPEC_URL", "-")]
208         [Property("CRITERIA", "MR")]
209         [Property("AUTHOR", "guowei.wang@samsung.com")]
210         public void HoverGetHoverFromPtr()
211         {
212             tlog.Debug(tag, $"HoverGetHoverFromPtr START");
213             var hover2 = new Hover(2);
214             
215             Hover hover = Hover.GetHoverFromPtr(Hover.getCPtr(hover2).Handle);
216             Assert.Pass("HoverGetHoverFromPtr");
217                         
218             hover2.Dispose();
219             hover.Dispose();
220             tlog.Debug(tag, $"HoverGetHoverFromPtr END (OK)");
221             Assert.Pass("HoverGetHoverFromPtr");
222         }
223     }
224 }