2 * Copyright (c) 2014 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.
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
28 /// Compare a uint16_t value with an unsigned int
29 void DALI_TEST_EQUALS( uint16_t value1, unsigned int value2, const char* location )
31 ::DALI_TEST_EQUALS< uint16_t >( value1, static_cast< uint16_t >( value2 ), location );
33 } // unnamed namespace
35 int UtcDaliUint16PairConstructor01P(void)
37 Dali::TestApplication testApp;
41 DALI_TEST_EQUALS(v.GetX(), 0u, TEST_LOCATION);
42 DALI_TEST_EQUALS(v.GetY(), 0u, TEST_LOCATION);
47 int UtcDaliUint16PairConstructor02P(void)
49 Dali::TestApplication testApp;
53 DALI_TEST_EQUALS(v.GetX(), 10u, TEST_LOCATION);
54 DALI_TEST_EQUALS(v.GetY(), 10u, TEST_LOCATION);
59 int UtcDaliUint16PairCopyConstructor01P(void)
61 Dali::TestApplication testApp;
65 DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
66 DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
71 int UtcDaliUint16PairGetWidthP(void)
73 Dali::TestApplication testApp;
76 DALI_TEST_EQUALS(v.GetWidth(), 5u, TEST_LOCATION);
81 int UtcDaliUint16PairGetHeightP(void)
83 Dali::TestApplication testApp;
86 DALI_TEST_EQUALS(v.GetHeight(), 5u, TEST_LOCATION);
91 int UtcDaliUint16PairGetXP(void)
93 Dali::TestApplication testApp;
96 DALI_TEST_EQUALS(v.GetX(), 5u, TEST_LOCATION);
101 int UtcDaliUint16PairGetYP(void)
103 Dali::TestApplication testApp;
106 DALI_TEST_EQUALS(v.GetY(), 5u, TEST_LOCATION);
111 int UtcDaliUint16PairSetXP(void)
113 Dali::TestApplication testApp;
115 Uint16Pair v( 5, 5 );
116 DALI_TEST_EQUALS( v.GetX(), 5u, TEST_LOCATION );
118 DALI_TEST_EQUALS( v.GetX(), 10u, TEST_LOCATION );
123 int UtcDaliUint16PairSetWidthP(void)
125 Dali::TestApplication testApp;
127 Uint16Pair v( 5, 5 );
128 DALI_TEST_EQUALS( v.GetWidth(), 5u, TEST_LOCATION );
130 DALI_TEST_EQUALS( v.GetWidth(), 10u, TEST_LOCATION );
135 int UtcDaliUint16PairSetYP(void)
137 Dali::TestApplication testApp;
139 Uint16Pair v( 5, 5 );
140 DALI_TEST_EQUALS( v.GetY(), 5u, TEST_LOCATION );
142 DALI_TEST_EQUALS( v.GetY(), 10u, TEST_LOCATION );
147 int UtcDaliUint16PairSetHeightP(void)
149 Dali::TestApplication testApp;
151 Uint16Pair v( 5, 5 );
152 DALI_TEST_EQUALS( v.GetHeight(), 5u, TEST_LOCATION );
154 DALI_TEST_EQUALS( v.GetHeight(), 10u, TEST_LOCATION );
159 int UtcDaliUint16PairEqualsP(void)
161 Dali::TestApplication testApp;
165 DALI_TEST_EQUALS(v == u, true, TEST_LOCATION);
169 DALI_TEST_EQUALS(v == u, false, TEST_LOCATION);
174 int UtcDaliUint16PairNotEqualsP(void)
176 Dali::TestApplication testApp;
180 DALI_TEST_EQUALS(v != u, false, TEST_LOCATION);
184 DALI_TEST_EQUALS(v != u, true, TEST_LOCATION);
189 int UtcDaliUint16PairLessThanP(void)
191 Dali::TestApplication testApp;
195 DALI_TEST_EQUALS(u < v, true, TEST_LOCATION);
199 DALI_TEST_EQUALS(v < u, true, TEST_LOCATION);
203 DALI_TEST_EQUALS(v < u, false, TEST_LOCATION);
208 int UtcDaliUint16PairGreaterThanP(void)
210 Dali::TestApplication testApp;
217 DALI_TEST_EQUALS(u > v, true, TEST_LOCATION);
221 DALI_TEST_EQUALS(v > u, true, TEST_LOCATION);
226 int UtcDaliUint16PairFromFloatVecP(void)
228 Dali::TestApplication testApp;
230 Dali::Vector2 v2(5.f, 5.f);
232 Uint16Pair u = Uint16Pair::FromFloatVec2(v2);
233 DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
234 DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
236 Dali::Vector3 v3(5.f, 5.f, 5.f);
238 u = Uint16Pair::FromFloatVec2(v3);
239 DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
240 DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);
245 int UtcDaliUint16PairFromFloatArrayP(void)
247 Dali::TestApplication testApp;
249 float array[] = {5.f, 5.f};
251 Uint16Pair u = Uint16Pair::FromFloatArray(array);
252 DALI_TEST_EQUALS(u.GetX(), 5u, TEST_LOCATION);
253 DALI_TEST_EQUALS(u.GetY(), 5u, TEST_LOCATION);