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