[NUI] Update TCs of NUI.Devel.
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / public / Events / TSPinchGestureDetector.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/PinchGestureDetector")]
13     class PublicPinchGestureDetectorTest
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("PinchGestureDetector constructor")]
32         [Property("SPEC", "Tizen.NUI.PinchGestureDetector.PinchGestureDetector C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void PinchGestureDetectorConstructor()
37         {
38             tlog.Debug(tag, $"PinchGestureDetectorConstructor START");
39             PinchGestureDetector a1 = new PinchGestureDetector();
40
41             a1.Dispose();
42             tlog.Debug(tag, $"PinchGestureDetectorConstructor END (OK)");
43             Assert.Pass("PinchGestureDetectorConstructor");
44         }
45
46         [Test]
47         [Category("P1")]
48         [Description("PinchGestureDetector constructor")]
49         [Property("SPEC", "Tizen.NUI.PinchGestureDetector.PinchGestureDetector C")]
50         [Property("SPEC_URL", "-")]
51         [Property("CRITERIA", "CONSTR")]
52         [Property("AUTHOR", "guowei.wang@samsung.com")]
53         public void PinchGestureDetectorConstructorWithPinchGestureDetector()
54         {
55             tlog.Debug(tag, $"PinchGestureDetectorConstructor START");
56
57             using (PinchGestureDetector detector = new PinchGestureDetector())
58             {
59                 var testingTarget = new PinchGestureDetector(detector);
60                 Assert.IsNotNull(testingTarget, "Can't create success object Hover");
61                 Assert.IsInstanceOf<PinchGestureDetector>(testingTarget, "Should be an instance of PinchGestureDetector type.");
62
63                 testingTarget.Dispose();
64             }
65
66             tlog.Debug(tag, $"PinchGestureDetectorConstructor END (OK)");
67             Assert.Pass("PinchGestureDetectorConstructor");
68         }
69
70         [Test]
71         [Category("P1")]
72         [Description("PinchGestureDetector GetPinchGestureDetectorFromPtr")]
73         [Property("SPEC", "Tizen.NUI.PinchGestureDetector.GetPinchGestureDetectorFromPtr M")]
74         [Property("SPEC_URL", "-")]
75         [Property("CRITERIA", "MR")]
76         [Property("AUTHOR", "guowei.wang@samsung.com")]
77         public void PinchGestureDetectorGetPinchGestureDetectorFromPtr()
78         {
79             tlog.Debug(tag, $"PinchGestureDetectorGetPinchGestureDetectorFromPtr START");
80             PinchGestureDetector a1 = new PinchGestureDetector();
81
82             PinchGestureDetector a2 = PinchGestureDetector.GetPinchGestureDetectorFromPtr(PinchGestureDetector.getCPtr(a1).Handle);
83                         
84             a1.Dispose();
85             
86             tlog.Debug(tag, $"PinchGestureDetectorGetPinchGestureDetectorFromPtr END (OK)");
87             Assert.Pass("PinchGestureDetectorGetPinchGestureDetectorFromPtr");
88         }
89
90         [Test]
91         [Category("P1")]
92         [Description("PinchGestureDetector DownCast")]
93         [Property("SPEC", "Tizen.NUI.PinchGestureDetector.DownCast M")]
94         [Property("SPEC_URL", "-")]
95         [Property("CRITERIA", "MR")]
96         [Property("AUTHOR", "guowei.wang@samsung.com")]
97         public void PinchGestureDetectorDownCast()
98         {
99             tlog.Debug(tag, $"PinchGestureDetectorDownCast START");
100
101             using (PinchGestureDetector detector = new PinchGestureDetector())
102             {
103                 var testingTarget = PinchGestureDetector.DownCast(detector);
104                 Assert.IsInstanceOf<PinchGestureDetector>(testingTarget, "Should be an instance of PinchGestureDetector type.");
105
106                 testingTarget.Dispose();
107             }
108
109             tlog.Debug(tag, $"PinchGestureDetectorDownCast END (OK)");
110         }
111
112         [Test]
113         [Category("P1")]
114         [Description("PinchGestureDetector getCPtr")]
115         [Property("SPEC", "Tizen.NUI.PinchGestureDetector.getCPtr M")]
116         [Property("SPEC_URL", "-")]
117         [Property("CRITERIA", "MR")]
118         [Property("AUTHOR", "guowei.wang@samsung.com")]
119         public void PinchGestureDetectorgetCPtr()
120         {
121             tlog.Debug(tag, $"PinchGestureDetectorgetCPtr START");
122             PinchGestureDetector a1 = new PinchGestureDetector();
123
124             global::System.Runtime.InteropServices.HandleRef b1 = PinchGestureDetector.getCPtr(a1);
125
126             a1.Dispose();
127             
128             tlog.Debug(tag, $"PinchGestureDetectorgetCPtr END (OK)");
129             Assert.Pass("PinchGestureDetectorgetCPtr");
130         }
131
132                 [Test]
133         [Category("P1")]
134         [Description("PinchGestureDetector Assign")]
135         [Property("SPEC", "Tizen.NUI.PinchGestureDetector.Assign M")]
136         [Property("SPEC_URL", "-")]
137         [Property("CRITERIA", "MR")]
138         [Property("AUTHOR", "guowei.wang@samsung.com")]
139         public void PinchGestureDetectorAssign()
140         {
141             tlog.Debug(tag, $"PinchGestureDetectorAssign START");
142
143             using (PinchGestureDetector detector = new PinchGestureDetector())
144             {
145                 var testingTarget = detector.Assign(detector);
146                 Assert.IsInstanceOf<PinchGestureDetector>(testingTarget, "Should be an instance of PinchGestureDetector type.");
147
148                 testingTarget.Dispose();
149             }
150
151             tlog.Debug(tag, $"PinchGestureDetectorAssign END (OK)");            
152         }
153                 
154         [Test]
155         [Category("P1")]
156         [Description("PinchGestureDetector DetectedSignal")]
157         [Property("SPEC", "Tizen.NUI.PinchGestureDetector.DetectedSignal M")]
158         [Property("SPEC_URL", "-")]
159         [Property("CRITERIA", "MR")]
160         [Property("AUTHOR", "guowei.wang@samsung.com")]
161         public void PinchGestureDetectorDetectedSignal()
162         {
163             tlog.Debug(tag, $"PinchGestureDetectorDetectedSignal START");
164             PinchGestureDetector a1 = new PinchGestureDetector();
165
166             PinchGestureDetectedSignal b1 = a1.DetectedSignal();
167                         
168             a1.Dispose();
169             
170             tlog.Debug(tag, $"PinchGestureDetectorDetectedSignal END (OK)");
171             Assert.Pass("PinchGestureDetectorDetectedSignal");
172         }
173
174                 [Test]
175         [Category("P1")]
176         [Description("Test Detected property.")]
177         [Property("SPEC", "Tizen.NUI.PinchGestureDetector.Detected A")]
178         [Property("SPEC_URL", "-")]
179         [Property("CRITERIA", "PRW")]
180         [Property("AUTHOR", "guowei.wang@samsung.com")]
181         public void PinchGestureDetectorDetected()
182         {
183             tlog.Debug(tag, $"PinchGestureDetectorDetected START");
184             PinchGestureDetector a1 = new PinchGestureDetector();
185                         
186             a1.Detected += OnDetected;
187             a1.Detected -= OnDetected;
188                         
189             a1.Dispose();
190             tlog.Debug(tag, $"PinchGestureDetectorDetected END (OK)");
191             Assert.Pass("PinchGestureDetectorDetected");
192         }
193                 
194                 private void OnDetected(object obj, PinchGestureDetector.DetectedEventArgs e)
195                 { }
196
197         [Test]
198         [Category("P1")]
199         [Description("Test DetectedEventArgs View.")]
200         [Property("SPEC", "Tizen.NUI.DetectedEventArgs.View A")]
201         [Property("SPEC_URL", "-")]
202         [Property("CRITERIA", "PRW")]
203         [Property("AUTHOR", "guowei.wang@samsung.com")]
204         public void PinchGestureDetectedEventArgsView()
205         {
206             tlog.Debug(tag, $"PinchGestureDetectedEventArgsView START");
207
208             var testingTarget = new Tizen.NUI.PinchGestureDetector.DetectedEventArgs();
209             Assert.IsNotNull(testingTarget, "Can't create success object DetectedEventArgs.");
210             Assert.IsInstanceOf<Tizen.NUI.PinchGestureDetector.DetectedEventArgs>(testingTarget, "Should return DetectedEventArgs instance.");
211
212             using (View view = new View() { Size = new Size(100, 50) })
213             {
214                 testingTarget.View = view;
215                 Assert.AreEqual(100, testingTarget.View.Size.Width, "Should be equal!");
216             }
217
218             testingTarget.PinchGesture = new PinchGesture(Gesture.StateType.Possible);
219             Assert.AreEqual(Gesture.StateType.Possible, testingTarget.PinchGesture.State, "Should be equal!");
220
221             tlog.Debug(tag, $"PinchGestureDetectedEventArgsView END (OK)");
222         }
223     }
224 }