|
1 /* |
|
2 * Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: test api of alf_core_toolkit |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // [INCLUDE FILES] |
|
21 #include <e32svr.h> |
|
22 #include <stifparser.h> |
|
23 #include <stiftestinterface.h> |
|
24 #include <uiacceltk/huirealpoint.h> |
|
25 #include <uiacceltk/huirealrect.h> |
|
26 |
|
27 #include "testuiaifcoretoolkit.h" |
|
28 |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CTestUiAifCoreToolkit::TestTHRRConstructor |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 TInt CTestUiAifCoreToolkit::TestTHRRConstructor( CStifItemParser& /*aItem*/ ) |
|
34 { |
|
35 |
|
36 // Print to UI |
|
37 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
38 _LIT( KHuiMappingFunctions, "In TestTHRRConstructor" ); |
|
39 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
40 // Print to log file |
|
41 iLog->Log( KHuiMappingFunctions ); |
|
42 |
|
43 THuiRealRect rect; |
|
44 |
|
45 return KErrNone; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CTestUiAifCoreToolkit::TestTHRRConstructorWithPoint |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 TInt CTestUiAifCoreToolkit::TestTHRRConstructorWithPoint( CStifItemParser& /*aItem*/ ) |
|
53 { |
|
54 |
|
55 // Print to UI |
|
56 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
57 _LIT( KHuiMappingFunctions, "In TestTHRRConstructorWithPoint" ); |
|
58 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
59 // Print to log file |
|
60 iLog->Log( KHuiMappingFunctions ); |
|
61 |
|
62 THuiRealPoint point1; |
|
63 THuiRealPoint point2; |
|
64 THuiRealRect rect( point1, point2 ); |
|
65 |
|
66 return KErrNone; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CTestUiAifCoreToolkit::TestTHRRConstructorWithPointAndSize |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 TInt CTestUiAifCoreToolkit::TestTHRRConstructorWithPointAndSize( CStifItemParser& /*aItem*/ ) |
|
74 { |
|
75 |
|
76 // Print to UI |
|
77 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
78 _LIT( KHuiMappingFunctions, "In TestTHRRConstructorWithPointAndSize" ); |
|
79 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
80 // Print to log file |
|
81 iLog->Log( KHuiMappingFunctions ); |
|
82 |
|
83 THuiRealPoint point; |
|
84 THuiRealSize size; |
|
85 THuiRealRect rect( point, size ); |
|
86 |
|
87 return KErrNone; |
|
88 } |
|
89 |
|
90 // ----------------------------------------------------------------------------- |
|
91 // CTestUiAifCoreToolkit::TestTHRRConstructorWithTRect |
|
92 // ----------------------------------------------------------------------------- |
|
93 // |
|
94 TInt CTestUiAifCoreToolkit::TestTHRRConstructorWithTRect( CStifItemParser& /*aItem*/ ) |
|
95 { |
|
96 |
|
97 // Print to UI |
|
98 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
99 _LIT( KHuiMappingFunctions, "In TestTHRRConstructorWithTRect" ); |
|
100 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
101 // Print to log file |
|
102 iLog->Log( KHuiMappingFunctions ); |
|
103 |
|
104 TRect rect; |
|
105 THuiRealRect realRect( rect ); |
|
106 |
|
107 return KErrNone; |
|
108 } |
|
109 |
|
110 // ----------------------------------------------------------------------------- |
|
111 // CTestUiAifCoreToolkit::TestTHRRWidth |
|
112 // ----------------------------------------------------------------------------- |
|
113 // |
|
114 TInt CTestUiAifCoreToolkit::TestTHRRWidth( CStifItemParser& /*aItem*/ ) |
|
115 { |
|
116 |
|
117 // Print to UI |
|
118 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
119 _LIT( KHuiMappingFunctions, "In TestTHRRWidth" ); |
|
120 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
121 // Print to log file |
|
122 iLog->Log( KHuiMappingFunctions ); |
|
123 |
|
124 TRect rect( 1, 1, 1, 1 ); |
|
125 THuiRealRect realRect( rect ); |
|
126 realRect.Width(); |
|
127 |
|
128 return KErrNone; |
|
129 } |
|
130 |
|
131 // ----------------------------------------------------------------------------- |
|
132 // CTestUiAifCoreToolkit::TestTHRRHeight |
|
133 // ----------------------------------------------------------------------------- |
|
134 // |
|
135 TInt CTestUiAifCoreToolkit::TestTHRRHeight( CStifItemParser& /*aItem*/ ) |
|
136 { |
|
137 |
|
138 // Print to UI |
|
139 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
140 _LIT( KHuiMappingFunctions, "In TestTHRRHeight" ); |
|
141 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
142 // Print to log file |
|
143 iLog->Log( KHuiMappingFunctions ); |
|
144 |
|
145 TRect rect( 1, 1, 1, 1 ); |
|
146 THuiRealRect realRect( rect ); |
|
147 realRect.Height(); |
|
148 |
|
149 return KErrNone; |
|
150 } |
|
151 |
|
152 // ----------------------------------------------------------------------------- |
|
153 // CTestUiAifCoreToolkit::TestTHRRTopRight |
|
154 // ----------------------------------------------------------------------------- |
|
155 // |
|
156 TInt CTestUiAifCoreToolkit::TestTHRRTopRight( CStifItemParser& /*aItem*/ ) |
|
157 { |
|
158 |
|
159 // Print to UI |
|
160 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
161 _LIT( KHuiMappingFunctions, "In TestTHRRTopRight" ); |
|
162 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
163 // Print to log file |
|
164 iLog->Log( KHuiMappingFunctions ); |
|
165 |
|
166 TRect rect( 1, 1, 1, 1 ); |
|
167 THuiRealRect realRect( rect ); |
|
168 realRect.TopRight(); |
|
169 |
|
170 return KErrNone; |
|
171 } |
|
172 |
|
173 // ----------------------------------------------------------------------------- |
|
174 // CTestUiAifCoreToolkit::TestTHRRBottomLeft |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 TInt CTestUiAifCoreToolkit::TestTHRRBottomLeft( CStifItemParser& /*aItem*/ ) |
|
178 { |
|
179 |
|
180 // Print to UI |
|
181 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
182 _LIT( KHuiMappingFunctions, "In TestTHRRBottomLeft" ); |
|
183 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
184 // Print to log file |
|
185 iLog->Log( KHuiMappingFunctions ); |
|
186 |
|
187 TRect rect( 1, 1, 1, 1 ); |
|
188 THuiRealRect realRect( rect ); |
|
189 realRect.BottomLeft(); |
|
190 |
|
191 return KErrNone; |
|
192 } |
|
193 |
|
194 // ----------------------------------------------------------------------------- |
|
195 // CTestUiAifCoreToolkit::TestTHRRSize |
|
196 // ----------------------------------------------------------------------------- |
|
197 // |
|
198 TInt CTestUiAifCoreToolkit::TestTHRRSize( CStifItemParser& /*aItem*/ ) |
|
199 { |
|
200 |
|
201 // Print to UI |
|
202 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
203 _LIT( KHuiMappingFunctions, "In TestTHRRSize" ); |
|
204 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
205 // Print to log file |
|
206 iLog->Log( KHuiMappingFunctions ); |
|
207 |
|
208 TRect rect( 1, 1, 1, 1 ); |
|
209 THuiRealRect realRect( rect ); |
|
210 realRect.Size(); |
|
211 |
|
212 return KErrNone; |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------------- |
|
216 // CTestUiAifCoreToolkit::TestTHRRCenter |
|
217 // ----------------------------------------------------------------------------- |
|
218 // |
|
219 TInt CTestUiAifCoreToolkit::TestTHRRCenter( CStifItemParser& /*aItem*/ ) |
|
220 { |
|
221 |
|
222 // Print to UI |
|
223 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
224 _LIT( KHuiMappingFunctions, "In TestTHRRCenter" ); |
|
225 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
226 // Print to log file |
|
227 iLog->Log( KHuiMappingFunctions ); |
|
228 |
|
229 TRect rect( 1, 1, 1, 1 ); |
|
230 THuiRealRect realRect( rect ); |
|
231 realRect.Center(); |
|
232 |
|
233 return KErrNone; |
|
234 } |
|
235 |
|
236 // ----------------------------------------------------------------------------- |
|
237 // CTestUiAifCoreToolkit::TestTHRRGrow |
|
238 // ----------------------------------------------------------------------------- |
|
239 // |
|
240 TInt CTestUiAifCoreToolkit::TestTHRRGrow( CStifItemParser& /*aItem*/ ) |
|
241 { |
|
242 |
|
243 // Print to UI |
|
244 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
245 _LIT( KHuiMappingFunctions, "In TestTHRRGrow" ); |
|
246 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
247 // Print to log file |
|
248 iLog->Log( KHuiMappingFunctions ); |
|
249 |
|
250 TRect rect( 1, 1, 1, 1 ); |
|
251 THuiRealRect realRect( rect ); |
|
252 TReal32 num1 = 0.1; |
|
253 TReal32 num2 = 0.1; |
|
254 realRect.Grow( num1, num2 ); |
|
255 |
|
256 return KErrNone; |
|
257 } |
|
258 |
|
259 // ----------------------------------------------------------------------------- |
|
260 // CTestUiAifCoreToolkit::TestTHRRShrink |
|
261 // ----------------------------------------------------------------------------- |
|
262 // |
|
263 TInt CTestUiAifCoreToolkit::TestTHRRShrink( CStifItemParser& /*aItem*/ ) |
|
264 { |
|
265 |
|
266 // Print to UI |
|
267 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
268 _LIT( KHuiMappingFunctions, "In TestTHRRShrink" ); |
|
269 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
270 // Print to log file |
|
271 iLog->Log( KHuiMappingFunctions ); |
|
272 |
|
273 TRect rect( 1, 1, 1, 1 ); |
|
274 THuiRealRect realRect( rect ); |
|
275 TReal32 num1 = 0.1; |
|
276 TReal32 num2 = 0.1; |
|
277 realRect.Shrink( num1, num2 ); |
|
278 |
|
279 return KErrNone; |
|
280 } |
|
281 |
|
282 // ----------------------------------------------------------------------------- |
|
283 // CTestUiAifCoreToolkit::TestTHRRShrinkTPoint |
|
284 // ----------------------------------------------------------------------------- |
|
285 // |
|
286 TInt CTestUiAifCoreToolkit::TestTHRRShrinkTPoint( CStifItemParser& /*aItem*/ ) |
|
287 { |
|
288 |
|
289 // Print to UI |
|
290 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
291 _LIT( KHuiMappingFunctions, "In TestTHRRShrinkTPoint" ); |
|
292 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
293 // Print to log file |
|
294 iLog->Log( KHuiMappingFunctions ); |
|
295 |
|
296 TRect rect( 1, 1, 1, 1 ); |
|
297 THuiRealRect realRect( rect ); |
|
298 TPoint point( 0, 1 ); |
|
299 realRect.Shrink( point ); |
|
300 |
|
301 return KErrNone; |
|
302 } |
|
303 |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CTestUiAifCoreToolkit::TestTHRRShrinkTHuiRealPoint |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 TInt CTestUiAifCoreToolkit::TestTHRRShrinkTHuiRealPoint( CStifItemParser& /*aItem*/ ) |
|
309 { |
|
310 |
|
311 // Print to UI |
|
312 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
313 _LIT( KHuiMappingFunctions, "In TestTHRRShrinkTHuiRealPoint" ); |
|
314 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
315 // Print to log file |
|
316 iLog->Log( KHuiMappingFunctions ); |
|
317 |
|
318 TRect rect( 1, 1, 1, 1 ); |
|
319 THuiRealRect realRect( rect ); |
|
320 THuiRealPoint point( 1, 0 ); |
|
321 realRect.Shrink( point ); |
|
322 |
|
323 return KErrNone; |
|
324 } |
|
325 |
|
326 // ----------------------------------------------------------------------------- |
|
327 // CTestUiAifCoreToolkit::TestTHRRShrinkTHuiRealRect |
|
328 // ----------------------------------------------------------------------------- |
|
329 // |
|
330 TInt CTestUiAifCoreToolkit::TestTHRRShrinkTHuiRealRect( CStifItemParser& /*aItem*/ ) |
|
331 { |
|
332 |
|
333 // Print to UI |
|
334 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
335 _LIT( KHuiMappingFunctions, "In TestTHRRShrinkTHuiRealRect" ); |
|
336 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
337 // Print to log file |
|
338 iLog->Log( KHuiMappingFunctions ); |
|
339 |
|
340 TRect rect1( 1, 1, 1, 1 ); |
|
341 TRect rect2( 0, 0, 1, 1 ); |
|
342 THuiRealRect realRect1( rect1 ); |
|
343 THuiRealRect realRect2( rect2 ); |
|
344 realRect1.Shrink( realRect2 ); |
|
345 |
|
346 return KErrNone; |
|
347 } |
|
348 |
|
349 // ----------------------------------------------------------------------------- |
|
350 // CTestUiAifCoreToolkit::TestTHRRMove |
|
351 // ----------------------------------------------------------------------------- |
|
352 // |
|
353 TInt CTestUiAifCoreToolkit::TestTHRRMove( CStifItemParser& /*aItem*/ ) |
|
354 { |
|
355 |
|
356 // Print to UI |
|
357 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
358 _LIT( KHuiMappingFunctions, "In TestTHRRMove" ); |
|
359 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
360 // Print to log file |
|
361 iLog->Log( KHuiMappingFunctions ); |
|
362 |
|
363 TRect rect( 1, 1, 1, 1 ); |
|
364 THuiRealRect realRect( rect ); |
|
365 realRect.Move( 1, 1 ); |
|
366 |
|
367 return KErrNone; |
|
368 } |
|
369 |
|
370 // ----------------------------------------------------------------------------- |
|
371 // CTestUiAifCoreToolkit::TestTHRRoperatorTRect |
|
372 // ----------------------------------------------------------------------------- |
|
373 // |
|
374 TInt CTestUiAifCoreToolkit::TestTHRRoperatorTRect( CStifItemParser& /*aItem*/ ) |
|
375 { |
|
376 |
|
377 // Print to UI |
|
378 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
379 _LIT( KHuiMappingFunctions, "In TestTHRRoperatorTRect" ); |
|
380 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
381 // Print to log file |
|
382 iLog->Log( KHuiMappingFunctions ); |
|
383 |
|
384 TRect rect( 1, 1, 1, 1 ); |
|
385 THuiRealRect realRect = rect; |
|
386 |
|
387 return KErrNone; |
|
388 } |
|
389 |
|
390 // ----------------------------------------------------------------------------- |
|
391 // CTestUiAifCoreToolkit::TestTHRRRound |
|
392 // ----------------------------------------------------------------------------- |
|
393 // |
|
394 TInt CTestUiAifCoreToolkit::TestTHRRRound( CStifItemParser& /*aItem*/ ) |
|
395 { |
|
396 |
|
397 // Print to UI |
|
398 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
399 _LIT( KHuiMappingFunctions, "In TestTHRRRound" ); |
|
400 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
401 // Print to log file |
|
402 iLog->Log( KHuiMappingFunctions ); |
|
403 |
|
404 TRect rect( 1, 1, 1, 1 ); |
|
405 THuiRealRect realRect( rect ); |
|
406 realRect.Round(); |
|
407 |
|
408 return KErrNone; |
|
409 } |
|
410 |
|
411 // ----------------------------------------------------------------------------- |
|
412 // CTestUiAifCoreToolkit::TestTHRRBoundingRect |
|
413 // ----------------------------------------------------------------------------- |
|
414 // |
|
415 TInt CTestUiAifCoreToolkit::TestTHRRBoundingRect( CStifItemParser& /*aItem*/ ) |
|
416 { |
|
417 |
|
418 // Print to UI |
|
419 _LIT( KTestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
420 _LIT( KHuiMappingFunctions, "In TestTHRRBoundingRect" ); |
|
421 TestModuleIf().Printf( 0, KTestuiaifcoretoolkit, KHuiMappingFunctions ); |
|
422 // Print to log file |
|
423 iLog->Log( KHuiMappingFunctions ); |
|
424 |
|
425 TRect rect1( 1, 1, 1, 1 ); |
|
426 TRect rect2( 0, 0, 1, 1 ); |
|
427 THuiRealRect realRect1( rect1 ); |
|
428 THuiRealRect realRect2( rect2 ); |
|
429 realRect1.BoundingRect( realRect2 ); |
|
430 |
|
431 return KErrNone; |
|
432 } |