2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <dali-test-suite-utils.h>
19 #include <dali/public-api/dali-core.h>
24 void utc_dali_angle_axis_startup(void)
26 test_return_value = TET_UNDEF;
29 void utc_dali_angle_axis_cleanup(void)
31 test_return_value = TET_PASS;
34 int UtcDaliAngleAxisNew01(void)
36 TestApplication application;
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);
44 int UtcDaliAngleAxisNew02(void)
46 TestApplication application;
49 AngleAxis a(d, Vector3::XAXIS);
51 DALI_TEST_EQUALS(a.angle, Radian(d), 0.001f, TEST_LOCATION);
52 DALI_TEST_EQUALS(a.axis, Vector3::XAXIS, 0.001f, TEST_LOCATION);
56 int UtcDaliAngleAxisNew03(void)
58 TestApplication application;
61 AngleAxis a(r, Vector3::ZAXIS);
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);
69 int UtcDaliAngleAxisAssign(void)
71 TestApplication application;
74 AngleAxis a(r, Vector3::ZAXIS);
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);
84 int UtcDaliAngleAxisCopyConstructor(void)
86 TestApplication application;
89 AngleAxis a(r, Vector3::ZAXIS);
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);
98 int UtcDaliAngleAxisMoveConstructor(void)
100 TestApplication application;
102 Radian r(Math::PI_2);
103 AngleAxis a(r, Vector3::ZAXIS);
104 AngleAxis b = std::move(a);
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);
112 int UtcDaliAngleAxisCopyAssignmwent(void)
114 TestApplication application;
116 Radian r(Math::PI_2);
117 AngleAxis a(r, Vector3::ZAXIS);
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);
127 int UtcDaliAngleAxisMoveAssignmwent(void)
129 TestApplication application;
131 Radian r(Math::PI_2);
132 AngleAxis a(r, Vector3::ZAXIS);
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);
142 int UtcDaliAngleAxisEqual(void)
144 TestApplication application;
146 Radian r(Math::PI_2);
147 AngleAxis a(r, Vector3::ZAXIS);
150 tet_result((a == b) ? TET_PASS : TET_FAIL);
152 b.axis = Vector3::YAXIS;
153 tet_result(!(a == b) ? TET_PASS : TET_FAIL);