[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 / TSGesture.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/Gesture")]
13     class PublicGestureTest
14     {
15         private const string tag = "NUITEST"; 
16         private LongPressGesture longPressGesture;
17
18         [SetUp]
19         public void Init()
20         {
21             tlog.Info(tag, "Init() is called!");
22             longPressGesture = new LongPressGesture(Gesture.StateType.Started);
23         }
24
25         [TearDown]
26         public void Destroy()
27         {
28             longPressGesture?.Dispose();
29             tlog.Info(tag, "Destroy() is called!");
30         }
31
32         [Test]
33         [Category("P1")]
34         [Description("Gesture constructor")]
35         [Property("SPEC", "Tizen.NUI.Gesture.Gesture C")]
36         [Property("SPEC_URL", "-")]
37         [Property("CRITERIA", "CONSTR")]
38         [Property("AUTHOR", "guowei.wang@samsung.com")]
39         public void GestureConstructor()
40         {
41             tlog.Debug(tag, $"GestureConstructor START");
42             
43             var testingTarget = new Gesture(longPressGesture);
44             Assert.IsNotNull(testingTarget, "Can't create success object Gesture");
45             Assert.IsInstanceOf<Gesture>(testingTarget, "Should be an instance of Gesture type.");
46
47             testingTarget.Dispose();
48             tlog.Debug(tag, $"GestureConstructor END (OK)");
49             Assert.Pass("GestureConstructor");
50         }
51
52         [Test]
53         [Category("P1")]
54         [Description("Gesture type")]
55         [Property("SPEC", "Tizen.NUI.Gesture.type A")]
56         [Property("SPEC_URL", "-")]
57         [Property("CRITERIA", "PRW")]
58         [Property("AUTHOR", "guowei.wang@samsung.com")]
59         public void GestureType()
60         {
61             tlog.Debug(tag, $"GestureType START");
62
63             var testingTarget = new Gesture(longPressGesture);
64             Assert.IsNotNull(testingTarget, "Can't create success object Gesture");
65             Assert.IsInstanceOf<Gesture>(testingTarget, "Should be an instance of Gesture type.");
66
67             try
68             {
69                 var type = testingTarget.Type;
70                 tlog.Debug(tag, "type : " + type);
71             }
72             catch (Exception e)
73             {
74                 tlog.Debug(tag, "Caught Exception" + e.ToString());                
75                 Assert.Fail("Caught Exception" + e.ToString());
76             }
77
78             testingTarget.Dispose();
79             tlog.Debug(tag, $"GestureType END (OK)");
80             Assert.Pass("GestureType");
81         }
82
83         [Test]
84         [Category("P1")]
85         [Description("Gesture state")]
86         [Property("SPEC", "Tizen.NUI.Gesture.state A")]
87         [Property("SPEC_URL", "-")]
88         [Property("CRITERIA", "PRW")]
89         [Property("AUTHOR", "guowei.wang@samsung.com")]
90         public void GestureState()
91         {
92             tlog.Debug(tag, $"GestureState START");
93
94             var testingTarget = new Gesture(longPressGesture);
95             Assert.IsNotNull(testingTarget, "Can't create success object Gesture");
96             Assert.IsInstanceOf<Gesture>(testingTarget, "Should be an instance of Gesture type.");
97
98             try
99             {
100                 var state = testingTarget.State;
101                 tlog.Debug(tag, "state : " + state);
102             }
103             catch (Exception e)
104             {
105                 tlog.Debug(tag, "Caught Exception" + e.ToString());
106                 Assert.Fail("Caught Exception" + e.ToString());
107             }
108
109             testingTarget.Dispose();
110             tlog.Debug(tag, $"GestureState END (OK)");
111             Assert.Pass("GestureState");
112         }
113
114         [Test]
115         [Category("P1")]
116         [Description("Gesture time")]
117         [Property("SPEC", "Tizen.NUI.Gesture.time A")]
118         [Property("SPEC_URL", "-")]
119         [Property("CRITERIA", "PRW")]
120         [Property("AUTHOR", "guowei.wang@samsung.com")]
121         public void GestureTime()
122         {
123             tlog.Debug(tag, $"GestureTime START");
124
125             var testingTarget = new Gesture(longPressGesture);
126             Assert.IsNotNull(testingTarget, "Can't create success object Gesture");
127             Assert.IsInstanceOf<Gesture>(testingTarget, "Should be an instance of Gesture type.");
128
129             try
130             {
131                 var time = testingTarget.Time;
132                 tlog.Debug(tag, "time : " + time);
133             }
134             catch (Exception e)
135             {
136                 tlog.Debug(tag, "Caught Exception" + e.ToString());
137                 Assert.Fail("Caught Exception" + e.ToString());
138             }
139
140             testingTarget.Dispose();
141             tlog.Debug(tag, $"GestureTime END (OK)");
142             Assert.Pass("GestureTime");
143         }
144
145
146         [Test]
147         [Category("P1")]
148         [Description("Gesture GetGestureFromPtr")]
149         [Property("SPEC", "Tizen.NUI.Gesture.GetGestureFromPtr M")]
150         [Property("SPEC_URL", "-")]
151         [Property("CRITERIA", "MR")]
152         [Property("AUTHOR", "guowei.wang@samsung.com")]
153         public void GetstureGetGestureFromPtr()
154         {
155             tlog.Debug(tag, $"GetstureGetGestureFromPtr START");
156
157             var testingTarget = Gesture.GetGestureFromPtr(longPressGesture.SwigCPtr.Handle);
158             Assert.IsNotNull(testingTarget, "Can't create success object Gesture");
159             Assert.IsInstanceOf<Gesture>(testingTarget, "Should be an instance of Gesture type.");
160
161             testingTarget.Dispose();
162
163             tlog.Debug(tag, $"GetstureGetGestureFromPtr END (OK)");
164             Assert.Pass("GetstureGetGestureFromPtr");
165         }
166     }
167 }