[Tizen] Add screen and client rotation itself function
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Degree.cpp
1 #include <iostream>
2
3 #include <stdlib.h>
4 #include <dali/public-api/dali-core.h>
5 #include <dali-test-suite-utils.h>
6
7 using namespace Dali;
8
9 void utc_dali_degree_startup(void)
10 {
11   test_return_value = TET_UNDEF;
12 }
13
14 void utc_dali_degree_cleanup(void)
15 {
16   test_return_value = TET_PASS;
17 }
18
19
20 // Positive test case for constructors
21 int UtcDaliDegreeConstructors01(void)
22 {
23   TestApplication application;
24
25   // Default constructor, does not initialise the value
26   Degree degree0( 0.0f );
27
28   // Test assignment operator
29   degree0 = Degree(180.0f);
30   DALI_TEST_EQUALS( degree0.degree, 180.0f, 0.001f, TEST_LOCATION );
31
32   // Constructor from float value
33   Degree degree1( 180.0f );
34   DALI_TEST_EQUALS( degree1.degree, 180.0f, 0.001f, TEST_LOCATION );
35
36   // Constructor from a Radian
37   Degree degree2( Radian( Math::PI ) );
38   DALI_TEST_EQUALS( degree2.degree, 180.0f, 0.001f, TEST_LOCATION );
39
40   END_TEST;
41 }
42
43 // Positive test case for comparison
44 int UtcDaliDegreeComparison01(void)
45 {
46   TestApplication application;
47
48   // Comparison between degrees
49   Degree degree0( 90.0f );
50   Degree degree1( 90.0f );
51   Degree degree2( 180.0f );
52
53   DALI_TEST_CHECK( degree0 == degree1 );
54   DALI_TEST_CHECK( degree0 != degree2 );
55
56   // Comparison between radian to degree
57   Degree degree3( 180.0f );
58   Degree degree4( 90.0f );
59   Radian radian0( Math::PI );
60
61   DALI_TEST_CHECK( degree3 == Degree(radian0) );
62   DALI_TEST_CHECK( degree4 != Degree(radian0) );
63
64   // Comparison with float
65   Degree degree5( 90.0f );
66
67   DALI_TEST_CHECK( degree5.degree == 90.0f );
68   DALI_TEST_CHECK( degree5.degree != 180.0f );
69
70   END_TEST;
71 }
72
73 int UtcDaliDegreeOperatorEquals(void)
74 {
75   TestApplication application;
76
77   Degree a(90.0f);
78   Degree b(90.0f);
79   Degree c(180.0f);
80
81   DALI_TEST_EQUALS(a == a, true, TEST_LOCATION);
82   DALI_TEST_EQUALS(a == b, true, TEST_LOCATION);
83   DALI_TEST_EQUALS(a == c, false, TEST_LOCATION);
84   END_TEST;
85 }
86
87 int UtcDaliDegreeOperatorNotEquals(void)
88 {
89   TestApplication application;
90
91   Degree a(90.0f);
92   Degree b(90.0f);
93   Degree c(180.0f);
94
95   DALI_TEST_EQUALS(a != a, false, TEST_LOCATION);
96   DALI_TEST_EQUALS(a != b, false, TEST_LOCATION);
97   DALI_TEST_EQUALS(a != c, true, TEST_LOCATION);
98   END_TEST;
99 }