|
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 functions for alfvisual.h |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // [INCLUDE FILES] |
|
21 #include <e32svr.h> |
|
22 #include <stifparser.h> |
|
23 #include <stiftestinterface.h> |
|
24 #include <alf/alfbatchbuffer.h> |
|
25 #include "testplatalfvisual.h" |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CTestPlatAlfVisual::TestAlfEnvNewFuncsL |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 TInt CTestPlatAlfVisual::TestAlfEnvNewFuncsL( CStifItemParser& /*aItem*/ ) |
|
35 { |
|
36 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
37 _LIT( KTestAlfEnvNewFuncsL, "TestAlfEnvNewFuncsL" ); |
|
38 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvNewFuncsL ); |
|
39 // Print to log file |
|
40 iLog->Log( KTestAlfEnvNewFuncsL ); |
|
41 |
|
42 STIF_ASSERT_NOT_NULL( iAlfEnv ); |
|
43 |
|
44 return KErrNone; |
|
45 } |
|
46 |
|
47 // ----------------------------------------------------------------------------- |
|
48 // CTestPlatAlfVisual::TestAlfEnvClient |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 TInt CTestPlatAlfVisual::TestAlfEnvClient( CStifItemParser& /*aItem*/ ) |
|
52 { |
|
53 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
54 _LIT( KTestAlfEnvClient, "TestAlfEnvClient" ); |
|
55 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvClient ); |
|
56 // Print to log file |
|
57 iLog->Log( KTestAlfEnvClient ); |
|
58 |
|
59 iAlfEnv->Client(); |
|
60 iAlfEnv->TokenClient(); |
|
61 |
|
62 return KErrNone; |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CTestPlatAlfVisual::TestAlfEnvNewDisplayL |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 TInt CTestPlatAlfVisual::TestAlfEnvNewDisplayL( CStifItemParser& /*aItem*/ ) |
|
70 { |
|
71 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
72 _LIT( KTestAlfEnvNewDisplayL, "TestAlfEnvNewDisplayL" ); |
|
73 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvNewDisplayL ); |
|
74 // Print to log file |
|
75 iLog->Log( KTestAlfEnvNewDisplayL ); |
|
76 |
|
77 TRect vRect( 0, 0, 1, 1 ); |
|
78 TUid vUid = { 0x00000001 }; |
|
79 STIF_ASSERT_EQUALS( 1, iAlfEnv->DisplayCount() ); |
|
80 STIF_ASSERT_SAME( iAlfDisplay, &iAlfEnv->PrimaryDisplay() ); |
|
81 TRAPD( err, iAlfEnv->NewDisplayL( vRect, CAlfEnv::ENewDisplayAsCoeControl, NULL, |
|
82 CAlfDisplay::EDisplayNormal, vUid ) ); |
|
83 if ( err != KErrNone ) |
|
84 { |
|
85 return KErrNone; |
|
86 } |
|
87 else |
|
88 { |
|
89 return KErrNone; |
|
90 } |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CTestPlatAlfVisual::TestAlfEnvCtrlGroupL |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 TInt CTestPlatAlfVisual::TestAlfEnvCtrlGroupL( CStifItemParser& /*aItem*/ ) |
|
98 { |
|
99 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
100 _LIT( KTestAlfEnvCtrlGroupL, "TestAlfEnvCtrlGroupL" ); |
|
101 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvCtrlGroupL ); |
|
102 // Print to log file |
|
103 iLog->Log( KTestAlfEnvCtrlGroupL ); |
|
104 const TInt groupName = 23; |
|
105 CAlfControlGroup& ctrlgroup = iAlfEnv->NewControlGroupL( groupName ); |
|
106 iAlfEnv->ControlGroup( ctrlgroup.ResourceId() ); |
|
107 CAlfControlGroup* group = iAlfEnv->FindControlGroup( groupName ); |
|
108 STIF_ASSERT_NOT_EQUALS( 0, (TInt)group ); |
|
109 iAlfEnv->DeleteControlGroup( groupName ); |
|
110 |
|
111 return KErrNone; |
|
112 } |
|
113 |
|
114 // ----------------------------------------------------------------------------- |
|
115 // CTestPlatAlfVisual::TestAlfEnvProcessFresh |
|
116 // ----------------------------------------------------------------------------- |
|
117 // |
|
118 TInt CTestPlatAlfVisual::TestAlfEnvProcessFresh( CStifItemParser& /*aItem*/ ) |
|
119 { |
|
120 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
121 _LIT( KTestAlfEnvProcessFresh, "TestAlfEnvProcessFresh" ); |
|
122 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvProcessFresh ); |
|
123 // Print to log file |
|
124 iLog->Log( KTestAlfEnvProcessFresh ); |
|
125 |
|
126 TAlfRefreshMode mode = EAlfRefreshModeManual; |
|
127 iAlfEnv->SetRefreshMode(mode); |
|
128 mode = EAlfRefreshModeAutomatic; |
|
129 iAlfEnv->SetRefreshMode(mode); |
|
130 mode = EAlfRefreshModeForced; |
|
131 iAlfEnv->SetRefreshMode(mode); |
|
132 |
|
133 iAlfEnv->RefreshMode(); |
|
134 |
|
135 TReal32 framerate = 0.0; |
|
136 iAlfEnv->SetMaxFrameRate(framerate); |
|
137 framerate = 1000.0; |
|
138 iAlfEnv->SetMaxFrameRate(framerate); |
|
139 framerate = 0.0; |
|
140 iAlfEnv->SetMaxFrameRate(framerate); |
|
141 iAlfEnv->ContinueRefresh(); |
|
142 iAlfEnv->PauseRefresh(); |
|
143 CAlfEnv::RefreshCallBack( iAlfEnv ); |
|
144 |
|
145 return KErrNone; |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // CTestPlatAlfVisual::TestAlfEnvProcessTextureManagerL |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 TInt CTestPlatAlfVisual::TestAlfEnvProcessTextureManagerL( CStifItemParser& /*aItem*/ ) |
|
153 { |
|
154 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
155 _LIT( KTestAlfEnvProcessTextureManagerL, "TestAlfEnvProcessTextureManagerL" ); |
|
156 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvProcessTextureManagerL ); |
|
157 // Print to log file |
|
158 iLog->Log( KTestAlfEnvProcessTextureManagerL ); |
|
159 |
|
160 TUid vUid = { 0x00000002 }; |
|
161 iAlfEnv->CreateSharedTextureManagerL( vUid ); |
|
162 CAlfTextureManager* found1 = iAlfEnv->SharedTextureManager( vUid ); |
|
163 STIF_ASSERT_NOT_EQUALS( 0 , (TInt)found1); |
|
164 iAlfEnv->TextureManager(); |
|
165 iAlfEnv->TextStyleManager(); |
|
166 iAlfEnv->DeleteSharedTextureManager( vUid ); |
|
167 |
|
168 return KErrNone; |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CTestPlatAlfVisual::TestAlfEnvObserverL |
|
173 // ----------------------------------------------------------------------------- |
|
174 // |
|
175 TInt CTestPlatAlfVisual::TestAlfEnvObserverL( CStifItemParser& /*aItem*/ ) |
|
176 { |
|
177 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
178 _LIT( KTestAlfEnvObserverL, "TestAlfEnvObserverL" ); |
|
179 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvObserverL ); |
|
180 // Print to log file |
|
181 iLog->Log( KTestAlfEnvObserverL ); |
|
182 |
|
183 iAlfEnv->AddActionObserverL( NULL ); |
|
184 iAlfEnv->RemoveActionObserver( NULL ); |
|
185 |
|
186 return KErrNone; |
|
187 } |
|
188 |
|
189 |
|
190 // ----------------------------------------------------------------------------- |
|
191 // CTestPlatAlfVisual::TestAlfEnvProcessCmd |
|
192 // ----------------------------------------------------------------------------- |
|
193 // |
|
194 TInt CTestPlatAlfVisual::TestAlfEnvProcessCmd( CStifItemParser& /*aItem*/ ) |
|
195 { |
|
196 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
197 _LIT( KTestAlfEnvProcessCmd, "TestAlfEnvProcessCmd" ); |
|
198 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvProcessCmd ); |
|
199 // Print to log file |
|
200 iLog->Log( KTestAlfEnvProcessCmd ); |
|
201 const TInt cmdnum = 23; |
|
202 const TInt num = 1000000; |
|
203 TAlfCustomEventCommand command( cmdnum ); |
|
204 iAlfEnv->Send(command); |
|
205 iAlfEnv->Send( command, num ); |
|
206 iAlfEnv->CancelCommands( &command ); |
|
207 iAlfEnv->CancelCommands( NULL ); |
|
208 iAlfEnv->Send( command, num ); |
|
209 iAlfEnv->CancelCommands( &command, EAlfOpNone ); |
|
210 iAlfEnv->Send( command, num ); |
|
211 iAlfEnv->CancelCommands( &command, EAlfCommandTypeNone ); |
|
212 iAlfEnv->Send( command, num ); |
|
213 iAlfEnv->CancelCustomCommands( NULL ); |
|
214 iAlfEnv->Send( command, num ); |
|
215 iAlfEnv->CancelCustomCommands( NULL, cmdnum ); |
|
216 iAlfEnv->Send( command, num ); |
|
217 iAlfEnv->MilliSecondsUntilCommand( &command ); |
|
218 iAlfEnv->MilliSecondsUntilCommand( &command, EAlfOpNone ); |
|
219 iAlfEnv->MilliSecondsUntilCommand( &command, EAlfCommandTypeNone ); |
|
220 iAlfEnv->MilliSecondsUntilCustomCommand( NULL ); |
|
221 iAlfEnv->MilliSecondsUntilCustomCommand( NULL, 0 ); |
|
222 |
|
223 return KErrNone; |
|
224 |
|
225 } |
|
226 |
|
227 // ----------------------------------------------------------------------------- |
|
228 // CTestPlatAlfVisual::TestAlfEnvKeyAndPointerEventL |
|
229 // ----------------------------------------------------------------------------- |
|
230 // |
|
231 TInt CTestPlatAlfVisual::TestAlfEnvKeyAndPointerEventL( CStifItemParser& /*aItem*/ ) |
|
232 { |
|
233 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
234 _LIT( KTestAlfEnvKeyAndPointerEventL, "TestAlfEnvKeyAndPointerEventL" ); |
|
235 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvKeyAndPointerEventL ); |
|
236 // Print to log file |
|
237 iLog->Log( KTestAlfEnvKeyAndPointerEventL ); |
|
238 |
|
239 TKeyEvent vEvent; |
|
240 TPointerEvent vPointEvent; |
|
241 iAlfEnv->HandleKeyEventL( vEvent, EEventKeyDown ); |
|
242 iAlfEnv->HandlePointerEventL( vPointEvent, *iAlfDisplay ); |
|
243 |
|
244 return KErrNone; |
|
245 } |
|
246 |
|
247 // ----------------------------------------------------------------------------- |
|
248 // CTestPlatAlfVisual::TestAlfEnvNotifyL |
|
249 // ----------------------------------------------------------------------------- |
|
250 // |
|
251 TInt CTestPlatAlfVisual::TestAlfEnvNotifyL( CStifItemParser& /*aItem*/ ) |
|
252 { |
|
253 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
254 _LIT( KTestAlfEnvNotifyL, "TestAlfEnvNotifyL" ); |
|
255 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvNotifyL ); |
|
256 // Print to log file |
|
257 iLog->Log( KTestAlfEnvNotifyL ); |
|
258 |
|
259 iAlfEnv->NotifySkinChangedL(); |
|
260 iAlfEnv->NotifyLayoutChangedL(); |
|
261 |
|
262 return KErrNone; |
|
263 } |
|
264 |
|
265 // ----------------------------------------------------------------------------- |
|
266 // CTestPlatAlfVisual::TestAlfEnvProcessWidgetL |
|
267 // ----------------------------------------------------------------------------- |
|
268 // |
|
269 TInt CTestPlatAlfVisual::TestAlfEnvProcessWidgetL( CStifItemParser& /*aItem*/ ) |
|
270 { |
|
271 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
272 _LIT( KTestAlfEnvProcessWidgetL, "TestAlfEnvProcessWidgetL" ); |
|
273 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvProcessWidgetL ); |
|
274 // Print to log file |
|
275 iLog->Log( KTestAlfEnvProcessWidgetL ); |
|
276 iAlfEnv->WidgetFactory(); |
|
277 iAlfEnv->AppendWidgetL( NULL ); |
|
278 char* p = "test"; |
|
279 iAlfEnv->FindWidget( p ); |
|
280 |
|
281 return KErrNone; |
|
282 } |
|
283 |
|
284 // ----------------------------------------------------------------------------- |
|
285 // CTestPlatAlfVisual::TestAlfEnvGetAttributes |
|
286 // ----------------------------------------------------------------------------- |
|
287 // |
|
288 TInt CTestPlatAlfVisual::TestAlfEnvGetAttributes( CStifItemParser& /*aItem*/ ) |
|
289 { |
|
290 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
291 _LIT( KTestAlfEnvGetAttributes, "TestAlfEnvGetAttributes" ); |
|
292 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvGetAttributes ); |
|
293 // Print to log file |
|
294 iLog->Log( KTestAlfEnvGetAttributes ); |
|
295 |
|
296 iAlfEnv->LayoutMetricsUtility(); |
|
297 iAlfEnv->Renderer(); |
|
298 iAlfEnv->LastReceivedPtrEvent(); |
|
299 CAlfBatchBuffer& batch = iAlfEnv->BatchBufferHandler(); |
|
300 const TAlfAutoFlushMode defaultFlushMode = batch.AutoFlushMode(); |
|
301 STIF_ASSERT_EQUALS( defaultFlushMode, EAlfAutoFlushDeferred ); |
|
302 iAlfEnv->Version(); |
|
303 iAlfEnv->Extension( 0 ); |
|
304 iAlfEnv->Display( 0 ); |
|
305 |
|
306 return KErrNone; |
|
307 } |
|
308 |
|
309 // ----------------------------------------------------------------------------- |
|
310 // CTestPlatAlfVisual::TestAlfEnvFindControl |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 TInt CTestPlatAlfVisual::TestAlfEnvFindControl( CStifItemParser& /*aItem*/ ) |
|
314 { |
|
315 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
316 _LIT( KTestAlfEnvFindControl, "TestAlfEnvFindControl" ); |
|
317 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvFindControl ); |
|
318 // Print to log file |
|
319 iLog->Log( KTestAlfEnvFindControl ); |
|
320 |
|
321 iAlfCtl->SetId( 1 ); |
|
322 CAlfControl* vTemp = iAlfEnv->FindControl( 1 ); |
|
323 STIF_ASSERT_SAME( iAlfCtl, vTemp ); |
|
324 |
|
325 return KErrNone; |
|
326 } |
|
327 |
|
328 // ----------------------------------------------------------------------------- |
|
329 // CTestPlatAlfVisual::TestAlfEnvFindDisplayIndex |
|
330 // ----------------------------------------------------------------------------- |
|
331 // |
|
332 TInt CTestPlatAlfVisual::TestAlfEnvFindDisplayIndex( CStifItemParser& /*aItem*/ ) |
|
333 { |
|
334 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
335 _LIT( KTestAlfEnvFindDisplayIndex, "TestAlfEnvFindDisplayIndex" ); |
|
336 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvFindDisplayIndex ); |
|
337 // Print to log file |
|
338 iLog->Log( KTestAlfEnvFindDisplayIndex ); |
|
339 |
|
340 TInt vIndex = iAlfEnv->FindDisplayIndex( *iAlfDisplay ); |
|
341 STIF_ASSERT_EQUALS( 0, vIndex ); |
|
342 |
|
343 return KErrNone; |
|
344 } |
|
345 |
|
346 // ----------------------------------------------------------------------------- |
|
347 // CTestPlatAlfVisual::TestAlfEnvAddExtension |
|
348 // ----------------------------------------------------------------------------- |
|
349 // |
|
350 TInt CTestPlatAlfVisual::TestAlfEnvAddExtension( CStifItemParser& /*aItem*/ ) |
|
351 { |
|
352 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
353 _LIT( KTestAlfEnvAddExtension, "TestAlfEnvAddExtension" ); |
|
354 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvAddExtension ); |
|
355 // Print to log file |
|
356 iLog->Log( KTestAlfEnvAddExtension ); |
|
357 |
|
358 iAlfEnv->AddExtension( 0, NULL ); |
|
359 |
|
360 return KErrNone; |
|
361 } |
|
362 |
|
363 // ----------------------------------------------------------------------------- |
|
364 // CTestPlatAlfVisual::TestAlfEnvSetAndReSetL |
|
365 // ----------------------------------------------------------------------------- |
|
366 // |
|
367 TInt CTestPlatAlfVisual::TestAlfEnvSetAndReSetL( CStifItemParser& /*aItem*/ ) |
|
368 { |
|
369 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
370 _LIT( KTestAlfEnvSetAndReSetL, "TestAlfEnvSetAndReSetL" ); |
|
371 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvSetAndReSetL ); |
|
372 // Print to log file |
|
373 iLog->Log( KTestAlfEnvSetAndReSetL ); |
|
374 |
|
375 const TInt num = 1000000; |
|
376 iAlfEnv->SetIdleThreshold( num ); |
|
377 iAlfEnv->Release(); |
|
378 iAlfEnv->RestoreL(); |
|
379 iAlfEnv->SetFullScreenDrawing( ETrue ); |
|
380 |
|
381 return KErrNone; |
|
382 } |
|
383 |
|
384 // ----------------------------------------------------------------------------- |
|
385 // CTestPlatAlfVisual::TestAlfEnvStatic |
|
386 // ----------------------------------------------------------------------------- |
|
387 // |
|
388 TInt CTestPlatAlfVisual::TestAlfEnvStatic( CStifItemParser& /*aItem*/ ) |
|
389 { |
|
390 _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" ); |
|
391 _LIT( KTestAlfEnvStatic, "TestAlfEnvStatic" ); |
|
392 TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfEnvStatic ); |
|
393 // Print to log file |
|
394 iLog->Log( KTestAlfEnvStatic ); |
|
395 |
|
396 CAlfEnv* vTemp = CAlfEnv::Static(); |
|
397 STIF_ASSERT_SAME( iAlfEnv, vTemp ); |
|
398 vTemp = NULL; |
|
399 |
|
400 return KErrNone; |
|
401 } |
|
402 |
|
403 // End of file |
|
404 |