Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-AngleAxis.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 #include <iostream>
18 #include <stdlib.h>
19 #include <dali/dali.h>
20 #include <dali-test-suite-utils.h>
21
22 void utc_dali_angle_axis_startup(void)
23 {
24   test_return_value = TET_UNDEF;
25 }
26
27 void utc_dali_angle_axis_cleanup(void)
28 {
29   test_return_value = TET_PASS;
30 }
31
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
45
46 int UtcDaliAngleAxisNew02(void)
47 {
48   TestApplication application;
49
50   Degree d(75.0f);
51   AngleAxis a(d, Vector3::XAXIS);
52
53   DALI_TEST_EQUALS(a.angle, d, 0.001f, TEST_LOCATION);
54   DALI_TEST_EQUALS(a.axis, Vector3::XAXIS, 0.001f, TEST_LOCATION);
55   END_TEST;
56 }
57
58
59 int UtcDaliAngleAxisNew03(void)
60 {
61   TestApplication application;
62
63   Radian r(Math::PI_2);
64   AngleAxis a(r, Vector3::ZAXIS);
65
66   // AngleAxis stores its angle as a degree, so should only do degree comparison.
67   DALI_TEST_EQUALS(a.angle, Degree(Radian(Math::PI_2)), 0.001f, TEST_LOCATION);
68   DALI_TEST_EQUALS(a.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
69   END_TEST;
70 }
71
72 int UtcDaliAngleAxisAssign(void)
73 {
74   TestApplication application;
75
76   Radian r(Math::PI_2);
77   AngleAxis a(r, Vector3::ZAXIS);
78
79   AngleAxis b = a;
80
81   // AngleAxis stores its angle as a degree, so should only do degree comparison.
82   DALI_TEST_EQUALS(b.angle, Degree(Radian(Math::PI_2)), 0.001f, TEST_LOCATION);
83   DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
84   END_TEST;
85 }
86
87 int UtcDaliAngleAxisCopy(void)
88 {
89   TestApplication application;
90
91   Radian r(Math::PI_2);
92   AngleAxis a(r, Vector3::ZAXIS);
93   AngleAxis b(a);
94
95   // AngleAxis stores its angle as a degree, so should only do degree comparison.
96   DALI_TEST_EQUALS(b.angle, Degree(Radian(Math::PI_2)), 0.001f, TEST_LOCATION);
97   DALI_TEST_EQUALS(b.axis, Vector3::ZAXIS, 0.001f, TEST_LOCATION);
98   END_TEST;
99 }