Merge remote-tracking branch 'origin/master' into tizen
[platform/core/csapi/tizenfx.git] / test / Tizen.NUI.Tests / Tizen.NUI.Devel.Tests / testcase / internal / Common / TSAngleAxis.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/AngleAxis")]
13     public class InternalAngleAxisTest
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("AngleAxis constructor.")]
32         [Property("SPEC", "Tizen.NUI.AngleAxis.AngleAxis C")]
33         [Property("SPEC_URL", "-")]
34         [Property("CRITERIA", "CONSTR")]
35         [Property("AUTHOR", "guowei.wang@samsung.com")]
36         public void AngleAxisConstructor()
37         {
38             tlog.Debug(tag, $"AngleAxisConstructor START");
39
40             var testingTarget = new AngleAxis();
41             Assert.IsNotNull(testingTarget, "Can't create success object AngleAxis");
42             Assert.IsInstanceOf<AngleAxis>(testingTarget, "Should be an instance of AngleAxis type.");
43
44             testingTarget.Dispose();
45             tlog.Debug(tag, $"AngleAxisConstructor END (OK)");
46         }
47
48         [Test]
49         [Category("P1")]
50         [Description("AngleAxis constructor. With Radian and Vector3.")]
51         [Property("SPEC", "Tizen.NUI.AngleAxis.AngleAxis C")]
52         [Property("SPEC_URL", "-")]
53         [Property("CRITERIA", "CONSTR")]
54         [Property("AUTHOR", "guowei.wang@samsung.com")]
55         public void AngleAxisConstructorWithRadianAndVector3()
56         {
57             tlog.Debug(tag, $"AngleAxisConstructorWithRadianAndVector3 START");
58
59             using (Radian radian = new Radian(0.3f))
60             {
61                 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
62                 {
63                     var testingTarget = new AngleAxis(radian, vector);
64                     Assert.IsNotNull(testingTarget, "Can't create success object AngleAxis");
65                     Assert.IsInstanceOf<AngleAxis>(testingTarget, "Should be an instance of AngleAxis type.");
66
67                     testingTarget.Dispose();
68                 }
69             }
70
71             tlog.Debug(tag, $"AngleAxisConstructorWithRadianAndVector3 END (OK)");
72         }
73
74         [Test]
75         [Category("P1")]
76         [Description("AngleAxis getCPtr.")]
77         [Property("SPEC", "Tizen.NUI.AngleAxis.getCPtr M")]
78         [Property("SPEC_URL", "-")]
79         [Property("CRITERIA", "MR")]
80         [Property("AUTHOR", "guowei.wang@samsung.com")]
81         public void AngleAxisGetCPtr()
82         {
83             tlog.Debug(tag, $"AngleAxisGetCPtr START");
84
85             var testingTarget = new AngleAxis();
86             Assert.IsNotNull(testingTarget, "Can't create success object AngleAxis");
87             Assert.IsInstanceOf<AngleAxis>(testingTarget, "Should be an instance of AngleAxis type.");
88
89             try
90             {
91                 AngleAxis.getCPtr(testingTarget);
92             }
93             catch (Exception e)
94             {
95                 tlog.Debug(tag, e.Message.ToString());
96                 Assert.Fail("Caught Exception : Failed!");
97             }
98
99             testingTarget.Dispose();
100             tlog.Debug(tag, $"AngleAxisGetCPtr END (OK)");
101         }
102
103         [Test]
104         [Category("P1")]
105         [Description("AngleAxis constructor. angle.")]
106         [Property("SPEC", "Tizen.NUI.AngleAxis.angle A")]
107         [Property("SPEC_URL", "-")]
108         [Property("CRITERIA", "PRW")]
109         [Property("AUTHOR", "guowei.wang@samsung.com")]
110         public void AngleAxisAngle()
111         {
112             tlog.Debug(tag, $"AngleAxisAngle START");
113
114             using (Radian radian = new Radian(0.3f))
115             {
116                 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
117                 {
118                     var testingTarget = new AngleAxis(radian, vector);
119                     Assert.IsNotNull(testingTarget, "Can't create success object AngleAxis");
120                     Assert.IsInstanceOf<AngleAxis>(testingTarget, "Should be an instance of AngleAxis type.");
121
122                     Assert.AreEqual(0.3f, testingTarget.angle.ConvertToFloat(), "Should be equal!");
123
124                     testingTarget.angle = new Radian(0.8f);
125                     Assert.AreEqual(0.8f, testingTarget.angle.ConvertToFloat(), "Should be equal!");
126
127                     testingTarget.Dispose();
128                 }
129             }
130
131             tlog.Debug(tag, $"AngleAxisAngle END (OK)");
132         }
133
134         [Test]
135         [Category("P1")]
136         [Description("AngleAxis constructor. axis.")]
137         [Property("SPEC", "Tizen.NUI.AngleAxis.axis A")]
138         [Property("SPEC_URL", "-")]
139         [Property("CRITERIA", "PRW")]
140         [Property("AUTHOR", "guowei.wang@samsung.com")]
141         public void AngleAxisAxis()
142         {
143             tlog.Debug(tag, $"AngleAxisAxis START");
144
145             using (Radian radian = new Radian(0.3f))
146             {
147                 using (Vector3 vector = new Vector3(1.0f, 2.0f, 3.0f))
148                 {
149                     var testingTarget = new AngleAxis(radian, vector);
150                     Assert.IsNotNull(testingTarget, "Can't create success object AngleAxis");
151                     Assert.IsInstanceOf<AngleAxis>(testingTarget, "Should be an instance of AngleAxis type.");
152
153                     Assert.AreEqual(1.0f, testingTarget.axis.X, "Should be equal!");
154                     Assert.AreEqual(2.0f, testingTarget.axis.Y, "Should be equal!");
155                     Assert.AreEqual(3.0f, testingTarget.axis.Z, "Should be equal!");
156
157                     testingTarget.axis = new Vector3(3.0f, 2.0f, 1.0f);
158                     Assert.AreEqual(3.0f, testingTarget.axis.X, "Should be equal!");
159                     Assert.AreEqual(2.0f, testingTarget.axis.Y, "Should be equal!");
160                     Assert.AreEqual(1.0f, testingTarget.axis.Z, "Should be equal!");
161
162                     testingTarget.Dispose();
163                 }
164             }
165
166             tlog.Debug(tag, $"AngleAxisAxis END (OK)");
167         }
168     }
169 }