Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Common / TSAngleThresholdPair.cs
1 using global::System;
2 using NUnit.Framework;
3 using NUnit.Framework.TUnit;
4 using Tizen.NUI.Components;
5 using Tizen.NUI.BaseComponents;
6
7 namespace Tizen.NUI.Devel.Tests
8 {
9     using tlog = Tizen.Log;
10
11     [TestFixture]
12     [Description("internal/Common/AngleThresholdPair")]
13     public class InternalAngleThresholdPairTest
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("AngleThresholdPair constructor.")]
32         [Property("SPEC", "Tizen.NUI.AngleThresholdPair.AngleThresholdPair C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void AngleThresholdPairConstructor()
37         {
38             tlog.Debug(tag, $"AngleThresholdPairConstructor START");
39
40             var testingTarget = new AngleThresholdPair();
41             Assert.IsNotNull(testingTarget, "Can't create success object AngleThresholdPair");
42             Assert.IsInstanceOf<AngleThresholdPair>(testingTarget, "Should be an instance of AngleThresholdPair type.");
43
44             testingTarget.Dispose();
45             tlog.Debug(tag, $"AngleThresholdPairConstructor END (OK)");
46         }
47
48         [Test]
49         [Category("P1")]
50         [Description("AngleThresholdPair constructor. With Radians.")]
51         [Property("SPEC", "Tizen.NUI.AngleThresholdPair.AngleThresholdPair C")]
52         [Property("SPEC_URL", "-")]
53         [Property("CRITERIA", "CONSTR")]
54         [Property("AUTHOR", "guowei.wang@samsung.com")]
55         public void AngleThresholdPairConstructorWithRadians()
56         {
57             tlog.Debug(tag, $"AngleThresholdPairConstructorWithRadians START");
58
59             using (Radian t = new Radian(0.3f))
60             {
61                 using (Radian u = new Radian(0.8f))
62                 {
63                     var testingTarget = new AngleThresholdPair(t, u);
64                     Assert.IsNotNull(testingTarget, "Can't create success object AngleThresholdPair");
65                     Assert.IsInstanceOf<AngleThresholdPair>(testingTarget, "Should be an instance of AngleThresholdPair type.");
66
67                     testingTarget.Dispose();
68                 }
69             }
70
71             tlog.Debug(tag, $"AngleThresholdPairConstructorWithRadians END (OK)");
72         }
73
74         [Test]
75         [Category("P1")]
76         [Description("AngleThresholdPair constructor. With AngleThresholdPair.")]
77         [Property("SPEC", "Tizen.NUI.AngleThresholdPair.AngleThresholdPair C")]
78         [Property("SPEC_URL", "-")]
79         [Property("CRITERIA", "CONSTR")]
80         [Property("AUTHOR", "guowei.wang@samsung.com")]
81         public void AngleThresholdPairConstructorWithAngleThresholdPair()
82         {
83             tlog.Debug(tag, $"AngleThresholdPairConstructorWithAngleThresholdPair START");
84
85             using (Radian t = new Radian(0.3f))
86             {
87                 using (Radian u = new Radian(0.8f))
88                 {
89                     using (AngleThresholdPair angleThresholdPair = new AngleThresholdPair(t, u))
90                     {
91                         var testingTarget = new AngleThresholdPair(angleThresholdPair);
92                         Assert.IsNotNull(testingTarget, "Can't create success object AngleThresholdPair");
93                         Assert.IsInstanceOf<AngleThresholdPair>(testingTarget, "Should be an instance of AngleThresholdPair type.");
94
95                         testingTarget.Dispose();
96                     }
97                 }
98             }
99
100             tlog.Debug(tag, $"AngleThresholdPairConstructorWithAngleThresholdPair END (OK)");
101         }
102
103         [Test]
104         [Category("P1")]
105         [Description("AngleThresholdPair constructor. second.")]
106         [Property("SPEC", "Tizen.NUI.AngleThresholdPair.second A")]
107         [Property("SPEC_URL", "-")]
108         [Property("CRITERIA", "PRW")]
109         [Property("AUTHOR", "guowei.wang@samsung.com")]
110         public void AngleThresholdPairSecond()
111         {
112             tlog.Debug(tag, $"AngleThresholdPairSecond START");
113
114             using (Radian t = new Radian(0.3f))
115             {
116                 using (Radian u = new Radian(0.8f))
117                 {
118                     var testingTarget = new AngleThresholdPair(t, u);
119                     Assert.IsNotNull(testingTarget, "Can't create success object AngleThresholdPair");
120                     Assert.IsInstanceOf<AngleThresholdPair>(testingTarget, "Should be an instance of AngleThresholdPair type.");
121
122                     Assert.AreEqual(0.8f, testingTarget.second.ConvertToFloat(), "Should be equal!");
123
124                     testingTarget.second = new Radian(0.9f);
125                     Assert.AreEqual(0.9f, testingTarget.second.ConvertToFloat(), "Should be equal!");
126
127                     testingTarget.Dispose();
128                 }
129             }
130
131             tlog.Debug(tag, $"AngleThresholdPairSecond END (OK)");
132         }
133
134         [Test]
135         [Category("P1")]
136         [Description("AngleThresholdPair first.")]
137         [Property("SPEC", "Tizen.NUI.AngleThresholdPair.first A")]
138         [Property("SPEC_URL", "-")]
139         [Property("CRITERIA", "PRW")]
140         [Property("AUTHOR", "guowei.wang@samsung.com")]
141         public void AngleThresholdPairFirst()
142         {
143             tlog.Debug(tag, $"AngleThresholdPairFirst START");
144
145             using (Radian t = new Radian(0.3f))
146             {
147                 using (Radian u = new Radian(0.8f))
148                 {
149                     var testingTarget = new AngleThresholdPair(t, u);
150                     Assert.IsNotNull(testingTarget, "Can't create success object AngleThresholdPair");
151                     Assert.IsInstanceOf<AngleThresholdPair>(testingTarget, "Should be an instance of AngleThresholdPair type.");
152
153                     Assert.AreEqual(0.3f, testingTarget.first.ConvertToFloat(), "Should be equal!");
154
155                     testingTarget.first = new Radian(0.4f);
156                     Assert.AreEqual(0.4f, testingTarget.first.ConvertToFloat(), "Should be equal!");
157
158                     testingTarget.Dispose();
159                 }
160             }
161
162             tlog.Debug(tag, $"AngleThresholdPairFirst END (OK)");
163         }
164
165         [Test]
166         [Category("P1")]
167         [Description("AngleThresholdPair getCPtr.")]
168         [Property("SPEC", "Tizen.NUI.AngleThresholdPair.getCPtr M")]
169         [Property("SPEC_URL", "-")]
170         [Property("CRITERIA", "MR")]
171         [Property("AUTHOR", "guowei.wang@samsung.com")]
172         public void AngleThresholdPairGetCPtr()
173         {
174             tlog.Debug(tag, $"AngleThresholdPairGetCPtr START");
175
176             using (Radian t = new Radian(0.3f))
177             {
178                 using (Radian u = new Radian(0.8f))
179                 {
180                     var testingTarget = new AngleThresholdPair(t, u);
181                     Assert.IsNotNull(testingTarget, "Can't create success object AngleThresholdPair");
182                     Assert.IsInstanceOf<AngleThresholdPair>(testingTarget, "Should be an instance of AngleThresholdPair type.");
183
184                     try
185                     {
186                         AngleThresholdPair.getCPtr(testingTarget);
187                     }
188                     catch (Exception e)
189                     {
190                         tlog.Debug(tag, e.Message.ToString());
191                         Assert.Fail("Caught Exception : Failed!");
192                     }
193
194                     testingTarget.Dispose();
195                 }
196             }
197
198             tlog.Debug(tag, $"AngleThresholdPairGetCPtr END (OK)");
199         }
200     }
201 }