UTC coverage for MathUtils,Matrix,Uint16Pair,PropertyTypes
[platform/core/uifw/dali-core.git] / automated-tests / src / dali / utc-Dali-Uint16Pair.cpp
1 /*
2  * Copyright (c) 2014 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 <iostream>
19
20 #include <stdlib.h>
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
23
24 using namespace Dali;
25
26
27 int UtcDaliUint16PairConstructor01P(void)
28 {
29   Dali::TestApplication testApp;
30
31   Uint16Pair v;
32
33   DALI_TEST_EQUALS(v.GetX(), 0u, TEST_LOCATION);
34   DALI_TEST_EQUALS(v.GetY(), 0u, TEST_LOCATION);
35
36   END_TEST;
37 }
38
39 int UtcDaliUint16PairConstructor02P(void)
40 {
41   Dali::TestApplication testApp;
42
43   Uint16Pair v(10,10);
44
45   DALI_TEST_EQUALS(v.GetX(), 10u, TEST_LOCATION);
46   DALI_TEST_EQUALS(v.GetY(), 10u, TEST_LOCATION);
47
48   END_TEST;
49 }
50
51 int UtcDaliUint16PairCopyConstructor01P(void)
52 {
53   Dali::TestApplication testApp;
54
55   Uint16Pair u(5,5);
56   Uint16Pair v(u);
57   DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
58   DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
59
60   END_TEST;
61 }
62
63 int UtcDaliUint16PairGetWidthP(void)
64 {
65   Dali::TestApplication testApp;
66
67   Uint16Pair v(5,5);
68   DALI_TEST_EQUALS(v.GetWidth(), 5u, TEST_LOCATION);
69
70   END_TEST;
71 }
72
73 int UtcDaliUint16PairGetHeightP(void)
74 {
75   Dali::TestApplication testApp;
76
77   Uint16Pair v(5,5);
78   DALI_TEST_EQUALS(v.GetHeight(), 5u, TEST_LOCATION);
79
80   END_TEST;
81 }
82
83 int UtcDaliUint16PairGetXP(void)
84 {
85   Dali::TestApplication testApp;
86
87   Uint16Pair v(5,5);
88   DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
89
90   END_TEST;
91 }
92
93 int UtcDaliUint16PairGetYP(void)
94 {
95   Dali::TestApplication testApp;
96
97   Uint16Pair v(5,5);
98   DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
99
100   END_TEST;
101 }
102
103 int UtcDaliUint16PairEqualsP(void)
104 {
105   Dali::TestApplication testApp;
106
107   Uint16Pair v(5,5);
108   Uint16Pair u(5,5);
109   DALI_TEST_EQUALS(v == u, true, TEST_LOCATION);
110
111   v = Uint16Pair(5,4);
112   u = Uint16Pair(5,5);
113   DALI_TEST_EQUALS(v == u, false, TEST_LOCATION);
114
115   END_TEST;
116 }
117
118 int UtcDaliUint16PairNotEqualsP(void)
119 {
120   Dali::TestApplication testApp;
121
122   Uint16Pair v(5,5);
123   Uint16Pair u(5,5);
124   DALI_TEST_EQUALS(v != u, false, TEST_LOCATION);
125
126   v = Uint16Pair(5,4);
127   u = Uint16Pair(5,5);
128   DALI_TEST_EQUALS(v != u, true, TEST_LOCATION);
129
130   END_TEST;
131 }
132
133 int UtcDaliUint16PairLessThanP(void)
134 {
135   Dali::TestApplication testApp;
136
137   Uint16Pair u(5,5);
138   Uint16Pair v(6,6);
139   DALI_TEST_EQUALS(u < v, true, TEST_LOCATION);
140
141   u = Uint16Pair(0,1);
142   v = Uint16Pair(1,0);
143   DALI_TEST_EQUALS(v < u, true, TEST_LOCATION);
144
145   u = Uint16Pair(1,0);
146   v = Uint16Pair(0,1);
147   DALI_TEST_EQUALS(v < u, false, TEST_LOCATION);
148
149   END_TEST;
150 }
151
152 int UtcDaliUint16PairGreaterThanP(void)
153 {
154   Dali::TestApplication testApp;
155
156   Uint16Pair u;
157   Uint16Pair v;
158
159   u = Uint16Pair(0,1);
160   v = Uint16Pair(1,0);
161   DALI_TEST_EQUALS(u > v, true, TEST_LOCATION);
162
163   u = Uint16Pair(1,0);
164   v = Uint16Pair(0,1);
165   DALI_TEST_EQUALS(v > u, true, TEST_LOCATION);
166
167   END_TEST;
168 }
169
170 int UtcDaliUint16PairFromFloatVecP(void)
171 {
172   Dali::TestApplication testApp;
173
174   Dali::Vector2 v2(5.f, 5.f);
175
176   Uint16Pair u = Uint16Pair::FromFloatVec2(v2);
177   DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
178   DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
179
180   Dali::Vector3 v3(5.f, 5.f, 5.f);
181
182   u = Uint16Pair::FromFloatVec2(v3);
183   DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
184   DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
185
186   END_TEST;
187 }
188
189 int UtcDaliUint16PairFromFloatArrayP(void)
190 {
191   Dali::TestApplication testApp;
192
193   float array[] = {5.f, 5.f};
194
195   Uint16Pair u = Uint16Pair::FromFloatArray(array);
196   DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
197   DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
198
199   END_TEST;
200 }