[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 / TSLongPressGesture.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/LongPressGesture")]
13     internal class PublicLongPressGestureTest
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 LongPressGesture object.")]
32         [Property("SPEC", "Tizen.NUI.LongPressGesture.LongPressGesture C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("COVPARAM", "")]
36         [Property("AUTHOR", "guowei.wang@samsung.com")]
37         public void LongPressGestureConstructor()
38         {
39             tlog.Debug(tag, $"LongPressGestureConstructor START");
40
41             var testingTarget = new LongPressGesture(Gesture.StateType.Finished);
42             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
43             Assert.IsInstanceOf<LongPressGesture>(testingTarget, "Should be an instance of Hover type.");
44
45             testingTarget.Dispose();
46             tlog.Debug(tag, $"LongPressGestureConstructor END (OK)");
47             Assert.Pass("LongPressGestureConstructor");
48         }
49
50         [Test]
51         [Category("P1")]
52         [Description("Test NumberOfTouches property.")]
53         [Property("SPEC", "Tizen.NUI.LongPressGesture.NumberOfTouches A")]
54         [Property("SPEC_URL", "-")]
55         [Property("CRITERIA", "PRW")]
56         [Property("AUTHOR", "guowei.wang@samsung.com")]
57         public void LongPressGestureNumberOfTouches()
58         {
59             tlog.Debug(tag, $"LongPressGestureNumberOfTouches START");
60
61             var testingTarget = new LongPressGesture(Gesture.StateType.Finished);
62             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
63             Assert.IsInstanceOf<LongPressGesture>(testingTarget, "Should be an instance of Hover type.");
64
65             tlog.Debug(tag, "NumberOfTouches : " + testingTarget.NumberOfTouches);
66
67             testingTarget.Dispose();
68             tlog.Debug(tag, $"LongPressGestureNumberOfTouches END (OK)");
69             Assert.Pass("LongPressGestureNumberOfTouches");
70         }
71
72         [Test]
73         [Category("P1")]
74         [Description("Test ScreenPoint property.")]
75         [Property("SPEC", "Tizen.NUI.LongPressGesture.ScreenPoint A")]
76         [Property("SPEC_URL", "-")]
77         [Property("CRITERIA", "PRW")]
78         [Property("AUTHOR", "guowei.wang@samsung.com")]
79         public void LongPressGestureScreenPoint()
80         {
81             tlog.Debug(tag, $"LongPressGestureScreenPoint START");
82
83             var testingTarget = new LongPressGesture(Gesture.StateType.Finished);
84             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
85             Assert.IsInstanceOf<LongPressGesture>(testingTarget, "Should be an instance of Hover type.");
86
87             tlog.Debug(tag, "ScreenPoint : " + testingTarget.ScreenPoint);
88
89             testingTarget.Dispose();
90             tlog.Debug(tag, $"LongPressGestureScreenPoint END (OK)");
91             Assert.Pass("LongPressGestureScreenPoint");
92         }
93
94         [Test]
95         [Category("P1")]
96         [Description("Test LocalPoint property.")]
97         [Property("SPEC", "Tizen.NUI.LongPressGesture.LocalPoint A")]
98         [Property("SPEC_URL", "-")]
99         [Property("CRITERIA", "PRW")]
100         [Property("AUTHOR", "guowei.wang@samsung.com")]
101         public void LongPressGestureLocalPoint()
102         {
103             tlog.Debug(tag, $"LongPressGestureLocalPoint START");
104
105             var testingTarget = new LongPressGesture(Gesture.StateType.Finished);
106             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
107             Assert.IsInstanceOf<LongPressGesture>(testingTarget, "Should be an instance of Hover type.");
108
109             tlog.Debug(tag, "LocalPoint : " + testingTarget.LocalPoint);
110
111             testingTarget.Dispose();
112             tlog.Debug(tag, $"LongPressGestureLocalPoint END (OK)");
113             Assert.Pass("LongPressGestureLocalPoint");
114         }
115
116         [Test]
117         [Category("P1")]
118         [Description("Test getCPtr property.")]
119         [Property("SPEC", "Tizen.NUI.LongPressGesture.getCPtr M")]
120         [Property("SPEC_URL", "-")]
121         [Property("CRITERIA", "MR")]
122         [Property("AUTHOR", "guowei.wang@samsung.com")]
123         public void LongPressGesturegetCPtr()
124         {
125             tlog.Debug(tag, $"LongPressGesturegetCPtr START");
126
127             var testingTarget = new LongPressGesture(Gesture.StateType.Finished);
128             Assert.IsNotNull(testingTarget, "Can't create success object Hover");
129             Assert.IsInstanceOf<LongPressGesture>(testingTarget, "Should be an instance of Hover type.");
130
131             try
132             {
133                 LongPressGesture.getCPtr(testingTarget);
134             }
135             catch (Exception e)
136             {
137                 tlog.Debug(tag, e.Message.ToString());
138                 Assert.Fail("Caught Exception : Failed!");
139             }
140
141             testingTarget.Dispose();
142             tlog.Debug(tag, $"LongPressGesturegetCPtr END (OK)");
143             Assert.Pass("LongPressGestureLocalPoint");
144         }
145
146         [Test]
147         [Category("P1")]
148         [Description("Test GetLongPressGestureFromPtr property.")]
149         [Property("SPEC", "Tizen.NUI.LongPressGesture.GetLongPressGestureFromPtr M")]
150         [Property("SPEC_URL", "-")]
151         [Property("CRITERIA", "MR")]
152         [Property("AUTHOR", "guowei.wang@samsung.com")]
153         public void LongPressGestureGetLongPressGestureFromPtr()
154         {
155             tlog.Debug(tag, $"LongPressGestureGetLongPressGestureFromPtr START");
156
157             using (LongPressGesture gestrue = new LongPressGesture(Gesture.StateType.Finished))
158             {
159                 var testingTarget = LongPressGesture.GetLongPressGestureFromPtr(LongPressGesture.getCPtr(gestrue).Handle);
160                 Assert.IsNotNull(testingTarget, "Can't create success object Hover");
161                 Assert.IsInstanceOf<LongPressGesture>(testingTarget, "Should be an instance of Hover type.");
162
163                 testingTarget.Dispose();
164             }
165
166             tlog.Debug(tag, $"LongPressGestureGetLongPressGestureFromPtr END (OK)");
167             Assert.Pass("LongPressGestureGetLongPressGestureFromPtr");
168         }
169     }
170
171 }