|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <apgtask.h> |
|
17 #include <hal.h> |
|
18 #include <w32debug.h> |
|
19 #include <e32std.h> |
|
20 #include <graphics/fbsdefs.h> |
|
21 |
|
22 #include "TGraphicsHarness.h" |
|
23 #include "GraphicsTestUtilsServer.h" |
|
24 |
|
25 _LIT(KGraphicsTestFrameworkPanic, "Graphics Test Framework"); |
|
26 const TInt KTestCleanupStack = 0x40; |
|
27 |
|
28 const TDisplayMode testDisplayModes[] = |
|
29 { |
|
30 EGray2, |
|
31 EGray4, |
|
32 EGray16, |
|
33 EGray256, |
|
34 EColor16, |
|
35 EColor256, |
|
36 EColor64K, |
|
37 EColor16M, |
|
38 EColor4K, |
|
39 EColor16MU, |
|
40 EColor16MA, |
|
41 EColor16MAP, |
|
42 }; |
|
43 |
|
44 /** |
|
45 The test code manager, provides functions to set active object |
|
46 with lowest priority for running tests in auto mode. |
|
47 */ |
|
48 class CTestManager : public CActive |
|
49 { |
|
50 friend class CTGraphicsBase; |
|
51 protected: |
|
52 static CTestManager* NewL(MTestCases* aAutoTestApp); |
|
53 ~CTestManager(); |
|
54 void FinishAllTestCases(); |
|
55 void StartTest(); //initialize an active object and set it status as active |
|
56 void SetSelfDrive(TBool aSelfDrive); |
|
57 void CaseComplete(); |
|
58 private: |
|
59 CTestManager(MTestCases* aAutoTestApp); |
|
60 void NextTest(); |
|
61 // from CActive |
|
62 void RunL(); |
|
63 void DoCancel(); |
|
64 TInt RunError(TInt aError); |
|
65 private: |
|
66 MTestCases* iTestCase; |
|
67 TInt iCurTestCaseNumber; //a current test case, every time when function RunTestCaseL is called this member inc by one |
|
68 TBool iTestCompleted; |
|
69 TBool iSelfDrive; |
|
70 }; |
|
71 |
|
72 /** Construct an active object with the lowest priority */ |
|
73 CTestManager::CTestManager(MTestCases* aTestCases) : |
|
74 CActive(EPriorityIdle), iTestCase(aTestCases), iSelfDrive(EFalse) |
|
75 {} |
|
76 |
|
77 CTestManager::~CTestManager() |
|
78 { |
|
79 Cancel(); |
|
80 } |
|
81 |
|
82 CTestManager* CTestManager::NewL(MTestCases* aTestCases) |
|
83 { |
|
84 CTestManager *theTestManager=new (ELeave) CTestManager(aTestCases); |
|
85 CActiveScheduler::Add(theTestManager); |
|
86 return theTestManager; |
|
87 } |
|
88 |
|
89 void CTestManager::RunL() |
|
90 { |
|
91 __ASSERT_ALWAYS(iTestCase, User::Panic(KGraphicsTestFrameworkPanic, KErrBadHandle)); |
|
92 if( iTestCompleted) |
|
93 { |
|
94 return; |
|
95 } |
|
96 |
|
97 // debug statement to indicate progress of test suite by |
|
98 // printing the sub-test that is currently active |
|
99 TTime timeStamp; |
|
100 timeStamp.HomeTime(); |
|
101 TBuf<50> dateStr; |
|
102 _LIT(KDateString3,"%-B%:0%J%:1%T%:2%S%:3.%Cms"); |
|
103 timeStamp.FormatL(dateStr, KDateString3); |
|
104 ++iCurTestCaseNumber; |
|
105 RDebug::Print(_L("%S - Test Case Number: %d"), &dateStr, iCurTestCaseNumber); |
|
106 |
|
107 iTestCase->RunTestCaseL(iCurTestCaseNumber); |
|
108 if (iTestCompleted) |
|
109 { |
|
110 _LIT(KFinished,"Finished test case %d and test completed"); |
|
111 RDebug::Print(KFinished,iCurTestCaseNumber); |
|
112 } |
|
113 else |
|
114 { |
|
115 if (iSelfDrive) |
|
116 { |
|
117 _LIT(KStarted,"Started test case %d"); |
|
118 RDebug::Print(KStarted,iCurTestCaseNumber); |
|
119 } |
|
120 else |
|
121 { |
|
122 NextTest(); |
|
123 } |
|
124 } |
|
125 } |
|
126 |
|
127 void CTestManager::DoCancel() |
|
128 { |
|
129 if (!iSelfDrive) |
|
130 iTestCompleted = ETrue; |
|
131 } |
|
132 |
|
133 TInt CTestManager::RunError(TInt aError) |
|
134 { |
|
135 TTime timeStamp; |
|
136 timeStamp.HomeTime(); |
|
137 TBuf<50> dateStr; |
|
138 _LIT(KDateString3,"%-B%:0%J%:1%T%:2%S%:3 %Cms"); |
|
139 timeStamp.FormatL(dateStr, KDateString3); |
|
140 _LIT(KTestLeft,"RunTestCaseL left of %S - Test Case Number: %d"); |
|
141 RDebug::Print(KTestLeft, &dateStr, iCurTestCaseNumber); |
|
142 |
|
143 aError = iTestCase->RunTestCaseLeft(aError); |
|
144 FinishAllTestCases(); |
|
145 return aError; |
|
146 } |
|
147 |
|
148 /** |
|
149 Initialize an active object and set it as active |
|
150 */ |
|
151 void CTestManager::StartTest() |
|
152 { |
|
153 TRequestStatus *pS= (&iStatus); |
|
154 User::RequestComplete(pS, 0); |
|
155 SetActive(); |
|
156 } |
|
157 |
|
158 /** |
|
159 Time to move on to the next test step |
|
160 */ |
|
161 void CTestManager::NextTest() |
|
162 { |
|
163 _LIT(KFinished,"Finished test case %d"); |
|
164 RDebug::Print(KFinished,iCurTestCaseNumber); |
|
165 StartTest(); |
|
166 } |
|
167 |
|
168 /** |
|
169 Stop active scheduler, and quit a test step |
|
170 */ |
|
171 void CTestManager::FinishAllTestCases() |
|
172 { |
|
173 iTestCompleted = ETrue; |
|
174 CActiveScheduler::Stop(); |
|
175 } |
|
176 |
|
177 /** |
|
178 Controls wether the manager calls RunTestCaseL whenever the system is otherwise idol |
|
179 */ |
|
180 void CTestManager::SetSelfDrive(TBool aSelfDrive) |
|
181 { |
|
182 if (iSelfDrive!=aSelfDrive) |
|
183 { |
|
184 iSelfDrive = aSelfDrive; |
|
185 if (aSelfDrive) |
|
186 { |
|
187 if (IsActive()) |
|
188 Cancel(); |
|
189 } |
|
190 else |
|
191 { |
|
192 if (!IsActive() && !iTestCompleted) |
|
193 NextTest(); |
|
194 } |
|
195 } |
|
196 } |
|
197 |
|
198 /** |
|
199 Tells the manager this case is finished so you can call RunTestCaseL again |
|
200 */ |
|
201 void CTestManager::CaseComplete() |
|
202 { |
|
203 __ASSERT_DEBUG(!IsActive(), User::Panic(KGraphicsTestFrameworkPanic, ETestPanicAlreadyActive)); |
|
204 if (iSelfDrive && !iTestCompleted) |
|
205 NextTest(); |
|
206 } |
|
207 |
|
208 |
|
209 //------------- |
|
210 |
|
211 EXPORT_C const TDesC& CTGraphicsBase::ColorModeName(TDisplayMode aMode) |
|
212 { |
|
213 _LIT(KNone,"None"); |
|
214 _LIT(KGray2,"Grey2"); |
|
215 _LIT(KGray4,"Grey4"); |
|
216 _LIT(KGray16,"Grey16"); |
|
217 _LIT(KGray256,"Grey256"); |
|
218 _LIT(KColor16,"Color16"); |
|
219 _LIT(KColor256,"Color256"); |
|
220 _LIT(KColor4K,"Color4K"); |
|
221 _LIT(KColor64K,"Color64K"); |
|
222 _LIT(KColor16M,"Color16M"); |
|
223 _LIT(KColor16MU,"Color16MU"); |
|
224 _LIT(KColor16MA,"Color16MA"); |
|
225 _LIT(KColor16MAP,"Color16MAP"); |
|
226 _LIT(KRgb,"RGB"); |
|
227 _LIT(KUnknown,"Unknown"); |
|
228 switch(aMode) |
|
229 { |
|
230 case ENone: |
|
231 return KNone; |
|
232 case EGray2: |
|
233 return KGray2; |
|
234 case EGray4: |
|
235 return KGray4; |
|
236 case EGray16: |
|
237 return KGray16; |
|
238 case EGray256: |
|
239 return KGray256; |
|
240 case EColor16: |
|
241 return KColor16; |
|
242 case EColor256: |
|
243 return KColor256; |
|
244 case EColor64K: |
|
245 return KColor64K; |
|
246 case EColor16M: |
|
247 return KColor16M; |
|
248 case ERgb: |
|
249 return KRgb; |
|
250 case EColor4K: |
|
251 return KColor4K; |
|
252 case EColor16MU: |
|
253 return KColor16MU; |
|
254 case EColor16MA: |
|
255 return KColor16MA; |
|
256 case EColor16MAP: |
|
257 return KColor16MAP; |
|
258 default: |
|
259 return KUnknown; |
|
260 } |
|
261 } |
|
262 |
|
263 EXPORT_C const TDesC& CTGraphicsBase::RotationName(CFbsBitGc::TGraphicsOrientation aOrientation) |
|
264 { |
|
265 _LIT(K0,"Normal"); |
|
266 _LIT(K90,"Rotated90"); |
|
267 _LIT(K180,"Rotated180"); |
|
268 _LIT(K270,"Rotated270"); |
|
269 _LIT(KUnknown,"Unknown"); |
|
270 switch(aOrientation) |
|
271 { |
|
272 case CFbsBitGc::EGraphicsOrientationNormal: |
|
273 return K0; |
|
274 case CFbsBitGc::EGraphicsOrientationRotated90: |
|
275 return K90; |
|
276 case CFbsBitGc::EGraphicsOrientationRotated180: |
|
277 return K180; |
|
278 case CFbsBitGc::EGraphicsOrientationRotated270: |
|
279 return K270; |
|
280 default: |
|
281 return KUnknown; |
|
282 } |
|
283 } |
|
284 |
|
285 EXPORT_C void CTGraphicsBase::SaveScreenShotL(CFbsScreenDevice* aScdv) |
|
286 { |
|
287 #ifdef __WINS__ |
|
288 _LIT(KBitmapDrive, "c:"); |
|
289 #else |
|
290 _LIT(KBitmapDrive, "e:"); |
|
291 #endif |
|
292 _LIT(KBitmapPath, "\\screenshot.mbm"); |
|
293 TDisplayMode dispMode = aScdv->DisplayMode(); |
|
294 TSize scrSize = aScdv->SizeInPixels(); |
|
295 CFbsBitmap* dstBmp = new(ELeave) CFbsBitmap; |
|
296 CleanupStack::PushL(dstBmp); |
|
297 User::LeaveIfError(dstBmp->Create(scrSize, dispMode)); |
|
298 HBufC8* row = HBufC8::NewLC(scrSize.iWidth*4); |
|
299 TPtr8 prow = row->Des(); |
|
300 for (TInt ii = 0; ii < scrSize.iHeight; ++ii) |
|
301 { |
|
302 aScdv->GetScanLine(prow, TPoint(0, ii), scrSize.iWidth, dispMode); |
|
303 dstBmp->SetScanLine(prow,ii); |
|
304 } |
|
305 CleanupStack::PopAndDestroy(row); |
|
306 TFileName mbmFile; |
|
307 mbmFile.Append(KBitmapDrive); |
|
308 mbmFile.Append(KBitmapPath); |
|
309 User::LeaveIfError(dstBmp->Save(mbmFile)); |
|
310 CleanupStack::PopAndDestroy(dstBmp); |
|
311 } |
|
312 |
|
313 EXPORT_C CTGraphicsBase::CTGraphicsBase(CTestStep* aStep) : |
|
314 iStep(aStep) |
|
315 {} |
|
316 |
|
317 EXPORT_C CTGraphicsBase::~CTGraphicsBase() |
|
318 { |
|
319 if(iTestManager) |
|
320 { |
|
321 iTestManager -> Cancel(); |
|
322 } |
|
323 delete iTestManager; |
|
324 } |
|
325 |
|
326 void CTGraphicsBase::InitializeL() |
|
327 { |
|
328 __ASSERT_DEBUG(iStep, User::Panic(KGraphicsTestFrameworkPanic, KErrBadHandle)); |
|
329 iTestManager = CTestManager::NewL(this); |
|
330 } |
|
331 |
|
332 /** |
|
333 The function must be called after all test cases completed |
|
334 */ |
|
335 EXPORT_C void CTGraphicsBase::TestComplete() |
|
336 { |
|
337 if(iTestManager) |
|
338 { |
|
339 iTestManager -> FinishAllTestCases(); |
|
340 } |
|
341 } |
|
342 |
|
343 EXPORT_C void CTGraphicsBase::SetSelfDrive(TBool aSelfDrive) |
|
344 { |
|
345 if (iTestManager) |
|
346 iTestManager->SetSelfDrive(aSelfDrive); |
|
347 } |
|
348 |
|
349 EXPORT_C void CTGraphicsBase::CaseComplete() |
|
350 { |
|
351 if (iTestManager) |
|
352 iTestManager->CaseComplete(); |
|
353 } |
|
354 |
|
355 EXPORT_C TInt CTGraphicsBase::RunTestCaseLeft(TInt aError) |
|
356 { |
|
357 _LIT(KRunTestCaseLLeft,"The RunTestCaseL left with %d"); |
|
358 ERR_PRINTF2(KRunTestCaseLLeft,aError); |
|
359 iStep->SetTestStepResult(EFail); |
|
360 return KErrNone; |
|
361 } |
|
362 |
|
363 /** Start a test cases loop */ |
|
364 void CTGraphicsBase::Execute() |
|
365 { |
|
366 __ASSERT_DEBUG(iTestManager, User::Panic(KGraphicsTestFrameworkPanic, KErrBadHandle)); |
|
367 __ASSERT_DEBUG(CActiveScheduler::Current(), User::Panic(KGraphicsTestFrameworkPanic, KErrBadHandle)); |
|
368 |
|
369 iTestManager -> StartTest(); |
|
370 CActiveScheduler::Start(); |
|
371 } |
|
372 /** |
|
373 Reset test cases counter to a new value. Can be used for running the same consequence of test |
|
374 cases with different initial parameters. |
|
375 aNewCurrentTestCase cannot be negative. |
|
376 */ |
|
377 EXPORT_C void CTGraphicsBase::ResetCounter(TInt aNewCurrentTestCase ) |
|
378 { |
|
379 __ASSERT_DEBUG(aNewCurrentTestCase >= 0, User::Panic(KGraphicsTestFrameworkPanic, KErrArgument)); |
|
380 iTestManager->iCurTestCaseNumber = aNewCurrentTestCase; |
|
381 } |
|
382 |
|
383 //--------------------- |
|
384 /** |
|
385 Initialise the cleanup stack. |
|
386 */ |
|
387 void CTGraphicsStep::SetupCleanup(CTrapCleanup*& tc) |
|
388 { |
|
389 tc = CTrapCleanup::New(); |
|
390 if (!tc) |
|
391 { |
|
392 User::Panic(_L("Out of memory"), KErrNoMemory); |
|
393 } |
|
394 |
|
395 TRAPD(r, |
|
396 { |
|
397 for ( TInt ii = KTestCleanupStack; ii > 0; ii-- ) |
|
398 CleanupStack::PushL( (TAny*)1 ); |
|
399 TEST( r == KErrNone ); |
|
400 CleanupStack::Pop( KTestCleanupStack ); |
|
401 } ); |
|
402 } |
|
403 |
|
404 void CTGraphicsStep::LogHeapInfo(RWsSession& aWs, TBool aStart) |
|
405 { |
|
406 _LIT(KInfoStart,"Start"); |
|
407 _LIT(KInfoEnd,"End"); |
|
408 _LIT(KInfoCheckPassed,"WsHeap leak check passed"); |
|
409 _LIT(KInfoCheckFailed,"Memory leak detected. Number of orphaned cells=%d."); |
|
410 _LIT(KInfoCheckFailed2,"See epocwindout for the address of the first orphaned cell."); |
|
411 _LIT(KInfoHeapSummary," WsHeap - Count=%d,Total=%d,Free=%d,Max free=%d"); |
|
412 _LIT(KInfoDisabled,"Memory leak testing has not been enabled."); |
|
413 |
|
414 TPckgBuf<TWsDebugHeapInfo> heapInfo; |
|
415 aWs.DebugInfo(EWsDebugInfoHeap,heapInfo); |
|
416 TBuf<256> infoBuf; |
|
417 if (aStart) |
|
418 { |
|
419 infoBuf.Append(KInfoStart); |
|
420 } |
|
421 else |
|
422 { |
|
423 infoBuf.Append(KInfoEnd); |
|
424 TInt heapFailCount=aWs.DebugInfo(EWsDebugFetchCheckHeapResult); |
|
425 if (heapFailCount==KErrNone) |
|
426 { |
|
427 INFO_PRINTF1(KInfoCheckPassed); |
|
428 } |
|
429 else if (heapFailCount>0) // Negative error should be ignored as it means the check has not been enabled |
|
430 { |
|
431 TEST(0); |
|
432 ERR_PRINTF2(KInfoCheckFailed,heapFailCount); |
|
433 ERR_PRINTF1(KInfoCheckFailed2); |
|
434 } |
|
435 else |
|
436 { |
|
437 WARN_PRINTF1(KInfoDisabled); |
|
438 } |
|
439 } |
|
440 infoBuf.AppendFormat(KInfoHeapSummary,heapInfo().iCount,heapInfo().iTotal,heapInfo().iAvailable,heapInfo().iLargestAvailable); |
|
441 INFO_PRINTF1(infoBuf); |
|
442 } |
|
443 |
|
444 /** |
|
445 Main entry point from CTestStep class. |
|
446 Creates cleanup stack, background window and launches a test |
|
447 */ |
|
448 EXPORT_C TVerdict CTGraphicsStep::doTestStepL() |
|
449 { |
|
450 TInt memFree; |
|
451 HAL::Get(HALData::EMemoryRAMFree, memFree); |
|
452 INFO_PRINTF2(_L("Test started - RAM free: %d"), memFree); |
|
453 |
|
454 __UHEAP_MARK; |
|
455 CTrapCleanup* tc = NULL; |
|
456 SetupCleanup(tc); |
|
457 |
|
458 TInt err = RFbsSession::Connect(); |
|
459 if(err != KErrNone) |
|
460 { |
|
461 FbsStartup(); |
|
462 err = RFbsSession::Connect(); |
|
463 |
|
464 if(err != KErrNone) |
|
465 { |
|
466 User::Panic(_L("Font bitmap session connect"), err); |
|
467 } |
|
468 } |
|
469 RWsSession ws; |
|
470 err = ws.Connect(); |
|
471 if (iLogHeapInfo && err==KErrNone) |
|
472 { |
|
473 ws.DebugInfo(EWsDebugSetCheckHeapOnDisconnectClient); |
|
474 LogHeapInfo(ws,ETrue); |
|
475 } |
|
476 TInt theId1 = NULL; |
|
477 #ifdef __WINS__ |
|
478 RWindowGroup winGroup = RWindowGroup(ws); |
|
479 RWindow theWindow(ws); |
|
480 if (err==KErrNone) |
|
481 { |
|
482 const TUint32 ENullWsHandle = 0xFFFFFFFF; // Events delivered to this handle are thrown away |
|
483 //creat background window with the size of the screen |
|
484 //it is particulary important for tests which draw on the screen, read screen buffer |
|
485 //and compare result. By default top TEF window is concole and blinking cursor can interfere |
|
486 //with the work of the tests |
|
487 TSize size(640, 240); //some default value |
|
488 //retrieve screen size |
|
489 err = GetScreenSize(size); |
|
490 if(err) |
|
491 { |
|
492 WARN_PRINTF2(_L("Can't retrieve size from screen driver err = %d"), err); |
|
493 } |
|
494 |
|
495 winGroup.Construct(ENullWsHandle); |
|
496 winGroup.AutoForeground(ETrue); |
|
497 theId1 = winGroup.Identifier(); |
|
498 |
|
499 theWindow.Construct(winGroup, ENullWsHandle); |
|
500 theWindow.SetExtent(TPoint(0, 0), size); |
|
501 theWindow.SetVisible(ETrue); |
|
502 theWindow.Activate(); |
|
503 |
|
504 //the following trick we need to put the window on the top |
|
505 TApaTaskList taskList(ws); |
|
506 TApaTask task = taskList.FindByPos(1); |
|
507 task.BringToForeground(); |
|
508 TApaTask task1(ws); |
|
509 task1.SetWgId(theId1); |
|
510 task1.BringToForeground(); |
|
511 } |
|
512 #endif |
|
513 if (err==KErrNone) |
|
514 { |
|
515 CloseAllPanicWindows(theId1, ws); |
|
516 } |
|
517 |
|
518 // initialize the test and kick off the test cases loop |
|
519 TRAP(err, TestSetupL(); // initialize a test step |
|
520 ExecuteL()); // run active scheduler, in order to complete test execution |
|
521 // CTGraphicsStep::TestComplete function needs to be called |
|
522 |
|
523 if (err) |
|
524 { |
|
525 SetTestStepResult(EFail); |
|
526 } |
|
527 |
|
528 TestClose(); // free all allocated resources here |
|
529 |
|
530 if (ws.Handle()) |
|
531 { |
|
532 CloseAllPanicWindows(theId1, ws); |
|
533 #ifdef __WINS__ |
|
534 theWindow.Close(); |
|
535 winGroup.Close(); |
|
536 #endif |
|
537 ws.Close(); |
|
538 User::After(50000); |
|
539 // Prev close will trigger Wserv dummy shutdown and heap check |
|
540 // We then re-connect to get the result of the shutdown. |
|
541 RWsSession ws2; |
|
542 TInt errConnection; |
|
543 TInt MaxNumberOfAttempt=10; |
|
544 TInt currentAttempt=0; |
|
545 do |
|
546 { |
|
547 errConnection=ws2.Connect(); |
|
548 if (errConnection==KErrNone) |
|
549 { |
|
550 LogHeapInfo(ws2,EFalse); |
|
551 ws2.Close(); |
|
552 } |
|
553 else |
|
554 { |
|
555 RDebug::Printf("Connection Error with Wserv... %i",errConnection); |
|
556 User::After(50000); |
|
557 } |
|
558 currentAttempt++; |
|
559 }while( (errConnection!=KErrNone) && (currentAttempt<MaxNumberOfAttempt) ); |
|
560 } |
|
561 RFbsSession::Disconnect(); |
|
562 |
|
563 delete tc; |
|
564 |
|
565 __UHEAP_MARKEND; |
|
566 |
|
567 return TestStepResult(); |
|
568 } |
|
569 |
|
570 void CTGraphicsStep::CloseAllPanicWindows(TInt aId, RWsSession& ws) const |
|
571 { |
|
572 TInt idFocus = ws.GetFocusWindowGroup(); |
|
573 TWsEvent event; |
|
574 event.SetType(EEventKey); //EEventKeyDown |
|
575 TKeyEvent *keyEvent = event.Key(); |
|
576 keyEvent->iCode = EKeyEscape; |
|
577 keyEvent->iScanCode = EStdKeyEscape; |
|
578 keyEvent->iModifiers = 0; |
|
579 TInt theLimit = 50; |
|
580 while(idFocus != aId && (theLimit-- > 0)) |
|
581 { |
|
582 ws.SendEventToAllWindowGroups(event); |
|
583 idFocus = ws.GetFocusWindowGroup(); |
|
584 } |
|
585 } |
|
586 |
|
587 TInt CTGraphicsStep::GetScreenSize(TSize& aSize) const |
|
588 { |
|
589 CFbsScreenDevice* dev = NULL; |
|
590 |
|
591 TInt err = KErrNone; |
|
592 TInt sizeOfDisplayMode = sizeof (testDisplayModes) / sizeof(testDisplayModes[0]); |
|
593 |
|
594 for(TInt theScreenModeIndex = sizeOfDisplayMode - 1; theScreenModeIndex ; theScreenModeIndex--) |
|
595 { |
|
596 TDisplayMode disp = testDisplayModes[theScreenModeIndex]; |
|
597 TRAP(err, dev = CFbsScreenDevice::NewL(_L(""), disp)); //scdv |
|
598 if(err == KErrNone) |
|
599 { |
|
600 aSize = dev->SizeInPixels(); |
|
601 delete dev; |
|
602 return KErrNone; |
|
603 } |
|
604 delete dev; |
|
605 dev = NULL; |
|
606 } |
|
607 |
|
608 return err; |
|
609 } |
|
610 |
|
611 /** Installs an active scheduler and launches a test*/ |
|
612 void CTGraphicsStep::ExecuteL() |
|
613 { |
|
614 CActiveScheduler* theAs = new (ELeave) CActiveScheduler; |
|
615 CleanupStack::PushL(theAs); |
|
616 CActiveScheduler::Install(theAs); |
|
617 |
|
618 CTGraphicsBase* autoTest = CreateTestL(); |
|
619 User::LeaveIfNull(autoTest); |
|
620 CleanupStack::PushL(autoTest); |
|
621 |
|
622 autoTest -> InitializeL(); |
|
623 autoTest -> ConstructL(); |
|
624 autoTest -> Execute(); |
|
625 |
|
626 CleanupStack::PopAndDestroy(2, theAs); |
|
627 } |
|
628 |
|
629 TInt E32Dll( ) |
|
630 { |
|
631 return 0; |
|
632 } |
|
633 |