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/huianchorlayout.h> |
|
25 #include <uiacceltk/huienv.h> |
|
26 #include <uiacceltk/huicontrol.h> |
|
27 |
|
28 #include "testuiaifcoretoolkit.h" |
|
29 // ----------------------------------------------------------------------------- |
|
30 // CTestUiAifCoreToolkit::TestCHuiAnLayAddNewL |
|
31 // ----------------------------------------------------------------------------- |
|
32 // |
|
33 TInt CTestUiAifCoreToolkit::TestCHuiAnLayAddNewL( CStifItemParser& /*aItem*/ ) |
|
34 { |
|
35 |
|
36 // Print to UI |
|
37 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
38 _LIT( KTestCHuiAnLayAddNewL, "In TestCHuiAnLayAddNewL" ); |
|
39 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayAddNewL ); |
|
40 // Print to log file |
|
41 iLog->Log( KTestCHuiAnLayAddNewL ); |
|
42 |
|
43 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
44 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
45 |
|
46 return KErrNone; |
|
47 } |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CTestUiAifCoreToolkit::TestCHuiAnLayDestructL |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 TInt CTestUiAifCoreToolkit::TestCHuiAnLayDestructL( CStifItemParser& /*aItem*/ ) |
|
53 { |
|
54 |
|
55 // Print to UI |
|
56 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
57 _LIT( KTestCHuiAnLayDestructL, "In TestCHuiAnLayDestructL" ); |
|
58 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayDestructL ); |
|
59 // Print to log file |
|
60 iLog->Log( KTestCHuiAnLayDestructL ); |
|
61 |
|
62 |
|
63 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
64 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
65 |
|
66 return KErrNone; |
|
67 } |
|
68 // ----------------------------------------------------------------------------- |
|
69 // CTestUiAifCoreToolkit::TestCHuiAnLayResetL |
|
70 // ----------------------------------------------------------------------------- |
|
71 // |
|
72 TInt CTestUiAifCoreToolkit::TestCHuiAnLayResetL( CStifItemParser& /*aItem*/ ) |
|
73 { |
|
74 |
|
75 // Print to UI |
|
76 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
77 _LIT( KTestCHuiAnLayResetL, "In TestCHuiAnLayResetL" ); |
|
78 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayResetL ); |
|
79 // Print to log file |
|
80 iLog->Log( KTestCHuiAnLayResetL ); |
|
81 |
|
82 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
83 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
84 iAnchorLayout->Reset(); |
|
85 |
|
86 return KErrNone; |
|
87 } |
|
88 // ----------------------------------------------------------------------------- |
|
89 // CTestUiAifCoreToolkit::TestCHuiAnLaySetAnchorL |
|
90 // ----------------------------------------------------------------------------- |
|
91 // |
|
92 TInt CTestUiAifCoreToolkit::TestCHuiAnLaySetAnchorL( CStifItemParser& /*aItem*/ ) |
|
93 { |
|
94 |
|
95 // Print to UI |
|
96 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
97 _LIT( KTestCHuiAnLaySetAnchorL, "In TestCHuiAnLaySetAnchorL" ); |
|
98 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLaySetAnchorL ); |
|
99 // Print to log file |
|
100 iLog->Log( KTestCHuiAnLaySetAnchorL ); |
|
101 |
|
102 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
103 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
104 const TInt KChildOne = 0; |
|
105 const THuiTimedPoint KBottomRightDefinitionTwo(0.8f, 0.7f); |
|
106 iAnchorLayout->SetAnchor(EHuiAnchorBottomRight, KChildOne, |
|
107 EHuiAnchorOriginLeft, EHuiAnchorOriginTop, |
|
108 EHuiAnchorMetricRelativeToSize, |
|
109 EHuiAnchorMetricRelativeToSize, |
|
110 KBottomRightDefinitionTwo); |
|
111 |
|
112 return KErrNone; |
|
113 } |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CTestUiAifCoreToolkit::TestCHuiAnLaySetRelativeAnchorRectL |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 TInt CTestUiAifCoreToolkit::TestCHuiAnLaySetRelativeAnchorRectL( CStifItemParser& /*aItem*/ ) |
|
119 { |
|
120 |
|
121 // Print to UI |
|
122 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
123 _LIT( KTestCHuiAnLaySetRelativeAnchorRectL, "In TestCHuiAnLaySetRelativeAnchorRectL" ); |
|
124 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLaySetRelativeAnchorRectL ); |
|
125 // Print to log file |
|
126 iLog->Log( KTestCHuiAnLaySetRelativeAnchorRectL ); |
|
127 |
|
128 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
129 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
130 const THuiRealPoint KTopLeftDefinitionOne(0.2f, 0.3f); |
|
131 const THuiRealPoint KBottomRightDefinitionOne(-0.3f, -0.2f); |
|
132 const TInt KChildOne = 0; |
|
133 iAnchorLayout->SetRelativeAnchorRect(KChildOne, EHuiAnchorOriginLeft, EHuiAnchorOriginTop, KTopLeftDefinitionOne, |
|
134 EHuiAnchorOriginRight, EHuiAnchorOriginBottom, KBottomRightDefinitionOne ); |
|
135 |
|
136 return KErrNone; |
|
137 } |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CTestUiAifCoreToolkit::TestCHuiAnLayRemoveAnchorL |
|
140 // ----------------------------------------------------------------------------- |
|
141 // |
|
142 TInt CTestUiAifCoreToolkit::TestCHuiAnLayRemoveAnchorL( CStifItemParser& /*aItem*/ ) |
|
143 { |
|
144 |
|
145 // Print to UI |
|
146 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
147 _LIT( KTestCHuiAnLayRemoveAnchorL, "In TestCHuiAnLayRemoveAnchorL" ); |
|
148 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayRemoveAnchorL ); |
|
149 // Print to log file |
|
150 iLog->Log( KTestCHuiAnLayRemoveAnchorL ); |
|
151 |
|
152 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
153 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
154 iAnchorLayout->RemoveAnchor( EHuiAnchorTopLeft, 0 ); |
|
155 iAnchorLayout->RemoveAnchor( EHuiAnchorBottomRight, 0 ); |
|
156 |
|
157 return KErrNone; |
|
158 } |
|
159 // ----------------------------------------------------------------------------- |
|
160 // CTestUiAifCoreToolkit::TestCHuiAnLayAttachOriginL |
|
161 // ----------------------------------------------------------------------------- |
|
162 // |
|
163 TInt CTestUiAifCoreToolkit::TestCHuiAnLayAttachOriginL( CStifItemParser& /*aItem*/ ) |
|
164 { |
|
165 |
|
166 // Print to UI |
|
167 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
168 _LIT( KTestCHuiAnLayAttachOriginL, "In TestCHuiAnLayAttachOriginL" ); |
|
169 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayAttachOriginL ); |
|
170 // Print to log file |
|
171 iLog->Log( KTestCHuiAnLayAttachOriginL ); |
|
172 |
|
173 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
174 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
175 THuiMetric offset; |
|
176 iAnchorLayout->Attach( 0, EHuiAnchorTypeWidth, offset, EHuiAnchorAttachmentOriginLeft ); |
|
177 |
|
178 return KErrNone; |
|
179 } |
|
180 // ----------------------------------------------------------------------------- |
|
181 // CTestUiAifCoreToolkit::TestCHuiAnLayAttachOriginTopLeftL |
|
182 // ----------------------------------------------------------------------------- |
|
183 // |
|
184 TInt CTestUiAifCoreToolkit::TestCHuiAnLayAttachOriginTopLeftL( CStifItemParser& /*aItem*/ ) |
|
185 { |
|
186 |
|
187 // Print to UI |
|
188 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
189 _LIT( KTestCHuiAnLayAttachOriginTopLeftL, "In TestCHuiAnLayAttachOriginTopLeftL" ); |
|
190 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayAttachOriginTopLeftL ); |
|
191 // Print to log file |
|
192 iLog->Log( KTestCHuiAnLayAttachOriginTopLeftL ); |
|
193 |
|
194 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
195 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
196 THuiXYMetric offset; |
|
197 iAnchorLayout->Attach( 0, EHuiAnchorTypeWidth, offset ); |
|
198 |
|
199 return KErrNone; |
|
200 } |
|
201 // ----------------------------------------------------------------------------- |
|
202 // CTestUiAifCoreToolkit::TestCHuiAnLayAttachOriginNoneL |
|
203 // ----------------------------------------------------------------------------- |
|
204 // |
|
205 TInt CTestUiAifCoreToolkit::TestCHuiAnLayAttachOriginNoneL( CStifItemParser& /*aItem*/ ) |
|
206 { |
|
207 |
|
208 // Print to UI |
|
209 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
210 _LIT( KTestCHuiAnLayAttachOriginNoneL, "In TestCHuiAnLayAttachOriginNoneL" ); |
|
211 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayAttachOriginNoneL ); |
|
212 // Print to log file |
|
213 iLog->Log( KTestCHuiAnLayAttachOriginNoneL ); |
|
214 |
|
215 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
216 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
217 THuiBoxMetric offset; |
|
218 iAnchorLayout->Attach( 0, offset ); |
|
219 |
|
220 return KErrNone; |
|
221 } |
|
222 // ----------------------------------------------------------------------------- |
|
223 // CTestUiAifCoreToolkit::TestCHuiAnLayDetachL |
|
224 // ----------------------------------------------------------------------------- |
|
225 // |
|
226 TInt CTestUiAifCoreToolkit::TestCHuiAnLayDetachL( CStifItemParser& /*aItem*/ ) |
|
227 { |
|
228 |
|
229 // Print to UI |
|
230 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
231 _LIT( KTestCHuiAnLayDetachL, "In TestCHuiAnLayDetachL" ); |
|
232 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayDetachL ); |
|
233 // Print to log file |
|
234 iLog->Log( KTestCHuiAnLayDetachL ); |
|
235 |
|
236 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
237 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
238 iAnchorLayout->Detach( 0 ); |
|
239 |
|
240 return KErrNone; |
|
241 } |
|
242 // ----------------------------------------------------------------------------- |
|
243 // CTestUiAifCoreToolkit::TestCHuiAnLayDetachAnchorL |
|
244 // ----------------------------------------------------------------------------- |
|
245 // |
|
246 TInt CTestUiAifCoreToolkit::TestCHuiAnLayDetachAnchorL( CStifItemParser& /*aItem*/ ) |
|
247 { |
|
248 |
|
249 // Print to UI |
|
250 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
251 _LIT( KTestCHuiAnLayDetachAnchorL, "In TestCHuiAnLayDetachAnchorL" ); |
|
252 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayDetachAnchorL ); |
|
253 // Print to log file |
|
254 iLog->Log( KTestCHuiAnLayDetachAnchorL ); |
|
255 |
|
256 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
257 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
258 iAnchorLayout->Detach( 0, EHuiAnchorTypeLeft ); |
|
259 |
|
260 return KErrNone; |
|
261 } |
|
262 // ----------------------------------------------------------------------------- |
|
263 // CTestUiAifCoreToolkit::TestCHuiAnLaySetSizeL |
|
264 // ----------------------------------------------------------------------------- |
|
265 // |
|
266 TInt CTestUiAifCoreToolkit::TestCHuiAnLaySetSizeL( CStifItemParser& /*aItem*/ ) |
|
267 { |
|
268 |
|
269 // Print to UI |
|
270 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
271 _LIT( KTestCHuiAnLaySetSizeL, "In TestCHuiAnLaySetSizeL" ); |
|
272 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLaySetSizeL ); |
|
273 // Print to log file |
|
274 iLog->Log( KTestCHuiAnLaySetSizeL ); |
|
275 |
|
276 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
277 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
278 THuiRealSize size; |
|
279 iAnchorLayout->SetSize( size, 1 ); |
|
280 |
|
281 return KErrNone; |
|
282 } |
|
283 // ----------------------------------------------------------------------------- |
|
284 // CTestUiAifCoreToolkit::TestCHuiAnLayChildSizeL |
|
285 // ----------------------------------------------------------------------------- |
|
286 // |
|
287 TInt CTestUiAifCoreToolkit::TestCHuiAnLayChildSizeL( CStifItemParser& /*aItem*/ ) |
|
288 { |
|
289 |
|
290 // Print to UI |
|
291 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
292 _LIT( KTestCHuiAnLayChildSizeL, "In TestCHuiAnLayChildSizeL" ); |
|
293 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayChildSizeL ); |
|
294 // Print to log file |
|
295 iLog->Log( KTestCHuiAnLayChildSizeL ); |
|
296 |
|
297 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
298 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
299 TSize size; |
|
300 iAnchorLayout->ChildSize( 0, size ); |
|
301 |
|
302 return KErrNone; |
|
303 } |
|
304 // ----------------------------------------------------------------------------- |
|
305 // CTestUiAifCoreToolkit::TestCHuiAnLayChildPosL |
|
306 // ----------------------------------------------------------------------------- |
|
307 // |
|
308 TInt CTestUiAifCoreToolkit::TestCHuiAnLayChildPosL( CStifItemParser& /*aItem*/ ) |
|
309 { |
|
310 |
|
311 // Print to UI |
|
312 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
313 _LIT( KTestCHuiAnLayChildPosL, "In TestCHuiAnLayChildPosL" ); |
|
314 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayChildPosL ); |
|
315 // Print to log file |
|
316 iLog->Log( KTestCHuiAnLayChildPosL ); |
|
317 |
|
318 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
319 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
320 TPoint aPos; |
|
321 iAnchorLayout->ChildPos( 0, aPos ); |
|
322 |
|
323 return KErrNone; |
|
324 } |
|
325 // ----------------------------------------------------------------------------- |
|
326 // CTestUiAifCoreToolkit::TestCHuiAnLayChildRectL |
|
327 // ----------------------------------------------------------------------------- |
|
328 // |
|
329 TInt CTestUiAifCoreToolkit::TestCHuiAnLayChildRectL( CStifItemParser& /*aItem*/ ) |
|
330 { |
|
331 |
|
332 // Print to UI |
|
333 _LIT( Ktestuiaifcoretoolkit, "testuiaifcoretoolkit" ); |
|
334 _LIT( KTestCHuiAnLayChildRectL, "In TestCHuiAnLayChildRectL" ); |
|
335 TestModuleIf().Printf( 0, Ktestuiaifcoretoolkit, KTestCHuiAnLayChildRectL ); |
|
336 // Print to log file |
|
337 iLog->Log( KTestCHuiAnLayChildRectL ); |
|
338 |
|
339 CHuiAnchorLayout* iAnchorLayout = CHuiAnchorLayout::AddNewL( *iHuiControl ); |
|
340 STIF_ASSERT_NOT_NULL( iAnchorLayout ); |
|
341 THuiRealRect aRect; |
|
342 iAnchorLayout->ChildRect( 0, aRect ); |
|
343 |
|
344 return KErrNone; |
|
345 } |
|
346 |
|
347 // [End of File] |
|