First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Test backed up windows
21 @internalComponent - Internal Symbian test code
26 CTBackedUpWindow::CTBackedUpWindow(CTestStep* aStep):
27 CTWsGraphicsBase(aStep)
32 void CTBackedUpWindow::CheckWindow(CFbsBitmap *aBitmap)
34 TPoint oldPos=iBackedUpWindow.Position();
35 iBackedUpWindow.SetPosition(TPoint(0,0));
37 iCheckWindow.SetVisible(ETrue);
38 iCheckWindow.SetPosition(iCheckPos);
40 iCheckWindow.BeginRedraw();
41 TheGc->Activate(iCheckWindow);
42 TheGc->BitBlt(TPoint(0,0), aBitmap);
44 iCheckWindow.EndRedraw();
46 TheClient->iWs.Flush();
47 TheClient->WaitForRedrawsToFinish();
48 TBool retVal = TheClient->iScreen->RectCompare(TRect(iSize),TRect(iCheckPos,iSize));
51 INFO_PRINTF3(_L("TheClient->iScreen->RectCompare(TRect(iSize),TRect(iCheckPos,iSize)) return value - Expected: %d , Actual: %d"), ETrue, retVal);
53 iCheckWindow.SetVisible(EFalse);
54 iBackedUpWindow.SetPosition(oldPos);
57 void CTBackedUpWindow::CheckWindow()
59 CheckWindow(&iBitmap);
62 void CTBackedUpWindow::Draw(TInt aDrawFunc, TAny *aParam)
64 TheGc->Activate(iBackedUpWindow);
65 Draw(aDrawFunc, aParam, TheGc, iBitGc);
69 void CTBackedUpWindow::DrawWithTwoGcsL()
71 RBlankWindow blank(TheClient->iWs);
72 User::LeaveIfError(blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle));
75 User::LeaveIfError(TheClient->iScreen->CreateContext(gc2));
76 CleanupStack::PushL(gc2);
79 TFontSpec fspec(KTestFontTypefaceName,200);
80 User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)font1,fspec));
82 TFontSpec fspec2(KTestFontTypefaceName,400);
83 User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)font2,fspec2));
85 gc2->Activate(iBackedUpWindow);
87 TheGc->Activate(iBackedUpWindow);
88 TheGc->UseFont(font1);
89 _LIT(KText,"Testing123");
90 TheGc->DrawText(KText,TPoint(20,20));
91 gc2->DrawText(KText,TPoint(20,40));
92 iBitGc->UseFont(font1);
93 iBitGc->DrawText(KText,TPoint(20,20));
94 iBitGc->UseFont(font2);
95 iBitGc->DrawText(KText,TPoint(20,40));
96 iBitGc->DiscardFont();
98 TheClient->iScreen->ReleaseFont(font2);
99 TheClient->iScreen->ReleaseFont(font1);
100 CleanupStack::PopAndDestroy();
104 void CTBackedUpWindow::Draw(TInt aDrawFunc, TAny *aParam, CBitmapContext *gc1, CBitmapContext *gc2) //DDD
107 for(TInt mode=0;mode<2;mode++)
117 gc->SetBrushColor(*((TRgb *)aParam));
118 gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
119 gc->SetPenStyle(CGraphicsContext::ENullPen);
120 gc->DrawRect(TRect(iSize));
124 TSize half(iSize.iWidth/2,iSize.iHeight/2);
125 gc->DrawEllipse(TRect(half));
126 gc->DrawEllipse(TRect(TPoint(0,half.iHeight),half));
128 gc->SetOrigin(TPoint(half.iWidth,0));
129 gc->SetClippingRect(rect1);
130 gc->DrawEllipse(rect1);
131 gc->SetOrigin(TPoint(half.iWidth,half.iHeight));
132 gc->SetClippingRect(rect1);
133 gc->DrawEllipse(rect1);
134 gc->SetOrigin(TPoint(0,0));
135 gc->CancelClippingRect();
140 TInt param= *((TInt *)aParam);
142 gc->DrawLine(TPoint(param+(param*27)%iSize.iWidth,0),
143 TPoint(iSize.iWidth-((param<<1)+(param*19)%iSize.iWidth),iSize.iHeight));
145 gc->DrawLine(TPoint(0, (param<<1)+(param*7)%iSize.iHeight),
146 TPoint(iSize.iWidth,param+(param*13)%iSize.iHeight));
152 for(;pos.iX<iSize.iWidth;pos.iX+=10)
153 gc->DrawLine(pos,pos+TSize(0,iSize.iHeight));
154 for(pos.iX=0;pos.iY<iSize.iHeight;pos.iY+=10)
155 gc->DrawLine(pos,pos+TSize(iSize.iWidth,0));
162 CTBackedUpWindow::~CTBackedUpWindow()
164 iBackedUpWindow.Close();
165 iCheckWindow.Close();
166 iOomFrontWindow.Close();
168 delete iBitmapDevice;
173 void CopyToGray4L(CFbsBitmap*& aDestBitmap,const CFbsBitmap& aSrcBitmap)
175 aDestBitmap=new(ELeave) CFbsBitmap();
176 CleanupStack::PushL(aDestBitmap);
177 User::LeaveIfError(aDestBitmap->Create(aSrcBitmap.SizeInPixels(),EGray4));
178 CFbsBitmapDevice* device=CFbsBitmapDevice::NewL(aDestBitmap);
179 CleanupStack::PushL(device);
181 User::LeaveIfError(device->CreateContext(gc));
182 gc->BitBlt(TPoint(),&aSrcBitmap);
184 CleanupStack::PopAndDestroy(device);
185 CleanupStack::Pop(aDestBitmap);
188 void CTBackedUpWindow::ConstructL()
190 iBackedUpWindow=RBackedUpWindow(TheClient->iWs);
191 iBackedUpWindow.Construct(*(TheClient->iGroup->GroupWin()),EGray4,ENullWsHandle);
192 TSize size=TheClient->iScreen->SizeInTwips();
193 iSize=TheClient->iScreen->SizeInPixels();
198 size.iWidth-=1; //Modification to get the mapping factor the same as the screen
199 size.iHeight-=1; //Ditto
200 iWinPos.SetXY(iSize.iWidth>>1,iSize.iHeight>>1);
201 User::LeaveIfError(iBackedUpWindow.SetExtentErr(iWinPos,iSize));
202 iBackedUpWindow.Activate();
204 iCheckPos.SetXY(iSize.iWidth,0);
205 iCheckWindow=RWindow(TheClient->iWs);
206 iCheckWindow.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle);
207 iCheckWindow.SetSize(iSize);
208 iCheckWindow.SetVisible(EFalse);
209 iCheckWindow.Activate();
212 TDisplayMode defMode=TheClient->iWs.GetDefModeMaxNumColors(col,grey);
213 User::LeaveIfError(iBitmap.Create(iSize,defMode));
214 iBitmap.SetSizeInTwips(size);
215 iBitmapDevice=CFbsBitmapDevice::NewL(&iBitmap);
216 User::LeaveIfError(iBitmapDevice->CreateContext(iBitGc));
218 TRgb rgb(TRgb::Gray4(2));
221 iTestBitmap=new(ELeave) CFbsBitmap();
222 User::LeaveIfError(iTestBitmap->Load(TEST_BITMAP_NAME,0));
223 iTestBitmap->SetSizeInTwips(TSize(1500,750));
224 iMaskBitmap=new(ELeave) CFbsBitmap();
225 User::LeaveIfError(iMaskBitmap->Load(TEST_BITMAP_NAME,0));
226 TDisplayMode defMode2=iMaskBitmap->DisplayMode();
229 CFbsBitmap* bitmap=iTestBitmap;
230 CopyToGray4L(iTestBitmap,*bitmap);
233 CopyToGray4L(iMaskBitmap,*bitmap);
236 defMode2=iMaskBitmap->DisplayMode();
237 defMode2=iMaskBitmap->DisplayMode();
240 void CTBackedUpWindow::InvisVis()
242 iBackedUpWindow.SetVisible(EFalse);
243 TheClient->iWs.Flush();
244 iBackedUpWindow.SetVisible(ETrue);
245 TheClient->iWs.Flush();
248 void CTBackedUpWindow::WindowOnTop()
250 RBlankWindow blank(TheClient->iWs);
251 blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle);
254 TheClient->iWs.Flush();
260 for(pos.iX=-iSize.iWidth;pos.iX<iSize.iWidth;pos.iX+=50)
261 for(pos.iY=-iSize.iHeight;pos.iY<iSize.iHeight;pos.iY+=50)
263 blank=RBlankWindow(TheClient->iWs);
264 blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle);
265 blank.SetColor(TRgb::Gray256(220));
266 blank.SetShadowHeight(2);
267 blank.SetExtent(pos+iWinPos,TSize((sizeMode&0x1)?iSize.iWidth>>1:iSize.iWidth<<1,(sizeMode&0x2)?iSize.iHeight>>1:iSize.iHeight<<1));
268 sizeMode=(sizeMode+1)%4;
271 TheClient->iWs.Flush();
277 void CTBackedUpWindow::Resize()
279 RBlankWindow blank(TheClient->iWs);
280 blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle);
281 blank.SetColor(TRgb::Gray256(128));
283 TInt xtop=(iSize.iWidth)-(iSize.iWidth>>2);
284 TInt ytop=(iSize.iHeight)-(iSize.iHeight>>2);
285 for(TInt winMode=0;winMode<3;winMode++)
290 blank.SetExtent(TPoint(0,ytop),TSize(iSize.iWidth,iSize.iHeight>>1));
293 blank.SetExtent(TPoint(xtop,0),TSize(iSize.iWidth>>1,iSize.iHeight));
296 blank.SetExtent(TPoint(xtop,ytop),TSize(iSize.iWidth>>1,iSize.iHeight>>1));
299 blank.SetShadowHeight(winMode);
300 TPoint oldPos=iBackedUpWindow.Position();
302 for(TUint i=0;i<sizeof(moveList)/sizeof(moveList[0]);i++)
305 iBackedUpWindow.SetPosition(pos);
306 TheClient->iWs.Flush();
308 iBackedUpWindow.SetPosition(oldPos);
313 void CTBackedUpWindow::ChildWindows()
318 RBlankWindow blank(TheClient->iWs);
319 for(pos.iX=-(iSize.iWidth>>1);pos.iX<iSize.iWidth;pos.iX+=33)
320 for(pos.iY=-(iSize.iHeight>>1);pos.iY<iSize.iHeight;pos.iY+=33)
322 blank.Construct(iBackedUpWindow,ENullWsHandle);
323 blank.SetColor(TRgb::Gray256(220));
324 blank.SetShadowHeight(2);
325 blank.SetExtent(pos,TSize((sizeMode&0x1)?iSize.iWidth>>2:iSize.iWidth,(sizeMode&0x2)?iSize.iHeight>>2:iSize.iHeight));
326 sizeMode=(sizeMode+1)%4;
329 TheClient->iWs.Flush();
335 void CTBackedUpWindow::DupBitmapTestL()
337 INFO_PRINTF1(_L("AUTO Dup Bitmap Test "));
338 CFbsBitmap *dup=new(ELeave) CFbsBitmap();
339 dup->Duplicate(iBackedUpWindow.BitmapHandle());
341 TRgb rgb(TRgb::Gray4(1));
344 INFO_PRINTF1(_L(" Done Window Drawing Test"));
346 CFbsBitmapDevice *dupDevice=NULL;
347 TRAPD(err,dupDevice=CFbsBitmapDevice::NewL(dup));
349 if (err==KErrNone && dupDevice->CreateContext(gc)==KErrNone)
351 Draw(3,NULL,gc,iBitGc); // Draw directly to backup bitmap (and test bitmap)
352 iBackedUpWindow.UpdateScreen();
353 INFO_PRINTF1(_L(" First Bitmap Drawing"));
355 TRgb rgb(TRgb::Gray256(128));
357 if (TheClient->iWs.GetDefModeMaxNumColors(col,grey)>EGray4)
359 Draw(0,&rgb,gc,iBitGc);
360 Draw(1,NULL,gc,iBitGc);
361 iBackedUpWindow.UpdateScreen(TRegionFix<1>(TRect(iSize)));
362 INFO_PRINTF1(_L(" Second Bitmap Drawing"));
370 void CTBackedUpWindow::UpdateBitmapTestL()
372 INFO_PRINTF1(_L("AUTO UpdateBitmap "));
374 CFbsBitmap *dup=new(ELeave) CFbsBitmap();
375 dup->Duplicate(iBackedUpWindow.BitmapHandle());
377 iBackedUpWindow.UpdateBackupBitmap();
378 INFO_PRINTF1(_L(" First Drawing"));
382 rgb=TRgb::Gray256(128);
387 iBackedUpWindow.UpdateBackupBitmap();
388 INFO_PRINTF1(_L(" Second Drawing"));
393 void CTBackedUpWindow::OOML()
395 iOomFrontWindow=RBlankWindow(TheClient->iWs);
396 TSize size(iBackedUpWindow.Size());
399 TPoint pos(size.iWidth*3/2,size.iHeight*3/2);
400 iOomFrontWindow.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle);
401 iOomFrontWindow.SetColor(TRgb(TRgb::Gray4(1)));
402 iOomFrontWindow.SetExtent(pos,size);
403 iOomFrontWindow.Activate();
404 TheClient->iWs.Flush();
406 TPoint buwPos=iBackedUpWindow.Position();
407 TSize buwSize=iBackedUpWindow.Size();
408 for(TInt count=0;count<100;count++)
410 iOomFrontWindow.SetVisible(ETrue);
411 TheClient->iWs.HeapSetFail(RHeap::EDeterministic,count);
412 iBackedUpWindow.SetPosition(buwPos+TPoint(10,5));
413 iBackedUpWindow.SetPosition(buwPos);
414 iOomFrontWindow.SetSize(size+TSize(10,5));
415 iOomFrontWindow.SetSize(size);
416 iBackedUpWindow.SetSizeErr(buwSize+TSize(13,7));
417 iBackedUpWindow.SetSizeErr(buwSize);
418 iOomFrontWindow.SetVisible(EFalse);
419 TheClient->iWs.HeapSetFail(RHeap::ENone,0);
420 User::LeaveIfError(iBackedUpWindow.SetSizeErr(buwSize));
421 TheClient->WaitForRedrawsToFinish();
425 iOomFrontWindow.Close();
428 void CTBackedUpWindow::doGraphicFunctionsL(CBitmapContext *gc,TBool aExtraDrawBitMap)
430 TSize size=iBackedUpWindow.Size();
432 _LIT(KFontName,"Swiss");
433 TFontSpec fspec(KFontName,190);
434 User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)aFont,fspec));
435 CFbsBitmap* aBitmap=iTestBitmap;
436 CFbsBitmap* aMaskBitmap=iMaskBitmap;
438 #include "DLLDRAW.H" // Draws to a Gc called 'gc'
440 TheClient->iScreen->ReleaseFont(aFont);
443 void CTBackedUpWindow::AllGraphicFunctionsL(RBlankWindow &aBlank,TBool aExtraDrawBitMap/*=ETrue*/)
445 aExtraDrawBitMap=EFalse; //Check out when bitblit scaling has changed again
446 aBlank.SetVisible(ETrue);
447 TheGc->Activate(iBackedUpWindow);
448 TRAPD(err,doGraphicFunctionsL(TheGc,aExtraDrawBitMap));
450 User::LeaveIfError(err);
452 iBitGc->SetUserDisplayMode(EGray4);
453 doGraphicFunctionsL(iBitGc,aExtraDrawBitMap);
454 aBlank.SetVisible(EFalse);
458 void CTBackedUpWindow::AllGraphicFunctionsTestsL()
460 RBlankWindow blank(TheClient->iWs);
461 TInt xtop=(iSize.iWidth)-(iSize.iWidth>>1);
462 TInt ytop=(iSize.iHeight)-(iSize.iHeight>>1);
463 blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle);
464 blank.SetColor(TRgb::Gray256(128));
466 blank.SetExtent(TPoint(0,ytop),TSize(iSize.iWidth,iSize.iHeight>>2));
467 AllGraphicFunctionsL(blank);
468 blank.SetExtent(TPoint(0,ytop+10),TSize(iSize.iWidth,iSize.iHeight>>2));
469 AllGraphicFunctionsL(blank);
470 blank.SetExtent(TPoint(xtop,ytop),TSize(iSize.iWidth>>1,iSize.iHeight));
471 AllGraphicFunctionsL(blank,EFalse);
472 blank.SetExtent(TPoint(xtop+(iSize.iWidth>>1),ytop),TSize(iSize.iWidth>>1,iSize.iHeight));
473 AllGraphicFunctionsL(blank,EFalse);
474 blank.SetExtent(TPoint(xtop+10,iSize.iHeight),TSize(iSize.iWidth,iSize.iHeight));
475 AllGraphicFunctionsL(blank,EFalse);
476 blank.SetExtent(TPoint(xtop,ytop),iSize);
477 AllGraphicFunctionsL(blank,EFalse);
478 blank.SetExtent(TPoint(0,0),TSize(0,0));
479 AllGraphicFunctionsL(blank);
483 void CTBackedUpWindow::RunTestCaseL(TInt /*aCurTestCase*/)
488 for (TInt iSubTest=0;iSubTest<KLastSubtest;iSubTest++)
490 DoSubTestL(iSubTest);
492 iBackedUpWindow.MaintainBackup(); //Putting this line here is a work around
495 for (TInt iSubTest=0;iSubTest<KLastSubtest;iSubTest++)
497 DoSubTestL(iSubTest);
507 void CTBackedUpWindow::DoSubTestL(TInt iState)
509 _LIT(KTest0,"Simple draw");
510 _LIT(KTest1,"Resizing");
511 _LIT(KTest2,"Invisible/Visible");
512 _LIT(KTest3,"Windows on top");
513 _LIT(KTest4,"Child Windows");
515 _LIT(KTest6,"Update Bitmap");
516 _LIT(KTest7,"Bitmap duplicate");
517 _LIT(KTest8,"Two Graphic Contexts");
518 _LIT(KTest9,"All Graphic Functions");
519 _LIT(KTest10,"Reactivate");
520 _LIT(KTest11,"DoDrawCommand");
522 TRgb rgb1(255,255,255);
523 TRgb rgb2(255,255,255);
524 TRgb rgb3(255,255,255);
525 TRgb rgb4(255,255,255);
526 TRgb rgb5(255,255,255);
527 TRgb rgb6(255,255,255);
528 TRgb rgb7(255,255,255);
529 TRgb color(TRgb::Gray4(2));
531 iTest->iState=iState;
532 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
536 @SYMTestCaseID GRAPHICS-WSERV-0202-0001
540 @SYMTestCaseDesc Test drawing in a backed up window
542 @SYMTestPriority High
544 @SYMTestStatus Implemented
546 @SYMTestActions Draw in a backed up window and a normal window and check
547 the two drawings are the same
549 @SYMTestExpectedResults The two drawings are exactly the same
552 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0202-0001"));
553 iTest->LogSubTest(KTest0);
558 @SYMTestCaseID GRAPHICS-WSERV-0202-0002
562 @SYMTestCaseDesc Test drawing in a backed up window
564 @SYMTestPriority High
566 @SYMTestStatus Implemented
568 @SYMTestActions Draw in a backed up window and a normal window and check
569 the two drawings are the same
571 @SYMTestExpectedResults The two drawings are exactly the same
574 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0202-0002"));
575 iTest->LogSubTest(KTest1);
582 @SYMTestCaseID GRAPHICS-WSERV-0203
586 @SYMTestCaseDesc Test making a backed up window invisible
588 @SYMTestPriority High
590 @SYMTestStatus Implemented
592 @SYMTestActions Draw in a backed up window and a normal window, make
593 the backed up window invisible then visible and
594 then check the two drawings are the same
596 @SYMTestExpectedResults The two drawings are exactly the same
599 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0203"));
600 iTest->LogSubTest(KTest2);
607 @SYMTestCaseID GRAPHICS-WSERV-0204
611 @SYMTestCaseDesc Test drawing in a backed up window and then placing a
614 @SYMTestPriority High
616 @SYMTestStatus Implemented
618 @SYMTestActions Draw in a backed up window and a normal window, then
619 place a window on top of the backed up window and then
620 check the two drawings are the same
622 @SYMTestExpectedResults The two drawings are exactly the same
625 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0204"));
626 iTest->LogSubTest(KTest3);
627 //TRgb rgb(220,220,220);
634 @SYMTestCaseID GRAPHICS-WSERV-0205
638 @SYMTestCaseDesc Test drawing in a backed up window and then drawing in
641 @SYMTestPriority High
643 @SYMTestStatus Implemented
645 @SYMTestActions Draw in a backed up window and a normal window, then
646 create and draw in a child window and then
647 check the two original drawings are the same
649 @SYMTestExpectedResults The two drawings are exactly the same
652 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0205"));
653 iTest->LogSubTest(KTest4);
660 @SYMTestCaseID GRAPHICS-WSERV-0206
664 @SYMTestCaseDesc Out of memeory test for backed up windows
666 @SYMTestPriority High
668 @SYMTestStatus Implemented
670 @SYMTestActions Out of memeory test for backed up windows
672 @SYMTestExpectedResults Backed up window responds correctly when out
676 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0206"));
677 iTest->LogSubTest(KTest5);
678 if (!iTest->IsFullRomL())
687 @SYMTestCaseID GRAPHICS-WSERV-0207
691 @SYMTestCaseDesc Test updating a bitmap in a backed up window
693 @SYMTestPriority High
695 @SYMTestStatus Implemented
697 @SYMTestActions Update a bitmap in a backed up window and a normal window
698 and check the two bitmaps are the same
700 @SYMTestExpectedResults The two bitmaps are exactly the same
703 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0207"));
704 iTest->LogSubTest(KTest6);
710 @SYMTestCaseID GRAPHICS-WSERV-0208
714 @SYMTestCaseDesc Test updating a duplicate bitmap in a backed up window
716 @SYMTestPriority High
718 @SYMTestStatus Implemented
720 @SYMTestActions Update a duplicated bitmap in a backed up window and a normal window
721 and check the two bitmaps are the same
723 @SYMTestExpectedResults The two bitmaps are exactly the same
726 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0208"));
727 if (iSupState==0) //Will fail unless the window is fully backup.
729 iTest->LogSubTest(KTest7);
735 @SYMTestCaseID GRAPHICS-WSERV-0209
739 @SYMTestCaseDesc Test drawing with two graphic contexts in a backed up window
741 @SYMTestPriority High
743 @SYMTestStatus Implemented
745 @SYMTestActions Draw using two graphic contexts in a backed up window and a normal
746 window and check the two drawings are the same
748 @SYMTestExpectedResults The two drawings are exactly the same
751 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0209"));
752 iTest->LogSubTest(KTest8);
760 @SYMTestCaseID GRAPHICS-WSERV-0210
764 @SYMTestCaseDesc Test drawing using all the graphic functions in a backed up window
766 @SYMTestPriority High
768 @SYMTestStatus Implemented
770 @SYMTestActions Draw using all the graphic functions in a backed up window and a normal
771 window and check the two drawings are the same
773 @SYMTestExpectedResults The two drawings are exactly the same
776 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0210"));
777 iTest->LogSubTest(KTest9);
778 if(TheClient->iScreen->SizeInPixels() == TSize(640,240))
779 AllGraphicFunctionsTestsL();
782 //A Coverage test, nothing spectacular just making the code
783 //go into CWsGc::Reactivate
787 @SYMTestCaseID GRAPHICS-WSERV-0502
789 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0502"));
790 iTest->LogSubTest(KTest10);
792 RBackedUpWindow extentWindow;
793 extentWindow=RBackedUpWindow(TheClient->iWs);
794 extentWindow.Construct(*(TheClient->iGroup->GroupWin()),EGray4,ENullWsHandle);
795 TheGc->Activate(extentWindow);
797 User::LeaveIfError(extentWindow.SetExtentErr(TPoint(2,2), TSize(4,4)));
798 extentWindow.Activate();
799 extentWindow.Close();
804 //Coverage for various messages for CWsGc::DoDrawCommand
808 @SYMTestCaseID GRAPHICS-WSERV-0507
810 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0507"));
811 iTest->LogSubTest(KTest11);
812 TheGc->Activate(iBackedUpWindow);
815 iBitGc->SetUserDisplayMode(EGray4);
817 // EWsGcOpDrawWsGraphic
818 TheGc->DrawWsGraphic(TWsGraphicId(0), TRect(0,0,10,10));
820 //create a large junk buffer so that messages with Ptr suffix will be sent
823 junkBuf8.CreateMax(650); // a large enough buffer to sent as Ptr (this value used to crash the code before)
824 junkBuf.CreateMax(650); // a large enough buffer to sent as Ptr
825 for (int i=0; i<junkBuf.MaxLength()-1;i++)
830 junkBuf8[junkBuf8.MaxLength()-1] = '\0';
831 junkBuf[junkBuf.MaxLength()-1] = '\0';
833 // EWsGcOpDrawWsGraphicPtr
834 TheGc->DrawWsGraphic(TWsGraphicId(0), TRect(0,0,10,10), junkBuf8);
836 // Set font for drawing on screen
838 TFontSpec fspec(KTestFontTypefaceName,200);
839 User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)font1,fspec));
840 TheGc->UseFont(font1);
841 iBitGc->UseFont(font1);
843 // EWsGcOpDrawTextPtr
844 TheGc->DrawText(junkBuf, TPoint(0,0));
845 iBitGc->DrawText(junkBuf, TPoint(0,0));
847 // EWsGcOpDrawBoxText - unreachable 299-too lo, 300-too hi
849 // EWsGcOpDrawBoxTextPtr
850 TheGc->DrawText(junkBuf, TRect(0,0,10,10), 0, CGraphicsContext::ELeft, 0);
851 iBitGc->DrawText(junkBuf, TRect(0,0,10,10), 0, CGraphicsContext::ELeft, 0);
853 // EWsGcOpDrawTextVerticalPtr
854 TheGc->DrawTextVertical(junkBuf, TPoint(0,0), ETrue);
855 iBitGc->DrawTextVertical(junkBuf, TPoint(0,0), ETrue);
857 // EWsGcOpDrawBoxTextVerticalPtr
858 TheGc->DrawTextVertical(junkBuf, TRect(0,0,10,10), 0, ETrue, CGraphicsContext::ELeft, 0);
859 iBitGc->DrawTextVertical(junkBuf, TRect(0,0,10,10), 0, ETrue, CGraphicsContext::ELeft, 0);
862 TheGc->MoveBy(TPoint(2,2));
863 iBitGc->MoveBy(TPoint(2,2));
865 // a bitmap for bitblt ops
866 CWsBitmap bmp(TheClient->iWs);
867 bmp.Create(TSize(16,16), iBackedUpWindow.DisplayMode());
870 TheGc->BitBlt(TPoint(0,0), &bmp);
871 iBitGc->BitBlt(TPoint(0,0), &bmp);
874 TheGc->BitBlt(TPoint(0,0), &bmp, TRect(0,0,10,10));
875 iBitGc->BitBlt(TPoint(0,0), &bmp, TRect(0,0,10,10));
877 // EWsGcOpGdiWsBltMasked
878 TheGc->BitBltMasked(TPoint(0,0), &bmp, TRect(0,0,10,10), &bmp, EFalse);
879 iBitGc->BitBltMasked(TPoint(0,0), &bmp, TRect(0,0,10,10), &bmp, EFalse);
881 // EWsGcOpGdiWsAlphaBlendBitmaps
882 TheGc->AlphaBlendBitmaps(TPoint(0,0), &bmp, TRect(0,0,10,10), &bmp, TPoint(1,1));
883 iBitGc->AlphaBlendBitmaps(TPoint(0,0), &bmp, TRect(0,0,10,10), &bmp, TPoint(1,1));
885 // EWsGcOpWsDrawBitmapMasked
886 TheGc->DrawBitmapMasked(TRect(0,0,10,10), &bmp, TRect(0,0,8,8), &bmp, ETrue);
887 iBitGc->DrawBitmapMasked(TRect(0,0,10,10), &bmp, TRect(0,0,8,8), &bmp, ETrue);
890 TheGc->DrawBitmap(TPoint(0,0), &bmp);
891 iBitGc->DrawBitmap(TPoint(0,0), &bmp);
893 // EWsGcOpDrawBitmapMasked
894 TheGc->DrawBitmapMasked(TRect(0,0,10,10), static_cast<const CFbsBitmap*>(&bmp),
895 TRect(0,0,8,8), static_cast<const CFbsBitmap*>(&bmp),
897 iBitGc->DrawBitmapMasked(TRect(0,0,10,10), static_cast<const CFbsBitmap*>(&bmp),
898 TRect(0,0,8,8), static_cast<const CFbsBitmap*>(&bmp),
901 // EWsGcOpDrawPolyLineContinued
902 TheGc->DrawPolyLine(reinterpret_cast<const TPoint*>(junkBuf8.Ptr()),
903 TInt(junkBuf8.Size()/sizeof(TPoint)));
904 iBitGc->DrawPolyLine(reinterpret_cast<const TPoint*>(junkBuf8.Ptr()),
905 TInt(junkBuf8.Size()/sizeof(TPoint)));
908 TheGc->CopyRect(TPoint(0,0), TRect(0,0,10,10));
909 iBitGc->CopyRect(TPoint(0,0), TRect(0,0,10,10));
913 TheGc->DiscardFont();
914 iBitGc->DiscardFont();
915 TheClient->iScreen->ReleaseFont(font1);
922 //the following have no client equivalent methods
923 // EWsGcOpMapColorsLocal
924 // EWsGcOpDrawPolyLineLocalBufLen
925 // EWsGcOpDrawPolyLineLocal
926 // EWsGcOpDrawPolygonLocalBufLen
927 // EWsGcOpDrawPolygonLocal
928 // EWsGcOpDrawBitmapLocal
929 // EWsGcOpDrawBitmap2Local
930 // EWsGcOpDrawBitmap3Local
931 // EWsGcOpDrawBitmapMaskedLocal
932 // EWsGcOpDrawTextPtr1
933 // EWsGcOpDrawBoxTextPtr1
934 // EWsGcOpDrawTextVerticalPtr1
935 // EWsGcOpDrawBoxTextVerticalPtr1
936 // EWsGcOpDrawTextLocal
937 // EWsGcOpDrawBoxTextLocal
938 // EWsGcOpGdiBlt2Local
939 // EWsGcOpGdiBlt3Local
940 // EWsGcOpGdiBltMaskedLocal
941 ((CTBackedUpWindowStep*)iStep)->CloseTMSGraphicsStep();
946 ((CTBackedUpWindowStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
947 ((CTBackedUpWindowStep*)iStep)->CloseTMSGraphicsStep();
950 ((CTBackedUpWindowStep*)iStep)->RecordTestResultL();
953 __WS_CONSTRUCT_STEP__(BackedUpWindow)