[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 / TSRotationGestureDetector.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/RotationGestureDetector")]
13     class PublicRotationGestureDetectorTest
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("RotationGestureDetector constructor")]
32         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.RotationGestureDetector C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void RotationGestureDetectorConstructor()
37         {
38             tlog.Debug(tag, $"RotationGestureDetectorConstructor START");
39             RotationGestureDetector a1 = new RotationGestureDetector();
40
41             a1.Dispose();
42             tlog.Debug(tag, $"RotationGestureDetectorConstructor END (OK)");
43             Assert.Pass("RotationGestureDetectorConstructor");
44         }
45
46         [Test]
47         [Category("P1")]
48         [Description("RotationGestureDetector constructor")]
49         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.RotationGestureDetector C")]
50         [Property("SPEC_URL", "-")]
51         [Property("CRITERIA", "CONSTR")]
52         [Property("AUTHOR", "guowei.wang@samsung.com")]
53         public void RotationGestureDetectorConstructorWithRotationGestureDetector()
54         {
55             tlog.Debug(tag, $"RotationGestureDetectorConstructorWithRotationGestureDetector START");
56
57             using (RotationGestureDetector detector = new RotationGestureDetector())
58             {
59                 var testingTarget = new RotationGestureDetector(detector);
60                 Assert.IsNotNull(testingTarget, "Can't create success object Hover");
61                 Assert.IsInstanceOf<RotationGestureDetector>(testingTarget, "Should be an instance of RotationGestureDetector type.");
62
63                 testingTarget.Dispose();
64             }
65
66             tlog.Debug(tag, $"RotationGestureDetectorConstructorWithRotationGestureDetector END (OK)");
67             Assert.Pass("RotationGestureDetectorConstructor");
68         }
69
70         [Test]
71         [Category("P1")]
72         [Description("RotationGestureDetector GetRotationGestureDetectorFromPtr")]
73         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.GetRotationGestureDetectorFromPtr M")]
74         [Property("SPEC_URL", "-")]
75         [Property("CRITERIA", "MR")]
76         [Property("AUTHOR", "guowei.wang@samsung.com")]
77         public void RotationGestureDetectorGetRotationGestureDetectorFromPtr()
78         {
79             tlog.Debug(tag, $"RotationGestureDetectorGetRotationGestureDetectorFromPtr START");
80             RotationGestureDetector a1 = new RotationGestureDetector();
81                         
82             RotationGestureDetector a2 = RotationGestureDetector.GetRotationGestureDetectorFromPtr(RotationGestureDetector.getCPtr(a1).Handle);
83             a1.Dispose();
84                                                 
85             tlog.Debug(tag, $"RotationGestureDetectorGetRotationGestureDetectorFromPtr END (OK)");
86             Assert.Pass("RotationGestureDetectorGetRotationGestureDetectorFromPtr");
87         }
88
89         [Test]
90         [Category("P1")]
91         [Description("RotationGestureDetector DownCast")]
92         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.DownCast M")]
93         [Property("SPEC_URL", "-")]
94         [Property("CRITERIA", "MR")]
95         [Property("AUTHOR", "guowei.wang@samsung.com")]
96         public void RotationGestureDetectorDownCast()
97         {
98             tlog.Debug(tag, $"RotationGestureDetectorDownCast START");
99
100             using (RotationGestureDetector detector = new RotationGestureDetector())
101             {
102                 var testingTarget = RotationGestureDetector.DownCast(detector);
103                 Assert.IsNotNull(testingTarget, "Can't create success object RotationGestureDetector");
104                 Assert.IsInstanceOf<RotationGestureDetector>(testingTarget, "Should be an instance of RotationGestureDetector type.");
105
106                 testingTarget.Dispose();
107             }
108
109             tlog.Debug(tag, $"RotationGestureDetectorDownCast END (OK)");
110         }
111
112         [Test]
113         [Category("P1")]
114         [Description("RotationGestureDetector getCPtr")]
115         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.getCPtr M")]
116         [Property("SPEC_URL", "-")]
117         [Property("CRITERIA", "MR")]
118         [Property("AUTHOR", "guowei.wang@samsung.com")]
119         public void RotationGestureDetectorgetCPtr()
120         {
121             tlog.Debug(tag, $"RotationGestureDetectorgetCPtr START");
122             RotationGestureDetector a1 = new RotationGestureDetector();
123             global::System.Runtime.InteropServices.HandleRef b1 = RotationGestureDetector.getCPtr(a1);
124
125             a1.Dispose();
126             
127             tlog.Debug(tag, $"RotationGestureDetectorgetCPtr END (OK)");
128             Assert.Pass("RotationGestureDetectorgetCPtr");
129         }
130
131                 [Test]
132         [Category("P1")]
133         [Description("RotationGestureDetector Assign")]
134         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.Assign M")]
135         [Property("SPEC_URL", "-")]
136         [Property("CRITERIA", "MR")]
137         [Property("AUTHOR", "guowei.wang@samsung.com")]
138         public void RotationGestureDetectorAssign()
139         {
140             tlog.Debug(tag, $"RotationGestureDetectorAssign START");
141             RotationGestureDetector a1 = new RotationGestureDetector();
142
143             RotationGestureDetector b1 = a1;
144
145             b1.Dispose();
146             a1.Dispose();
147             
148             tlog.Debug(tag, $"RotationGestureDetectorAssign END (OK)");
149             Assert.Pass("RotationGestureDetectorAssign");
150         }
151                 
152         [Test]
153         [Category("P1")]
154         [Description("RotationGestureDetector DetectedSignal")]
155         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.DetectedSignal M")]
156         [Property("SPEC_URL", "-")]
157         [Property("CRITERIA", "MR")]
158         [Property("AUTHOR", "guowei.wang@samsung.com")]
159         public void RotationGestureDetectorDetectedSignal()
160         {
161             tlog.Debug(tag, $"RotationGestureDetectorDetectedSignal START");
162             RotationGestureDetector a1 = new RotationGestureDetector();
163
164             RotationGestureDetectedSignal b1 = a1.DetectedSignal();
165
166             a1.Dispose();
167             
168             tlog.Debug(tag, $"RotationGestureDetectorDetectedSignal END (OK)");
169             Assert.Pass("RotationGestureDetectorDetectedSignal");
170         }
171                 
172                 [Test]
173         [Category("P1")]
174         [Description("Test Detected property.")]
175         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.Detected A")]
176         [Property("SPEC_URL", "-")]
177         [Property("CRITERIA", "PRW")]
178         [Property("AUTHOR", "guowei.wang@samsung.com")]
179         public void RotationGestureDetectorDetected()
180         {
181             tlog.Debug(tag, $"RotationGestureDetectorDetected START");
182             RotationGestureDetector a1 = new RotationGestureDetector();
183                         
184             a1.Detected += OnDetected;
185             a1.Detected -= OnDetected;
186                         
187             RotationGestureDetector.DetectedEventArgs e = new RotationGestureDetector.DetectedEventArgs();
188             object o = new object();
189                         
190             OnDetected(o, e);
191                         
192             a1.Dispose();
193                         
194             tlog.Debug(tag, $"RotationGestureDetectorDetected END (OK)");
195             Assert.Pass("RotationGestureDetectorDetected");
196         }               
197                 
198                 private void OnDetected(object obj, RotationGestureDetector.DetectedEventArgs e)
199                 {
200             View v1 = e.View;
201             e.View = v1;
202                         
203             RotationGesture p1 = e.RotationGesture;
204             e.RotationGesture = p1;
205                 }               
206     }
207
208 }