sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Test backed up windows sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #include "TBACKUPW.H" sl@0: sl@0: CTBackedUpWindow::CTBackedUpWindow(CTestStep* aStep): sl@0: CTWsGraphicsBase(aStep) sl@0: { sl@0: } sl@0: sl@0: sl@0: void CTBackedUpWindow::CheckWindow(CFbsBitmap *aBitmap) sl@0: { sl@0: TPoint oldPos=iBackedUpWindow.Position(); sl@0: iBackedUpWindow.SetPosition(TPoint(0,0)); sl@0: sl@0: iCheckWindow.SetVisible(ETrue); sl@0: iCheckWindow.SetPosition(iCheckPos); sl@0: sl@0: iCheckWindow.BeginRedraw(); sl@0: TheGc->Activate(iCheckWindow); sl@0: TheGc->BitBlt(TPoint(0,0), aBitmap); sl@0: TheGc->Deactivate(); sl@0: iCheckWindow.EndRedraw(); sl@0: sl@0: TheClient->iWs.Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: TBool retVal = TheClient->iScreen->RectCompare(TRect(iSize),TRect(iCheckPos,iSize)); sl@0: TEST(retVal); sl@0: if (!retVal) sl@0: INFO_PRINTF3(_L("TheClient->iScreen->RectCompare(TRect(iSize),TRect(iCheckPos,iSize)) return value - Expected: %d , Actual: %d"), ETrue, retVal); sl@0: sl@0: iCheckWindow.SetVisible(EFalse); sl@0: iBackedUpWindow.SetPosition(oldPos); sl@0: } sl@0: sl@0: void CTBackedUpWindow::CheckWindow() sl@0: { sl@0: CheckWindow(&iBitmap); sl@0: } sl@0: sl@0: void CTBackedUpWindow::Draw(TInt aDrawFunc, TAny *aParam) sl@0: { sl@0: TheGc->Activate(iBackedUpWindow); sl@0: Draw(aDrawFunc, aParam, TheGc, iBitGc); sl@0: TheGc->Deactivate(); sl@0: } sl@0: sl@0: void CTBackedUpWindow::DrawWithTwoGcsL() sl@0: { sl@0: RBlankWindow blank(TheClient->iWs); sl@0: User::LeaveIfError(blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle)); sl@0: blank.Activate(); sl@0: CWindowGc *gc2; sl@0: User::LeaveIfError(TheClient->iScreen->CreateContext(gc2)); sl@0: CleanupStack::PushL(gc2); sl@0: sl@0: CFbsFont *font1; sl@0: TFontSpec fspec(KTestFontTypefaceName,200); sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)font1,fspec)); sl@0: CFbsFont *font2; sl@0: TFontSpec fspec2(KTestFontTypefaceName,400); sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)font2,fspec2)); sl@0: sl@0: gc2->Activate(iBackedUpWindow); sl@0: gc2->UseFont(font2); sl@0: TheGc->Activate(iBackedUpWindow); sl@0: TheGc->UseFont(font1); sl@0: _LIT(KText,"Testing123"); sl@0: TheGc->DrawText(KText,TPoint(20,20)); sl@0: gc2->DrawText(KText,TPoint(20,40)); sl@0: iBitGc->UseFont(font1); sl@0: iBitGc->DrawText(KText,TPoint(20,20)); sl@0: iBitGc->UseFont(font2); sl@0: iBitGc->DrawText(KText,TPoint(20,40)); sl@0: iBitGc->DiscardFont(); sl@0: TheGc->Deactivate(); sl@0: TheClient->iScreen->ReleaseFont(font2); sl@0: TheClient->iScreen->ReleaseFont(font1); sl@0: CleanupStack::PopAndDestroy(); sl@0: blank.Close(); sl@0: } sl@0: sl@0: void CTBackedUpWindow::Draw(TInt aDrawFunc, TAny *aParam, CBitmapContext *gc1, CBitmapContext *gc2) //DDD sl@0: { sl@0: CBitmapContext *gc; sl@0: for(TInt mode=0;mode<2;mode++) sl@0: { sl@0: if (mode==0) sl@0: gc=gc1; sl@0: else sl@0: gc=gc2; sl@0: gc->Reset(); sl@0: switch(aDrawFunc) sl@0: { sl@0: case 0: sl@0: gc->SetBrushColor(*((TRgb *)aParam)); sl@0: gc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: gc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: gc->DrawRect(TRect(iSize)); sl@0: break; sl@0: case 1: sl@0: { sl@0: TSize half(iSize.iWidth/2,iSize.iHeight/2); sl@0: gc->DrawEllipse(TRect(half)); sl@0: gc->DrawEllipse(TRect(TPoint(0,half.iHeight),half)); sl@0: TRect rect1(half); sl@0: gc->SetOrigin(TPoint(half.iWidth,0)); sl@0: gc->SetClippingRect(rect1); sl@0: gc->DrawEllipse(rect1); sl@0: gc->SetOrigin(TPoint(half.iWidth,half.iHeight)); sl@0: gc->SetClippingRect(rect1); sl@0: gc->DrawEllipse(rect1); sl@0: gc->SetOrigin(TPoint(0,0)); sl@0: gc->CancelClippingRect(); sl@0: } sl@0: break; sl@0: case 2: sl@0: { sl@0: TInt param= *((TInt *)aParam); sl@0: if (param&0x1) sl@0: gc->DrawLine(TPoint(param+(param*27)%iSize.iWidth,0), sl@0: TPoint(iSize.iWidth-((param<<1)+(param*19)%iSize.iWidth),iSize.iHeight)); sl@0: else sl@0: gc->DrawLine(TPoint(0, (param<<1)+(param*7)%iSize.iHeight), sl@0: TPoint(iSize.iWidth,param+(param*13)%iSize.iHeight)); sl@0: } sl@0: break; sl@0: case 3: sl@0: { sl@0: TPoint pos; sl@0: for(;pos.iXDrawLine(pos,pos+TSize(0,iSize.iHeight)); sl@0: for(pos.iX=0;pos.iYDrawLine(pos,pos+TSize(iSize.iWidth,0)); sl@0: } sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: sl@0: CTBackedUpWindow::~CTBackedUpWindow() sl@0: { sl@0: iBackedUpWindow.Close(); sl@0: iCheckWindow.Close(); sl@0: iOomFrontWindow.Close(); sl@0: delete iBitGc; sl@0: delete iBitmapDevice; sl@0: delete iTestBitmap; sl@0: delete iMaskBitmap; sl@0: } sl@0: sl@0: void CopyToGray4L(CFbsBitmap*& aDestBitmap,const CFbsBitmap& aSrcBitmap) sl@0: { sl@0: aDestBitmap=new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(aDestBitmap); sl@0: User::LeaveIfError(aDestBitmap->Create(aSrcBitmap.SizeInPixels(),EGray4)); sl@0: CFbsBitmapDevice* device=CFbsBitmapDevice::NewL(aDestBitmap); sl@0: CleanupStack::PushL(device); sl@0: CFbsBitGc* gc; sl@0: User::LeaveIfError(device->CreateContext(gc)); sl@0: gc->BitBlt(TPoint(),&aSrcBitmap); sl@0: delete gc; sl@0: CleanupStack::PopAndDestroy(device); sl@0: CleanupStack::Pop(aDestBitmap); sl@0: } sl@0: sl@0: void CTBackedUpWindow::ConstructL() sl@0: { sl@0: iBackedUpWindow=RBackedUpWindow(TheClient->iWs); sl@0: iBackedUpWindow.Construct(*(TheClient->iGroup->GroupWin()),EGray4,ENullWsHandle); sl@0: TSize size=TheClient->iScreen->SizeInTwips(); sl@0: iSize=TheClient->iScreen->SizeInPixels(); sl@0: iSize.iWidth>>=1; sl@0: iSize.iHeight>>=1; sl@0: size.iWidth>>=1; sl@0: size.iHeight>>=1; sl@0: size.iWidth-=1; //Modification to get the mapping factor the same as the screen sl@0: size.iHeight-=1; //Ditto sl@0: iWinPos.SetXY(iSize.iWidth>>1,iSize.iHeight>>1); sl@0: User::LeaveIfError(iBackedUpWindow.SetExtentErr(iWinPos,iSize)); sl@0: iBackedUpWindow.Activate(); sl@0: sl@0: iCheckPos.SetXY(iSize.iWidth,0); sl@0: iCheckWindow=RWindow(TheClient->iWs); sl@0: iCheckWindow.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle); sl@0: iCheckWindow.SetSize(iSize); sl@0: iCheckWindow.SetVisible(EFalse); sl@0: iCheckWindow.Activate(); sl@0: sl@0: TInt col,grey; sl@0: TDisplayMode defMode=TheClient->iWs.GetDefModeMaxNumColors(col,grey); sl@0: User::LeaveIfError(iBitmap.Create(iSize,defMode)); sl@0: iBitmap.SetSizeInTwips(size); sl@0: iBitmapDevice=CFbsBitmapDevice::NewL(&iBitmap); sl@0: User::LeaveIfError(iBitmapDevice->CreateContext(iBitGc)); sl@0: sl@0: TRgb rgb(TRgb::Gray4(2)); sl@0: Draw(0,&rgb); sl@0: sl@0: iTestBitmap=new(ELeave) CFbsBitmap(); sl@0: User::LeaveIfError(iTestBitmap->Load(TEST_BITMAP_NAME,0)); sl@0: iTestBitmap->SetSizeInTwips(TSize(1500,750)); sl@0: iMaskBitmap=new(ELeave) CFbsBitmap(); sl@0: User::LeaveIfError(iMaskBitmap->Load(TEST_BITMAP_NAME,0)); sl@0: TDisplayMode defMode2=iMaskBitmap->DisplayMode(); sl@0: if (defMode>EGray4) sl@0: { sl@0: CFbsBitmap* bitmap=iTestBitmap; sl@0: CopyToGray4L(iTestBitmap,*bitmap); sl@0: delete bitmap; sl@0: bitmap=iMaskBitmap; sl@0: CopyToGray4L(iMaskBitmap,*bitmap); sl@0: delete bitmap; sl@0: } sl@0: defMode2=iMaskBitmap->DisplayMode(); sl@0: defMode2=iMaskBitmap->DisplayMode(); sl@0: } sl@0: sl@0: void CTBackedUpWindow::InvisVis() sl@0: { sl@0: iBackedUpWindow.SetVisible(EFalse); sl@0: TheClient->iWs.Flush(); sl@0: iBackedUpWindow.SetVisible(ETrue); sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTBackedUpWindow::WindowOnTop() sl@0: { sl@0: RBlankWindow blank(TheClient->iWs); sl@0: blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle); sl@0: blank.Activate(); sl@0: blank.Close(); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: TPoint pos; sl@0: TInt sizeMode=0; sl@0: TInt draw=13; sl@0: sl@0: for(pos.iX=-iSize.iWidth;pos.iXiWs); sl@0: blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle); sl@0: blank.SetColor(TRgb::Gray256(220)); sl@0: blank.SetShadowHeight(2); sl@0: blank.SetExtent(pos+iWinPos,TSize((sizeMode&0x1)?iSize.iWidth>>1:iSize.iWidth<<1,(sizeMode&0x2)?iSize.iHeight>>1:iSize.iHeight<<1)); sl@0: sizeMode=(sizeMode+1)%4; sl@0: blank.Activate(); sl@0: Draw(2,&draw); sl@0: TheClient->iWs.Flush(); sl@0: draw++; sl@0: blank.Close(); sl@0: } sl@0: } sl@0: sl@0: void CTBackedUpWindow::Resize() sl@0: { sl@0: RBlankWindow blank(TheClient->iWs); sl@0: blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle); sl@0: blank.SetColor(TRgb::Gray256(128)); sl@0: blank.Activate(); sl@0: TInt xtop=(iSize.iWidth)-(iSize.iWidth>>2); sl@0: TInt ytop=(iSize.iHeight)-(iSize.iHeight>>2); sl@0: for(TInt winMode=0;winMode<3;winMode++) sl@0: { sl@0: switch(winMode) sl@0: { sl@0: case 0: sl@0: blank.SetExtent(TPoint(0,ytop),TSize(iSize.iWidth,iSize.iHeight>>1)); sl@0: break; sl@0: case 1: sl@0: blank.SetExtent(TPoint(xtop,0),TSize(iSize.iWidth>>1,iSize.iHeight)); sl@0: break; sl@0: case 2: sl@0: blank.SetExtent(TPoint(xtop,ytop),TSize(iSize.iWidth>>1,iSize.iHeight>>1)); sl@0: break; sl@0: } sl@0: blank.SetShadowHeight(winMode); sl@0: TPoint oldPos=iBackedUpWindow.Position(); sl@0: TPoint pos=oldPos; sl@0: for(TUint i=0;iiWs.Flush(); sl@0: } sl@0: iBackedUpWindow.SetPosition(oldPos); sl@0: } sl@0: blank.Close(); sl@0: } sl@0: sl@0: void CTBackedUpWindow::ChildWindows() sl@0: { sl@0: TPoint pos; sl@0: TInt sizeMode=0; sl@0: TInt draw=13; sl@0: RBlankWindow blank(TheClient->iWs); sl@0: for(pos.iX=-(iSize.iWidth>>1);pos.iX>1);pos.iY>2:iSize.iWidth,(sizeMode&0x2)?iSize.iHeight>>2:iSize.iHeight)); sl@0: sizeMode=(sizeMode+1)%4; sl@0: blank.Activate(); sl@0: Draw(2,&draw); sl@0: TheClient->iWs.Flush(); sl@0: draw++; sl@0: blank.Close(); sl@0: } sl@0: } sl@0: sl@0: void CTBackedUpWindow::DupBitmapTestL() sl@0: { sl@0: INFO_PRINTF1(_L("AUTO Dup Bitmap Test ")); sl@0: CFbsBitmap *dup=new(ELeave) CFbsBitmap(); sl@0: dup->Duplicate(iBackedUpWindow.BitmapHandle()); sl@0: CheckWindow(dup); sl@0: TRgb rgb(TRgb::Gray4(1)); sl@0: Draw(0,&rgb); sl@0: CheckWindow(dup); sl@0: INFO_PRINTF1(_L(" Done Window Drawing Test")); sl@0: sl@0: CFbsBitmapDevice *dupDevice=NULL; sl@0: TRAPD(err,dupDevice=CFbsBitmapDevice::NewL(dup)); sl@0: CFbsBitGc *gc; sl@0: if (err==KErrNone && dupDevice->CreateContext(gc)==KErrNone) sl@0: { sl@0: Draw(3,NULL,gc,iBitGc); // Draw directly to backup bitmap (and test bitmap) sl@0: iBackedUpWindow.UpdateScreen(); sl@0: INFO_PRINTF1(_L(" First Bitmap Drawing")); sl@0: CheckWindow(); sl@0: TRgb rgb(TRgb::Gray256(128)); sl@0: TInt col,grey; sl@0: if (TheClient->iWs.GetDefModeMaxNumColors(col,grey)>EGray4) sl@0: rgb=TRgb::Gray4(2); sl@0: Draw(0,&rgb,gc,iBitGc); sl@0: Draw(1,NULL,gc,iBitGc); sl@0: iBackedUpWindow.UpdateScreen(TRegionFix<1>(TRect(iSize))); sl@0: INFO_PRINTF1(_L(" Second Bitmap Drawing")); sl@0: CheckWindow(); sl@0: delete gc; sl@0: } sl@0: delete dupDevice; sl@0: delete dup; sl@0: } sl@0: sl@0: void CTBackedUpWindow::UpdateBitmapTestL() sl@0: { sl@0: INFO_PRINTF1(_L("AUTO UpdateBitmap ")); sl@0: CheckWindow(); sl@0: CFbsBitmap *dup=new(ELeave) CFbsBitmap(); sl@0: dup->Duplicate(iBackedUpWindow.BitmapHandle()); sl@0: Draw(3,NULL); sl@0: iBackedUpWindow.UpdateBackupBitmap(); sl@0: INFO_PRINTF1(_L(" First Drawing")); sl@0: CheckWindow(dup); sl@0: TRgb rgb; sl@0: if (iSupState==0) sl@0: rgb=TRgb::Gray256(128); sl@0: else sl@0: rgb=TRgb::Gray4(2); sl@0: Draw(0,&rgb); sl@0: Draw(1,NULL); sl@0: iBackedUpWindow.UpdateBackupBitmap(); sl@0: INFO_PRINTF1(_L(" Second Drawing")); sl@0: CheckWindow(dup); sl@0: delete dup; sl@0: } sl@0: sl@0: void CTBackedUpWindow::OOML() sl@0: { sl@0: iOomFrontWindow=RBlankWindow(TheClient->iWs); sl@0: TSize size(iBackedUpWindow.Size()); sl@0: size.iWidth>>=1; sl@0: size.iHeight>>=1; sl@0: TPoint pos(size.iWidth*3/2,size.iHeight*3/2); sl@0: iOomFrontWindow.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle); sl@0: iOomFrontWindow.SetColor(TRgb(TRgb::Gray4(1))); sl@0: iOomFrontWindow.SetExtent(pos,size); sl@0: iOomFrontWindow.Activate(); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: TPoint buwPos=iBackedUpWindow.Position(); sl@0: TSize buwSize=iBackedUpWindow.Size(); sl@0: for(TInt count=0;count<100;count++) sl@0: { sl@0: iOomFrontWindow.SetVisible(ETrue); sl@0: TheClient->iWs.HeapSetFail(RHeap::EDeterministic,count); sl@0: iBackedUpWindow.SetPosition(buwPos+TPoint(10,5)); sl@0: iBackedUpWindow.SetPosition(buwPos); sl@0: iOomFrontWindow.SetSize(size+TSize(10,5)); sl@0: iOomFrontWindow.SetSize(size); sl@0: iBackedUpWindow.SetSizeErr(buwSize+TSize(13,7)); sl@0: iBackedUpWindow.SetSizeErr(buwSize); sl@0: iOomFrontWindow.SetVisible(EFalse); sl@0: TheClient->iWs.HeapSetFail(RHeap::ENone,0); sl@0: User::LeaveIfError(iBackedUpWindow.SetSizeErr(buwSize)); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: CheckWindow(); sl@0: } sl@0: sl@0: iOomFrontWindow.Close(); sl@0: } sl@0: sl@0: void CTBackedUpWindow::doGraphicFunctionsL(CBitmapContext *gc,TBool aExtraDrawBitMap) sl@0: { sl@0: TSize size=iBackedUpWindow.Size(); sl@0: CFbsFont *aFont; sl@0: _LIT(KFontName,"Swiss"); sl@0: TFontSpec fspec(KFontName,190); sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)aFont,fspec)); sl@0: CFbsBitmap* aBitmap=iTestBitmap; sl@0: CFbsBitmap* aMaskBitmap=iMaskBitmap; sl@0: sl@0: #include "DLLDRAW.H" // Draws to a Gc called 'gc' sl@0: sl@0: TheClient->iScreen->ReleaseFont(aFont); sl@0: } sl@0: sl@0: void CTBackedUpWindow::AllGraphicFunctionsL(RBlankWindow &aBlank,TBool aExtraDrawBitMap/*=ETrue*/) sl@0: { sl@0: aExtraDrawBitMap=EFalse; //Check out when bitblit scaling has changed again sl@0: aBlank.SetVisible(ETrue); sl@0: TheGc->Activate(iBackedUpWindow); sl@0: TRAPD(err,doGraphicFunctionsL(TheGc,aExtraDrawBitMap)); sl@0: TheGc->Deactivate(); sl@0: User::LeaveIfError(err); sl@0: iBitGc->Reset(); sl@0: iBitGc->SetUserDisplayMode(EGray4); sl@0: doGraphicFunctionsL(iBitGc,aExtraDrawBitMap); sl@0: aBlank.SetVisible(EFalse); sl@0: CheckWindow(); sl@0: } sl@0: sl@0: void CTBackedUpWindow::AllGraphicFunctionsTestsL() sl@0: { sl@0: RBlankWindow blank(TheClient->iWs); sl@0: TInt xtop=(iSize.iWidth)-(iSize.iWidth>>1); sl@0: TInt ytop=(iSize.iHeight)-(iSize.iHeight>>1); sl@0: blank.Construct(*(TheClient->iGroup->GroupWin()),ENullWsHandle); sl@0: blank.SetColor(TRgb::Gray256(128)); sl@0: blank.Activate(); sl@0: blank.SetExtent(TPoint(0,ytop),TSize(iSize.iWidth,iSize.iHeight>>2)); sl@0: AllGraphicFunctionsL(blank); sl@0: blank.SetExtent(TPoint(0,ytop+10),TSize(iSize.iWidth,iSize.iHeight>>2)); sl@0: AllGraphicFunctionsL(blank); sl@0: blank.SetExtent(TPoint(xtop,ytop),TSize(iSize.iWidth>>1,iSize.iHeight)); sl@0: AllGraphicFunctionsL(blank,EFalse); sl@0: blank.SetExtent(TPoint(xtop+(iSize.iWidth>>1),ytop),TSize(iSize.iWidth>>1,iSize.iHeight)); sl@0: AllGraphicFunctionsL(blank,EFalse); sl@0: blank.SetExtent(TPoint(xtop+10,iSize.iHeight),TSize(iSize.iWidth,iSize.iHeight)); sl@0: AllGraphicFunctionsL(blank,EFalse); sl@0: blank.SetExtent(TPoint(xtop,ytop),iSize); sl@0: AllGraphicFunctionsL(blank,EFalse); sl@0: blank.SetExtent(TPoint(0,0),TSize(0,0)); sl@0: AllGraphicFunctionsL(blank); sl@0: blank.Close(); sl@0: } sl@0: sl@0: void CTBackedUpWindow::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: switch(iSupState) sl@0: { sl@0: case 0: sl@0: for (TInt iSubTest=0;iSubTestiState=iState; sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch(iState) sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0202-0001 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test drawing in a backed up window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Draw in a backed up window and a normal window and check sl@0: the two drawings are the same sl@0: sl@0: @SYMTestExpectedResults The two drawings are exactly the same sl@0: */ sl@0: case 0: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0202-0001")); sl@0: iTest->LogSubTest(KTest0); sl@0: Draw(1,NULL); sl@0: CheckWindow(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0202-0002 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test drawing in a backed up window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Draw in a backed up window and a normal window and check sl@0: the two drawings are the same sl@0: sl@0: @SYMTestExpectedResults The two drawings are exactly the same sl@0: */ sl@0: case 1: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0202-0002")); sl@0: iTest->LogSubTest(KTest1); sl@0: Draw(0,&rgb1); sl@0: Draw(3,NULL); sl@0: Resize(); sl@0: CheckWindow(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0203 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test making a backed up window invisible sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Draw in a backed up window and a normal window, make sl@0: the backed up window invisible then visible and sl@0: then check the two drawings are the same sl@0: sl@0: @SYMTestExpectedResults The two drawings are exactly the same sl@0: */ sl@0: case 2: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0203")); sl@0: iTest->LogSubTest(KTest2); sl@0: Draw(0,&rgb2); sl@0: Draw(1,NULL); sl@0: InvisVis(); sl@0: CheckWindow(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0204 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test drawing in a backed up window and then placing a sl@0: window on top of it sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Draw in a backed up window and a normal window, then sl@0: place a window on top of the backed up window and then sl@0: check the two drawings are the same sl@0: sl@0: @SYMTestExpectedResults The two drawings are exactly the same sl@0: */ sl@0: case 3: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0204")); sl@0: iTest->LogSubTest(KTest3); sl@0: //TRgb rgb(220,220,220); sl@0: Draw(0,&rgb3); sl@0: Draw(1,NULL); sl@0: WindowOnTop(); sl@0: CheckWindow(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0205 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test drawing in a backed up window and then drawing in sl@0: a child window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Draw in a backed up window and a normal window, then sl@0: create and draw in a child window and then sl@0: check the two original drawings are the same sl@0: sl@0: @SYMTestExpectedResults The two drawings are exactly the same sl@0: */ sl@0: case 4: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0205")); sl@0: iTest->LogSubTest(KTest4); sl@0: Draw(0,&rgb4); sl@0: Draw(3,NULL); sl@0: ChildWindows(); sl@0: CheckWindow(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0206 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Out of memeory test for backed up windows sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Out of memeory test for backed up windows sl@0: sl@0: @SYMTestExpectedResults Backed up window responds correctly when out sl@0: of memory sl@0: */ sl@0: case 5: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0206")); sl@0: iTest->LogSubTest(KTest5); sl@0: if (!iTest->IsFullRomL()) sl@0: { sl@0: Draw(0,&rgb5); sl@0: Draw(3,NULL); sl@0: OOML(); sl@0: CheckWindow(); sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0207 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test updating a bitmap in a backed up window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Update a bitmap in a backed up window and a normal window sl@0: and check the two bitmaps are the same sl@0: sl@0: @SYMTestExpectedResults The two bitmaps are exactly the same sl@0: */ sl@0: case 6: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0207")); sl@0: iTest->LogSubTest(KTest6); sl@0: Draw(0,&rgb6); sl@0: Draw(1,NULL); sl@0: UpdateBitmapTestL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0208 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test updating a duplicate bitmap in a backed up window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Update a duplicated bitmap in a backed up window and a normal window sl@0: and check the two bitmaps are the same sl@0: sl@0: @SYMTestExpectedResults The two bitmaps are exactly the same sl@0: */ sl@0: case 7: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0208")); sl@0: if (iSupState==0) //Will fail unless the window is fully backup. sl@0: break; sl@0: iTest->LogSubTest(KTest7); sl@0: Draw(0,&rgb7); sl@0: Draw(1,NULL); sl@0: DupBitmapTestL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0209 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test drawing with two graphic contexts in a backed up window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Draw using two graphic contexts in a backed up window and a normal sl@0: window and check the two drawings are the same sl@0: sl@0: @SYMTestExpectedResults The two drawings are exactly the same sl@0: */ sl@0: case 8: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0209")); sl@0: iTest->LogSubTest(KTest8); sl@0: Draw(0,&color); sl@0: Draw(1,NULL); sl@0: DrawWithTwoGcsL(); sl@0: CheckWindow(); sl@0: break; sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0210 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test drawing using all the graphic functions in a backed up window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Draw using all the graphic functions in a backed up window and a normal sl@0: window and check the two drawings are the same sl@0: sl@0: @SYMTestExpectedResults The two drawings are exactly the same sl@0: */ sl@0: case 9: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0210")); sl@0: iTest->LogSubTest(KTest9); sl@0: if(TheClient->iScreen->SizeInPixels() == TSize(640,240)) sl@0: AllGraphicFunctionsTestsL(); sl@0: break; sl@0: sl@0: //A Coverage test, nothing spectacular just making the code sl@0: //go into CWsGc::Reactivate sl@0: case 10: sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0502 sl@0: */ sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0502")); sl@0: iTest->LogSubTest(KTest10); sl@0: TheGc->Deactivate(); sl@0: RBackedUpWindow extentWindow; sl@0: extentWindow=RBackedUpWindow(TheClient->iWs); sl@0: extentWindow.Construct(*(TheClient->iGroup->GroupWin()),EGray4,ENullWsHandle); sl@0: TheGc->Activate(extentWindow); sl@0: TheClient->Flush(); sl@0: User::LeaveIfError(extentWindow.SetExtentErr(TPoint(2,2), TSize(4,4))); sl@0: extentWindow.Activate(); sl@0: extentWindow.Close(); sl@0: TheGc->Deactivate(); sl@0: break; sl@0: } sl@0: sl@0: //Coverage for various messages for CWsGc::DoDrawCommand sl@0: case 11: sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0507 sl@0: */ sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0507")); sl@0: iTest->LogSubTest(KTest11); sl@0: TheGc->Activate(iBackedUpWindow); sl@0: TheGc->Reset(); sl@0: iBitGc->Reset(); sl@0: iBitGc->SetUserDisplayMode(EGray4); sl@0: sl@0: // EWsGcOpDrawWsGraphic sl@0: TheGc->DrawWsGraphic(TWsGraphicId(0), TRect(0,0,10,10)); sl@0: sl@0: //create a large junk buffer so that messages with Ptr suffix will be sent sl@0: RBuf8 junkBuf8; sl@0: RBuf junkBuf; sl@0: junkBuf8.CreateMax(650); // a large enough buffer to sent as Ptr (this value used to crash the code before) sl@0: junkBuf.CreateMax(650); // a large enough buffer to sent as Ptr sl@0: for (int i=0; iDrawWsGraphic(TWsGraphicId(0), TRect(0,0,10,10), junkBuf8); sl@0: sl@0: // Set font for drawing on screen sl@0: CFbsFont *font1; sl@0: TFontSpec fspec(KTestFontTypefaceName,200); sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont *&)font1,fspec)); sl@0: TheGc->UseFont(font1); sl@0: iBitGc->UseFont(font1); sl@0: sl@0: // EWsGcOpDrawTextPtr sl@0: TheGc->DrawText(junkBuf, TPoint(0,0)); sl@0: iBitGc->DrawText(junkBuf, TPoint(0,0)); sl@0: sl@0: // EWsGcOpDrawBoxText - unreachable 299-too lo, 300-too hi sl@0: sl@0: // EWsGcOpDrawBoxTextPtr sl@0: TheGc->DrawText(junkBuf, TRect(0,0,10,10), 0, CGraphicsContext::ELeft, 0); sl@0: iBitGc->DrawText(junkBuf, TRect(0,0,10,10), 0, CGraphicsContext::ELeft, 0); sl@0: sl@0: // EWsGcOpDrawTextVerticalPtr sl@0: TheGc->DrawTextVertical(junkBuf, TPoint(0,0), ETrue); sl@0: iBitGc->DrawTextVertical(junkBuf, TPoint(0,0), ETrue); sl@0: sl@0: // EWsGcOpDrawBoxTextVerticalPtr sl@0: TheGc->DrawTextVertical(junkBuf, TRect(0,0,10,10), 0, ETrue, CGraphicsContext::ELeft, 0); sl@0: iBitGc->DrawTextVertical(junkBuf, TRect(0,0,10,10), 0, ETrue, CGraphicsContext::ELeft, 0); sl@0: sl@0: // EWsGcOpMoveBy sl@0: TheGc->MoveBy(TPoint(2,2)); sl@0: iBitGc->MoveBy(TPoint(2,2)); sl@0: sl@0: // a bitmap for bitblt ops sl@0: CWsBitmap bmp(TheClient->iWs); sl@0: bmp.Create(TSize(16,16), iBackedUpWindow.DisplayMode()); sl@0: sl@0: // EWsGcOpGdiWsBlt2 sl@0: TheGc->BitBlt(TPoint(0,0), &bmp); sl@0: iBitGc->BitBlt(TPoint(0,0), &bmp); sl@0: sl@0: // EWsGcOpGdiWsBlt3 sl@0: TheGc->BitBlt(TPoint(0,0), &bmp, TRect(0,0,10,10)); sl@0: iBitGc->BitBlt(TPoint(0,0), &bmp, TRect(0,0,10,10)); sl@0: sl@0: // EWsGcOpGdiWsBltMasked sl@0: TheGc->BitBltMasked(TPoint(0,0), &bmp, TRect(0,0,10,10), &bmp, EFalse); sl@0: iBitGc->BitBltMasked(TPoint(0,0), &bmp, TRect(0,0,10,10), &bmp, EFalse); sl@0: sl@0: // EWsGcOpGdiWsAlphaBlendBitmaps sl@0: TheGc->AlphaBlendBitmaps(TPoint(0,0), &bmp, TRect(0,0,10,10), &bmp, TPoint(1,1)); sl@0: iBitGc->AlphaBlendBitmaps(TPoint(0,0), &bmp, TRect(0,0,10,10), &bmp, TPoint(1,1)); sl@0: sl@0: // EWsGcOpWsDrawBitmapMasked sl@0: TheGc->DrawBitmapMasked(TRect(0,0,10,10), &bmp, TRect(0,0,8,8), &bmp, ETrue); sl@0: iBitGc->DrawBitmapMasked(TRect(0,0,10,10), &bmp, TRect(0,0,8,8), &bmp, ETrue); sl@0: sl@0: // EWsGcOpDrawBitmap sl@0: TheGc->DrawBitmap(TPoint(0,0), &bmp); sl@0: iBitGc->DrawBitmap(TPoint(0,0), &bmp); sl@0: sl@0: // EWsGcOpDrawBitmapMasked sl@0: TheGc->DrawBitmapMasked(TRect(0,0,10,10), static_cast(&bmp), sl@0: TRect(0,0,8,8), static_cast(&bmp), sl@0: EFalse); sl@0: iBitGc->DrawBitmapMasked(TRect(0,0,10,10), static_cast(&bmp), sl@0: TRect(0,0,8,8), static_cast(&bmp), sl@0: EFalse); sl@0: sl@0: // EWsGcOpDrawPolyLineContinued sl@0: TheGc->DrawPolyLine(reinterpret_cast(junkBuf8.Ptr()), sl@0: TInt(junkBuf8.Size()/sizeof(TPoint))); sl@0: iBitGc->DrawPolyLine(reinterpret_cast(junkBuf8.Ptr()), sl@0: TInt(junkBuf8.Size()/sizeof(TPoint))); sl@0: sl@0: // EWsGcOpCopyRect sl@0: TheGc->CopyRect(TPoint(0,0), TRect(0,0,10,10)); sl@0: iBitGc->CopyRect(TPoint(0,0), TRect(0,0,10,10)); sl@0: sl@0: //cleanup sl@0: TheClient->Flush(); sl@0: TheGc->DiscardFont(); sl@0: iBitGc->DiscardFont(); sl@0: TheClient->iScreen->ReleaseFont(font1); sl@0: junkBuf.Close(); sl@0: junkBuf8.Close(); sl@0: TheGc->Deactivate(); sl@0: sl@0: CheckWindow(); sl@0: sl@0: //the following have no client equivalent methods sl@0: // EWsGcOpMapColorsLocal sl@0: // EWsGcOpDrawPolyLineLocalBufLen sl@0: // EWsGcOpDrawPolyLineLocal sl@0: // EWsGcOpDrawPolygonLocalBufLen sl@0: // EWsGcOpDrawPolygonLocal sl@0: // EWsGcOpDrawBitmapLocal sl@0: // EWsGcOpDrawBitmap2Local sl@0: // EWsGcOpDrawBitmap3Local sl@0: // EWsGcOpDrawBitmapMaskedLocal sl@0: // EWsGcOpDrawTextPtr1 sl@0: // EWsGcOpDrawBoxTextPtr1 sl@0: // EWsGcOpDrawTextVerticalPtr1 sl@0: // EWsGcOpDrawBoxTextVerticalPtr1 sl@0: // EWsGcOpDrawTextLocal sl@0: // EWsGcOpDrawBoxTextLocal sl@0: // EWsGcOpGdiBlt2Local sl@0: // EWsGcOpGdiBlt3Local sl@0: // EWsGcOpGdiBltMaskedLocal sl@0: ((CTBackedUpWindowStep*)iStep)->CloseTMSGraphicsStep(); sl@0: break; sl@0: } sl@0: sl@0: default: sl@0: ((CTBackedUpWindowStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTBackedUpWindowStep*)iStep)->CloseTMSGraphicsStep(); sl@0: break; sl@0: } sl@0: ((CTBackedUpWindowStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: __WS_CONSTRUCT_STEP__(BackedUpWindow)