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.
20 #include <dali/public-api/dali-core.h>
21 #include <dali-test-suite-utils.h>
23 void utc_dali_angle_axis_startup(void)
25 test_return_value = TET_UNDEF;
28 void utc_dali_angle_axis_cleanup(void)
30 test_return_value = TET_PASS;
35 int UtcDaliAngleAxisNew01(void)
37 TestApplication application;
40 DALI_TEST_EQUALS(float(a.angle), 0.0f, 0.001f, TEST_LOCATION);
41 DALI_TEST_EQUALS(a.axis, Vector3(0.0f, 0.0f, 0.0f), 0.001f, TEST_LOCATION);
47 int UtcDaliAngleAxisNew02(void)
49 TestApplication application;
52 AngleAxis a(d, Vector3::XAXIS);
54 DALI_TEST_EQUALS(a.angle, Radian(d), 0.001f, TEST_LOCATION);
55 DALI_TEST_EQUALS(a.axis, Vector3::XAXIS, 0.001f, TEST_LOCATION);
60 int UtcDaliAngleAxisNew03(void)
62 TestApplication application;
65 AngleAxis a(r, Vector3::ZAXIS);
67 // AngleAxis stores its angle as a degree, so should only do degree comparison.
68 DALI_TEST_EQUALS(a.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
69 DALI_TEST_EQUALS(a.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
73 int UtcDaliAngleAxisAssign(void)
75 TestApplication application;
78 AngleAxis a(r, Vector3::ZAXIS);
82 // AngleAxis stores its angle as a degree, so should only do degree comparison.
83 DALI_TEST_EQUALS(b.angle, Radian(Math::PI_2), 0.001f, TEST_LOCATION);
84 DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
88 int UtcDaliAngleAxisCopyConstructor(void)
90 TestApplication application;
92 Radian r( Math::PI_2 );
93 AngleAxis a( r, Vector3::ZAXIS );
96 // AngleAxis stores its angle as a degree, so should only do degree comparison.
97 DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION );
98 DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION );
102 int UtcDaliAngleAxisMoveConstructor(void)
104 TestApplication application;
106 Radian r( Math::PI_2 );
107 AngleAxis a( r, Vector3::ZAXIS );
108 AngleAxis b = std::move( a );
110 // AngleAxis stores its angle as a degree, so should only do degree comparison.
111 DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION );
112 DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION );
116 int UtcDaliAngleAxisCopyAssignmwent(void)
118 TestApplication application;
120 Radian r( Math::PI_2 );
121 AngleAxis a( r, Vector3::ZAXIS );
125 // AngleAxis stores its angle as a degree, so should only do degree comparison.
126 DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION );
127 DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION );
131 int UtcDaliAngleAxisMoveAssignmwent(void)
133 TestApplication application;
135 Radian r( Math::PI_2 );
136 AngleAxis a( r, Vector3::ZAXIS );
140 // AngleAxis stores its angle as a degree, so should only do degree comparison.
141 DALI_TEST_EQUALS( b.angle, Radian( Math::PI_2 ), 0.001f, TEST_LOCATION );
142 DALI_TEST_EQUALS( b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION );
146 int UtcDaliAngleAxisEqual(void)
148 TestApplication application;
150 Radian r(Math::PI_2);
151 AngleAxis a(r, Vector3::ZAXIS);
154 tet_result((a == b) ? TET_PASS : TET_FAIL);
156 b.axis = Vector3::YAXIS;
157 tet_result(!(a == b) ? TET_PASS : TET_FAIL);