Revert "[Tizen] Appendix log for ttrace + Print keycode and timestamp"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-AngleAxis.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 #include <dali-test-suite-utils.h>
19 #include <dali/public-api/dali-core.h>
20 #include <stdlib.h>
21
22 #include <iostream>
23
24 void utc_dali_angle_axis_startup(void)
25 {
26   test_return_value = TET_UNDEF;
27 }
28
29 void utc_dali_angle_axis_cleanup(void)
30 {
31   test_return_value = TET_PASS;
32 }
33
34 int UtcDaliAngleAxisNew01(void)
35 {
36   TestApplication application;
37
38   AngleAxis a;
39   DALI_TEST_EQUALS(float(a.angle), 0.0f, 0.001f, TEST_LOCATION);
40   DALI_TEST_EQUALS(a.axis, Vector3(0.0f, 0.0f, 0.0f), 0.001f, TEST_LOCATION);
41   END_TEST;
42 }
43
44 int UtcDaliAngleAxisNew02(void)
45 {
46   TestApplication application;
47
48   Degree    d(75.0f);
49   AngleAxis a(d, Vector3::XAXIS);
50
51   DALI_TEST_EQUALS(a.angle, Radian(d), 0.001f, TEST_LOCATION);
52   DALI_TEST_EQUALS(a.axis, Vector3::XAXIS, 0.001f, TEST_LOCATION);
53   END_TEST;
54 }
55
56 int UtcDaliAngleAxisNew03(void)
57 {
58   TestApplication application;
59
60   Radian    r(Math::PI_2);
61   AngleAxis a(r, Vector3::ZAXIS);
62
63   // AngleAxis stores its angle as a degree, so should only do degree comparison.
64   DALI_TEST_EQUALS(a.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
65   DALI_TEST_EQUALS(a.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
66   END_TEST;
67 }
68
69 int UtcDaliAngleAxisAssign(void)
70 {
71   TestApplication application;
72
73   Radian    r(Math::PI_2);
74   AngleAxis a(r, Vector3::ZAXIS);
75
76   AngleAxis b = a;
77
78   // AngleAxis stores its angle as a degree, so should only do degree comparison.
79   DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
80   DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
81   END_TEST;
82 }
83
84 int UtcDaliAngleAxisCopyConstructor(void)
85 {
86   TestApplication application;
87
88   Radian    r(Math::PI_2);
89   AngleAxis a(r, Vector3::ZAXIS);
90   AngleAxis b(a);
91
92   // AngleAxis stores its angle as a degree, so should only do degree comparison.
93   DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
94   DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
95   END_TEST;
96 }
97
98 int UtcDaliAngleAxisMoveConstructor(void)
99 {
100   TestApplication application;
101
102   Radian    r(Math::PI_2);
103   AngleAxis a(r, Vector3::ZAXIS);
104   AngleAxis b = std::move(a);
105
106   // AngleAxis stores its angle as a degree, so should only do degree comparison.
107   DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
108   DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
109   END_TEST;
110 }
111
112 int UtcDaliAngleAxisCopyAssignmwent(void)
113 {
114   TestApplication application;
115
116   Radian    r(Math::PI_2);
117   AngleAxis a(r, Vector3::ZAXIS);
118   AngleAxis b;
119   b = a;
120
121   // AngleAxis stores its angle as a degree, so should only do degree comparison.
122   DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
123   DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
124   END_TEST;
125 }
126
127 int UtcDaliAngleAxisMoveAssignmwent(void)
128 {
129   TestApplication application;
130
131   Radian    r(Math::PI_2);
132   AngleAxis a(r, Vector3::ZAXIS);
133   AngleAxis b;
134   b = std::move(a);
135
136   // AngleAxis stores its angle as a degree, so should only do degree comparison.
137   DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
138   DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
139   END_TEST;
140 }
141
142 int UtcDaliAngleAxisEqual(void)
143 {
144   TestApplication application;
145
146   Radian    r(Math::PI_2);
147   AngleAxis a(r, Vector3::ZAXIS);
148   AngleAxis b(a);
149
150   tet_result((a == b) ? TET_PASS : TET_FAIL);
151
152   b.axis = Vector3::YAXIS;
153   tet_result(!(a == b) ? TET_PASS : TET_FAIL);
154   END_TEST;
155 }