|
1 // Copyright (c) 1996-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 // Test Direct Screen Access |
|
15 // |
|
16 // |
|
17 |
|
18 #include "tdirecta.h" |
|
19 |
|
20 static TRect WinExt; |
|
21 static TInt WinCol=0; |
|
22 static TTimeIntervalMicroSeconds32 MoveInterval; |
|
23 static TTimeIntervalMicroSeconds32 ModeInterval; |
|
24 static TTimeIntervalMicroSeconds32 FlipInterval; |
|
25 static TBool ImmediateModeSwitch; |
|
26 #if defined(LOGGING) |
|
27 LOCAL_D TLogMessageText LogMessageText; |
|
28 #endif |
|
29 |
|
30 _LIT(SemControl,"Control"); |
|
31 _LIT(SemNextOp,"TrigerWindow"); |
|
32 _LIT(FontName,"DejaVu Serif Condensed"); |
|
33 _LIT(QueueControl,"Queue"); |
|
34 |
|
35 LOCAL_D TSize FullScreenModeSize; |
|
36 LOCAL_D TInt Copy2ndHalfOfScreen; |
|
37 |
|
38 const TBool KRegionTrackingOnly = ETrue; |
|
39 const TBool KDrawingDsa = EFalse; |
|
40 |
|
41 const TInt KPanicTestOrdinalPriority=65536; |
|
42 const TInt KMainTestOrdinalPriority=65535; |
|
43 const TInt KMainTestBaseWindow=KMainTestOrdinalPriority/3; |
|
44 const TInt KAboveMainTestBaseWindow = KMainTestBaseWindow +1; |
|
45 |
|
46 const TInt KMaxIdlingTime = 25; //used for RegionTrackingOnly DSAs, it represents the maximum number of times the Idling function can be called |
|
47 //Ids of two RegionTrackingOnly DSAs |
|
48 const TInt KRegionTrackingOnlyDsaWaitingForAbortSignal = 25; |
|
49 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA |
|
50 const TInt KRegionTrackingOnlyDsaNoAbortSignal = 26; |
|
51 #endif |
|
52 |
|
53 const TInt KRegionTrackingOnlyDsaExistLast = 0; |
|
54 const TInt KDrawingDsaExistLast = 1; |
|
55 const TInt KShortDelay = 5000; |
|
56 #define SHORT_DELAY TTimeIntervalMicroSeconds32(KShortDelay) |
|
57 |
|
58 _LIT(KSem_DefectFix_KAA_5J3BLW_Name, "DefectFix_KAA_5J3BLW"); |
|
59 |
|
60 GLDEF_C TInt ProcDirect(TAny *aScreenNumber) |
|
61 { |
|
62 CTrapCleanup* cleanupStack = NULL; |
|
63 User::LeaveIfNull(cleanupStack = CTrapCleanup::New()); |
|
64 |
|
65 #if defined(LOGGING) |
|
66 _LIT(KWindow,"Window Toggle Vis="); |
|
67 _LIT(KParams,"%d, Pos=(%d,%d,%d,%d), Col=%d"); |
|
68 #endif |
|
69 RSemaphore controlSem; |
|
70 RSemaphore windowSem; |
|
71 User::LeaveIfError(controlSem.OpenGlobal(SemControl)); |
|
72 User::LeaveIfError(windowSem.OpenGlobal(SemNextOp)); |
|
73 RWsSession ws; |
|
74 User::LeaveIfError(ws.Connect()); |
|
75 |
|
76 // assign to the correct screen |
|
77 CWsScreenDevice* screen = NULL; |
|
78 TInt err; |
|
79 TRAP(err, screen = new (ELeave) CWsScreenDevice(ws)); |
|
80 if (err!=KErrNone) |
|
81 return err; |
|
82 |
|
83 if ((err=screen->Construct((TInt)aScreenNumber))!=KErrNone) |
|
84 { |
|
85 delete screen; |
|
86 return err; |
|
87 } |
|
88 |
|
89 RWindowGroup group(ws); |
|
90 User::LeaveIfError(group.Construct(898)); |
|
91 group.EnableReceiptOfFocus(EFalse); |
|
92 group.SetOrdinalPosition(0,KAboveMainTestBaseWindow ); |
|
93 RBlankWindow window(ws); |
|
94 User::LeaveIfError(window.Construct(group,899)); |
|
95 TBool vis=EFalse; |
|
96 window.SetVisible(vis); |
|
97 window.Activate(); |
|
98 ws.Flush(); |
|
99 controlSem.Signal(); |
|
100 windowSem.Wait(); |
|
101 RMsgQueueBase queue; |
|
102 TInt open = queue.OpenGlobal(QueueControl); |
|
103 TInt data; |
|
104 while (queue.Receive(&data,sizeof(TInt)) != KErrNone) |
|
105 { |
|
106 vis=!vis; |
|
107 if (vis) |
|
108 { |
|
109 window.SetColor(TRgb::Gray4(WinCol)); |
|
110 window.SetExtent(WinExt.iTl,WinExt.Size()); |
|
111 #if defined(LOGGING) |
|
112 LogMessageText.Copy(KWindow); |
|
113 LogMessageText.AppendFormat(KParams,vis,WinExt.iTl.iX,WinExt.iTl.iY,WinExt.iBr.iX,WinExt.iBr.iY,WinCol); |
|
114 ws.LogMessage(LogMessageText); |
|
115 #endif |
|
116 } |
|
117 window.SetVisible(vis); |
|
118 ws.Flush(); |
|
119 windowSem.Wait(); |
|
120 } |
|
121 queue.Close(); |
|
122 |
|
123 window.Close(); |
|
124 group.Close(); |
|
125 |
|
126 delete screen; |
|
127 ws.Close(); |
|
128 controlSem.Close(); |
|
129 windowSem.Close(); |
|
130 |
|
131 delete cleanupStack; |
|
132 return(KErrNone); |
|
133 } |
|
134 |
|
135 |
|
136 /*CDirectScreenAccessOld*/ |
|
137 |
|
138 CDirectScreenAccessOld* CDirectScreenAccessOld::NewL(RWsSession& aWs,MAbortDirectScreenAccess& aAborter) |
|
139 { |
|
140 CDirectScreenAccessOld* self=new(ELeave) CDirectScreenAccessOld(aWs,aAborter); |
|
141 CleanupStack::PushL(self); |
|
142 self->ConstructL(); |
|
143 CleanupStack::Pop(self); |
|
144 return self; |
|
145 } |
|
146 |
|
147 CDirectScreenAccessOld::~CDirectScreenAccessOld() |
|
148 { |
|
149 __ASSERT_ALWAYS(!iAborting,AutoPanic(EAutoPanicDirect)); |
|
150 Cancel(); |
|
151 iDirectAccess.Close(); |
|
152 } |
|
153 |
|
154 void CDirectScreenAccessOld::ConstructL() |
|
155 { |
|
156 User::LeaveIfError(iDirectAccess.Construct()); |
|
157 CActiveScheduler::Add(this); |
|
158 } |
|
159 |
|
160 TInt CDirectScreenAccessOld::Request(RRegion*& aRegion, RWindowBase& aWindow) |
|
161 { |
|
162 TInt ret=iDirectAccess.Request(aRegion,iStatus,aWindow); |
|
163 if (ret==KErrNone) |
|
164 SetActive(); |
|
165 return ret; |
|
166 } |
|
167 |
|
168 void CDirectScreenAccessOld::DoCancel() |
|
169 { |
|
170 iDirectAccess.Cancel(); |
|
171 } |
|
172 |
|
173 void CDirectScreenAccessOld::RunL() |
|
174 { |
|
175 iAborting=ETrue; |
|
176 iAborter.AbortNow(REINTERPRET_CAST(RDirectScreenAccess::TTerminationReasons&,iStatus)); |
|
177 iAborting=EFalse; |
|
178 iDirectAccess.Completed(); |
|
179 } |
|
180 |
|
181 |
|
182 /*CColorAnimation*/ |
|
183 |
|
184 CColorAnimation* CColorAnimation::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWinBase& aParent,TRect aExtent,TBool aStart,TBool aRegionTrackingOnly) |
|
185 { |
|
186 CColorAnimation* self=new(ELeave) CColorAnimation(aScreenNumber,aId,aCallBack); |
|
187 CleanupStack::PushL(self); |
|
188 self->ConstructL(aParent,aExtent,aRegionTrackingOnly); |
|
189 if (aStart) |
|
190 self->StartL(); |
|
191 CleanupStack::Pop(self); |
|
192 return self; |
|
193 } |
|
194 |
|
195 CColorAnimation::~CColorAnimation() |
|
196 { |
|
197 delete iTimer; |
|
198 delete iDrawer; |
|
199 delete iWindow; |
|
200 delete iWindow2; |
|
201 TheClient->Flush(); |
|
202 } |
|
203 |
|
204 void CColorAnimation::ConstructL(CTWinBase& aParent,TRect aExtent,TBool aRegionTrackingOnly,TInt aTypeWindow/*=0*/,TInt aSingleWinForMultipleDSA/*=0*/) |
|
205 { |
|
206 iRegionTrackingOnly = aRegionTrackingOnly; |
|
207 // Make sure that the top right corner is not 0,0 |
|
208 if (aTypeWindow && aExtent.iTl==TPoint(0,0)) |
|
209 { |
|
210 aExtent.iTl=TPoint(10,10); |
|
211 } |
|
212 RWindowBase* win=NULL; |
|
213 iSingleWinForMultipleDSA=aSingleWinForMultipleDSA; |
|
214 if (aSingleWinForMultipleDSA) |
|
215 { |
|
216 win=iCallBack.iCallBackWin->BaseWin(); |
|
217 iWinSize=TheClient->iScreen->SizeInPixels(); |
|
218 } |
|
219 else |
|
220 { |
|
221 iWindow=new(ELeave) CTBlankWindow(); |
|
222 iWinSize=aExtent.Size(); |
|
223 iWindow->ConstructExtLD(aParent,aExtent.iTl,iWinSize); |
|
224 ChangeModeL(iCallBack.DisplayMode(iId)); |
|
225 win=iWindow->BaseWin(); |
|
226 win->SetShadowDisabled(ETrue); |
|
227 win->Activate(); |
|
228 } |
|
229 if (!aTypeWindow) |
|
230 { |
|
231 if(iRegionTrackingOnly) |
|
232 { |
|
233 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,*win,*this,iRegionTrackingOnly); |
|
234 } |
|
235 else |
|
236 { |
|
237 //needed for the non NGA case: only the old API is allowed to be used |
|
238 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,*win,*this); |
|
239 } |
|
240 } |
|
241 else |
|
242 { |
|
243 TRect childRect(0,0,100,100); |
|
244 switch(aTypeWindow) |
|
245 { |
|
246 case 1: |
|
247 { |
|
248 // Create a Blank Window smaller than it's parent and its top left corner within the parent area and withn the screen area |
|
249 childRect.Shrink(10,10); |
|
250 break; |
|
251 } |
|
252 case 2: |
|
253 { |
|
254 // Create a Blank Window with its top left corner being left side of its parent |
|
255 childRect.Move(-10,0); |
|
256 break; |
|
257 } |
|
258 } |
|
259 iWindow2=new(ELeave) CTBlankWindow(); |
|
260 iWindow2->ConstructExtLD(*iWindow,childRect.iTl,childRect.Size()); |
|
261 // Finish constructing the window |
|
262 RWindowBase& win=*iWindow2->BaseWin(); |
|
263 win.SetShadowDisabled(ETrue); |
|
264 win.Activate(); |
|
265 // Create the Direct Screen Access object |
|
266 if(iRegionTrackingOnly) |
|
267 { |
|
268 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this,iRegionTrackingOnly); |
|
269 } |
|
270 else |
|
271 { |
|
272 //needed for the non NGA case: only the old API is allowed to be used |
|
273 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this); |
|
274 } |
|
275 } |
|
276 TheClient->Flush(); |
|
277 if (iId == 4) |
|
278 { |
|
279 // This clause is needed to prevent sub-test 9 from taking an |
|
280 // exceedingly large amount of time. The CColorAnimation with iId 4 is |
|
281 // the one which controls when the test stops. This raise in |
|
282 // priority compared to the other CColorAnimations, allows it's |
|
283 // callbacks to get through when otherwise they would take much longer |
|
284 // due to the volume of callbacks generated by the other |
|
285 // CColorAnimations |
|
286 iTimer=CPeriodic::NewL(1); |
|
287 } |
|
288 else |
|
289 { |
|
290 iTimer=CPeriodic::NewL(0); |
|
291 } |
|
292 } |
|
293 |
|
294 TPoint CColorAnimation::AbsoluteWindowPosition(TInt aWindowId/*=0*/) |
|
295 { |
|
296 if (iSingleWinForMultipleDSA) |
|
297 { |
|
298 return iCallBack.iCallBackWin->BaseWin()->AbsPosition(); |
|
299 } |
|
300 if (!aWindowId) |
|
301 { |
|
302 // Return the absolute position of iWindow, if Color Animation is not for Position Relative to Screen test. |
|
303 return iWindow->BaseWin()->AbsPosition(); |
|
304 } |
|
305 else |
|
306 { |
|
307 // Return the absolute position of iWindow2, if it is for Position Relative to Screen test. |
|
308 return iWindow2->BaseWin()->AbsPosition(); |
|
309 } |
|
310 } |
|
311 |
|
312 TInt CColorAnimation::DrawColorL(TAny* aAnimation) |
|
313 { |
|
314 STATIC_CAST(CColorAnimation*,aAnimation)->DrawColorL(); |
|
315 return(KErrNone); |
|
316 } |
|
317 |
|
318 TInt CColorAnimation::IdlingL(TAny* aAnimation) |
|
319 { |
|
320 (static_cast<CColorAnimation*>(aAnimation))->IdlingL(); |
|
321 return(KErrNone); |
|
322 } |
|
323 |
|
324 void CColorAnimation::StartL(TBool aChildWindow/*=EFalse*/) |
|
325 { |
|
326 iDrawer->StartL(); |
|
327 TRect bounding=iDrawer->DrawingRegion()->BoundingRect(); |
|
328 TRect window; |
|
329 if (aChildWindow) |
|
330 { |
|
331 window.SetRect(AbsoluteWindowPosition(1),iWinSize); |
|
332 } |
|
333 else |
|
334 { |
|
335 window.SetRect(AbsoluteWindowPosition(),iWinSize); |
|
336 } |
|
337 // Check that the window contains the bounding area (a bounding rect of (0,0,0,0) shouldn't fail the test) |
|
338 if (!(window.Contains(bounding.iTl) && window.Contains(bounding.iBr-TPoint(1,1))) && bounding.Size()!=TSize(0,0)) |
|
339 { |
|
340 iCallBack.Fail(); |
|
341 // iDrawer->Cancel(); |
|
342 // iDrawer->StartL(); |
|
343 // bounding=iDrawer->DrawingRegion()->BoundingRect(); |
|
344 } |
|
345 if(!iRegionTrackingOnly) |
|
346 { |
|
347 iTimer->Start(0,iCallBack.TimerInterval(iId),TCallBack(CColorAnimation::DrawColorL,this)); |
|
348 iDrawer->Gc()->SetPenStyle(CGraphicsContext::ENullPen); |
|
349 iDrawer->Gc()->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
350 } |
|
351 else |
|
352 { |
|
353 iTimer->Start(0,iCallBack.TimerInterval(iId),TCallBack(CColorAnimation::IdlingL,this)); |
|
354 } |
|
355 } |
|
356 |
|
357 void CColorAnimation::StartOrPanic() |
|
358 { |
|
359 TRAPD(err,StartL()); |
|
360 if (err!=KErrNone) |
|
361 { |
|
362 iCallBack.LogLeave(err); |
|
363 iCallBack.Fail(); |
|
364 } |
|
365 } |
|
366 |
|
367 void CColorAnimation::Stop() |
|
368 { |
|
369 iTimer->Cancel(); |
|
370 iDrawer->Cancel(); |
|
371 } |
|
372 |
|
373 void CColorAnimation::BringWindowToFront() |
|
374 { |
|
375 iWindow->WinTreeNode()->SetOrdinalPosition(0); |
|
376 } |
|
377 |
|
378 void CColorAnimation::ChangeModeL(TDisplayMode aMode) |
|
379 { |
|
380 User::LeaveIfError(iWindow->BaseWin()->SetRequiredDisplayMode(aMode)); |
|
381 TheClient->Flush(); |
|
382 } |
|
383 |
|
384 void CColorAnimation::FinishTest() |
|
385 { |
|
386 iCallBack.Finished(iId); |
|
387 } |
|
388 |
|
389 inline CDirectScreenAccess* CColorAnimation::GetDrawer() |
|
390 { |
|
391 return iDrawer; |
|
392 } |
|
393 |
|
394 void CColorAnimation::DrawColorL() |
|
395 { |
|
396 TBool aFinished; |
|
397 iDrawer->Gc()->SetBrushColor(iCallBack.BrushColorL(iId,iColor,aFinished)); |
|
398 if (iSingleWinForMultipleDSA==1) |
|
399 { |
|
400 iDrawer->Gc()->DrawRect(iWinSize-TSize(iWinSize.iWidth/2,iWinSize.iHeight/2)); |
|
401 } |
|
402 else if (iSingleWinForMultipleDSA==2) |
|
403 { |
|
404 iDrawer->Gc()->DrawRect(TRect(TPoint(iWinSize.iWidth/2,iWinSize.iHeight/2),TSize(iWinSize.iWidth/2,iWinSize.iHeight/2))); |
|
405 } |
|
406 else |
|
407 { |
|
408 iDrawer->Gc()->DrawRect(iWinSize); |
|
409 } |
|
410 iDrawer->ScreenDevice()->Update(); |
|
411 if (aFinished) |
|
412 { |
|
413 if (iId==1) |
|
414 { |
|
415 iWindow->SetSize(TSize(48,52)); |
|
416 TheClient->Flush(); |
|
417 } |
|
418 if (aFinished==1) |
|
419 Stop(); |
|
420 iCallBack.Finished(iId); |
|
421 } |
|
422 } |
|
423 |
|
424 void CColorAnimation::IdlingL() |
|
425 { |
|
426 iIdling++; |
|
427 if(iIdling == KMaxIdlingTime) |
|
428 { |
|
429 Stop(); |
|
430 iIdling = 0; |
|
431 if (iId == KRegionTrackingOnlyDsaWaitingForAbortSignal) |
|
432 { |
|
433 _LIT(KErrorAbortNotReceived,"DSA didn't get an abort signal even though the window was opened in front"); |
|
434 CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorAbortNotReceived); |
|
435 CallBack().Fail(); |
|
436 } |
|
437 iCallBack.Finished(iId); |
|
438 } |
|
439 } |
|
440 |
|
441 void CColorAnimation::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) |
|
442 { |
|
443 TInt slow=iCallBack.SlowStopping(iId,iCount); |
|
444 switch (slow) |
|
445 { |
|
446 case eAbortAll: |
|
447 iCallBack.Finished(iId); |
|
448 case eAbort: |
|
449 Stop(); |
|
450 return; |
|
451 case eStopDelayed: |
|
452 User::After(750000); //0.75 secs |
|
453 break; |
|
454 default:; |
|
455 } |
|
456 ++iCount; |
|
457 iTimer->Cancel(); |
|
458 } |
|
459 |
|
460 void CColorAnimation::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) |
|
461 { |
|
462 TRAPD(err,StartL()); |
|
463 if (err!=KErrNone) |
|
464 iCallBack.FailedReStart(iId,err); |
|
465 } |
|
466 |
|
467 |
|
468 /*CScrollingTextDrawer*/ |
|
469 |
|
470 CScrollingTextDrawer* CScrollingTextDrawer::NewL(TInt aScreenNumber,CFbsScreenDevice*& aDevice,CFbsBitGc& aGc) |
|
471 { |
|
472 CScrollingTextDrawer* self=new(ELeave) CScrollingTextDrawer(aDevice,aGc); |
|
473 CleanupStack::PushL(self); |
|
474 self->ConstructL(aScreenNumber); |
|
475 CleanupStack::Pop(self); |
|
476 return self; |
|
477 } |
|
478 |
|
479 CScrollingTextDrawer::~CScrollingTextDrawer() |
|
480 { |
|
481 if(iFontDevice) |
|
482 { |
|
483 iFontDevice->ReleaseFont(iFont); |
|
484 delete iFontDevice; |
|
485 } |
|
486 } |
|
487 |
|
488 void CScrollingTextDrawer::ConstructL(TInt aScreenNumber) |
|
489 { |
|
490 iFontDevice=CFbsScreenDevice::NewL(aScreenNumber,iDevice->DisplayMode()); |
|
491 _LIT(text,"ABCDEFGHIJKLMNOPQRSTUVWXYZ"); |
|
492 iText=text; |
|
493 CreateFontL(); |
|
494 //iFirstChar=0; |
|
495 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
496 #if defined(LOGGING) |
|
497 iWs.Connect(); |
|
498 // point to correct screen |
|
499 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(iWs); |
|
500 CleanupStack::PushL(screen); |
|
501 User::LeaveIfError(screen->Construct(aScreenNumber)); |
|
502 CleanupStack::Pop(screen); |
|
503 |
|
504 _LIT(KConstTextDrawer,"Constructed Text Drawer"); |
|
505 LogMessageText.Copy(KConstTextDrawer); |
|
506 iWs.LogMessage(LogMessageText); |
|
507 iWs.Flush(); |
|
508 |
|
509 delete screen; |
|
510 iWs.Close(); |
|
511 #endif |
|
512 } |
|
513 |
|
514 void CScrollingTextDrawer::CreateFontL() |
|
515 { |
|
516 TInt screenHeight=iDevice->SizeInPixels().iHeight; |
|
517 TFontSpec fontSpec(FontName,screenHeight); |
|
518 User::LeaveIfError(iFontDevice->GetNearestFontToDesignHeightInPixels(iFont,fontSpec)); |
|
519 iGc->UseFont(iFont); |
|
520 TInt fontHeight=iFont->HeightInPixels(); |
|
521 iDrawRect.iTl.iY=(screenHeight-fontHeight)/2; |
|
522 iDrawRect.iBr.iY=iDrawRect.iTl.iY+fontHeight; |
|
523 iDrawHeight=iFont->AscentInPixels(); |
|
524 iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]); |
|
525 iDrawRect.iBr.iX=Max(iDevice->SizeInPixels().iWidth,iDevice->SizeInPixels().iHeight); |
|
526 iDrawRect.iTl.iX=iDrawRect.iBr.iX-iCharWidth; |
|
527 } |
|
528 |
|
529 void CScrollingTextDrawer::SetBottomOfTest(TInt aBottom) |
|
530 { |
|
531 if (iDrawRect.iBr.iY>aBottom) |
|
532 { |
|
533 iDrawRect.iTl.iY-=iDrawRect.iBr.iY-aBottom; |
|
534 iDrawRect.iBr.iY=aBottom; |
|
535 } |
|
536 } |
|
537 |
|
538 void CScrollingTextDrawer::Scroll() |
|
539 { |
|
540 iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]); |
|
541 iDrawRect.iTl.iX-=iJump; |
|
542 iGc->DrawText(iText.Mid(iFirstChar),iDrawRect,iDrawHeight); |
|
543 iDevice->Update(); |
|
544 if (iDrawRect.iTl.iX<-iCharWidth) |
|
545 { |
|
546 if (++iFirstChar==iText.Length()) |
|
547 { |
|
548 iFirstChar=0; |
|
549 iDrawRect.iTl.iX=iDevice->SizeInPixels().iWidth; |
|
550 } |
|
551 else |
|
552 iDrawRect.iTl.iX+=iCharWidth; |
|
553 iCharWidth=iFont->CharWidthInPixels(iText[iFirstChar]); |
|
554 } |
|
555 } |
|
556 |
|
557 |
|
558 /*CScrollText*/ |
|
559 |
|
560 TInt CScrollText::DrawText(TAny* aAnimation) |
|
561 { |
|
562 STATIC_CAST(CScrollText*,aAnimation)->ScrollText(); |
|
563 return(KErrNone); |
|
564 } |
|
565 |
|
566 CScrollText* CScrollText::NewL(TInt aScreenNumber,TInt aId,CTWindowGroup& aParent,TInt aScrollJump,TBool aStart/*=EFalse*/) |
|
567 { |
|
568 CScrollText* self=new(ELeave) CScrollText(aId,aScrollJump,aScreenNumber); |
|
569 CleanupStack::PushL(self); |
|
570 self->ConstructL(aParent); |
|
571 if (aStart) |
|
572 self->StartL(); |
|
573 CleanupStack::Pop(self); |
|
574 return self; |
|
575 } |
|
576 |
|
577 CScrollText::~CScrollText() |
|
578 { |
|
579 delete iTimer; |
|
580 delete iTextDraw; |
|
581 iTextDraw=NULL; |
|
582 delete iDrawer; |
|
583 delete iWindow; |
|
584 TheClient->Flush(); |
|
585 } |
|
586 |
|
587 void CScrollText::ConstructL(CTWindowGroup& aParent) |
|
588 { |
|
589 iWindow=new(ELeave) CTBlankWindow(); |
|
590 iWindow->ConstructL(aParent); |
|
591 RWindowBase& win=*iWindow->BaseWin(); |
|
592 win.Activate(); |
|
593 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this); |
|
594 TheClient->Flush(); |
|
595 iTimer=CPeriodic::NewL(0); |
|
596 } |
|
597 |
|
598 void CScrollText::StartL() |
|
599 { |
|
600 DoContinueL(); |
|
601 iDrawer->Gc()->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
602 if (!iTextDraw) |
|
603 { |
|
604 iTextDraw=CScrollingTextDrawer::NewL(iScreenNumber,iDrawer->ScreenDevice(),*iDrawer->Gc()); |
|
605 iTextDraw->SetScrollJump(iScrollJump); |
|
606 } |
|
607 } |
|
608 |
|
609 void CScrollText::ContinueL() |
|
610 { |
|
611 DoContinueL(); |
|
612 } |
|
613 |
|
614 void CScrollText::DoContinueL() |
|
615 { |
|
616 iTimer->Start(0,10000,TCallBack(CScrollText::DrawText,this)); |
|
617 |
|
618 //0.01secs |
|
619 iDrawer->StartL(); |
|
620 TRect bounding=iDrawer->DrawingRegion()->BoundingRect(); |
|
621 #if defined(LOGGING) |
|
622 _LIT(KBoundRect,"Continue Scroll Text Rect=(%d,%d,%d,%d)"); |
|
623 LogMessageText.Zero(); |
|
624 LogMessageText.AppendFormat(KBoundRect,bounding.iTl.iX,bounding.iTl.iY,bounding.iBr.iX,bounding.iBr.iY); |
|
625 TheClient->iWs.LogMessage(LogMessageText); |
|
626 TheClient->Flush(); |
|
627 #endif |
|
628 TRect window=TRect(iWindow->BaseWin()->AbsPosition(),iWindow->Size()); |
|
629 if (!window.Contains(bounding.iTl) || !window.Contains(bounding.iBr-TPoint(1,1))) |
|
630 AutoPanic(EAutoPanicTestFailed); |
|
631 } |
|
632 |
|
633 void CScrollText::Stop() |
|
634 { |
|
635 iTimer->Cancel(); |
|
636 iDrawer->Cancel(); |
|
637 } |
|
638 |
|
639 void CScrollText::ScrollText() |
|
640 { |
|
641 iTextDraw->Scroll(); |
|
642 } |
|
643 |
|
644 void CScrollText::AbortNow(RDirectScreenAccess::TTerminationReasons aReason) |
|
645 { |
|
646 iTimer->Cancel(); |
|
647 if (!iCounting) |
|
648 return; |
|
649 if (iAbortCountDown>0) |
|
650 --iAbortCountDown; |
|
651 else |
|
652 { |
|
653 if (aReason==RDirectScreenAccess::ETerminateRegion) |
|
654 { |
|
655 User::After(1500000); //1.5secs |
|
656 iAbortCountDown=7; |
|
657 } |
|
658 } |
|
659 } |
|
660 |
|
661 void CScrollText::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) |
|
662 //This function is pure virtual and so cannot have an 'L' at the end of it's name |
|
663 { |
|
664 ContinueL(); |
|
665 } |
|
666 |
|
667 /*CWindowWithChild*/ |
|
668 |
|
669 CWindowWithChild* CWindowWithChild::NewL(TInt aScreenNumber, CTWindowGroup& aParent,TBool aStart/*=EFalse*/) |
|
670 { |
|
671 CWindowWithChild* self=new(ELeave) CWindowWithChild(aScreenNumber); |
|
672 CleanupStack::PushL(self); |
|
673 self->ConstructL(aParent); |
|
674 if (aStart) |
|
675 self->StartL(); |
|
676 CleanupStack::Pop(self); |
|
677 return self; |
|
678 } |
|
679 |
|
680 CWindowWithChild::~CWindowWithChild() |
|
681 { |
|
682 delete iDrawer; |
|
683 delete iChildWindow; |
|
684 delete iWindow; |
|
685 TheClient->Flush(); |
|
686 } |
|
687 |
|
688 void CWindowWithChild::ConstructL(CTWindowGroup& aParent) |
|
689 { |
|
690 iWindow=new(ELeave) CTBlankWindow(); |
|
691 iWindow->ConstructL(aParent); |
|
692 |
|
693 iChildWindow = new(ELeave) CTWin(); |
|
694 iChildWindow->ConstructWin(*iWindow); |
|
695 |
|
696 iChildWindow->SetExt(TPoint(0,0), TSize(4,4)); |
|
697 RWindowBase& cwin=*iChildWindow->BaseWin(); |
|
698 cwin.Activate(); |
|
699 |
|
700 RWindowBase& win=*iWindow->BaseWin(); |
|
701 win.Activate(); |
|
702 |
|
703 iDrawer=CDirectScreenAccess::NewL(TheClient->iWs,*TheClient->iScreen,win,*this); |
|
704 |
|
705 TheClient->Flush(); |
|
706 } |
|
707 |
|
708 void CWindowWithChild::StartL() |
|
709 { |
|
710 DoContinueL(); |
|
711 } |
|
712 |
|
713 void CWindowWithChild::ContinueL() |
|
714 { |
|
715 DoContinueL(); |
|
716 } |
|
717 |
|
718 void CWindowWithChild::DoContinueL() |
|
719 { |
|
720 iDrawer->StartL(); |
|
721 iRunning = ETrue; |
|
722 } |
|
723 |
|
724 void CWindowWithChild::Stop() |
|
725 { |
|
726 iDrawer->Cancel(); |
|
727 } |
|
728 |
|
729 void CWindowWithChild::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) |
|
730 { |
|
731 iRunning = EFalse; |
|
732 } |
|
733 |
|
734 void CWindowWithChild::Restart(RDirectScreenAccess::TTerminationReasons /*aReason*/) |
|
735 //This function is pure virtual and so cannot have an 'L' at the end of it's name |
|
736 { |
|
737 ContinueL(); |
|
738 } |
|
739 |
|
740 void CWindowWithChild::PerformCoverageCalls() |
|
741 { |
|
742 //add coverage to commands with no/partial coverage |
|
743 RWindow& cwin=*iChildWindow->Win(); |
|
744 TInt priority = 0; |
|
745 |
|
746 cwin.SetPointerCapturePriority(priority); |
|
747 __ASSERT_ALWAYS(cwin.GetPointerCapturePriority()==priority, User::Invariant()); |
|
748 cwin.ClaimPointerGrab(EFalse); |
|
749 cwin.EnableBackup(0); |
|
750 __ASSERT_ALWAYS(cwin.PrevSibling()==0, User::Invariant()); |
|
751 cwin.Invalidate(TRect(0, 0, 10, 10)); |
|
752 cwin.FadeBehind(ETrue); |
|
753 TheClient->Flush(); |
|
754 // cover (empty) False condition in CWsWindow::SetFadeBehind |
|
755 cwin.FadeBehind(ETrue); |
|
756 TheClient->Flush(); |
|
757 } |
|
758 |
|
759 /*CWsBase*/ |
|
760 |
|
761 void CWsBase::ConstructL(TInt aScreenNumber, TInt aHandle) |
|
762 { |
|
763 User::LeaveIfError(iWs.Connect()); |
|
764 iScrDev=new(ELeave) CWsScreenDevice(iWs); |
|
765 User::LeaveIfError(iScrDev->Construct(aScreenNumber)); |
|
766 iGroup=RWindowGroup(iWs); |
|
767 User::LeaveIfError(iGroup.Construct(aHandle,EFalse)); |
|
768 iGroup.SetOrdinalPosition(0,KMainTestBaseWindow); |
|
769 } |
|
770 |
|
771 void CWsBase::CreateBlankWindowL(RBlankWindow& iWin,TInt aHandle) |
|
772 { |
|
773 iWin=RBlankWindow(iWs); |
|
774 User::LeaveIfError(iWin.Construct(iGroup,aHandle)); |
|
775 } |
|
776 |
|
777 CWsBase::~CWsBase() |
|
778 { |
|
779 iGroup.Close(); |
|
780 delete iScrDev; |
|
781 iWs.Close(); |
|
782 } |
|
783 |
|
784 |
|
785 /*CAnimating*/ |
|
786 |
|
787 TInt CAnimating::StartLC(TAny* aScreenNumber) |
|
788 { |
|
789 CAnimating* self=new(ELeave) CAnimating(); |
|
790 CleanupStack::PushL(self); |
|
791 self->ConstructL((TInt)aScreenNumber); |
|
792 return KErrNone; |
|
793 } |
|
794 |
|
795 void CAnimating::ConstructL(TInt aScreenNumber) |
|
796 { |
|
797 CWsBase::ConstructL(aScreenNumber,798); |
|
798 #if defined(LOGGING) |
|
799 _LIT(KAnimate1,"Constructed CWsBase"); |
|
800 LogMessageText.Copy(KAnimate1); |
|
801 iWs.LogMessage(LogMessageText); |
|
802 iWs.Flush(); |
|
803 #endif |
|
804 iGroup.EnableReceiptOfFocus(EFalse); |
|
805 CreateBlankWindowL(iWindow,799); |
|
806 User::LeaveIfError(iWindow.SetRequiredDisplayMode(EGray16)); |
|
807 iWindow.Activate(); |
|
808 #if defined(LOGGING) |
|
809 _LIT(KAnimate2,"Set up Windows"); |
|
810 LogMessageText.Copy(KAnimate2); |
|
811 iWs.LogMessage(LogMessageText); |
|
812 #endif |
|
813 iWs.Flush(); |
|
814 TDisplayMode displayMode=CWsBase::iScrDev->DisplayMode(); |
|
815 if (displayMode<EGray16) |
|
816 displayMode=EGray16; |
|
817 iScrDev=CFbsScreenDevice::NewL(aScreenNumber,displayMode); |
|
818 User::LeaveIfError(iScrDev->CreateContext(iGc)); |
|
819 #if defined(LOGGING) |
|
820 _LIT(KAnimate3,"Created Screen Device"); |
|
821 LogMessageText.Copy(KAnimate3); |
|
822 iWs.LogMessage(LogMessageText); |
|
823 iWs.Flush(); |
|
824 #endif |
|
825 iDirect=CDirectScreenAccessOld::NewL(iWs,*this); |
|
826 iTimer=CPeriodic::NewL(0); |
|
827 User::LeaveIfError(iControlSem.OpenGlobal(SemControl,EOwnerThread)); //Must be thread relative, since it won't get cleaned up when the thread is killed otherwise |
|
828 User::LeaveIfError(iControlQueue.OpenGlobal(QueueControl,EOwnerThread)); //Must be thread relative, since it won't get cleaned up when the thread is killed otherwise |
|
829 iSemCreated=ETrue; |
|
830 #if defined(LOGGING) |
|
831 _LIT(KAnimate5,"Created Direct, Timer and Semaphore"); |
|
832 LogMessageText.Copy(KAnimate5); |
|
833 iWs.LogMessage(LogMessageText); |
|
834 iWs.Flush(); |
|
835 #endif |
|
836 iScrSize=iScrDev->SizeInPixels(); |
|
837 iGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
838 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
839 StartAnimatingL(); |
|
840 #if defined(LOGGING) |
|
841 _LIT(KAnimate6,"Started Animation"); |
|
842 LogMessageText.Copy(KAnimate6); |
|
843 iWs.LogMessage(LogMessageText); |
|
844 iWs.Flush(); |
|
845 #endif |
|
846 } |
|
847 |
|
848 CAnimating::~CAnimating() |
|
849 //This function should never actually get run in practice |
|
850 { |
|
851 if (iSemCreated) |
|
852 { |
|
853 iControlSem.Close(); |
|
854 iControlQueue.Close(); |
|
855 } |
|
856 if (iDrawingRegion) |
|
857 iDrawingRegion->Destroy(); |
|
858 delete iTimer; |
|
859 delete iDirect; |
|
860 delete iGc; |
|
861 delete iScrDev; |
|
862 iWindow.Close(); |
|
863 } |
|
864 |
|
865 void CAnimating::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) |
|
866 { |
|
867 iTimer->Cancel(); |
|
868 iControlSem.Signal(); |
|
869 TInt data = 2; |
|
870 iControlQueue.Send(&data,sizeof(TInt)); |
|
871 User::After(10000000); //10 secs |
|
872 } |
|
873 |
|
874 TInt NextColor(TAny* aAnimation) |
|
875 { |
|
876 STATIC_CAST(CAnimating*,aAnimation)->DrawFrame(); |
|
877 return(KErrNone); |
|
878 } |
|
879 |
|
880 void CAnimating::DrawFrame() |
|
881 { |
|
882 iColor=(iColor+3)%16; |
|
883 iGc->SetBrushColor(TRgb::Gray16(iColor)); |
|
884 iGc->DrawRect(iScrSize); |
|
885 iScrDev->Update(); |
|
886 if (iColor==2) |
|
887 { |
|
888 iControlSem.Signal(); |
|
889 TInt data = 1; |
|
890 iControlQueue.Send(&data,sizeof(TInt)); |
|
891 } |
|
892 } |
|
893 |
|
894 void CAnimating::StartAnimatingL() |
|
895 { |
|
896 iTimer->Start(0,150000,TCallBack(NextColor,this)); //0.15 secs |
|
897 |
|
898 User::LeaveIfError(iDirect->Request(iDrawingRegion,iWindow)); |
|
899 iGc->SetClippingRegion(iDrawingRegion); |
|
900 } |
|
901 |
|
902 |
|
903 /*CMoveWindow*/ |
|
904 |
|
905 TInt CMoveWindow::StartLC(TAny* aScreenNumber) |
|
906 { |
|
907 CMoveWindow* self=new(ELeave) CMoveWindow(); |
|
908 CleanupStack::PushL(self); |
|
909 self->ConstructL((TInt)aScreenNumber); |
|
910 return KErrNone; |
|
911 } |
|
912 |
|
913 TInt CMoveWindow::FlipChange(TAny* aMoveWin) |
|
914 { |
|
915 Cast(aMoveWin)->FlipChange(); |
|
916 return(KErrNone); |
|
917 } |
|
918 |
|
919 TInt CMoveWindow::StateChange(TAny* aMoveWin) |
|
920 { |
|
921 Cast(aMoveWin)->StateChange(); |
|
922 return(KErrNone); |
|
923 } |
|
924 |
|
925 CMoveWindow::~CMoveWindow() |
|
926 { |
|
927 delete iStateTimer; |
|
928 delete iTimer; |
|
929 iWindow.Close(); |
|
930 iBackUpWin.Close(); |
|
931 delete iGc; |
|
932 } |
|
933 |
|
934 TInt MoveWin(TAny* aMoveWin) |
|
935 { |
|
936 STATIC_CAST(CMoveWindow*,aMoveWin)->MoveWindow(); |
|
937 return(KErrNone); |
|
938 } |
|
939 |
|
940 void CMoveWindow::ConstructL(TInt aScreenNumber) |
|
941 { |
|
942 CWsBase::ConstructL(aScreenNumber,898); |
|
943 iBounceArea=TRect(iScrDev->SizeInPixels()); |
|
944 iSize.iHeight=iBounceArea.iBr.iY/5; |
|
945 iSize.iWidth=iBounceArea.iBr.iX/5; |
|
946 iBounceArea.iTl.iX=iBounceArea.iBr.iX/6; |
|
947 iBounceArea.iBr.iX=5*iBounceArea.iBr.iX/6; |
|
948 iBounceArea.iTl.iY=iBounceArea.iBr.iY/4; |
|
949 iBounceArea.iBr.iY=3*iBounceArea.iBr.iY/4; |
|
950 iDelta=TSize(3,3); |
|
951 iTl=iBounceArea.iTl; |
|
952 CreateBlankWindowL(iWindow,899); |
|
953 iWindow.SetExtent(iTl,iSize); |
|
954 iWindow.SetShadowDisabled(ETrue); |
|
955 iWindow.SetColor(TRgb::Gray4(2)); |
|
956 iWindow.Activate(); |
|
957 iBackUpWin=RBackedUpWindow(iWs); |
|
958 User::LeaveIfError(iBackUpWin.Construct(iGroup,EGray4,698)); |
|
959 User::LeaveIfError(iBackUpWin.SetSizeErr(TSize(2,2))); |
|
960 iGc=new(ELeave) CWindowGc(iScrDev); |
|
961 User::LeaveIfError(iGc->Construct()); |
|
962 iDisplayMode=EGray4; |
|
963 if (MoveInterval>TTimeIntervalMicroSeconds32(0)) |
|
964 CreateTimerL(); |
|
965 if (ModeInterval>TTimeIntervalMicroSeconds32(0)) |
|
966 { |
|
967 iStateTimer=CPeriodic::NewL(0); |
|
968 iStateTimer->Start(ModeInterval,ModeInterval,TCallBack(CMoveWindow::StateChange,this)); |
|
969 } |
|
970 if (FlipInterval>TTimeIntervalMicroSeconds32(0)) |
|
971 { |
|
972 iDevice=new(ELeave) CWsScreenDevice(iWs); |
|
973 User::LeaveIfError(iDevice->Construct(aScreenNumber)); |
|
974 iNumOfModes=iDevice->NumScreenModes(); |
|
975 if (iNumOfModes>1) |
|
976 { |
|
977 iFlipTimer=CPeriodic::NewL(0); |
|
978 iFlipTimer->Start(FlipInterval,FlipInterval,TCallBack(CMoveWindow::FlipChange,this)); |
|
979 } |
|
980 } |
|
981 iStateCountDown=0; |
|
982 } |
|
983 |
|
984 void CMoveWindow::CreateTimerL() |
|
985 { |
|
986 iTimer=CPeriodic::NewL(0); |
|
987 iTimer->Start(0,MoveInterval,TCallBack(MoveWin,this)); |
|
988 |
|
989 } |
|
990 |
|
991 void CMoveWindow::MoveWindow() |
|
992 { |
|
993 if (--iStateCountDown>=0) |
|
994 { |
|
995 if (iStateCountDown==2) |
|
996 ToggleDisplayMode(); |
|
997 return; |
|
998 } |
|
999 TPoint iBr=iTl+iSize; |
|
1000 TSize iDeltaSize; |
|
1001 if ((iDelta.iHeight<0 && iTl.iY<=iBounceArea.iTl.iY) || (iDelta.iHeight>0 && iBr.iY>=iBounceArea.iBr.iY)) |
|
1002 { |
|
1003 iDelta.iHeight=-iDelta.iHeight; |
|
1004 iDeltaSize.iWidth=2; |
|
1005 } |
|
1006 if ((iDelta.iWidth<0 && iTl.iX<=iBounceArea.iTl.iX) || (iDelta.iWidth>0 && iBr.iX>=iBounceArea.iBr.iX)) |
|
1007 { |
|
1008 iDelta.iWidth=-iDelta.iWidth; |
|
1009 if (iDeltaSize.iWidth==0) |
|
1010 iDeltaSize.iHeight=2; |
|
1011 else |
|
1012 iDeltaSize.iWidth=0; |
|
1013 } |
|
1014 iTl+=iDelta; |
|
1015 iSize+=iDeltaSize; |
|
1016 iWindow.SetExtent(iTl,iSize); |
|
1017 iWs.Flush(); |
|
1018 } |
|
1019 |
|
1020 void CMoveWindow::StateChange() |
|
1021 { |
|
1022 if (ImmediateModeSwitch>1) |
|
1023 { |
|
1024 if (MoveInterval>TTimeIntervalMicroSeconds32(0) && iTimer==NULL) |
|
1025 { |
|
1026 TRAPD(err,CreateTimerL()); |
|
1027 if (err==KErrNone) |
|
1028 ImmediateModeSwitch=ETrue; |
|
1029 } |
|
1030 } |
|
1031 if (ImmediateModeSwitch || MoveInterval==TTimeIntervalMicroSeconds32(0)) |
|
1032 ToggleDisplayMode(); |
|
1033 else |
|
1034 { |
|
1035 if (iStateCountDown<-8) |
|
1036 iStateCountDown=6; |
|
1037 } |
|
1038 } |
|
1039 |
|
1040 void CMoveWindow::ToggleDisplayMode() |
|
1041 { |
|
1042 if(iDisplayMode==EColor16MU) |
|
1043 { |
|
1044 return; //Test probably doesn't work with mode EColor16MU |
|
1045 } |
|
1046 iDisplayMode=(iDisplayMode==EColor16M ? EGray4:EColor16M); |
|
1047 #if defined(LOGGING) |
|
1048 TInt newMode= |
|
1049 #endif |
|
1050 iWindow.SetRequiredDisplayMode(iDisplayMode); |
|
1051 iGc->Activate(iBackUpWin); |
|
1052 iBackUpWin.SetPosition(iDisplayMode==EColor16M ? TPoint(1,0):TPoint(0,1)); |
|
1053 #if defined(LOGGING) |
|
1054 TDisplayMode curentMode=iScrDev->DisplayMode(); |
|
1055 _LIT(KToggleMode,"Toggle Display Mode Mode=%d Window=%d Actual=%d"); |
|
1056 LogMessageText.Zero(); |
|
1057 LogMessageText.AppendFormat(KToggleMode,(TInt&)iDisplayMode,newMode,(TInt&)curentMode); |
|
1058 iWs.LogMessage(LogMessageText); |
|
1059 //iWs.LogCommand(RWsSession::ELoggingStatusDump); |
|
1060 #endif |
|
1061 iWs.Flush(); |
|
1062 iGc->Deactivate(); |
|
1063 } |
|
1064 |
|
1065 void CMoveWindow::FlipChange() |
|
1066 { |
|
1067 if (++iCurrentMode==2) //flip between modes 0 and 1 |
|
1068 iCurrentMode=0; |
|
1069 iDevice->SetScreenMode(iCurrentMode); |
|
1070 iWs.Flush(); |
|
1071 } |
|
1072 |
|
1073 // |
|
1074 // CBugFixColorAnimation |
|
1075 // |
|
1076 // This class is used for reproducing a defect found on 6.1: KAA-5J3BLW "Unnecessary Wserv's DSA abort". |
|
1077 // The problem was that a direct screen access client was getting an unnecessary abort notification |
|
1078 // when a new window (or window group) was created but not visible. |
|
1079 // This class will simulate the direct screen access client and it will check whether the first DSA abort |
|
1080 // is not caused by just creating a window. |
|
1081 |
|
1082 CBugFixColorAnimation* CBugFixColorAnimation::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWindowGroup& aParent,TRect aExtent,TBool aStart) |
|
1083 { |
|
1084 CBugFixColorAnimation* self=new(ELeave) CBugFixColorAnimation(aScreenNumber, aId,aCallBack); |
|
1085 CleanupStack::PushL(self); |
|
1086 self->ConstructL(aParent,aExtent); |
|
1087 if (aStart) |
|
1088 { |
|
1089 self->StartL(); |
|
1090 self->Started(); |
|
1091 } |
|
1092 CleanupStack::Pop(self); |
|
1093 return self; |
|
1094 } |
|
1095 |
|
1096 CBugFixColorAnimation::CBugFixColorAnimation(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack) |
|
1097 : CColorAnimation(aScreenNumber, aId, aCallBack) |
|
1098 { |
|
1099 iThreadParam.iScreenNumber = aScreenNumber; |
|
1100 } |
|
1101 |
|
1102 CBugFixColorAnimation::~CBugFixColorAnimation() |
|
1103 { |
|
1104 iSem.Close(); |
|
1105 if(iThread) |
|
1106 { |
|
1107 TRequestStatus status; |
|
1108 iThread->Logon(status); |
|
1109 if (iThread->StillAlive()) |
|
1110 { |
|
1111 iThread->Terminate(KErrNone); |
|
1112 User::WaitForRequest(status); |
|
1113 } |
|
1114 delete iThread; |
|
1115 } |
|
1116 iTestFailed->Cancel(); |
|
1117 delete iTestFailed; |
|
1118 } |
|
1119 |
|
1120 |
|
1121 LOCAL_D TInt TestFailed(TAny* aAnimation) |
|
1122 { |
|
1123 CBugFixColorAnimation* anim=reinterpret_cast<CBugFixColorAnimation*>(aAnimation); |
|
1124 TRAP_IGNORE( |
|
1125 anim->Stop(); |
|
1126 anim->CallBack().Fail(); |
|
1127 anim->FinishTest(); |
|
1128 ); |
|
1129 return KErrNone; |
|
1130 } |
|
1131 |
|
1132 LOCAL_D TInt CreateNewWindowGroup(TAny* aParam) |
|
1133 { |
|
1134 TDirectThreadParam* param = (TDirectThreadParam*)aParam; |
|
1135 TRect rect = param->iRect; |
|
1136 TBool isInFront = param->iIsInFront; |
|
1137 RWsSession ws; |
|
1138 TInt error=ws.Connect(); |
|
1139 |
|
1140 CWsScreenDevice* screen = NULL; |
|
1141 TRAP(error, screen = new (ELeave) CWsScreenDevice(ws)); |
|
1142 if (error!=KErrNone) |
|
1143 { |
|
1144 ws.Close(); |
|
1145 RThread::Rendezvous(error); |
|
1146 return error; |
|
1147 } |
|
1148 |
|
1149 if ((error=screen->Construct(param->iScreenNumber))!=KErrNone) |
|
1150 { |
|
1151 delete screen; |
|
1152 ws.Close(); |
|
1153 RThread::Rendezvous(error); |
|
1154 return error; |
|
1155 } |
|
1156 RSemaphore sem; |
|
1157 error = sem.OpenGlobal(KSem_DefectFix_KAA_5J3BLW_Name, EOwnerThread); |
|
1158 if (error!=KErrNone) |
|
1159 { |
|
1160 ws.Close(); |
|
1161 RThread::Rendezvous(error); |
|
1162 return error; |
|
1163 } |
|
1164 |
|
1165 RThread::Rendezvous(KErrNone); |
|
1166 |
|
1167 // wait for the dsa to start before creating the new window group |
|
1168 sem.Wait(); |
|
1169 sem.Close(); |
|
1170 |
|
1171 |
|
1172 RWindowGroup group(ws); |
|
1173 group.Construct(431,EFalse); |
|
1174 if(isInFront) |
|
1175 { |
|
1176 group.SetOrdinalPosition(0,KAboveMainTestBaseWindow); |
|
1177 } |
|
1178 else |
|
1179 { |
|
1180 group.SetOrdinalPosition(2); |
|
1181 } |
|
1182 RWindow window(ws); |
|
1183 error=window.Construct(group, 432); |
|
1184 if (error==KErrNone) |
|
1185 { |
|
1186 window.SetExtentErr(rect.iTl, rect.Size()); |
|
1187 window.SetOrdinalPosition(0,0); |
|
1188 ws.Flush(); |
|
1189 window.Activate(); |
|
1190 ws.Flush(); |
|
1191 if(!isInFront) |
|
1192 { |
|
1193 group.SetOrdinalPosition(-1); |
|
1194 } |
|
1195 ws.Flush(); |
|
1196 //Wait for wserv to render new window on top of the existing DSA region. |
|
1197 ws.Finish(); |
|
1198 //Now the window has been rendered (and DSA should have been aborted). |
|
1199 window.Close(); |
|
1200 } |
|
1201 |
|
1202 group.Close(); |
|
1203 delete screen; |
|
1204 ws.Close(); |
|
1205 return error; |
|
1206 } |
|
1207 |
|
1208 void CBugFixColorAnimation::ConstructL(CTWindowGroup& aParent,TRect aExtent) |
|
1209 { |
|
1210 CColorAnimation::ConstructL(aParent, aExtent,KDrawingDsa); |
|
1211 _LIT(ThreadName,"Create new Window"); |
|
1212 iAnimRect=aExtent; |
|
1213 TInt error=iSem.CreateGlobal(KSem_DefectFix_KAA_5J3BLW_Name, 0); |
|
1214 if (error==KErrNone) |
|
1215 { |
|
1216 iThreadParam.iRect = iAnimRect; |
|
1217 iThreadParam.iIsInFront = EFalse; |
|
1218 TThreadStartUp function=TThreadStartUp(CreateNewWindowGroup, &iThreadParam); |
|
1219 TRequestStatus status; |
|
1220 iThread=CProcess::NewThreadRendezvousL(ThreadName,&function, status); |
|
1221 User::WaitForRequest(status); |
|
1222 if (status != KErrNone) |
|
1223 { |
|
1224 RDebug::Printf("the request status is returned to be non KErrNone: %d", status.Int()); |
|
1225 TestFailed(this); |
|
1226 } |
|
1227 iTestFailed = CIdle::NewL(0); |
|
1228 } |
|
1229 else |
|
1230 { |
|
1231 TestFailed(this); |
|
1232 } |
|
1233 } |
|
1234 |
|
1235 void CBugFixColorAnimation::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) |
|
1236 { |
|
1237 Stop(); |
|
1238 if (!iTestFailed->IsActive()) |
|
1239 { |
|
1240 iTestFailed->Start(TCallBack(TestFailed,this)); |
|
1241 } |
|
1242 } |
|
1243 |
|
1244 void CBugFixColorAnimation::Restart(RDirectScreenAccess::TTerminationReasons aReason) |
|
1245 { |
|
1246 AbortNow(aReason); |
|
1247 } |
|
1248 |
|
1249 TInt CPanicDirect::DoTestOnNewSchedulerL(TInt aInt, TAny* aPtr) |
|
1250 { |
|
1251 CActiveScheduler* activeScheduler=new(ELeave) CActiveScheduler; |
|
1252 CActiveScheduler::Install(activeScheduler); |
|
1253 CleanupStack::PushL(activeScheduler); |
|
1254 DoTestNowL(aInt,aPtr); |
|
1255 CleanupStack::PopAndDestroy(activeScheduler); |
|
1256 return(EWsExitReasonBad); //calls to this method currently all ignore the return code anyway. |
|
1257 } |
|
1258 |
|
1259 TInt CPanicDirect::DoTestOnNewScheduler(TInt aInt, TAny* aPtr) |
|
1260 { |
|
1261 TInt rv=EWsExitReasonBad; |
|
1262 TRAP_IGNORE(rv=DoTestOnNewSchedulerL(aInt,aPtr)); |
|
1263 return(rv); //calls to this method currently all ignore the return code anyway. |
|
1264 } |
|
1265 |
|
1266 void CPanicDirect::DoTestNowL(TInt aInt, TAny* aPtr) |
|
1267 { |
|
1268 CPanicDirect* self=new(ELeave) CPanicDirect(); |
|
1269 CleanupStack::PushL(self); |
|
1270 self->ConstructL((TInt)aPtr, aInt); |
|
1271 self->TestL(); |
|
1272 CleanupStack::PopAndDestroy(self); |
|
1273 } |
|
1274 |
|
1275 void CPanicDirect::ConstructL(TInt aScreenNumber, TInt aInt) |
|
1276 { |
|
1277 iScreenNumber = aScreenNumber; |
|
1278 |
|
1279 User::LeaveIfError(iTimer.CreateLocal()); |
|
1280 User::LeaveIfError(iWs.Connect()); |
|
1281 iWsScrDev=new(ELeave) CWsScreenDevice(iWs); |
|
1282 User::LeaveIfError(iWsScrDev->Construct(iScreenNumber)); |
|
1283 |
|
1284 #if defined(LOGGING) |
|
1285 _LIT(KPanicThead1,"PanicThread: Into ConstructL"); |
|
1286 LogMessageText.Copy(KPanicThead1); |
|
1287 iWs.LogMessage(LogMessageText); |
|
1288 iWs.Flush(); |
|
1289 #endif |
|
1290 iGroup=RWindowGroup(iWs); |
|
1291 User::LeaveIfError(iGroup.Construct(2200+aInt,EFalse)); |
|
1292 iGroup.SetOrdinalPosition(0,KPanicTestOrdinalPriority); |
|
1293 iBlankWin=RBlankWindow(iWs); |
|
1294 User::LeaveIfError(iBlankWin.Construct(iGroup,2300+aInt)); |
|
1295 iBlankWin.Activate(); |
|
1296 iDirect=RDirectScreenAccess(iWs); |
|
1297 User::LeaveIfError(iDirect.Construct()); |
|
1298 iDisplayMode=iWsScrDev->DisplayMode(); |
|
1299 #if defined(LOGGING) |
|
1300 _LIT(KPanicThead2,"PanicThread: Creating Screen Device, Mode=%d"); |
|
1301 LogMessageText.Format(KPanicThead2,iDisplayMode); |
|
1302 iWs.LogMessage(LogMessageText); |
|
1303 iWs.Flush(); |
|
1304 #endif |
|
1305 iScreenDevice=CFbsScreenDevice::NewL(aScreenNumber,iDisplayMode); |
|
1306 #if defined(LOGGING) |
|
1307 _LIT(KPanicThead3,"PanicThread: Created Device"); |
|
1308 LogMessageText.Copy(KPanicThead3); |
|
1309 iWs.LogMessage(LogMessageText); |
|
1310 iWs.Flush(); |
|
1311 #endif |
|
1312 User::LeaveIfError(iScreenDevice->CreateContext(iGc)); |
|
1313 #if defined(LOGGING) |
|
1314 _LIT(KPanicThead4,"PanicThread: Created Context"); |
|
1315 LogMessageText.Copy(KPanicThead4); |
|
1316 iWs.LogMessage(LogMessageText); |
|
1317 iWs.Flush(); |
|
1318 #endif |
|
1319 iTextDraw=CScrollingTextDrawer::NewL(iScreenNumber,iScreenDevice,*iGc); |
|
1320 #if defined(LOGGING) |
|
1321 _LIT(KPanicThead5,"PanicThread: Created ScrollDrawer"); |
|
1322 LogMessageText.Copy(KPanicThead5); |
|
1323 iWs.LogMessage(LogMessageText); |
|
1324 iWs.Flush(); |
|
1325 #endif |
|
1326 iTextDraw->SetScrollJump(4); |
|
1327 #if defined(LOGGING) |
|
1328 _LIT(KCreatedDrawer,"PanicThread: CreatedDrawer"); |
|
1329 LogMessageText.Copy(KCreatedDrawer); |
|
1330 iWs.LogMessage(LogMessageText); |
|
1331 iWs.Flush(); |
|
1332 #endif |
|
1333 iTestNo=aInt; |
|
1334 } |
|
1335 |
|
1336 CPanicDirect::~CPanicDirect() |
|
1337 { |
|
1338 iDirect.Close(); |
|
1339 delete iGc; |
|
1340 delete iScreenDevice; |
|
1341 delete iTextDraw; |
|
1342 iBlankWin.Close(); |
|
1343 iGroup.Close(); |
|
1344 delete iWsScrDev; |
|
1345 iWs.Close(); |
|
1346 if (iRegion) |
|
1347 iRegion->Close(); |
|
1348 iTimer.Close(); |
|
1349 } |
|
1350 |
|
1351 void CPanicDirect::TestL() |
|
1352 { |
|
1353 if (iTestNo==2) |
|
1354 { |
|
1355 iDirect.Completed(); |
|
1356 return; |
|
1357 } |
|
1358 TInt err=iDirect.Request(iRegion,iDirectStatus,iBlankWin); |
|
1359 if (err!=KErrNone || !iRegion) |
|
1360 return; |
|
1361 TRect screen(iScreenDevice->SizeInPixels()); |
|
1362 TRect bounding=iRegion->BoundingRect(); |
|
1363 if (!screen.Contains(bounding.iTl) || !screen.Contains(bounding.iBr-TPoint(1,1))) |
|
1364 goto Cancel; |
|
1365 iGc->SetClippingRegion(iRegion); |
|
1366 iDrawingAllowed=ETrue; |
|
1367 iTimer.After(iTimerStatus,50000); //0.05secs |
|
1368 FOREVER |
|
1369 { |
|
1370 User::WaitForRequest(iDirectStatus,iTimerStatus); |
|
1371 if (iDirectStatus!=KRequestPending) |
|
1372 iDrawingAllowed=EFalse; |
|
1373 else if (iTimerStatus!=KRequestPending) |
|
1374 { |
|
1375 if (iDrawingAllowed) |
|
1376 DoDrawingL(); |
|
1377 iTimer.After(iTimerStatus,50000); //0.05secs |
|
1378 } |
|
1379 else |
|
1380 { |
|
1381 Cancel: |
|
1382 iDirect.Cancel(); |
|
1383 return; |
|
1384 } |
|
1385 } |
|
1386 } |
|
1387 |
|
1388 void CPanicDirect::DoDrawingL() |
|
1389 { |
|
1390 ++iCount; |
|
1391 iTextDraw->Scroll(); |
|
1392 if (iTestNo==1 && iCount==8) |
|
1393 { |
|
1394 iDirect.Request(iRegion,iDirectStatus,iBlankWin); |
|
1395 return; |
|
1396 } |
|
1397 if (iTestNo==3 && iCount==12) |
|
1398 { |
|
1399 iDirect.Completed(); |
|
1400 iDirect.Completed(); |
|
1401 return; |
|
1402 } |
|
1403 if (iTestNo==4 && iCount==16) |
|
1404 { |
|
1405 iBlankWin.SetSize(TSize(20,25)); |
|
1406 delete iRegion; |
|
1407 User::LeaveIfError(iDirect.Request(iRegion,iDirectStatus,iBlankWin)); |
|
1408 return; |
|
1409 } |
|
1410 if (iTestNo==5 && iCount==19) |
|
1411 { |
|
1412 iWs.Close(); |
|
1413 return; |
|
1414 } |
|
1415 } |
|
1416 |
|
1417 |
|
1418 /*CTDirect*/ |
|
1419 |
|
1420 CTDirect::CTDirect(CTestStep* aStep): |
|
1421 CTWsGraphicsBase(aStep) |
|
1422 { |
|
1423 iState = 0; |
|
1424 iNextFrameFinished = ETrue; |
|
1425 iPackagingFinished = EFalse; |
|
1426 iTimerRunning = EFalse; |
|
1427 } |
|
1428 |
|
1429 CTDirect::~CTDirect() |
|
1430 { |
|
1431 DeleteMoveWindow(); |
|
1432 DeleteScroll(); |
|
1433 |
|
1434 delete iAnim; |
|
1435 TheClient->WaitForRedrawsToFinish(); |
|
1436 delete iCallBackWin; |
|
1437 // put focus back to current screen as this test changed the focus screen to primary screen |
|
1438 TheClient->iWs.SetFocusScreen(iTest->iScreenNumber); |
|
1439 } |
|
1440 |
|
1441 void CTDirect::ConstructL() |
|
1442 { |
|
1443 _LIT(KCTDirectConstructL,"AUTO Construct Direct Test"); |
|
1444 LOG_MESSAGE(KCTDirectConstructL); |
|
1445 FullScreenModeSize=TheClient->iScreen->SizeInPixels(); |
|
1446 iIsScalingSupported=CheckScalingSupportedOrNot(); |
|
1447 iNumOfCallBack=0; |
|
1448 iCallBackWin=new(ELeave) CTBlankWindow; |
|
1449 iCallBackWin->ConstructL(*TheClient->iGroup); |
|
1450 User::LeaveIfError(iCallBackWin->BaseWin()->SetRequiredDisplayMode(EColor256)); |
|
1451 iCallBackWin->SetExt(TPoint(),TheClient->iScreen->SizeInPixels()); |
|
1452 iCallBackWin->SetVisible(EFalse); |
|
1453 iCallBackWin->Activate(); |
|
1454 // the following line makes sure that a console object hidden outside of |
|
1455 // screens range doesn't affect test results being on top of tested objects |
|
1456 TheClient->iGroup->GroupWin()->SetOrdinalPosition(0, KMainTestBaseWindow); |
|
1457 } |
|
1458 |
|
1459 void CTDirect::ConstrucBlankWindowL() |
|
1460 { |
|
1461 delete iWin; |
|
1462 iWin=new(ELeave) CTBlankWindow; |
|
1463 iWin->ConstructL(*TheClient->iGroup); |
|
1464 iWin->BaseWin()->SetShadowDisabled(ETrue); |
|
1465 iWin->BaseWin()->Activate(); |
|
1466 TheClient->Flush(); |
|
1467 } |
|
1468 |
|
1469 void CTDirect::InitialiseAnimationL() |
|
1470 { |
|
1471 ConstrucBlankWindowL(); |
|
1472 TInt colors,greys; |
|
1473 TDisplayMode dispMode=TheClient->iWs.GetDefModeMaxNumColors(colors,greys); |
|
1474 iScrDev=CFbsScreenDevice::NewL(iTest->iScreenNumber,dispMode); |
|
1475 User::LeaveIfError(iScrDev->CreateContext(iGc)); |
|
1476 INFO_PRINTF1(_L(" Constructed Screen Device")); |
|
1477 iScrSize=iScrDev->SizeInPixels(); |
|
1478 TFontSpec fontSpec(FontName,iScrSize.iHeight); |
|
1479 fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); |
|
1480 User::LeaveIfError(iScrDev->GetNearestFontToDesignHeightInPixels(iFont,fontSpec)); |
|
1481 iGc->UseFont(iFont); |
|
1482 iFlags|=eFontSet; |
|
1483 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
1484 TInt fontHeight=iFont->HeightInPixels(); |
|
1485 iDrawRect.iTl.iY=(iScrSize.iHeight-fontHeight)/2; |
|
1486 iDrawRect.SetHeight(fontHeight); |
|
1487 iDrawHeight=iFont->AscentInPixels(); |
|
1488 TSize winSize(25,20); |
|
1489 iWin2=new(ELeave) CTBlankWindow; |
|
1490 iWin2->ConstructL(*TheClient->iGroup); |
|
1491 iWin2->SetExt(TPoint((iScrSize.iWidth-winSize.iWidth)/2,(iScrSize.iHeight-winSize.iHeight)/2),winSize); |
|
1492 iWin2->SetColor(TRgb::Gray4(2)); |
|
1493 iWin2->BaseWin()->Activate(); |
|
1494 INFO_PRINTF1(_L(" Setup Window")); |
|
1495 iScrDev->Update(); |
|
1496 TheClient->iWs.Finish(); |
|
1497 |
|
1498 User::LeaveIfError(iControlSem.CreateGlobal(SemControl,0,KOwnerType)); |
|
1499 User::LeaveIfError(iControlQueue.CreateGlobal(QueueControl,1,sizeof(TInt),KOwnerType)); |
|
1500 |
|
1501 iFlags|=eDirectControlSem; |
|
1502 User::LeaveIfError(iWinSem.CreateGlobal(SemNextOp,0,KOwnerType)); |
|
1503 iFlags|=eDirectWindowSem; |
|
1504 iProcess=CProcess::NewTL(CProcess::eProcessDirectTest,iTest->iScreenNumber,&iThreadStatus); |
|
1505 INFO_PRINTF1(_L(" Constructed Semaphores & Thread")); |
|
1506 iControlSem.Wait(); |
|
1507 |
|
1508 iTimer=CPeriodic::NewL(iTest->EAutoTestPriority); |
|
1509 iRestart=CIdle::NewL(iTest->EAutoTestPriority+5); |
|
1510 iDirect=CDirectScreenAccessOld::NewL(TheClient->iWs,*this); |
|
1511 } |
|
1512 |
|
1513 void CTDirect::DestroyAnimation() |
|
1514 { |
|
1515 ResetScreenSizeMode(); |
|
1516 if(iProcess && iProcess->StillAlive()) |
|
1517 { |
|
1518 if (iFlags&eDirectControlSem) |
|
1519 { |
|
1520 iControlSem.Signal(); |
|
1521 TInt data = 3; |
|
1522 iControlQueue.Send(&data,sizeof(TInt)); |
|
1523 } |
|
1524 if (iFlags&eDirectWindowSem) |
|
1525 iWinSem.Signal(); |
|
1526 } |
|
1527 |
|
1528 delete iTimer; |
|
1529 iTimer=NULL; |
|
1530 delete iRestart; |
|
1531 iRestart=NULL; |
|
1532 delete iDirect; |
|
1533 iDirect=NULL; |
|
1534 delete iChangeScreenModeTimer; |
|
1535 iChangeScreenModeTimer=NULL; |
|
1536 delete iScreenModeTimer; |
|
1537 iScreenModeTimer=NULL; |
|
1538 |
|
1539 if (iFlags&eFontSet) |
|
1540 { |
|
1541 iGc->DiscardFont(); |
|
1542 iScrDev->ReleaseFont(iFont); |
|
1543 } |
|
1544 delete iGc; |
|
1545 if (iDrawingRegion) |
|
1546 iDrawingRegion->Destroy(); |
|
1547 delete iScrDev; |
|
1548 delete iWin; |
|
1549 delete iWin2; |
|
1550 if (iProcess) |
|
1551 { |
|
1552 User::WaitForRequest(iThreadStatus); |
|
1553 delete iProcess; |
|
1554 iProcess = NULL; |
|
1555 } |
|
1556 if (iFlags&eDirectControlSem) |
|
1557 { |
|
1558 iControlSem.Close(); |
|
1559 iControlQueue.Close(); |
|
1560 } |
|
1561 if (iFlags&eDirectWindowSem) |
|
1562 iWinSem.Close(); |
|
1563 } |
|
1564 |
|
1565 void CTDirect::ResetScreenSizeMode() |
|
1566 { |
|
1567 if (iModeBackup!=ESizeEnforcementNone) |
|
1568 { |
|
1569 TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone); |
|
1570 iModeBackup=ESizeEnforcementNone; |
|
1571 } |
|
1572 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal); |
|
1573 TheClient->iScreen->SetScreenMode(0); |
|
1574 TPixelsAndRotation pixelsAndRotation; |
|
1575 TheClient->iScreen->GetDefaultScreenSizeAndRotation(pixelsAndRotation); |
|
1576 TheClient->iScreen->SetScreenSizeAndRotation(pixelsAndRotation); |
|
1577 User::After(350000); //0.35secs |
|
1578 } |
|
1579 |
|
1580 void CTDirect::ScanTypeFacesL() |
|
1581 { |
|
1582 CFbsScreenDevice* scrdev=CFbsScreenDevice::NewL(iTest->iScreenNumber,EGray4); |
|
1583 TTypefaceSupport typeFace; |
|
1584 TInt numFaces=scrdev->NumTypefaces(); |
|
1585 TInt ii; |
|
1586 for (ii=0;ii<numFaces;++ii) |
|
1587 { |
|
1588 scrdev->TypefaceSupport(typeFace,ii); |
|
1589 } |
|
1590 delete scrdev; |
|
1591 } |
|
1592 |
|
1593 TInt RestartAnimation(TAny* aTest) |
|
1594 { |
|
1595 STATIC_CAST(CTDirect*,aTest)->Restart(); |
|
1596 return(KErrNone); |
|
1597 } |
|
1598 |
|
1599 TInt NextFrame(TAny* aTest) |
|
1600 { |
|
1601 STATIC_CAST(CTDirect*,aTest)->DrawFrame(); |
|
1602 return(KErrNone); |
|
1603 } |
|
1604 |
|
1605 void CTDirect::AbortNow(RDirectScreenAccess::TTerminationReasons aReason) |
|
1606 { |
|
1607 TEST(aReason==RDirectScreenAccess::ETerminateRegion); |
|
1608 |
|
1609 if (iDelay) |
|
1610 User::After(2000000); //2 secs |
|
1611 if (iCancelNext) |
|
1612 { |
|
1613 iFrameNo=eDirectNumFrames; |
|
1614 iTimer->Cancel(); |
|
1615 iDirect->Cancel(); |
|
1616 TheClient->Flush(); |
|
1617 iNextFrameFinished = ETrue; |
|
1618 iState++; |
|
1619 return; |
|
1620 } |
|
1621 iRestart->Start(TCallBack(RestartAnimation,this)); |
|
1622 } |
|
1623 |
|
1624 TBool CTDirect::Restart() |
|
1625 { |
|
1626 StartDirect(); |
|
1627 return ETrue; |
|
1628 } |
|
1629 |
|
1630 #pragma warning( disable : 4244 ) //conversion from 'int' to 'unsigned short', possible loss of data |
|
1631 TBool CTDirect::DrawFrame() |
|
1632 { |
|
1633 if (iFrameNo==eDirectNumFrames) |
|
1634 { |
|
1635 iState++; |
|
1636 iTimer->Cancel(); |
|
1637 if (iFrameNo==eDirectNumFrames) |
|
1638 iDirect->Cancel(); |
|
1639 iNextFrameFinished = ETrue; |
|
1640 return EFalse; |
|
1641 } |
|
1642 _LIT(Text,"A0"); |
|
1643 TBuf<2> iString(Text); //_LIT(Text,"ABCabc123"); |
|
1644 iString[0]+=iFrameNo; |
|
1645 iString[1]+=iFrameNo; |
|
1646 TInt textWidth=iFont->TextWidthInPixels(iString); |
|
1647 TInt maxTextWidth=Max(textWidth,iLastTextWidth); |
|
1648 iLastTextWidth=textWidth; |
|
1649 if (iLastMaxTextWidth!=maxTextWidth) |
|
1650 { |
|
1651 iLastMaxTextWidth=maxTextWidth; |
|
1652 iDrawRect.iTl.iX=(iScrSize.iWidth-iLastMaxTextWidth)/2; |
|
1653 iDrawRect.SetWidth(iLastMaxTextWidth); |
|
1654 } |
|
1655 TInt colorOffset=iFrameNo%2; |
|
1656 iGc->SetPenColor(TRgb::Gray4(colorOffset)); |
|
1657 iGc->DrawText(iString,iDrawRect,iDrawHeight,CGraphicsContext::ECenter); |
|
1658 iGc->SetPenColor(TRgb::Gray4(1+colorOffset)); |
|
1659 iGc->DrawLine(TPoint(),iScrSize.AsPoint()); |
|
1660 iGc->DrawLine(TPoint(iScrSize.iWidth,0),TPoint(0,iScrSize.iHeight)); |
|
1661 iGc->DrawLine(TPoint(iScrSize.iWidth/2,0),TPoint(iScrSize.iWidth/2,iScrSize.iHeight)); |
|
1662 iGc->DrawLine(TPoint(0,iScrSize.iHeight/2),TPoint(iScrSize.iWidth,iScrSize.iHeight/2)); |
|
1663 iScrDev->Update(); |
|
1664 ++iFrameNo; |
|
1665 if (iFrameNo==iFrameToSignalAfter) |
|
1666 SignalWindow(); |
|
1667 return ETrue; |
|
1668 } |
|
1669 #pragma warning( default : 4244 ) |
|
1670 |
|
1671 void CTDirect::SignalWindow() |
|
1672 { |
|
1673 switch(iState) |
|
1674 { |
|
1675 case 0: |
|
1676 switch(iFrameNo) |
|
1677 { |
|
1678 case 0: |
|
1679 iFrameToSignalAfter=0; |
|
1680 } |
|
1681 return; |
|
1682 case 1: |
|
1683 case 3: |
|
1684 switch(iFrameNo) |
|
1685 { |
|
1686 case 0: |
|
1687 iFrameToSignalAfter=3; |
|
1688 iDelay=(iState==3); |
|
1689 return; |
|
1690 case 3: |
|
1691 WinExt.SetSize(TSize(iScrSize.iWidth/2-5,iScrSize.iHeight/2+30)); |
|
1692 iFrameToSignalAfter=5; |
|
1693 break; |
|
1694 case 5: |
|
1695 iFrameToSignalAfter=7; |
|
1696 break; |
|
1697 case 7: |
|
1698 WinExt.SetSize(TSize(iScrSize.iWidth/2+30,iScrSize.iHeight/2-5)); |
|
1699 WinCol=1; |
|
1700 iFrameToSignalAfter=8; |
|
1701 break; |
|
1702 case 8: |
|
1703 iFrameToSignalAfter=0; |
|
1704 iDelay=EFalse; |
|
1705 break; |
|
1706 } |
|
1707 break; |
|
1708 case 2: |
|
1709 switch(iFrameNo) |
|
1710 { |
|
1711 case 0: |
|
1712 iFrameToSignalAfter=2; |
|
1713 return; |
|
1714 case 2: |
|
1715 WinExt.SetRect(TPoint(iScrSize.iWidth/2-15,iScrSize.iHeight/2-20),TSize(iScrSize.iWidth/3,iScrSize.iHeight/3)); |
|
1716 WinCol=2; |
|
1717 iFrameToSignalAfter=5; |
|
1718 break; |
|
1719 case 5: |
|
1720 iFrameToSignalAfter=6; |
|
1721 break; |
|
1722 case 6: |
|
1723 WinExt.SetRect(TPoint(iScrSize.iWidth/2-50,iScrSize.iHeight/3),TSize(iScrSize.iWidth/4,iScrSize.iHeight/3)); |
|
1724 WinCol=3; |
|
1725 iFrameToSignalAfter=8; |
|
1726 break; |
|
1727 case 8: |
|
1728 iFrameToSignalAfter=0; |
|
1729 break; |
|
1730 } |
|
1731 break; |
|
1732 case 4: |
|
1733 switch(iFrameNo) |
|
1734 { |
|
1735 case 0: |
|
1736 iFrameToSignalAfter=3; |
|
1737 return; |
|
1738 case 3: |
|
1739 iFrameToSignalAfter=6; |
|
1740 iWin2->SetVisible(EFalse); |
|
1741 TheClient->Flush(); |
|
1742 return; |
|
1743 case 6: |
|
1744 iFrameToSignalAfter=0; |
|
1745 iWin2->SetVisible(ETrue); |
|
1746 TheClient->Flush(); |
|
1747 return; |
|
1748 } |
|
1749 break; |
|
1750 case 5: |
|
1751 switch(iFrameNo) |
|
1752 { |
|
1753 case 0: |
|
1754 iFrameToSignalAfter=6; |
|
1755 return; |
|
1756 case 6: |
|
1757 iFrameToSignalAfter=0; |
|
1758 WinExt.SetRect(10,10,20,20); |
|
1759 iCancelNext=ETrue; |
|
1760 break; |
|
1761 } |
|
1762 break; |
|
1763 case 6: |
|
1764 switch(iFrameNo) |
|
1765 { |
|
1766 case 0: |
|
1767 iFrameToSignalAfter=7; |
|
1768 iCancelNext=EFalse; |
|
1769 return; |
|
1770 case 7: |
|
1771 iFrameToSignalAfter=0; |
|
1772 delete iWin; |
|
1773 TheClient->Flush(); |
|
1774 iWin=NULL; |
|
1775 iWindowDead=ETrue; |
|
1776 return; |
|
1777 } |
|
1778 break; |
|
1779 } |
|
1780 #if defined(LOGGING) |
|
1781 _LIT(KSignal,"Signaling Move Window"); |
|
1782 LogMessageText.Copy(KSignal); |
|
1783 TheClient->iWs.LogMessage(LogMessageText); |
|
1784 TheClient->Flush(); |
|
1785 #endif |
|
1786 iWinSem.Signal(); |
|
1787 } |
|
1788 |
|
1789 void CTDirect::StartDirect() |
|
1790 { |
|
1791 if (iWin==NULL) |
|
1792 { |
|
1793 TEST(iWindowDead); |
|
1794 if (!iWindowDead) |
|
1795 INFO_PRINTF3(_L("iWindowDead - Expected: %d, Actual: %d"), ETrue, iWindowDead); |
|
1796 |
|
1797 iFrameNo=eDirectNumFrames; |
|
1798 return; |
|
1799 } |
|
1800 TEST(!iWindowDead); |
|
1801 if (iWindowDead) |
|
1802 INFO_PRINTF3(_L("iWindowDead - Expected: %d, Actual: %d"), EFalse, iWindowDead); |
|
1803 |
|
1804 if (iDrawingRegion) |
|
1805 iDrawingRegion->Destroy(); |
|
1806 TInt retVal = iDirect->Request(iDrawingRegion,*iWin->BaseWin()); |
|
1807 TEST(retVal==KErrNone); |
|
1808 if (retVal!=KErrNone) |
|
1809 INFO_PRINTF3(_L("iDirect->Request(iDrawingRegion,*iWin->BaseWin()) return value - Expected: %d, Actual: %d"), KErrNone, retVal); |
|
1810 |
|
1811 iGc->SetClippingRegion(iDrawingRegion); |
|
1812 } |
|
1813 |
|
1814 void CTDirect::LogLeave(TInt aErr) |
|
1815 { |
|
1816 iTest->LogLeave(aErr); |
|
1817 } |
|
1818 |
|
1819 void CTDirect::Fail() |
|
1820 { |
|
1821 TEST(EFalse); |
|
1822 } |
|
1823 |
|
1824 void CTDirect::Finished(TInt aId) |
|
1825 { |
|
1826 //aId refers to the animation, it is not the test number |
|
1827 _LIT(KCTDirectFinished,"Destroying animation number %d"); |
|
1828 LOG_MESSAGE2(KCTDirectFinished,aId); |
|
1829 switch (aId) |
|
1830 { |
|
1831 case 10: |
|
1832 case 11: |
|
1833 ResetScreenSizeMode(); |
|
1834 case 9: |
|
1835 iPackagingFinished = ETrue; |
|
1836 case 8: |
|
1837 DeleteMoveWindow(); |
|
1838 //iPackagingFinished = ETrue; |
|
1839 if (iScroll) |
|
1840 { |
|
1841 DeleteScroll(); |
|
1842 #if defined(LOGGING) |
|
1843 _LIT(KDeleteScroll,"Deleting Scroll Text Id=%d TimerActive=%d"); |
|
1844 LogMessageText.Zero(); |
|
1845 LogMessageText.AppendFormat(KDeleteScroll,aId,iAnim->IsTimerActive()); |
|
1846 TheClient->iWs.LogMessage(LogMessageText); |
|
1847 TheClient->Flush(); |
|
1848 #endif |
|
1849 } |
|
1850 if (aId==8 && iAnim->IsTimerActive()) |
|
1851 return; |
|
1852 case 1: |
|
1853 case 12: |
|
1854 case 25: //case DSA using Region tracking Only (abort signal expceted) |
|
1855 case 26: //case DSA using Region tracking Only (abort signal not expceted) |
|
1856 { |
|
1857 iPackagingFinished = ETrue; |
|
1858 delete iAnim; |
|
1859 iAnim=NULL; |
|
1860 CHECKHANDLES: |
|
1861 TInt numProcessHandles; |
|
1862 TInt numThreadHandles; |
|
1863 RThread().HandleCount(numProcessHandles,numThreadHandles); |
|
1864 TEST(Abs(numThreadHandles-iNumThreadHandles)<2); |
|
1865 if (Abs(numThreadHandles-iNumThreadHandles)>=2) |
|
1866 INFO_PRINTF3(_L("Abs(numThreadHandles-iNumThreadHandles)<2 - Expected: %d or less, Actual: %d"), 2, Abs(numThreadHandles-iNumThreadHandles)); |
|
1867 } |
|
1868 break; |
|
1869 case 16: |
|
1870 case 15: |
|
1871 { |
|
1872 // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest() |
|
1873 // until this is the second call i.e. one of aId = 15 or aId = 16 has already been finished. |
|
1874 TInt index = aId-15; |
|
1875 iAnims[index]->Stop(); |
|
1876 delete iAnims[index]; |
|
1877 iAnims[index]=NULL; |
|
1878 // This test creates two animations iAnims[0] and iAnims[1]. |
|
1879 // Use (index ^ 1 ) = Toggle the Index, to get the index of other animation. |
|
1880 // If iAnims [ index ^ 1] is NULL then this is the second Call and test is finished. |
|
1881 if (iAnims[index ^ 1] != NULL) |
|
1882 { |
|
1883 return; |
|
1884 } |
|
1885 iPackagingFinished = ETrue; |
|
1886 goto CHECKHANDLES; |
|
1887 } |
|
1888 case 13: |
|
1889 { |
|
1890 iPackagingFinished = ETrue; |
|
1891 delete iBlankTopClientWin1; |
|
1892 // delete iBlankTopClientWin2; |
|
1893 TInt jj; |
|
1894 for (jj=0;jj<4;++jj) |
|
1895 iAnims[jj]->Stop(); |
|
1896 for (jj=0;jj<4;++jj) |
|
1897 delete iAnims[jj]; |
|
1898 break; |
|
1899 } |
|
1900 case 14: |
|
1901 { |
|
1902 iPackagingFinished = ETrue; |
|
1903 iAnims[0]->Stop(); |
|
1904 delete iAnims[0]; |
|
1905 if (iNumOfModes==iCurrentMode) |
|
1906 { |
|
1907 ResetScreenSizeMode(); |
|
1908 iCallBackWin->SetVisible(EFalse); |
|
1909 break; |
|
1910 } |
|
1911 break; |
|
1912 } |
|
1913 case 18: |
|
1914 case 17: |
|
1915 { |
|
1916 // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest() |
|
1917 // until this is the second call i.e. one of aId = 17 or aId = 18 has already been finished. |
|
1918 TInt ii = 0; |
|
1919 TBool finished = ETrue; |
|
1920 if (aId == 17) |
|
1921 { |
|
1922 iAnims[0]->Stop(); |
|
1923 delete iAnims[0]; |
|
1924 iAnims[0] = NULL; |
|
1925 for (ii=1;ii<=iNumAnimation;++ii) |
|
1926 { |
|
1927 if (iAnims[ii]) |
|
1928 { |
|
1929 finished = EFalse; |
|
1930 break; |
|
1931 } |
|
1932 } |
|
1933 } |
|
1934 else // aId == 18 |
|
1935 { |
|
1936 for (ii=1;ii<=iNumAnimation;++ii) |
|
1937 { |
|
1938 iAnims[ii]->Stop(); |
|
1939 delete iAnims[ii]; |
|
1940 iAnims[ii] = NULL; |
|
1941 } |
|
1942 if (iAnims[0]) |
|
1943 { |
|
1944 finished = EFalse; |
|
1945 } |
|
1946 } |
|
1947 if (!finished) |
|
1948 { |
|
1949 return; |
|
1950 } |
|
1951 iPackagingFinished = ETrue; |
|
1952 break; |
|
1953 } |
|
1954 case 19: |
|
1955 { |
|
1956 iPackagingFinished = ETrue; |
|
1957 iAnims[0]->Stop(); |
|
1958 delete iAnims[0]; |
|
1959 break; |
|
1960 } |
|
1961 case 21: |
|
1962 case 20: |
|
1963 { |
|
1964 // Stop the animation and delete it, but make sure that you don't increment iState and call Rquest() |
|
1965 // until this is the second call i.e. one of aId = 20 or aId = 21 has already been finished. |
|
1966 TInt index = aId-20; |
|
1967 iAnims[index]->Stop(); |
|
1968 delete iAnims[index]; |
|
1969 iAnims[index]=NULL; |
|
1970 // This test creates two animations iAnims[0] and iAnims[1]. |
|
1971 // Use (index ^ 1 ) = Toggle the Index, to get the index of other animation. |
|
1972 // If iAnims [ index ^ 1] is NULL then this is the second Call and test is finished. |
|
1973 if (iAnims[index ^ 1] != NULL) |
|
1974 { |
|
1975 return; |
|
1976 } |
|
1977 DeleteMoveWindow(); |
|
1978 iPackagingFinished = ETrue; |
|
1979 goto CHECKHANDLES; |
|
1980 } //unreachable line, no need for break |
|
1981 case 24: |
|
1982 iPackagingFinished = ETrue; |
|
1983 iAnim->Stop(); |
|
1984 delete iAnim; |
|
1985 iAnim=NULL; |
|
1986 //don't want to increase state, so decrement, since it is incremented below |
|
1987 //as part of processing normal completions. This is to reenter the test |
|
1988 //to call Fail() if required |
|
1989 iState--; |
|
1990 break; |
|
1991 |
|
1992 case 27: |
|
1993 case 28: |
|
1994 case 29: |
|
1995 case 30: |
|
1996 case 31: |
|
1997 case 32: |
|
1998 iAnims[aId-27]->Stop(); |
|
1999 delete iAnims[aId-27]; |
|
2000 iAnims[aId-27] = NULL; |
|
2001 if(aId != 32) |
|
2002 { |
|
2003 return; |
|
2004 } |
|
2005 DeleteMoveWindow(); |
|
2006 iPackagingFinished = ETrue; |
|
2007 break; |
|
2008 default: |
|
2009 iPackagingFinished = ETrue; |
|
2010 TInt ii; |
|
2011 for (ii=0;ii<6;++ii) |
|
2012 iAnims[ii]->Stop(); |
|
2013 for (ii=0;ii<6;++ii) |
|
2014 delete iAnims[ii]; |
|
2015 DeleteMoveWindow(); |
|
2016 break; |
|
2017 } |
|
2018 #if defined(LOGGING) |
|
2019 _LIT(KRequest,"Signal Start NextTest Id=%d, State=%d(+1)"); |
|
2020 LogMessageText.Zero(); |
|
2021 LogMessageText.AppendFormat(KRequest,aId,iState); |
|
2022 TheClient->iWs.LogMessage(LogMessageText); |
|
2023 TheClient->Flush(); |
|
2024 #endif |
|
2025 iState++; |
|
2026 } |
|
2027 |
|
2028 void CTDirect::DeleteMoveWindow() |
|
2029 { |
|
2030 if (iMoveWin) |
|
2031 { |
|
2032 TRequestStatus status; |
|
2033 iMoveWin->Logon(status); |
|
2034 if (iMoveWin->StillAlive()) |
|
2035 { |
|
2036 iMoveWin->Terminate(KErrNone); |
|
2037 User::WaitForRequest(status); |
|
2038 } |
|
2039 delete iMoveWin; |
|
2040 iMoveWin=NULL; |
|
2041 } |
|
2042 } |
|
2043 |
|
2044 void CTDirect::DeleteScroll() |
|
2045 { |
|
2046 if (iScroll) |
|
2047 { |
|
2048 TheClient->iScreen->SetScreenMode(0); |
|
2049 iScroll->Stop(); |
|
2050 delete iScroll; |
|
2051 iScroll=NULL; |
|
2052 } |
|
2053 } |
|
2054 |
|
2055 TDisplayMode CTDirect::DisplayMode(TInt aId) |
|
2056 { |
|
2057 switch (aId) |
|
2058 { |
|
2059 case 1: |
|
2060 case 13: |
|
2061 case 15: |
|
2062 case 16: |
|
2063 return EColor16; |
|
2064 case 2: |
|
2065 return EGray16; |
|
2066 case 3: |
|
2067 return EColor16; |
|
2068 case 4: |
|
2069 case 14: |
|
2070 case 17: |
|
2071 case 18: |
|
2072 case 19: |
|
2073 case 24: |
|
2074 return EColor256; |
|
2075 case 5: |
|
2076 return EGray256; |
|
2077 case 6: |
|
2078 return EColor4K; |
|
2079 case 7: |
|
2080 return EColor64K; |
|
2081 case 8: |
|
2082 case 9: |
|
2083 case 10: |
|
2084 case 11: |
|
2085 case 12: |
|
2086 { |
|
2087 TInt colors,grays; |
|
2088 /*TDisplayMode mode=*/TheClient->iWs.GetDefModeMaxNumColors(colors,grays); |
|
2089 if (colors==0) |
|
2090 return EGray4; |
|
2091 return (aId==8? EGray16:EColor16); |
|
2092 } |
|
2093 default:; |
|
2094 return TheClient->iScreen->DisplayMode(); |
|
2095 } |
|
2096 } |
|
2097 |
|
2098 void CTDirect::Log(const TText8* aFile, TInt aLine, TInt aSeverity,const TDesC& aString) |
|
2099 { |
|
2100 Logger().LogExtra(((TText8*)aFile), aLine, aSeverity, aString) ; |
|
2101 } |
|
2102 |
|
2103 TRgb CTDirect::BrushColorL(TInt aId,TInt& aColor,TBool& aFinished) |
|
2104 { |
|
2105 aFinished=EFalse; |
|
2106 switch (aId) |
|
2107 { |
|
2108 case 1: |
|
2109 case 13: |
|
2110 case 14: |
|
2111 case 15: |
|
2112 case 16: |
|
2113 case 17: |
|
2114 case 18: |
|
2115 case 19: |
|
2116 case 20: |
|
2117 case 21: |
|
2118 case 27: |
|
2119 aFinished=(aColor==20); |
|
2120 return TRgb::Color16(27 + aColor++); |
|
2121 case 28: |
|
2122 aFinished=(aColor==17); |
|
2123 return TRgb::Color16(28 + aColor++); |
|
2124 case 29: |
|
2125 aFinished=(aColor==15); |
|
2126 return TRgb::Color16(29 + aColor++); |
|
2127 case 8: |
|
2128 if (aColor==15) |
|
2129 { |
|
2130 ++iCycles; |
|
2131 aFinished=(iCycles==5); |
|
2132 } |
|
2133 else if (!iScroll) |
|
2134 aFinished=ETrue; |
|
2135 else if (!iScroll->IsRunning()) |
|
2136 iScroll->ContinueL(); |
|
2137 { |
|
2138 #if defined(LOGGING) |
|
2139 if (aFinished || iScroll==NULL) |
|
2140 { |
|
2141 _LIT(KColor,"Col=%d Cycles=%d Fin=%d iScroll=%d"); |
|
2142 LogMessageText.Zero(); |
|
2143 LogMessageText.AppendFormat(KColor,aColor,iCycles,aFinished,(TInt&)iScroll); |
|
2144 TheClient->iWs.LogMessage(LogMessageText); |
|
2145 TheClient->Flush(); |
|
2146 } |
|
2147 #endif |
|
2148 } |
|
2149 case 2: |
|
2150 if (aColor==16) |
|
2151 aColor=0; |
|
2152 return TRgb::Gray16(aColor++); |
|
2153 case 9: |
|
2154 case 10: |
|
2155 aFinished=iCycles>3; |
|
2156 case 11: |
|
2157 case 3: |
|
2158 if (aColor==16) |
|
2159 { |
|
2160 ++iCycles; |
|
2161 aColor=0; |
|
2162 } |
|
2163 return TRgb::Color16(aColor++); |
|
2164 case 4: |
|
2165 aFinished=(aColor==256); |
|
2166 return TRgb::Color256(aColor++); |
|
2167 case 5: |
|
2168 if (aColor==256) |
|
2169 aColor=0; |
|
2170 return TRgb::Gray256(aColor++); |
|
2171 case 6: |
|
2172 aColor+=127; |
|
2173 if (aColor>4095) |
|
2174 aColor-=4096; |
|
2175 return TRgb::Color4K(aColor); |
|
2176 case 7: |
|
2177 aColor+=211; |
|
2178 if (aColor>65535) |
|
2179 aColor-=65536; |
|
2180 return TRgb::Color64K(aColor++); |
|
2181 case 12: |
|
2182 aFinished=2*(aColor>5); |
|
2183 return TRgb::Color16(aColor++); |
|
2184 case 24: |
|
2185 iCycles++; |
|
2186 if (iCycles==5) |
|
2187 { |
|
2188 aFinished=ETrue; |
|
2189 CheckForTemporaryDeadlock(); |
|
2190 } |
|
2191 return TRgb::Color16(aColor++); |
|
2192 case 30: |
|
2193 aFinished=(aColor==256); |
|
2194 return TRgb::Color16(aColor++); |
|
2195 case 31: |
|
2196 aFinished=(aColor==100); |
|
2197 return TRgb::Color16(aColor++); |
|
2198 case 32: |
|
2199 aFinished=(aColor==300); |
|
2200 return TRgb::Color16(aColor++); |
|
2201 default:; |
|
2202 aFinished=ETrue; |
|
2203 return TRgb::Gray2(1); //White |
|
2204 } |
|
2205 } |
|
2206 |
|
2207 TInt CTDirect::TimerInterval(TInt aId) |
|
2208 { |
|
2209 switch (aId) |
|
2210 { |
|
2211 case 1: |
|
2212 case 15: |
|
2213 case 16: |
|
2214 case 17: |
|
2215 case 18: |
|
2216 case 20: |
|
2217 case 21: |
|
2218 return 143200; |
|
2219 case 27: |
|
2220 return 200000; |
|
2221 case 28: |
|
2222 return 180000; |
|
2223 case 29: |
|
2224 return 170000; |
|
2225 case 30: |
|
2226 return 200000; |
|
2227 case 31: |
|
2228 return 205000; |
|
2229 case 32: |
|
2230 return 300000; |
|
2231 case 2: |
|
2232 case 25: |
|
2233 case 26: |
|
2234 return 234567; |
|
2235 case 3: |
|
2236 return 200000; |
|
2237 case 4: |
|
2238 return 11718; |
|
2239 case 5: |
|
2240 return 13719; |
|
2241 case 6: |
|
2242 return 14719; |
|
2243 case 7: |
|
2244 return 15719; |
|
2245 case 8: |
|
2246 return 275000; |
|
2247 case 9: |
|
2248 return 210000; |
|
2249 case 10: |
|
2250 return 110000; |
|
2251 case 11: |
|
2252 return 123456; |
|
2253 case 12: |
|
2254 return 10627; |
|
2255 case 19: |
|
2256 return 1000000; |
|
2257 default:; |
|
2258 return 1; |
|
2259 } |
|
2260 } |
|
2261 |
|
2262 void CTDirect::FailedReStart(TInt /*aId*/,TInt /*aReason*/) |
|
2263 { |
|
2264 Fail(); |
|
2265 } |
|
2266 |
|
2267 TInt CTDirect::SlowStopping(TInt aId,TInt aCount) |
|
2268 { |
|
2269 if (aId==8) |
|
2270 return (aCount>1 ? CColorAnimation::eAbortAll : CColorAnimation::eStopNow); |
|
2271 if (aId==9 || aId==10) |
|
2272 return CColorAnimation::eStopNow; |
|
2273 TInt ret=(2*aId-3==aCount%12); |
|
2274 if (ret && aId==5) |
|
2275 { |
|
2276 ++iCount; |
|
2277 if (iCount==5) |
|
2278 return CColorAnimation::eAbort; |
|
2279 } |
|
2280 return ret; |
|
2281 } |
|
2282 |
|
2283 void CTDirect::ModeSwitch() |
|
2284 { |
|
2285 TRAPD(err,iAnim->ChangeModeL(EGray4)); |
|
2286 iWin2->SetSize(TSize(20,25)); |
|
2287 TheClient->Flush(); |
|
2288 if (err!=KErrNone) |
|
2289 Fail(); |
|
2290 } |
|
2291 |
|
2292 TestState CTDirect::AnimateWindowL() |
|
2293 { |
|
2294 // if (!iTimer->IsActive()) |
|
2295 { |
|
2296 |
|
2297 |
|
2298 iFrameNo=0; |
|
2299 SignalWindow(); |
|
2300 |
|
2301 |
|
2302 iTimer->Start(0,200000,TCallBack(NextFrame,this)); //0.2 secs |
|
2303 |
|
2304 StartDirect(); |
|
2305 TEST(iDrawingRegion->BoundingRect()==iScrSize); |
|
2306 } |
|
2307 // else |
|
2308 // { |
|
2309 // int i=0; |
|
2310 // } |
|
2311 return EWait; |
|
2312 } |
|
2313 |
|
2314 TestState CTDirect::AnimationDiesL() |
|
2315 { |
|
2316 INFO_PRINTF1(_L("AUTO Animation Dies ")); |
|
2317 _LIT(ThreadName,"AnimationDie"); |
|
2318 iFirstFunction=TThreadStartUp(CAnimating::StartLC,(TAny*)iTest->iScreenNumber); |
|
2319 CProcess* thread=CProcess::NewThreadL(ThreadName,&iFirstFunction); |
|
2320 CleanupStack::PushL(thread); |
|
2321 thread->LeaveIfDied(); |
|
2322 INFO_PRINTF1(_L(" Constructed Thread")); |
|
2323 iControlSem.Wait(); |
|
2324 RWindowGroup group(TheClient->iWs); |
|
2325 group.Construct(431,EFalse); |
|
2326 RBlankWindow win(TheClient->iWs); |
|
2327 win.Construct(group,432); |
|
2328 win.SetExtent(TPoint(12,34),TSize(56,78)); |
|
2329 win.Activate(); |
|
2330 INFO_PRINTF1(_L(" Constructed Windows")); |
|
2331 iControlSem.Wait(); |
|
2332 User::After(1000000); //1 sec |
|
2333 TRequestStatus threadDied; |
|
2334 thread->Logon(threadDied); |
|
2335 thread->Terminate(KErrGeneral); |
|
2336 INFO_PRINTF1(_L(" Waiting for Thread")); |
|
2337 User::WaitForRequest(threadDied); |
|
2338 CleanupStack::PopAndDestroy(thread); |
|
2339 win.Close(); |
|
2340 group.Close(); |
|
2341 INFO_PRINTF1(_L(" Finished")); |
|
2342 return ENext; |
|
2343 } |
|
2344 |
|
2345 TestState CTDirect::PackagingClassL() |
|
2346 { |
|
2347 ConstrucBlankWindowL(); |
|
2348 TInt numProcessHandles; |
|
2349 RThread().HandleCount(numProcessHandles,iNumThreadHandles); |
|
2350 iAnim=CColorAnimation::NewL(iTest->iScreenNumber,1,*this,*TheClient->iGroup,TRect(10,10,630,230),ETrue); |
|
2351 return EWait; |
|
2352 } |
|
2353 |
|
2354 TestState CTDirect::MultipleL() |
|
2355 { |
|
2356 TSize scrSize=TheClient->iScreen->SizeInPixels(); |
|
2357 |
|
2358 iFlags|=eMultiAnim; |
|
2359 iAnims[0]=CColorAnimation::NewL(iTest->iScreenNumber,2,*this,*TheClient->iGroup, |
|
2360 TRect(0,10,scrSize.iWidth/3+20,scrSize.iHeight/2-5),EFalse); |
|
2361 iAnims[1]=CColorAnimation::NewL(iTest->iScreenNumber,3,*this,*TheClient->iGroup, |
|
2362 TRect(10,scrSize.iHeight/2-20,scrSize.iWidth/3-5,scrSize.iHeight),EFalse); |
|
2363 iAnims[3]=CColorAnimation::NewL(iTest->iScreenNumber,5,*this,*TheClient->iGroup, |
|
2364 TRect(scrSize.iWidth/3-20,scrSize.iHeight/2+5,2*scrSize.iWidth/3+20,scrSize.iHeight-10),EFalse); |
|
2365 iAnims[2]=CColorAnimation::NewL(iTest->iScreenNumber,4,*this,*TheClient->iGroup, |
|
2366 TRect(scrSize.iWidth/3+5,0,2*scrSize.iWidth/3-5,scrSize.iHeight/2+20),EFalse); |
|
2367 iAnims[4]=CColorAnimation::NewL(iTest->iScreenNumber,6,*this,*TheClient->iGroup, |
|
2368 TRect(2*scrSize.iWidth/3-20,15,scrSize.iWidth,scrSize.iHeight/2+50),EFalse); |
|
2369 iAnims[5]=CColorAnimation::NewL(iTest->iScreenNumber,7,*this,*TheClient->iGroup, |
|
2370 TRect(2*scrSize.iWidth/3+5,-20,scrSize.iWidth-15,scrSize.iHeight+10),ETrue); |
|
2371 TInt ii; |
|
2372 for (ii=0;ii<5;++ii) |
|
2373 iAnims[ii]->StartL(); |
|
2374 _LIT(ThreadName,"MoveWin"); |
|
2375 |
|
2376 MoveInterval=100000; //0.1 secs |
|
2377 ModeInterval=1200000; //1.2 sec |
|
2378 ImmediateModeSwitch=EFalse; |
|
2379 iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber); |
|
2380 iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction); |
|
2381 return EWait; |
|
2382 } |
|
2383 |
|
2384 TestState CTDirect::MixDsaAndRegionTrackingOnlyL(TBool aWhoExitsLast) |
|
2385 { |
|
2386 TSize scrSize=TheClient->iScreen->SizeInPixels(); |
|
2387 |
|
2388 iFlags|=eMultiAnim; |
|
2389 TUint firstRegionTrackinOnlyDsa = (aWhoExitsLast == KRegionTrackingOnlyDsaExistLast ? 0 : 3); |
|
2390 TUint firstDrawingDsa = (aWhoExitsLast == KDrawingDsaExistLast ? 0 : 3); |
|
2391 |
|
2392 //DSAs who use region tracking only |
|
2393 iAnims[firstRegionTrackinOnlyDsa]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+27,*this,*TheClient->iGroup, |
|
2394 TRect(10,scrSize.iHeight/2-20,scrSize.iWidth/3-5,scrSize.iHeight),EFalse,KRegionTrackingOnly); |
|
2395 iAnims[firstRegionTrackinOnlyDsa+1]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+28,*this,*TheClient->iGroup, |
|
2396 TRect(2*scrSize.iWidth/3-20,15,scrSize.iWidth,scrSize.iHeight/2+50),EFalse,KRegionTrackingOnly); |
|
2397 iAnims[firstRegionTrackinOnlyDsa+2]=CColorAnimation::NewL(iTest->iScreenNumber,firstRegionTrackinOnlyDsa+29,*this,*TheClient->iGroup, |
|
2398 TRect(2*scrSize.iWidth/3+5,-20,scrSize.iWidth-15,scrSize.iHeight+10),EFalse,KRegionTrackingOnly); |
|
2399 |
|
2400 //DSAs who actually draw |
|
2401 iAnims[firstDrawingDsa]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+27,*this,*TheClient->iGroup, |
|
2402 TRect(0,10,scrSize.iWidth/3+20,scrSize.iHeight/2-5),EFalse,KDrawingDsa); |
|
2403 iAnims[firstDrawingDsa+1]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+28,*this,*TheClient->iGroup, |
|
2404 TRect(scrSize.iWidth/3+5,0,2*scrSize.iWidth/3-5,scrSize.iHeight/2+20),EFalse,KDrawingDsa); |
|
2405 iAnims[firstDrawingDsa+2]=CColorAnimation::NewL(iTest->iScreenNumber,firstDrawingDsa+29,*this,*TheClient->iGroup, |
|
2406 TRect(scrSize.iWidth/3-20,scrSize.iHeight/2+5,2*scrSize.iWidth/3+20,scrSize.iHeight-10),EFalse,KDrawingDsa); |
|
2407 |
|
2408 TInt ii; |
|
2409 for (ii=0;ii<6;++ii) |
|
2410 { |
|
2411 if(iAnims[ii]) |
|
2412 iAnims[ii]->StartL(); |
|
2413 } |
|
2414 |
|
2415 _LIT(ThreadName,"MoveWin"); |
|
2416 |
|
2417 MoveInterval=100000; //0.1 secs |
|
2418 ModeInterval=1200000; //1.2 secs |
|
2419 ImmediateModeSwitch=EFalse; |
|
2420 iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber); |
|
2421 iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction); |
|
2422 return EWait; |
|
2423 } |
|
2424 |
|
2425 TestState CTDirect::TryDifferentSupportedModesL() |
|
2426 { |
|
2427 |
|
2428 RWsSession session; |
|
2429 User::LeaveIfError(session.Connect()); |
|
2430 CWsScreenDevice* device = new(ELeave) CWsScreenDevice(session); |
|
2431 CleanupStack::PushL(device); |
|
2432 User::LeaveIfError(device->Construct(iTest->iScreenNumber)); |
|
2433 TUint numOfModes=device->NumScreenModes(); |
|
2434 _LIT(KTryingCurrentMode,"Trying Mode = %d"); |
|
2435 for(TUint currentMode =0; currentMode < numOfModes; currentMode++) |
|
2436 { |
|
2437 LOG_MESSAGE2(KTryingCurrentMode,currentMode); |
|
2438 device->SetScreenMode(currentMode); |
|
2439 TRAPD(err,iAnims[0]=CColorAnimation::NewL(iTest->iScreenNumber,4,*this,*TheClient->iGroup, |
|
2440 TRect(0,0,50,50),ETrue)); |
|
2441 if(err!=KErrNone) |
|
2442 { |
|
2443 TEST(EFalse); |
|
2444 } |
|
2445 else |
|
2446 { |
|
2447 User::After(2000000); |
|
2448 iAnims[0]->Stop(); |
|
2449 delete iAnims[0]; |
|
2450 } |
|
2451 } |
|
2452 CleanupStack::PopAndDestroy(device); |
|
2453 session.Close(); |
|
2454 iState++; |
|
2455 return EWait; |
|
2456 } |
|
2457 |
|
2458 |
|
2459 TestState CTDirect::FailCodesL() |
|
2460 { |
|
2461 __UHEAP_MARK; |
|
2462 TRequestStatus status; |
|
2463 RRegion region(TRect(0,0,10,10),1); |
|
2464 RRegion* pRegion=®ion; |
|
2465 RDirectScreenAccess direct(TheClient->iWs); |
|
2466 User::LeaveIfError(direct.Construct()); |
|
2467 RBlankWindow window(TheClient->iWs); |
|
2468 User::LeaveIfError(window.Construct(*TheClient->iGroup->WinTreeNode(),1234)); |
|
2469 TInt err=direct.Request(pRegion,status,window); |
|
2470 TEST(err==KErrNone); |
|
2471 if (err!=KErrNone) |
|
2472 INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNone, err); |
|
2473 TEST(pRegion!=NULL); |
|
2474 if (pRegion==NULL) |
|
2475 INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0); |
|
2476 pRegion->Destroy(); |
|
2477 direct.Cancel(); |
|
2478 User::WaitForRequest(status); |
|
2479 window.Activate(); |
|
2480 window.SetOrdinalPosition(-2); |
|
2481 pRegion=®ion; |
|
2482 err=direct.Request(pRegion,status,window); |
|
2483 TEST(err==KErrNone); |
|
2484 if (err!=KErrNone) |
|
2485 INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNone, err); |
|
2486 TEST(pRegion!=NULL); |
|
2487 if (pRegion==NULL) |
|
2488 INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0); |
|
2489 pRegion->Destroy(); |
|
2490 direct.Cancel(); |
|
2491 User::WaitForRequest(status); |
|
2492 #if defined(__WINS__) |
|
2493 // Loop over the allocations done. |
|
2494 // There is one allocating of the rectangle list and |
|
2495 // one of the region holding the list |
|
2496 for (TInt rate = 1; rate <= 2; rate++) |
|
2497 { |
|
2498 window.SetOrdinalPosition(0); |
|
2499 pRegion=®ion; |
|
2500 TheClient->Flush(); |
|
2501 __UHEAP_FAILNEXT(rate); |
|
2502 err=direct.Request(pRegion,status,window); |
|
2503 TEST(err==KErrNoMemory); |
|
2504 if (err!=KErrNoMemory) |
|
2505 INFO_PRINTF3(_L("direct.Request(pRegion,status,window) return value - Expected: %d, Actual: %d"), KErrNoMemory, err); |
|
2506 |
|
2507 TEST(pRegion==NULL); |
|
2508 if (pRegion!=NULL) |
|
2509 INFO_PRINTF3(_L("pRegion!=NULL - Expected: %d, Actual: %d"), 0, 0); |
|
2510 } |
|
2511 #endif |
|
2512 window.Close(); |
|
2513 direct.Close(); |
|
2514 region.Close(); |
|
2515 __UHEAP_MARKEND; |
|
2516 return ENext; |
|
2517 } |
|
2518 |
|
2519 void CTDirect::ScrolingTextL(TInt aId,TRect aWinRect,TBool aStartThread,TInt aScreenMode/*=0*/) |
|
2520 { |
|
2521 INFO_PRINTF1(_L("AUTO Construct ScrolingText ")); |
|
2522 INFO_PRINTF1(_L(" Constructed Window")); |
|
2523 iCycles=0; |
|
2524 TInt numProcessHandles; |
|
2525 RThread().HandleCount(numProcessHandles,iNumThreadHandles); |
|
2526 iAnim=CColorAnimation::NewL(iTest->iScreenNumber,aId,*this,*TheClient->iGroup,aWinRect,EFalse); |
|
2527 iScroll=CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse); |
|
2528 INFO_PRINTF1(_L(" Constructed Text Scroller & Animation")); |
|
2529 iAnim->BringWindowToFront(); |
|
2530 if (aStartThread) |
|
2531 { |
|
2532 _LIT(ThreadName,"MoveWin"); |
|
2533 INFO_PRINTF1(_L(" About to constructed Thread")); |
|
2534 iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber); |
|
2535 __ASSERT_DEBUG(!iMoveWin,AutoPanic(EAutoPanicDirect)); |
|
2536 iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction); |
|
2537 INFO_PRINTF1(_L(" Constructed Thread")); |
|
2538 } |
|
2539 if (aScreenMode>0) |
|
2540 { |
|
2541 TInt numScreenModes = TheClient->iScreen->NumScreenModes(); |
|
2542 if (aScreenMode < numScreenModes) |
|
2543 TheClient->iScreen->SetScreenMode(aScreenMode); |
|
2544 else |
|
2545 LOG_MESSAGE(_L("WARNING: Failed to change screen mode")); |
|
2546 // We have to run the test anyway to avoid things going wrong later |
|
2547 } |
|
2548 iAnim->StartOrPanic(); |
|
2549 iScroll->StartL(); |
|
2550 INFO_PRINTF1(_L(" Constructed/Started")); |
|
2551 #if defined(LOGGING) |
|
2552 _LIT(KStarted,"Finished StartUp ScrollText"); |
|
2553 LogMessageText.Copy(KStarted); |
|
2554 TheClient->iWs.LogMessage(LogMessageText); |
|
2555 TheClient->Flush(); |
|
2556 #endif |
|
2557 } |
|
2558 |
|
2559 TestState CTDirect::ScrolingText1L() |
|
2560 { |
|
2561 MoveInterval=0; |
|
2562 ModeInterval=1200000; //1.2 sec |
|
2563 ScrolingTextL(8,TRect(20,20,40,40),ETrue); |
|
2564 return EWait; |
|
2565 } |
|
2566 |
|
2567 TestState CTDirect::RClassL() |
|
2568 { |
|
2569 #if defined(LOGGING) |
|
2570 _LIT(KRClass,"Starting Panic test on RClass"); |
|
2571 LogMessageText.Zero(); |
|
2572 LogMessageText.AppendFormat(KRClass); |
|
2573 TheClient->iWs.LogMessage(LogMessageText); |
|
2574 TheClient->Flush(); |
|
2575 #endif |
|
2576 TEST(iTest->TestWsPanicL(CPanicDirect::DoTestOnNewScheduler,EWservPanicDirectMisuse,1,(TAny*)iTest->iScreenNumber)); |
|
2577 #if defined(LOGGING) |
|
2578 _LIT(KPanic1,"Done First Panic"); |
|
2579 LogMessageText.Zero(); |
|
2580 LogMessageText.AppendFormat(KPanic1); |
|
2581 TheClient->iWs.LogMessage(LogMessageText); |
|
2582 TheClient->Flush(); |
|
2583 #endif |
|
2584 #if defined(__WINS__) |
|
2585 #if defined(LOGGING) |
|
2586 _LIT(KPanic2,"Doing 2 debug panics"); |
|
2587 LogMessageText.Zero(); |
|
2588 LogMessageText.AppendFormat(KPanic2); |
|
2589 TheClient->iWs.LogMessage(LogMessageText); |
|
2590 TheClient->Flush(); |
|
2591 #endif |
|
2592 TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,2,(TAny*)iTest->iScreenNumber)); |
|
2593 TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,3,(TAny*)iTest->iScreenNumber)); |
|
2594 #endif |
|
2595 #if defined(LOGGING) |
|
2596 _LIT(KPanicTest,"Trying Panic %d"); |
|
2597 LogMessageText.Zero(); |
|
2598 LogMessageText.AppendFormat(KPanicTest,4); |
|
2599 TheClient->iWs.LogMessage(LogMessageText); |
|
2600 TheClient->Flush(); |
|
2601 #endif |
|
2602 TEST(iTest->TestWsPanicL(CPanicDirect::DoTestOnNewScheduler,EWservPanicDirectMisuse,4,(TAny*)iTest->iScreenNumber)); |
|
2603 TEST(iTest->TestW32PanicL(CPanicDirect::DoTestOnNewScheduler,EW32PanicDirectMisuse,5,(TAny*)iTest->iScreenNumber)); |
|
2604 return ENext; |
|
2605 } |
|
2606 |
|
2607 TestState CTDirect::ScrolingText2L() |
|
2608 { |
|
2609 MoveInterval=81234; //0.08 sec |
|
2610 ModeInterval=140123; //0.14 sec |
|
2611 ImmediateModeSwitch=2; |
|
2612 ScrolingTextL(9,TRect(15,25,45,35),ETrue); |
|
2613 iScroll->SetCountDown(5); |
|
2614 return EWait; |
|
2615 } |
|
2616 |
|
2617 TestState CTDirect::ScrolingText3L() |
|
2618 { |
|
2619 iModeBackup=TheClient->iScreen->ScreenModeEnforcement(); |
|
2620 if (iModeBackup!=ESizeEnforcementNone) |
|
2621 TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone); |
|
2622 MoveInterval=0; |
|
2623 ModeInterval=0; |
|
2624 FlipInterval=1200000; //1.2 secs |
|
2625 ScrolingTextL(10,TRect(25,30,35,45),ETrue,1); |
|
2626 iScroll->SetBottomOfTest(80); //So it can be seen in both screen modes |
|
2627 return EWait; |
|
2628 } |
|
2629 |
|
2630 TestState CTDirect::ScrolingText4L() |
|
2631 { |
|
2632 iModeBackup=TheClient->iScreen->ScreenModeEnforcement(); |
|
2633 if (iModeBackup!=ESizeEnforcementNone) |
|
2634 TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone); |
|
2635 MoveInterval=876543; //0.88 secs |
|
2636 ModeInterval=2178900; //2.18 secs |
|
2637 FlipInterval=5000000; //5 secs |
|
2638 ScrolingTextL(11,TRect(30,40,55,65),ETrue); |
|
2639 iScroll->SetBottomOfTest(80); //So it can be seen in both screen modes |
|
2640 return EWait; |
|
2641 } |
|
2642 |
|
2643 void CTDirect::CreateAnimForScreenModeL(TInt aAnimIndex,CTWinBase& aParent,TRect aRect,TInt aId) |
|
2644 { |
|
2645 iAnims[aAnimIndex]=CColorAnimation::NewL(iTest->iScreenNumber,aId,*this,aParent,aRect,EFalse); |
|
2646 iAnims[aAnimIndex]->StartL(); |
|
2647 iAnims[aAnimIndex]->BringWindowToFront(); |
|
2648 } |
|
2649 |
|
2650 void CTDirect::BlankTopClientWindowL(CTBlankWindow& aBlankWindow,TRect aRect) |
|
2651 { |
|
2652 aBlankWindow.ConstructExtLD(*TheClient->iGroup,aRect.iTl,aRect.Size()); |
|
2653 User::LeaveIfError(aBlankWindow.BaseWin()->SetRequiredDisplayMode(EColor256)); |
|
2654 aBlankWindow.BaseWin()->SetShadowDisabled(ETrue); |
|
2655 aBlankWindow.Activate(); |
|
2656 } |
|
2657 |
|
2658 static TInt ChangeScreenModeL(TAny* aTest) |
|
2659 { |
|
2660 STATIC_CAST(CTDirect*,aTest)->ChangeToNextScreenModeL(); |
|
2661 return KErrNone; |
|
2662 } |
|
2663 |
|
2664 void CTDirect::ChangeToNextScreenModeL() |
|
2665 { |
|
2666 #if defined(LOGGING) |
|
2667 _LIT(KChangeMode,"AUTO Screen Mode Pos Test2 CallBack"); |
|
2668 LogMessageText.Copy(KChangeMode); |
|
2669 TheClient->LogMessage(LogMessageText); |
|
2670 TheClient->iWs.LogCommand(RWsSession::ELoggingStatusDump); |
|
2671 #endif |
|
2672 iNumOfModes=TheClient->iScreen->NumScreenModes(); |
|
2673 if (iCurrentMode<iNumOfModes) |
|
2674 { |
|
2675 TPixelsAndRotation pixelsAndRotation; |
|
2676 SetScreenMode(iCurrentMode,pixelsAndRotation); |
|
2677 TInt oldCurrentMode=iCurrentMode; |
|
2678 CArrayFixFlat<TInt>* rotations=new(ELeave) CArrayFixFlat<TInt>(1); |
|
2679 CleanupStack::PushL(rotations); |
|
2680 User::LeaveIfError(TheClient->iScreen->GetRotationsList(iCurrentMode,rotations)); |
|
2681 TInt count=rotations->Count(); |
|
2682 TInt jj=0; |
|
2683 if (count>1) |
|
2684 { |
|
2685 for (jj=0;jj<count;) |
|
2686 { |
|
2687 if ((*rotations)[jj++]==pixelsAndRotation.iRotation) |
|
2688 { |
|
2689 break; |
|
2690 } |
|
2691 } |
|
2692 if (jj==count) |
|
2693 { |
|
2694 jj=0; |
|
2695 } |
|
2696 } |
|
2697 if (jj==0) |
|
2698 { |
|
2699 iCurrentMode++; |
|
2700 } |
|
2701 TInt currentRotation=(*rotations)[jj]; |
|
2702 TheClient->iScreen->SetCurrentRotations(oldCurrentMode,REINTERPRET_CAST(CFbsBitGc::TGraphicsOrientation&,currentRotation)); |
|
2703 CleanupStack::PopAndDestroy(rotations); |
|
2704 TheClient->iScreen->GetScreenModeSizeAndRotation(oldCurrentMode,pixelsAndRotation); |
|
2705 TInt screenWidth=pixelsAndRotation.iPixelSize.iWidth; |
|
2706 TInt screenHeight=pixelsAndRotation.iPixelSize.iHeight; |
|
2707 TPoint screenModeOrigin=TheClient->iScreen->GetScreenModeScaledOrigin(oldCurrentMode); |
|
2708 TPoint point1(screenModeOrigin.iX,screenModeOrigin.iY+(screenModeOrigin.iY+screenHeight)/2); |
|
2709 TPoint point2(screenModeOrigin.iX+(screenModeOrigin.iX+screenWidth)/2,screenHeight+screenModeOrigin.iY); |
|
2710 TRect rect0(point1,point2); |
|
2711 TRect rect1(TPoint(0,0),rect0.Size()); |
|
2712 CreateAnimForScreenModeL(0,*TheClient->iGroup,rect1,14); |
|
2713 TPoint pos=iAnims[0]->AbsoluteWindowPosition(); |
|
2714 TEST(pos==TPoint(0,0)); |
|
2715 } |
|
2716 } |
|
2717 |
|
2718 TInt ChangeScreenScaleCallBack(TAny* aTest) |
|
2719 { |
|
2720 static_cast<CTDirect*>(aTest)->ChangeScreenScale(); |
|
2721 return KErrNone; |
|
2722 } |
|
2723 |
|
2724 void CTDirect::ChangeScreenScale() |
|
2725 { |
|
2726 if (!iNumOfCallBack) |
|
2727 { |
|
2728 iCurrentMode=TheClient->iScreen->CurrentScreenMode(); |
|
2729 iModeData=TheClient->iScreen->GetCurrentScreenModeAttributes(); |
|
2730 iModeData.iScreenScale.SetSize(1,1); |
|
2731 } |
|
2732 TSizeMode testMode=iModeData; |
|
2733 if (!iNumOfCallBack) |
|
2734 { |
|
2735 testMode.iScreenScale.SetSize(2,2); |
|
2736 } |
|
2737 else if (iNumOfCallBack==1) |
|
2738 { |
|
2739 testMode.iScreenScale.SetSize(3,2); |
|
2740 } |
|
2741 else if (iNumOfCallBack==2) |
|
2742 { |
|
2743 testMode.iScreenScale.SetSize(2,3); |
|
2744 } |
|
2745 TheClient->iScreen->SetCurrentScreenModeAttributes(testMode); |
|
2746 TheClient->iScreen->SetAppScreenMode(iCurrentMode); |
|
2747 TheClient->iScreen->SetScreenMode(iCurrentMode); |
|
2748 if (iNumOfCallBack==2) |
|
2749 { |
|
2750 iScreenModeTimer->Cancel(); |
|
2751 delete iScreenModeTimer; |
|
2752 iScreenModeTimer=NULL; |
|
2753 } |
|
2754 iNumOfCallBack++; |
|
2755 } |
|
2756 |
|
2757 /* |
|
2758 * Creates a DSA for screen mode 0. After DSA has displayd 2 or 3 frames screen mode |
|
2759 * scale is changed with a timer. The DSA aborts and restarts once again |
|
2760 * and completes itself in different screen mode. |
|
2761 */ |
|
2762 TestState CTDirect::ScreenModeTestForScalingL() |
|
2763 { |
|
2764 CreateAnimForScreenModeL(0,*TheClient->iGroup,TRect(TSize(10,10)),19); |
|
2765 iScreenModeTimer=CPeriodic::NewL(0); |
|
2766 MoveInterval=2000000; |
|
2767 iScreenModeTimer->Start(1000,MoveInterval,TCallBack(ChangeScreenScaleCallBack,this)); |
|
2768 return EWait; |
|
2769 } |
|
2770 |
|
2771 /* |
|
2772 * Creates a DSA for screen mode 0, tests API AbsoluteWindowPosition() |
|
2773 * Then sets screen mode to last(test) screen mode, here it does the same thing as |
|
2774 * done for screenmode 0, but with diffrerent scale (2,2) (2,3) (3,2) (3,3) and |
|
2775 * with different origin (20,30) (30,20) (20,20). |
|
2776 * Lastly copy back the test screen mode values. |
|
2777 */ |
|
2778 TestState CTDirect::ScreenModeScalingTestL() |
|
2779 { |
|
2780 #if defined(LOGGING) |
|
2781 INFO_PRINTF1("AUTO ScreenModeScalingTest "); |
|
2782 #else |
|
2783 // DisabledStartLogText(); |
|
2784 #endif |
|
2785 INFO_PRINTF1(_L(" Switch to mode 0")); |
|
2786 iModeData.iScreenScale.iWidth=1; |
|
2787 iModeData.iScreenScale.iHeight=1; |
|
2788 TheClient->iScreen->SetCurrentScreenModeAttributes(iModeData); |
|
2789 TheClient->iScreen->SetAppScreenMode(0); |
|
2790 TheClient->iScreen->SetScreenMode(0); |
|
2791 iCurrentMode=0; |
|
2792 INFO_PRINTF1(_L(" Get Parameters")); |
|
2793 iCurrentScreenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin(); |
|
2794 iCurrentScreenModeScale=TheClient->iScreen->GetCurrentScreenModeScale(); |
|
2795 Copy2ndHalfOfScreen=(iCurrentScreenModeOrigin.iX>FullScreenModeSize.iWidth/2? 1 : 0); |
|
2796 TRect testWinRect(PhysicalToLogical(TPoint(),iCurrentScreenModeScale), |
|
2797 PhysicalToLogical(TPoint((Copy2ndHalfOfScreen ? FullScreenModeSize.iWidth : |
|
2798 FullScreenModeSize.iWidth/2), |
|
2799 FullScreenModeSize.iHeight)- |
|
2800 iCurrentScreenModeOrigin,iCurrentScreenModeScale) |
|
2801 ); |
|
2802 testWinRect.Shrink(10,10); |
|
2803 INFO_PRINTF1(_L(" Create Animation")); |
|
2804 CreateAnimForScreenModeL(0,*TheClient->iGroup,testWinRect,17); |
|
2805 TPoint pos0=iAnims[0]->AbsoluteWindowPosition(); |
|
2806 TEST(pos0==TPoint(10,10)); |
|
2807 |
|
2808 TInt numOfModes=TheClient->iScreen->NumScreenModes(); |
|
2809 iCurrentMode=numOfModes-1; |
|
2810 INFO_PRINTF1(_L(" Switch to Last Mode")); |
|
2811 TheClient->iScreen->SetAppScreenMode(iCurrentMode); |
|
2812 TheClient->iScreen->SetScreenMode(iCurrentMode); |
|
2813 TSizeMode storeModeData=TheClient->iScreen->GetCurrentScreenModeAttributes(); |
|
2814 TSizeMode testMode=storeModeData; |
|
2815 iNumAnimation=0; |
|
2816 for (TInt xScale=2;xScale<4;xScale++) |
|
2817 { |
|
2818 INFO_PRINTF1(_L(" New X-Scale")); |
|
2819 for (TInt yScale=2;yScale<4;yScale++) |
|
2820 { |
|
2821 INFO_PRINTF1(_L(" New Y-Scale")); |
|
2822 testMode.iScreenScale=TSize(xScale,yScale); |
|
2823 TestDifferentOriginAndScaleL(testMode,TPoint(20,20)); |
|
2824 TestDifferentOriginAndScaleL(testMode,TPoint(20,30)); |
|
2825 TestDifferentOriginAndScaleL(testMode,TPoint(30,20)); |
|
2826 } |
|
2827 } |
|
2828 TheClient->iScreen->SetScreenMode(iCurrentMode); |
|
2829 TheClient->iScreen->SetCurrentScreenModeAttributes(storeModeData); |
|
2830 INFO_PRINTF1(_L(" Set To Mode 0")); |
|
2831 TheClient->iScreen->SetAppScreenMode(0); |
|
2832 TheClient->iScreen->SetScreenMode(0); |
|
2833 return EWait; |
|
2834 } |
|
2835 |
|
2836 void CTDirect::TestDifferentOriginAndScaleL(TSizeMode &aMode,TPoint aOrigin) |
|
2837 { |
|
2838 aMode.iOrigin=aOrigin; |
|
2839 TheClient->iScreen->SetCurrentScreenModeAttributes(aMode); |
|
2840 TheClient->iScreen->SetAppScreenMode(iCurrentMode); |
|
2841 TheClient->iScreen->SetScreenMode(iCurrentMode); |
|
2842 iCurrentScreenModeOrigin=TheClient->iScreen->GetScreenModeOrigin(iCurrentMode); |
|
2843 iCurrentScreenModeScale=TheClient->iScreen->GetScreenModeScale(iCurrentMode); |
|
2844 Copy2ndHalfOfScreen=(iCurrentScreenModeOrigin.iX>FullScreenModeSize.iWidth/2? 1 : 0); |
|
2845 TRect testWinRect(PhysicalToLogical(TPoint(),iCurrentScreenModeScale), |
|
2846 PhysicalToLogical(TPoint((Copy2ndHalfOfScreen ? FullScreenModeSize.iWidth |
|
2847 : FullScreenModeSize.iWidth/2), |
|
2848 FullScreenModeSize.iHeight) |
|
2849 -iCurrentScreenModeOrigin,iCurrentScreenModeScale) |
|
2850 ); |
|
2851 testWinRect.Shrink(10,10); |
|
2852 ++iNumAnimation; |
|
2853 CreateAnimForScreenModeL(iNumAnimation,*TheClient->iGroup,testWinRect,18); |
|
2854 TPoint pos0=iAnims[iNumAnimation]->AbsoluteWindowPosition(); |
|
2855 TEST(pos0==TPoint(10,10)); |
|
2856 } |
|
2857 |
|
2858 //REQUIREMENT: CR PHAR-5SJGAM, PREQ673 |
|
2859 //Tests that DSA works correctly in screen modes with non-zero screen mode origin. |
|
2860 TestState CTDirect::DSAWithScreenModeOffset1L() |
|
2861 { |
|
2862 TPoint screenModeTwoOrigin=TheClient->iScreen->GetScreenModeScaledOrigin(2); |
|
2863 TPixelsAndRotation pixelsAndRotation; |
|
2864 TheClient->iScreen->GetScreenModeSizeAndRotation(2,pixelsAndRotation); |
|
2865 if(pixelsAndRotation.iRotation != CFbsBitGc::EGraphicsOrientationNormal) |
|
2866 { |
|
2867 TheClient->iScreen->SetCurrentRotations(2, CFbsBitGc::EGraphicsOrientationNormal); |
|
2868 } |
|
2869 TheClient->iScreen->GetScreenModeSizeAndRotation(2,pixelsAndRotation); |
|
2870 //check that the current rotation is normal |
|
2871 __ASSERT_DEBUG(pixelsAndRotation.iRotation==CFbsBitGc::EGraphicsOrientationNormal,AutoPanic(EAutoPanicDirect)); |
|
2872 TInt screenWidthMode2=pixelsAndRotation.iPixelSize.iWidth; |
|
2873 TInt screenHeightMode2=pixelsAndRotation.iPixelSize.iHeight; |
|
2874 TPoint point1(screenModeTwoOrigin.iX,screenModeTwoOrigin.iY+(screenModeTwoOrigin.iY+screenHeightMode2)/2); |
|
2875 TPoint point2(screenModeTwoOrigin.iX+(screenModeTwoOrigin.iX+screenWidthMode2)/2,screenHeightMode2+screenModeTwoOrigin.iY); |
|
2876 TPoint point3(screenModeTwoOrigin.iX+screenWidthMode2,screenModeTwoOrigin.iY+screenHeightMode2); |
|
2877 |
|
2878 SetScreenMode(0,pixelsAndRotation); |
|
2879 TRect rect0(point1,point2); |
|
2880 CreateAnimForScreenModeL(0,*TheClient->iGroup,rect0,13); |
|
2881 TPoint pos0=iAnims[0]->AbsoluteWindowPosition(); |
|
2882 TEST(pos0==point1); |
|
2883 |
|
2884 SetScreenMode(2,pixelsAndRotation); |
|
2885 TRect rect1(TPoint(0,0),rect0.Size()); |
|
2886 CreateAnimForScreenModeL(1,*TheClient->iGroup,rect1,13); |
|
2887 TPoint pos1=iAnims[1]->AbsoluteWindowPosition(); |
|
2888 TEST(pos1==rect1.iTl); |
|
2889 |
|
2890 SetScreenMode(0,pixelsAndRotation); |
|
2891 iBlankTopClientWin1=new(ELeave) CTBlankWindow(); |
|
2892 // TInt ordpos = iBlankTopClientWin1->BaseWin()->OrdinalPosition(); |
|
2893 TRect rect2(TPoint(point2.iX,point1.iY),point3); |
|
2894 BlankTopClientWindowL(*iBlankTopClientWin1,rect2); |
|
2895 TInt x=rect2.Size().iWidth/4; |
|
2896 TPoint animWinPt(x,0); |
|
2897 rect2.Shrink(x,0); |
|
2898 CreateAnimForScreenModeL(2,*iBlankTopClientWin1,TRect(animWinPt,rect2.Size()),13); |
|
2899 TPoint pos2=iAnims[2]->AbsoluteWindowPosition(); |
|
2900 TEST(pos2==rect2.iTl); |
|
2901 |
|
2902 SetScreenMode(2,pixelsAndRotation); |
|
2903 iBlankTopClientWin2=new(ELeave) CTBlankWindow(); |
|
2904 // ordpos = iBlankTopClientWin2->BaseWin()->OrdinalPosition(); |
|
2905 TPoint tl(rect1.iBr.iX,0); |
|
2906 TRect rect3(tl,TPoint(screenWidthMode2,rect1.iBr.iY)); |
|
2907 BlankTopClientWindowL(*iBlankTopClientWin2,rect3); |
|
2908 x=rect3.Size().iWidth/4; |
|
2909 animWinPt=TPoint(x,0); |
|
2910 rect3.Shrink(x,0); |
|
2911 CreateAnimForScreenModeL(3,*iBlankTopClientWin2,TRect(animWinPt,rect3.Size()),13); |
|
2912 TPoint pos3=iAnims[3]->AbsoluteWindowPosition(); |
|
2913 TEST(pos3==(animWinPt+tl)); |
|
2914 |
|
2915 SetScreenMode(0,pixelsAndRotation); |
|
2916 return EWait; |
|
2917 } |
|
2918 |
|
2919 //REQUIREMENT: CR PHAR-5SJGAM, PREQ673 |
|
2920 //Tests that DSA works correctly in screen modes with non-zero screen mode origin and different rotations |
|
2921 TestState CTDirect::DSAWithScreenModeOffset2L() |
|
2922 { |
|
2923 iCurrentMode=0; |
|
2924 TTimeIntervalMicroSeconds32 timeBetweenScreenModeChange=3200000; |
|
2925 iCallBackWin->WinTreeNode()->SetOrdinalPosition(0); |
|
2926 iCallBackWin->SetVisible(ETrue); //Used to forsce screen into Color256 so that it will rotate |
|
2927 iChangeScreenModeTimer=CPeriodic::NewL(0); |
|
2928 iChangeScreenModeTimer->Start(0,timeBetweenScreenModeChange,TCallBack(ChangeScreenModeL,this)); |
|
2929 return EWait; |
|
2930 } |
|
2931 |
|
2932 void CTDirect::SetScreenMode(TInt aMode,TPixelsAndRotation& aPixelsAndRotation) |
|
2933 { |
|
2934 TheClient->iScreen->SetScreenMode(aMode); |
|
2935 TheClient->iScreen->SetScreenModeEnforcement(ESizeEnforcementNone); |
|
2936 TheClient->iScreen->GetDefaultScreenSizeAndRotation(aPixelsAndRotation); |
|
2937 TheClient->iScreen->SetScreenSizeAndRotation(aPixelsAndRotation); |
|
2938 TheClient->Flush(); |
|
2939 } |
|
2940 |
|
2941 TestState CTDirect::DefectFix_KAA_5J3BLW_L() |
|
2942 { |
|
2943 TInt numProcessHandles; |
|
2944 RThread().HandleCount(numProcessHandles,iNumThreadHandles); |
|
2945 const TSize screenSize(TheClient->iScreen->SizeInPixels()); |
|
2946 const TRect dsaRect(0,0,screenSize.iWidth>>2,screenSize.iHeight>>2); |
|
2947 iAnim=CBugFixColorAnimation::NewL(iTest->iScreenNumber, 1, *this, *TheClient->iGroup, dsaRect,ETrue); |
|
2948 return EWait; |
|
2949 } |
|
2950 |
|
2951 TestState CTDirect::RegionTrackingOnlyNotificationsL(TUint aId) |
|
2952 { |
|
2953 TInt numProcessHandles; |
|
2954 RThread().HandleCount(numProcessHandles,iNumThreadHandles); |
|
2955 const TSize screenSize(TheClient->iScreen->SizeInPixels()); |
|
2956 const TRect dsaRect(0,0,screenSize.iWidth>>2,screenSize.iHeight>>2); |
|
2957 TBool isWindowOpenedInFrontOfDsa = (aId == KRegionTrackingOnlyDsaWaitingForAbortSignal); |
|
2958 iAnim=CRegionTrackingOnly::NewL(iTest->iScreenNumber, aId, *this, *TheClient->iGroup, dsaRect,ETrue,isWindowOpenedInFrontOfDsa); |
|
2959 return EWait; |
|
2960 } |
|
2961 |
|
2962 // Tests the new function of getting the window's absolute position |
|
2963 TestState CTDirect::WindowPoistionRelativeToScreenL() |
|
2964 { |
|
2965 //.. delete screen mode timer |
|
2966 delete iChangeScreenModeTimer; |
|
2967 iChangeScreenModeTimer=NULL; |
|
2968 |
|
2969 TInt numProcessHandles; |
|
2970 RThread().HandleCount(numProcessHandles,iNumThreadHandles); |
|
2971 TSize screenSize(TheClient->iScreen->SizeInPixels()); |
|
2972 TRect rect(0,0,screenSize.iWidth>>1,screenSize.iHeight); |
|
2973 rect.Shrink(10,10); |
|
2974 // First animation is for showing that child window is within the visible part of the parent window and within the visible screen area |
|
2975 iAnims[0]=new(ELeave) CColorAnimation(iTest->iScreenNumber,15,*this); |
|
2976 iAnims[0]->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,1); |
|
2977 iAnims[0]->StartL(ETrue); |
|
2978 // First animation is for showing that child window is to the side of visible part of parent window |
|
2979 rect.Move(screenSize.iWidth>>1,0); |
|
2980 iAnims[1]=new(ELeave) CColorAnimation(iTest->iScreenNumber,16,*this); |
|
2981 iAnims[1]->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,2); |
|
2982 iAnims[1]->StartL(ETrue); |
|
2983 return EWait; |
|
2984 } |
|
2985 |
|
2986 TestState CTDirect::MultipleDSAsOnSameWindowL() |
|
2987 { |
|
2988 TInt numProcessHandles; |
|
2989 RThread().HandleCount(numProcessHandles,iNumThreadHandles); |
|
2990 iCallBackWin->SetVisible(ETrue); |
|
2991 iCallBackWin->WinTreeNode()->SetOrdinalPosition(0); |
|
2992 iAnims[0]=new(ELeave) CColorAnimation(iTest->iScreenNumber,20,*this); |
|
2993 iAnims[0]->ConstructL(*TheClient->iGroup,TRect(),KDrawingDsa,0,1); |
|
2994 iAnims[0]->StartL(); |
|
2995 iAnims[1]=new(ELeave) CColorAnimation(iTest->iScreenNumber,21,*this); |
|
2996 iAnims[1]->ConstructL(*TheClient->iGroup,TRect(),KDrawingDsa,0,2); |
|
2997 iAnims[1]->StartL(); |
|
2998 _LIT(ThreadName,"MoveWin"); |
|
2999 MoveInterval=100000; |
|
3000 ModeInterval=0; |
|
3001 FlipInterval=0; |
|
3002 ImmediateModeSwitch=EFalse; |
|
3003 iFirstFunction=TThreadStartUp(CMoveWindow::StartLC,(TAny*)iTest->iScreenNumber); |
|
3004 iMoveWin=CProcess::NewThreadL(ThreadName,&iFirstFunction); |
|
3005 return EWait; |
|
3006 } |
|
3007 |
|
3008 TestState CTDirect::KillAnimationL() |
|
3009 { |
|
3010 TInt numProcessHandles; |
|
3011 RThread().HandleCount(numProcessHandles,iNumThreadHandles); |
|
3012 iAnim=CColorAnimation::NewL(iTest->iScreenNumber,12,*this,*TheClient->iGroup,TRect(15,15,625,225),ETrue); |
|
3013 return EWait; |
|
3014 } |
|
3015 |
|
3016 TestState CTDirect::TemporaryDeadlockL() |
|
3017 { |
|
3018 |
|
3019 if (iTestJustCompleted) |
|
3020 { |
|
3021 if (iTestJustFailed) |
|
3022 { |
|
3023 Fail(); |
|
3024 } |
|
3025 iState++; |
|
3026 return ENext; |
|
3027 } |
|
3028 |
|
3029 //make sure this code isn't called a second time |
|
3030 __ASSERT_ALWAYS(iAnim==NULL,AutoPanic(EAutoPanicDirect)); |
|
3031 |
|
3032 TSize screenSize(TheClient->iScreen->SizeInPixels()); |
|
3033 TRect rect(0,0,screenSize.iWidth>>1,screenSize.iHeight); |
|
3034 rect.Shrink(10,10); |
|
3035 iAnim=new(ELeave) CColorAnimation(iTest->iScreenNumber,24,*this); |
|
3036 iAnim->ConstructL(*TheClient->iGroup,rect,KDrawingDsa,1); |
|
3037 iAnim->StartL(ETrue); |
|
3038 return EWait; |
|
3039 } |
|
3040 |
|
3041 void CTDirect::CheckForTemporaryDeadlock() |
|
3042 { |
|
3043 |
|
3044 TBool result=ETrue; |
|
3045 TInt error; |
|
3046 |
|
3047 |
|
3048 //Create a window for placing on top |
|
3049 TTime beforeTime; |
|
3050 beforeTime.HomeTime(); |
|
3051 |
|
3052 RWindow window(TheClient->iWs); |
|
3053 |
|
3054 error=window.Construct(*TheClient->iGroup->GroupWin(), reinterpret_cast<TInt>(&window)); |
|
3055 if (error==KErrNone) |
|
3056 { |
|
3057 window.SetOrdinalPosition(0); |
|
3058 window.SetExtent(TPoint(30,30),TSize(10,10)); |
|
3059 window.SetBackgroundColor(TRgb(255,0,255)); |
|
3060 |
|
3061 //make sure the basewin is towards the back |
|
3062 iCallBackWin->BaseWin()->SetOrdinalPosition(5); |
|
3063 |
|
3064 window.SetRequiredDisplayMode(EColor256); |
|
3065 window.Activate(); |
|
3066 TheClient->iWs.Flush(); |
|
3067 //need code similar to below, but the status of the active object we |
|
3068 //really want is too private |
|
3069 //if (!iAnim->IsReadyToAbort()) |
|
3070 // { |
|
3071 // result=EFalse; |
|
3072 // } |
|
3073 window.Close(); |
|
3074 } |
|
3075 else |
|
3076 { |
|
3077 result = EFalse; |
|
3078 } |
|
3079 |
|
3080 TTime afterTime; |
|
3081 afterTime.HomeTime(); |
|
3082 TTimeIntervalMicroSeconds difference = afterTime.MicroSecondsFrom(beforeTime); |
|
3083 |
|
3084 //make time difference 350ms, since the two timers to be checked are 400ms and 500ms |
|
3085 if (difference>TTimeIntervalMicroSeconds(1000*350)) |
|
3086 { |
|
3087 result=EFalse; |
|
3088 } |
|
3089 |
|
3090 iTestJustCompleted = ETrue; |
|
3091 if (result==EFalse) |
|
3092 { |
|
3093 iTestJustFailed=ETrue; |
|
3094 } |
|
3095 } |
|
3096 |
|
3097 void CTDirect::RunTestCaseL(TInt /*aCurTestCase*/) |
|
3098 { |
|
3099 _LIT(Animation1,"Animating"); |
|
3100 _LIT(Animation2,"Animating Dies"); |
|
3101 _LIT(Animation3,"Packaging Class"); |
|
3102 _LIT(Animation4,"Many Animations"); |
|
3103 _LIT(Animation5,"Fail Codes"); |
|
3104 _LIT(Animation6,"Cancel The Other"); |
|
3105 _LIT(Animation7,"'R' Class API"); |
|
3106 _LIT(Animation8,"Switch Clear Type"); |
|
3107 _LIT(Animation9,"SizeMode Change"); |
|
3108 _LIT(Animation10,"Soak Testing"); |
|
3109 _LIT(Animation11,"Kill Animation"); |
|
3110 _LIT(Animation12,"Defect-Fix: KAA-5J3BLW"); |
|
3111 _LIT(Animation13,"Screen Mode Positioning DSA Test 1"); |
|
3112 _LIT(Animation14,"Screen Mode Positioning DSA Test 2"); |
|
3113 _LIT(Animation15,"Position Relative to Screen"); |
|
3114 _LIT(Animation16,"Screen mode Scaling DSA Test 1"); |
|
3115 _LIT(Animation17,"Screen mode Scaling DSA Test 2"); |
|
3116 _LIT(Animation18,"Multiple DSAs on same window"); |
|
3117 _LIT(Animation19,"DSA and windows temporary deadlock"); |
|
3118 _LIT(Animation25,"RegionTrackingOnly DSA, window opened in front"); |
|
3119 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA |
|
3120 _LIT(Animation26,"RegionTrackingOnly DSA, window opened behind"); |
|
3121 _LIT(Animation27,"Mixed DSAs, RegionTrackingOnly DSA last to exit"); |
|
3122 _LIT(Animation28,"Mixed DSAs, drawing DSA last to exit"); |
|
3123 _LIT(Animation29,"Trying all the screen supported modes"); |
|
3124 #endif |
|
3125 TestState ret=ENext; |
|
3126 |
|
3127 if (iTimerRunning && !iPackagingFinished) |
|
3128 { |
|
3129 // Prevent test harness from repeatedly running the test case too quickly. |
|
3130 User::After(SHORT_DELAY); |
|
3131 } |
|
3132 |
|
3133 //if (iState==0) iState=18; |
|
3134 iTest->iState=iState; |
|
3135 ((CTDirectStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); |
|
3136 switch(iState) |
|
3137 { |
|
3138 /** |
|
3139 @SYMTestCaseID GRAPHICS-WSERV-0158 |
|
3140 |
|
3141 @SYMDEF DEF081259 |
|
3142 |
|
3143 @SYMTestCaseDesc Create seven seperate animations and run them to completion |
|
3144 |
|
3145 @SYMTestPriority High |
|
3146 |
|
3147 @SYMTestStatus Implemented |
|
3148 |
|
3149 @SYMTestActions Create animations and start them running. Run until the animations finish. |
|
3150 |
|
3151 @SYMTestExpectedResults The animation run to completion without error |
|
3152 */ |
|
3153 case 0: |
|
3154 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); |
|
3155 if (iNextFrameFinished) |
|
3156 InitialiseAnimationL(); |
|
3157 case 1: |
|
3158 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); |
|
3159 case 2: |
|
3160 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); |
|
3161 case 3: |
|
3162 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); |
|
3163 case 4: |
|
3164 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); |
|
3165 case 5: |
|
3166 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); |
|
3167 case 6: |
|
3168 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0158")); |
|
3169 if (iNextFrameFinished) |
|
3170 { |
|
3171 iTest->LogSubTest(Animation1); |
|
3172 ret=AnimateWindowL(); |
|
3173 iNextFrameFinished=EFalse; |
|
3174 } |
|
3175 else |
|
3176 { |
|
3177 // Prevent test harness from repeatedly running the test case too quickly. |
|
3178 User::After(SHORT_DELAY); |
|
3179 } |
|
3180 break; |
|
3181 /** |
|
3182 @SYMTestCaseID GRAPHICS-WSERV-0159 |
|
3183 |
|
3184 @SYMDEF DEF081259 |
|
3185 |
|
3186 @SYMTestCaseDesc Check animation dies correctly when run in a thread |
|
3187 |
|
3188 @SYMTestPriority High |
|
3189 |
|
3190 @SYMTestStatus Implemented |
|
3191 |
|
3192 @SYMTestActions Create animation and run in from a thread that dies. Once the thread |
|
3193 has died check the animation has been dealt with correctly. |
|
3194 |
|
3195 @SYMTestExpectedResults The animation dies correctly |
|
3196 */ |
|
3197 case 7: |
|
3198 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0159")); |
|
3199 iTest->LogSubTest(Animation2); |
|
3200 ret=AnimationDiesL(); |
|
3201 ++iState; |
|
3202 DestroyAnimation(); |
|
3203 break; |
|
3204 /** |
|
3205 @SYMTestCaseID GRAPHICS-WSERV-0160 |
|
3206 |
|
3207 @SYMDEF DEF081259 |
|
3208 |
|
3209 @SYMTestCaseDesc Check animation runs correctly in blank window |
|
3210 |
|
3211 @SYMTestPriority High |
|
3212 |
|
3213 @SYMTestStatus Implemented |
|
3214 |
|
3215 @SYMTestActions Create an animation and run it in a blank window |
|
3216 |
|
3217 @SYMTestExpectedResults The animation runs to completion without error |
|
3218 */ |
|
3219 case 8: |
|
3220 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0160")); |
|
3221 if (!iTimerRunning) |
|
3222 { |
|
3223 iTest->LogSubTest(Animation3); |
|
3224 ret=PackagingClassL(); |
|
3225 iTimerRunning = ETrue; |
|
3226 } |
|
3227 if (iPackagingFinished) |
|
3228 { |
|
3229 iPackagingFinished = EFalse; |
|
3230 iTimerRunning = EFalse; |
|
3231 } |
|
3232 break; |
|
3233 /** |
|
3234 @SYMTestCaseID GRAPHICS-WSERV-0161 |
|
3235 |
|
3236 @SYMDEF DEF081259 |
|
3237 |
|
3238 @SYMTestCaseDesc Check many animations can be run in the same window |
|
3239 |
|
3240 @SYMTestPriority High |
|
3241 |
|
3242 @SYMTestStatus Implemented |
|
3243 |
|
3244 @SYMTestActions Create multiple animations in a window and run them all |
|
3245 until completion |
|
3246 |
|
3247 @SYMTestExpectedResults The animations run without error |
|
3248 */ |
|
3249 case 9: |
|
3250 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0161")); |
|
3251 if (!iTimerRunning) |
|
3252 { |
|
3253 iTest->LogSubTest(Animation4); |
|
3254 ret=MultipleL(); |
|
3255 iTimerRunning = ETrue; |
|
3256 } |
|
3257 if (iPackagingFinished) |
|
3258 { |
|
3259 iPackagingFinished = EFalse; |
|
3260 iTimerRunning = EFalse; |
|
3261 } |
|
3262 break; |
|
3263 /** |
|
3264 @SYMTestCaseID GRAPHICS-WSERV-0162 |
|
3265 |
|
3266 @SYMDEF DEF081259 |
|
3267 |
|
3268 @SYMTestCaseDesc Direct screen access out of memory test |
|
3269 |
|
3270 @SYMTestPriority High |
|
3271 |
|
3272 @SYMTestStatus Implemented |
|
3273 |
|
3274 @SYMTestActions Direct screen access out of memory test |
|
3275 |
|
3276 @SYMTestExpectedResults The out of memory error is handled correctly |
|
3277 */ |
|
3278 case 10: |
|
3279 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0162")); |
|
3280 iTest->LogSubTest(Animation5); |
|
3281 ret=FailCodesL(); |
|
3282 iState++; |
|
3283 break; |
|
3284 /** |
|
3285 @SYMTestCaseID GRAPHICS-WSERV-0163 |
|
3286 |
|
3287 @SYMDEF DEF081259 |
|
3288 |
|
3289 @SYMTestCaseDesc Two animations, one scrolling text |
|
3290 |
|
3291 @SYMTestPriority High |
|
3292 |
|
3293 @SYMTestStatus Implemented |
|
3294 |
|
3295 @SYMTestActions Create two animations, one which scrolls text across the screen and |
|
3296 run them to completion |
|
3297 |
|
3298 @SYMTestExpectedResults The animations run without error |
|
3299 */ |
|
3300 case 11: |
|
3301 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0163")); |
|
3302 if (!iTimerRunning) |
|
3303 { |
|
3304 iTest->LogSubTest(Animation6); |
|
3305 ret=ScrolingText1L(); |
|
3306 iTimerRunning = ETrue; |
|
3307 } |
|
3308 if (iPackagingFinished) |
|
3309 { |
|
3310 iPackagingFinished = EFalse; |
|
3311 iTimerRunning = EFalse; |
|
3312 } |
|
3313 break; |
|
3314 /** |
|
3315 @SYMTestCaseID GRAPHICS-WSERV-0164 |
|
3316 |
|
3317 @SYMDEF DEF081259 |
|
3318 |
|
3319 @SYMTestCaseDesc Test direct screen access panic messages |
|
3320 |
|
3321 @SYMTestPriority High |
|
3322 |
|
3323 @SYMTestStatus Implemented |
|
3324 |
|
3325 @SYMTestActions Call the direct screen access panic's and check they are handled |
|
3326 correctly |
|
3327 |
|
3328 @SYMTestExpectedResults The panic's are handled correctly |
|
3329 */ |
|
3330 case 12: |
|
3331 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0164")); |
|
3332 iTest->LogSubTest(Animation7); |
|
3333 ret=RClassL(); |
|
3334 iTest->CloseAllPanicWindows(); |
|
3335 iState++; |
|
3336 break; |
|
3337 /** |
|
3338 @SYMTestCaseID GRAPHICS-WSERV-0165 |
|
3339 |
|
3340 @SYMDEF DEF081259 |
|
3341 |
|
3342 @SYMTestCaseDesc Two animations, one scrolling text |
|
3343 |
|
3344 @SYMTestPriority High |
|
3345 |
|
3346 @SYMTestStatus Implemented |
|
3347 |
|
3348 @SYMTestActions Create two animations, one which scrolls text across the screen and |
|
3349 run them to completion |
|
3350 |
|
3351 @SYMTestExpectedResults The animations run without error |
|
3352 */ |
|
3353 case 13: |
|
3354 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0165")); |
|
3355 if (!iTimerRunning) |
|
3356 { |
|
3357 iTest->LogSubTest(Animation8); |
|
3358 ret=ScrolingText2L(); |
|
3359 iTimerRunning = ETrue; |
|
3360 } |
|
3361 if (iPackagingFinished) |
|
3362 { |
|
3363 iPackagingFinished = EFalse; |
|
3364 iTimerRunning = EFalse; |
|
3365 } |
|
3366 break; |
|
3367 /** |
|
3368 @SYMTestCaseID GRAPHICS-WSERV-0166 |
|
3369 |
|
3370 @SYMDEF DEF081259 |
|
3371 |
|
3372 @SYMTestCaseDesc Two animations, one scrolling text. Change the screen mode an run. |
|
3373 |
|
3374 @SYMTestPriority High |
|
3375 |
|
3376 @SYMTestStatus Implemented |
|
3377 |
|
3378 @SYMTestActions Create two animations, one which scrolls text across the screen and |
|
3379 run them to completion while changing the screen mode |
|
3380 |
|
3381 @SYMTestExpectedResults The animations run without error |
|
3382 */ |
|
3383 |
|
3384 case 14: |
|
3385 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0166")); |
|
3386 if (!iTimerRunning) |
|
3387 { |
|
3388 iTest->LogSubTest(Animation9); |
|
3389 ret=ScrolingText3L(); |
|
3390 if (ret == ENext) |
|
3391 iPackagingFinished = ETrue; |
|
3392 else |
|
3393 iTimerRunning = ETrue; |
|
3394 } |
|
3395 if (iPackagingFinished) |
|
3396 { |
|
3397 iPackagingFinished = EFalse; |
|
3398 iTimerRunning = EFalse; |
|
3399 FlipInterval = 0; // Stops the tests (erroneously) flipping for the rest of the run |
|
3400 } |
|
3401 break; |
|
3402 /** |
|
3403 @SYMTestCaseID GRAPHICS-WSERV-0167 |
|
3404 |
|
3405 @SYMDEF DEF081259 |
|
3406 |
|
3407 @SYMTestCaseDesc Start an animation then kill it |
|
3408 |
|
3409 @SYMTestPriority High |
|
3410 |
|
3411 @SYMTestStatus Implemented |
|
3412 |
|
3413 @SYMTestActions Start an animation running then kill it. Check the animation dies correctly |
|
3414 |
|
3415 @SYMTestExpectedResults The animations dies correctly |
|
3416 */ |
|
3417 case 15: |
|
3418 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0167")); |
|
3419 if (!iTimerRunning) |
|
3420 { |
|
3421 iTest->LogSubTest(Animation11); |
|
3422 ret=KillAnimationL(); |
|
3423 iTimerRunning = ETrue; |
|
3424 } |
|
3425 if (iPackagingFinished) |
|
3426 { |
|
3427 iPackagingFinished = EFalse; |
|
3428 iTimerRunning = EFalse; |
|
3429 } |
|
3430 break; |
|
3431 case 16: |
|
3432 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0167")); |
|
3433 iTest->LogSubTest(Animation10); //This test is designed to be left running for at least several hours |
|
3434 //ret=ScrolingText4L(); |
|
3435 iState++; |
|
3436 break; |
|
3437 /** |
|
3438 @SYMTestCaseID GRAPHICS-WSERV-0168 |
|
3439 |
|
3440 @SYMDEF DEF081259 |
|
3441 |
|
3442 @SYMTestCaseDesc CBugFixColorAnimation |
|
3443 |
|
3444 @SYMTestPriority High |
|
3445 |
|
3446 @SYMTestStatus Implemented |
|
3447 |
|
3448 @SYMTestActions This class is used for reproducing a defect found on 6.1: KAA-5J3BLW "Unnecessary Wserv's DSA abort". |
|
3449 The problem was that a direct screen access client was getting an unnecessary abort notification |
|
3450 when a new window (or window group) was created but not visible. |
|
3451 This class will simulate the direct screen access client and it will check whether the first DSA abort |
|
3452 is not caused by just creating a window. |
|
3453 |
|
3454 @SYMTestExpectedResults Abort is not caused when creatung a window |
|
3455 */ |
|
3456 case 17: |
|
3457 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0168")); |
|
3458 if (!iTimerRunning) |
|
3459 { |
|
3460 iTest->LogSubTest(Animation12); |
|
3461 ret=DefectFix_KAA_5J3BLW_L(); |
|
3462 iTimerRunning = ETrue; |
|
3463 } |
|
3464 if (iPackagingFinished) |
|
3465 { |
|
3466 iPackagingFinished = EFalse; |
|
3467 iTimerRunning = EFalse; |
|
3468 } |
|
3469 break; |
|
3470 /** |
|
3471 @SYMTestCaseID GRAPHICS-WSERV-0169 |
|
3472 |
|
3473 @SYMDEF DEF081259 |
|
3474 |
|
3475 @SYMTestCaseDesc Direct screen access in screen modes with non-zero screen mode origin |
|
3476 |
|
3477 @SYMTestPriority High |
|
3478 |
|
3479 @SYMTestStatus Implemented |
|
3480 |
|
3481 @SYMTestActions Tests that DSA works correctly in screen modes with non-zero screen mode origin |
|
3482 |
|
3483 @SYMTestExpectedResults The DSA works correctly |
|
3484 */ |
|
3485 case 18: |
|
3486 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0169")); |
|
3487 if (!CheckNonZeroOriginsSupportedOrNot()) |
|
3488 { |
|
3489 INFO_PRINTF1(_L("Non Zero Origins not supported\n")); |
|
3490 iState++; |
|
3491 } |
|
3492 else |
|
3493 { |
|
3494 if (!iTimerRunning) |
|
3495 { |
|
3496 iTest->LogSubTest(Animation13); |
|
3497 ret=DSAWithScreenModeOffset1L(); |
|
3498 iTimerRunning = ETrue; |
|
3499 } |
|
3500 if (iPackagingFinished) |
|
3501 { |
|
3502 iPackagingFinished = EFalse; |
|
3503 iTimerRunning = EFalse; |
|
3504 } |
|
3505 } |
|
3506 break; |
|
3507 /** |
|
3508 @SYMTestCaseID GRAPHICS-WSERV-0170 |
|
3509 |
|
3510 @SYMDEF DEF081259 |
|
3511 |
|
3512 @SYMTestCaseDesc Direct screen access in screen modes with non-zero screen mode origin |
|
3513 |
|
3514 @SYMTestPriority High |
|
3515 |
|
3516 @SYMTestStatus Implemented |
|
3517 |
|
3518 @SYMTestActions Tests that DSA works correctly in screen modes with non-zero screen mode origin and different rotations |
|
3519 |
|
3520 @SYMTestExpectedResults The DSA works correctly |
|
3521 */ |
|
3522 case 19: |
|
3523 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0170")); |
|
3524 if (!CheckNonZeroOriginsSupportedOrNot()) |
|
3525 { |
|
3526 INFO_PRINTF1(_L("Non Zero Origins not supported\n")); |
|
3527 iState++; |
|
3528 } |
|
3529 else |
|
3530 { |
|
3531 if (!iTimerRunning) |
|
3532 { |
|
3533 iTest->LogSubTest(Animation14); |
|
3534 ret=DSAWithScreenModeOffset2L(); |
|
3535 iTimerRunning = ETrue; |
|
3536 } |
|
3537 if (iPackagingFinished) |
|
3538 { |
|
3539 iPackagingFinished = EFalse; |
|
3540 iTimerRunning = EFalse; |
|
3541 } |
|
3542 } |
|
3543 break; |
|
3544 /** |
|
3545 @SYMTestCaseID GRAPHICS-WSERV-0171 |
|
3546 |
|
3547 @SYMDEF DEF081259 |
|
3548 |
|
3549 @SYMTestCaseDesc Window absolute position |
|
3550 |
|
3551 @SYMTestPriority High |
|
3552 |
|
3553 @SYMTestStatus Implemented |
|
3554 |
|
3555 @SYMTestActions Tests the new function of getting the window's absolute position |
|
3556 |
|
3557 @SYMTestExpectedResults Function works correctly |
|
3558 */ |
|
3559 case 20: |
|
3560 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0171")); |
|
3561 if (!iTimerRunning) |
|
3562 { |
|
3563 iTest->LogSubTest(Animation15); |
|
3564 ret=WindowPoistionRelativeToScreenL(); |
|
3565 iTimerRunning = ETrue; |
|
3566 } |
|
3567 if (iPackagingFinished) |
|
3568 { |
|
3569 iPackagingFinished = EFalse; |
|
3570 iTimerRunning = EFalse; |
|
3571 } |
|
3572 break; |
|
3573 /** |
|
3574 @SYMTestCaseID GRAPHICS-WSERV-0172 |
|
3575 |
|
3576 @SYMDEF DEF081259 |
|
3577 |
|
3578 @SYMTestCaseDesc Test direct screen access restart |
|
3579 |
|
3580 @SYMTestPriority High |
|
3581 |
|
3582 @SYMTestStatus Implemented |
|
3583 |
|
3584 @SYMTestActions Creates a DSA for screen mode 0. After DSA has displayed 2 or 3 frames screen mode |
|
3585 scale is changed with a timer. The DSA aborts and restarts once again |
|
3586 and completes itself in different screen mode. |
|
3587 |
|
3588 @SYMTestExpectedResults DSA restarts and completes correctly |
|
3589 */ |
|
3590 case 21: |
|
3591 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0172")); |
|
3592 if (iIsScalingSupported) |
|
3593 { |
|
3594 if (!iTimerRunning) |
|
3595 { |
|
3596 iTest->LogSubTest(Animation16); |
|
3597 ret=ScreenModeTestForScalingL(); |
|
3598 iTimerRunning = ETrue; |
|
3599 } |
|
3600 if (iPackagingFinished) |
|
3601 { |
|
3602 iPackagingFinished = EFalse; |
|
3603 iTimerRunning = EFalse; |
|
3604 } |
|
3605 break; |
|
3606 } |
|
3607 iState++; |
|
3608 break; |
|
3609 /** |
|
3610 @SYMTestCaseID GRAPHICS-WSERV-0173 |
|
3611 |
|
3612 @SYMDEF DEF081259 |
|
3613 |
|
3614 @SYMTestCaseDesc Test direct screen access scaling |
|
3615 |
|
3616 @SYMTestPriority High |
|
3617 |
|
3618 @SYMTestStatus Implemented |
|
3619 |
|
3620 @SYMTestActions Creates a DSA for screen mode 0, tests API AbsoluteWindowPosition() |
|
3621 Then sets screen mode to last(test) screen mode, here it does the same thing as |
|
3622 done for screenmode 0, but with diffrerent scale (2,2) (2,3) (3,2) (3,3) and |
|
3623 with different origin (20,30) (30,20) (20,20). |
|
3624 Lastly copy back the test screen mode values. |
|
3625 |
|
3626 @SYMTestExpectedResults DSA scales correctly |
|
3627 */ |
|
3628 case 22: |
|
3629 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0173")); |
|
3630 if (iIsScalingSupported) |
|
3631 { |
|
3632 if (!iTimerRunning) |
|
3633 { |
|
3634 iTest->LogSubTest(Animation17); |
|
3635 ret=ScreenModeScalingTestL(); |
|
3636 iTimerRunning = ETrue; |
|
3637 } |
|
3638 if (iPackagingFinished) |
|
3639 { |
|
3640 iPackagingFinished = EFalse; |
|
3641 iTimerRunning = EFalse; |
|
3642 } |
|
3643 break; |
|
3644 } |
|
3645 iState++; |
|
3646 break; |
|
3647 /** |
|
3648 @SYMTestCaseID GRAPHICS-WSERV-0174 |
|
3649 |
|
3650 @SYMDEF DEF081259 |
|
3651 |
|
3652 @SYMTestCaseDesc Test multiple direct screen access elements on the same window |
|
3653 |
|
3654 @SYMTestPriority High |
|
3655 |
|
3656 @SYMTestStatus Implemented |
|
3657 |
|
3658 @SYMTestActions Create a number of direct screen access elements on the same window and |
|
3659 check that they work correctly |
|
3660 |
|
3661 @SYMTestExpectedResults DSAs work correctly |
|
3662 */ |
|
3663 case 23: |
|
3664 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0174")); |
|
3665 if (iIsScalingSupported) |
|
3666 { |
|
3667 if (!iTimerRunning) |
|
3668 { |
|
3669 iTest->LogSubTest(Animation18); |
|
3670 ret=MultipleDSAsOnSameWindowL(); |
|
3671 iTimerRunning = ETrue; |
|
3672 } |
|
3673 if (iPackagingFinished) |
|
3674 { |
|
3675 iPackagingFinished = EFalse; |
|
3676 iTimerRunning = EFalse; |
|
3677 } |
|
3678 break; |
|
3679 } |
|
3680 iState++; |
|
3681 break; |
|
3682 /** |
|
3683 @SYMTestCaseID GRAPHICS-WSERV-0175 |
|
3684 |
|
3685 @SYMDEF DEF081259 |
|
3686 |
|
3687 @SYMTestCaseDesc Create a temporary deadlock on a DSA and resolve it |
|
3688 |
|
3689 @SYMTestPriority High |
|
3690 |
|
3691 @SYMTestStatus Implemented |
|
3692 |
|
3693 @SYMTestActions Resolve a temporary deadlock on a DSA |
|
3694 |
|
3695 @SYMTestExpectedResults DSA resolves the deadlock |
|
3696 */ |
|
3697 case 24: |
|
3698 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0175")); |
|
3699 if (!iTimerRunning) |
|
3700 { |
|
3701 iTest->LogSubTest(Animation19); |
|
3702 ret=TemporaryDeadlockL();//for INC072887 - removing a 0.5s delay in wserv. |
|
3703 iTimerRunning = ETrue; |
|
3704 } |
|
3705 if (iPackagingFinished) |
|
3706 { |
|
3707 iPackagingFinished = EFalse; |
|
3708 iTimerRunning = EFalse; |
|
3709 iState++; |
|
3710 } |
|
3711 break; |
|
3712 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA |
|
3713 case 25: |
|
3714 /** |
|
3715 @SYMTestCaseID GRAPHICS-WSERV-0533 |
|
3716 */ |
|
3717 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0533")); |
|
3718 if (!iTimerRunning) |
|
3719 { |
|
3720 FlipInterval=0; |
|
3721 iTest->LogSubTest(Animation25); |
|
3722 //Opens a window in front of a region tracking only DSA |
|
3723 ret=RegionTrackingOnlyNotificationsL(KRegionTrackingOnlyDsaWaitingForAbortSignal); |
|
3724 iTimerRunning = ETrue; |
|
3725 } |
|
3726 if (iPackagingFinished) |
|
3727 { |
|
3728 iPackagingFinished = EFalse; |
|
3729 iTimerRunning = EFalse; |
|
3730 } |
|
3731 break; |
|
3732 case 26: |
|
3733 /** |
|
3734 @SYMTestCaseID GRAPHICS-WSERV-0534 |
|
3735 */ |
|
3736 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0534")); |
|
3737 if (!iTimerRunning) |
|
3738 { |
|
3739 iTest->LogSubTest(Animation26); |
|
3740 //Opens a window behind a region tracking only DSA |
|
3741 ret=RegionTrackingOnlyNotificationsL(KRegionTrackingOnlyDsaNoAbortSignal); |
|
3742 iTimerRunning = ETrue; |
|
3743 } |
|
3744 if (iPackagingFinished) |
|
3745 { |
|
3746 iPackagingFinished = EFalse; |
|
3747 iTimerRunning = EFalse; |
|
3748 } |
|
3749 break; |
|
3750 case 27: |
|
3751 /** |
|
3752 @SYMTestCaseID GRAPHICS-WSERV-0535 |
|
3753 */ |
|
3754 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0535")); |
|
3755 if (!iTimerRunning) |
|
3756 { |
|
3757 iTest->LogSubTest(Animation27); |
|
3758 ret=MixDsaAndRegionTrackingOnlyL(KRegionTrackingOnlyDsaExistLast); |
|
3759 iTimerRunning = ETrue; |
|
3760 } |
|
3761 if (iPackagingFinished) |
|
3762 { |
|
3763 iPackagingFinished = EFalse; |
|
3764 iTimerRunning = EFalse; |
|
3765 } |
|
3766 break; |
|
3767 case 28: |
|
3768 /** |
|
3769 @SYMTestCaseID GRAPHICS-WSERV-0536 |
|
3770 */ |
|
3771 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0536")); |
|
3772 if (!iTimerRunning) |
|
3773 { |
|
3774 iTest->LogSubTest(Animation28); |
|
3775 ret=MixDsaAndRegionTrackingOnlyL(KDrawingDsaExistLast); |
|
3776 iTimerRunning = ETrue; |
|
3777 } |
|
3778 if (iPackagingFinished) |
|
3779 { |
|
3780 iPackagingFinished = EFalse; |
|
3781 iTimerRunning = EFalse; |
|
3782 } |
|
3783 break; |
|
3784 case 29: |
|
3785 /** |
|
3786 @SYMTestCaseID GRAPHICS-WSERV-0537 |
|
3787 */ |
|
3788 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0537")); |
|
3789 if (!iTimerRunning) |
|
3790 { |
|
3791 iTest->LogSubTest(Animation29); |
|
3792 ret=TryDifferentSupportedModesL(); |
|
3793 iTimerRunning = ETrue; |
|
3794 } |
|
3795 if (iPackagingFinished) |
|
3796 { |
|
3797 iPackagingFinished = EFalse; |
|
3798 iTimerRunning = EFalse; |
|
3799 } |
|
3800 break; |
|
3801 #else |
|
3802 //NON NGA negative test for RegionTrackingOnly DSA |
|
3803 case 25: |
|
3804 /** |
|
3805 @SYMTestCaseID GRAPHICS-WSERV-0575 |
|
3806 */ |
|
3807 ((CTDirectStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0575")); |
|
3808 if (!iTimerRunning) |
|
3809 { |
|
3810 FlipInterval=0; |
|
3811 iTest->LogSubTest(Animation25); |
|
3812 CColorAnimation* temp = NULL; |
|
3813 //Attempt to create a RegionTrackingOnly DSA in non NGA code |
|
3814 TRAPD(err,temp = CColorAnimation::NewL(iTest->iScreenNumber,1,*this,*TheClient->iGroup,TRect(10,10,630,230),ETrue,KRegionTrackingOnly)); |
|
3815 if(err!=KErrNotSupported) |
|
3816 { |
|
3817 _LIT(KCTDirectNonNgaError,"Attempt to creat a RegionTrackingOnly DSA did not return KErrNotSupported on non-NGA"); |
|
3818 LOG_MESSAGE(KCTDirectNonNgaError); |
|
3819 if(temp) |
|
3820 { |
|
3821 delete temp; |
|
3822 } |
|
3823 Fail(); |
|
3824 } |
|
3825 else |
|
3826 { |
|
3827 _LIT(KCTDirectNonNgaSuccess,"RegionTrackingOnly DSA not supported on non-NGA as expected"); |
|
3828 LOG_MESSAGE(KCTDirectNonNgaSuccess); |
|
3829 } |
|
3830 iState++; |
|
3831 } |
|
3832 break; |
|
3833 #endif |
|
3834 default: |
|
3835 ((CTDirectStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
3836 ((CTDirectStep*)iStep)->CloseTMSGraphicsStep(); |
|
3837 TestComplete(); |
|
3838 break; |
|
3839 } |
|
3840 ((CTDirectStep*)iStep)->RecordTestResultL(); |
|
3841 } |
|
3842 |
|
3843 CRegionTrackingOnly* CRegionTrackingOnly::NewL(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack,CTWindowGroup& aParent,TRect aExtent,TBool aStart,TBool aOpenWindowInFrontDsa) |
|
3844 { |
|
3845 CRegionTrackingOnly* self=new(ELeave) CRegionTrackingOnly(aScreenNumber, aId,aCallBack); |
|
3846 CleanupStack::PushL(self); |
|
3847 self->ConstructL(aParent,aExtent,aOpenWindowInFrontDsa); |
|
3848 if (aStart) |
|
3849 { |
|
3850 self->StartL(); |
|
3851 self->Started(); |
|
3852 } |
|
3853 CleanupStack::Pop(self); |
|
3854 return self; |
|
3855 } |
|
3856 |
|
3857 CRegionTrackingOnly::CRegionTrackingOnly(TInt aScreenNumber,TInt aId,MAnimCallBacks& aCallBack) |
|
3858 : CColorAnimation(aScreenNumber, aId, aCallBack) |
|
3859 { |
|
3860 iThreadParam.iScreenNumber = aScreenNumber; |
|
3861 } |
|
3862 |
|
3863 void CRegionTrackingOnly::ConstructL(CTWindowGroup& aParent,TRect aExtent,TBool aOpenWindowInFrontDsa) |
|
3864 { |
|
3865 iExpectedToAbort = aOpenWindowInFrontDsa; |
|
3866 CColorAnimation::ConstructL(aParent, aExtent, KRegionTrackingOnly); |
|
3867 _LIT(ThreadName,"Create new Window"); |
|
3868 |
|
3869 TInt error=iSem.CreateGlobal(KSem_DefectFix_KAA_5J3BLW_Name, 0); |
|
3870 if (error==KErrNone) |
|
3871 { |
|
3872 iAnimRect=aExtent; |
|
3873 iThreadParam.iRect = iAnimRect; |
|
3874 iThreadParam.iIsInFront = aOpenWindowInFrontDsa; |
|
3875 TThreadStartUp function=TThreadStartUp(CreateNewWindowGroup, &iThreadParam); |
|
3876 TRequestStatus status; |
|
3877 iThread=CProcess::NewThreadRendezvousL(ThreadName,&function,status); |
|
3878 User::WaitForRequest(status); |
|
3879 if (status != KErrNone) |
|
3880 { |
|
3881 RDebug::Printf("the request status is returned to be non KErrNone: %d", status.Int()); |
|
3882 TestFailed(this); |
|
3883 } |
|
3884 } |
|
3885 else |
|
3886 { |
|
3887 TestFailed(this); |
|
3888 } |
|
3889 } |
|
3890 |
|
3891 TBool CColorAnimation::TestGcAndScreenDeviceValues() |
|
3892 { |
|
3893 TBool succeeded = ETrue; |
|
3894 _LIT(KErrorLogGraphicContext,"GraphicsContext not NULL when using the region tracking feature only"); |
|
3895 _LIT(KErrorLogScreenDevice,"ScreenDevice not NULL when using the region tracking feature only"); |
|
3896 if(iRegionTrackingOnly && iDrawer->Gc() != NULL) |
|
3897 { |
|
3898 CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorLogGraphicContext); |
|
3899 succeeded = EFalse; |
|
3900 } |
|
3901 if(iRegionTrackingOnly && iDrawer->ScreenDevice() != NULL) |
|
3902 { |
|
3903 CallBack().Log((TText8*)__FILE__,__LINE__, ESevrErr,KErrorLogScreenDevice); |
|
3904 succeeded = EFalse; |
|
3905 } |
|
3906 return succeeded; |
|
3907 } |
|
3908 |
|
3909 void CRegionTrackingOnly::AbortNow(RDirectScreenAccess::TTerminationReasons /*aReason*/) |
|
3910 { |
|
3911 Stop(); |
|
3912 } |
|
3913 |
|
3914 void CRegionTrackingOnly::Restart(RDirectScreenAccess::TTerminationReasons/* aReason*/) |
|
3915 { |
|
3916 if(!TestGcAndScreenDeviceValues()) |
|
3917 { |
|
3918 CallBack().Fail(); |
|
3919 } |
|
3920 if (iExpectedToAbort) |
|
3921 { |
|
3922 _LIT(KExpected,"DSA got an abort signal as expected"); |
|
3923 CallBack().Log((TText8*)__FILE__,__LINE__,ESevrInfo,KExpected); |
|
3924 } |
|
3925 else |
|
3926 { |
|
3927 _LIT(KError,"DSA got an abort signal even though the window was opened behind it"); |
|
3928 CallBack().Log((TText8*)__FILE__,__LINE__,ESevrErr,KError); |
|
3929 CallBack().Fail(); |
|
3930 } |
|
3931 FinishTest(); |
|
3932 } |
|
3933 |
|
3934 CRegionTrackingOnly::~CRegionTrackingOnly() |
|
3935 { |
|
3936 iSem.Close(); |
|
3937 if(iThread) |
|
3938 { |
|
3939 TRequestStatus status; |
|
3940 iThread->Logon(status); |
|
3941 if (iThread->StillAlive()) |
|
3942 { |
|
3943 iThread->Terminate(KErrNone); |
|
3944 User::WaitForRequest(status); |
|
3945 } |
|
3946 delete iThread; |
|
3947 } |
|
3948 } |
|
3949 |
|
3950 __WS_CONSTRUCT_STEP__(Direct) |