0cc56b080bbb8e38f61803a97942dfdaacc40668
[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             RotationGestureDetector a2 = new RotationGestureDetector(a1);
41
42             a2.Dispose();
43             a1.Dispose();
44             
45             tlog.Debug(tag, $"RotationGestureDetectorConstructor END (OK)");
46             Assert.Pass("RotationGestureDetectorConstructor");
47         }
48
49         [Test]
50         [Category("P1")]
51         [Description("RotationGestureDetector GetRotationGestureDetectorFromPtr")]
52         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.GetRotationGestureDetectorFromPtr M")]
53         [Property("SPEC_URL", "-")]
54         [Property("CRITERIA", "MR")]
55         [Property("AUTHOR", "guowei.wang@samsung.com")]
56         public void RotationGestureDetectorGetRotationGestureDetectorFromPtr()
57         {
58             tlog.Debug(tag, $"RotationGestureDetectorGetRotationGestureDetectorFromPtr START");
59             RotationGestureDetector a1 = new RotationGestureDetector();
60                         
61             RotationGestureDetector a2 = RotationGestureDetector.GetRotationGestureDetectorFromPtr(RotationGestureDetector.getCPtr(a1).Handle);
62             a1.Dispose();
63                                                 
64             tlog.Debug(tag, $"RotationGestureDetectorGetRotationGestureDetectorFromPtr END (OK)");
65             Assert.Pass("RotationGestureDetectorGetRotationGestureDetectorFromPtr");
66         }
67
68         [Test]
69         [Category("P1")]
70         [Description("RotationGestureDetector DownCast")]
71         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.DownCast M")]
72         [Property("SPEC_URL", "-")]
73         [Property("CRITERIA", "MR")]
74         [Property("AUTHOR", "guowei.wang@samsung.com")]
75         public void RotationGestureDetectorDownCast()
76         {
77             tlog.Debug(tag, $"RotationGestureDetectorDownCast START");
78             BaseHandle handle = new BaseHandle();
79
80             RotationGestureDetector a1 = RotationGestureDetector.DownCast(handle);
81
82             a1.Dispose();
83             
84             tlog.Debug(tag, $"RotationGestureDetectorDownCast END (OK)");
85             Assert.Pass("RotationGestureDetectorDownCast");
86         }
87
88         [Test]
89         [Category("P1")]
90         [Description("RotationGestureDetector getCPtr")]
91         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.getCPtr M")]
92         [Property("SPEC_URL", "-")]
93         [Property("CRITERIA", "MR")]
94         [Property("AUTHOR", "guowei.wang@samsung.com")]
95         public void RotationGestureDetectorgetCPtr()
96         {
97             tlog.Debug(tag, $"RotationGestureDetectorgetCPtr START");
98             RotationGestureDetector a1 = new RotationGestureDetector();
99             global::System.Runtime.InteropServices.HandleRef b1 = RotationGestureDetector.getCPtr(a1);
100
101             a1.Dispose();
102             
103             tlog.Debug(tag, $"RotationGestureDetectorgetCPtr END (OK)");
104             Assert.Pass("RotationGestureDetectorgetCPtr");
105         }
106
107                 [Test]
108         [Category("P1")]
109         [Description("RotationGestureDetector Assign")]
110         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.Assign M")]
111         [Property("SPEC_URL", "-")]
112         [Property("CRITERIA", "MR")]
113         [Property("AUTHOR", "guowei.wang@samsung.com")]
114         public void RotationGestureDetectorAssign()
115         {
116             tlog.Debug(tag, $"RotationGestureDetectorAssign START");
117             RotationGestureDetector a1 = new RotationGestureDetector();
118
119             RotationGestureDetector b1 = a1;
120
121             b1.Dispose();
122             a1.Dispose();
123             
124             tlog.Debug(tag, $"RotationGestureDetectorAssign END (OK)");
125             Assert.Pass("RotationGestureDetectorAssign");
126         }
127                 
128         [Test]
129         [Category("P1")]
130         [Description("RotationGestureDetector DetectedSignal")]
131         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.DetectedSignal M")]
132         [Property("SPEC_URL", "-")]
133         [Property("CRITERIA", "MR")]
134         [Property("AUTHOR", "guowei.wang@samsung.com")]
135         public void RotationGestureDetectorDetectedSignal()
136         {
137             tlog.Debug(tag, $"RotationGestureDetectorDetectedSignal START");
138             RotationGestureDetector a1 = new RotationGestureDetector();
139
140             RotationGestureDetectedSignal b1 = a1.DetectedSignal();
141
142             a1.Dispose();
143             
144             tlog.Debug(tag, $"RotationGestureDetectorDetectedSignal END (OK)");
145             Assert.Pass("RotationGestureDetectorDetectedSignal");
146         }
147                 
148                 [Test]
149         [Category("P1")]
150         [Description("Test Detected property.")]
151         [Property("SPEC", "Tizen.NUI.RotationGestureDetector.Detected A")]
152         [Property("SPEC_URL", "-")]
153         [Property("CRITERIA", "PRW")]
154         [Property("AUTHOR", "guowei.wang@samsung.com")]
155         public void RotationGestureDetectorDetected()
156         {
157             tlog.Debug(tag, $"RotationGestureDetectorDetected START");
158             RotationGestureDetector a1 = new RotationGestureDetector();
159                         
160             a1.Detected += OnDetected;
161             a1.Detected -= OnDetected;
162                         
163             RotationGestureDetector.DetectedEventArgs e = new RotationGestureDetector.DetectedEventArgs();
164             object o = new object();
165                         
166             OnDetected(o, e);
167                         
168             a1.Dispose();
169                         
170             tlog.Debug(tag, $"RotationGestureDetectorDetected END (OK)");
171             Assert.Pass("RotationGestureDetectorDetected");
172         }               
173                 
174                 private void OnDetected(object obj, RotationGestureDetector.DetectedEventArgs e)
175                 {
176             View v1 = e.View;
177             e.View = v1;
178                         
179             RotationGesture p1 = e.RotationGesture;
180             e.RotationGesture = p1;
181                 }               
182     }
183
184 }