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 screen mode switching 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 "TSCRMODE.H" sl@0: sl@0: const TInt KBlankWinPosX=10; sl@0: const TInt KBlankWinPosY=20; sl@0: const TInt KBlankWinSizeX=30; sl@0: const TInt KBlankWinSizeY=25; sl@0: sl@0: const TInt KScreenMode0=0; sl@0: const TInt KScreenMode1=1; sl@0: _LIT(KScreenModeDisplayMode,"GetScreenModeDisplayMode"); sl@0: sl@0: sl@0: CTScrMode::CTScrMode(CTestStep* aStep) : CTWsGraphicsBase(aStep) sl@0: { sl@0: } sl@0: sl@0: // sl@0: // Static func to check windows sl@0: // sl@0: sl@0: LOCAL_C TInt DoPanicTest(TInt aInt, TAny *aScreenNumber) sl@0: { sl@0: RWsSession ws; sl@0: CWsScreenDevice *screen=NULL; sl@0: if (ws.Connect()==KErrNone) sl@0: { sl@0: screen = new (ELeave) CWsScreenDevice(ws); sl@0: if (screen && screen->Construct((TInt)aScreenNumber)==KErrNone) sl@0: { sl@0: TPixelsTwipsAndRotation sar; sl@0: CFbsBitGc::TGraphicsOrientation rot=CFbsBitGc::EGraphicsOrientationNormal; sl@0: TInt mode=0; sl@0: switch(aInt) sl@0: { sl@0: case 0: sl@0: case 1: sl@0: screen->SetScreenMode(aInt==0?1000:-1); sl@0: break; sl@0: case 2: sl@0: case 3: sl@0: screen->GetScreenModeSizeAndRotation(aInt==2?screen->NumScreenModes():-100000, sar); sl@0: break; sl@0: case 4: sl@0: case 5: sl@0: screen->GetScreenModeSizeAndRotation(aInt==4?screen->NumScreenModes()+100:-10, sar); sl@0: break; sl@0: case 6: sl@0: mode=screen->NumScreenModes(); sl@0: goto SetRot; sl@0: case 7: sl@0: mode=-55; sl@0: goto SetRot; sl@0: case 8: sl@0: mode=234; sl@0: goto SetRot; sl@0: case 9: sl@0: mode=screen->NumScreenModes()+2; sl@0: rot=CFbsBitGc::EGraphicsOrientationRotated270; sl@0: SetRot: sl@0: screen->SetCurrentRotations(mode,rot); sl@0: break; sl@0: case 10: sl@0: case 11: sl@0: ws.SetPointerCursorArea(aInt==10?1000:-1,TRect()); sl@0: break; sl@0: case 12: sl@0: case 13: sl@0: ws.PointerCursorArea(aInt==12?1003:-2); sl@0: break; sl@0: case 14: sl@0: case 15: sl@0: { sl@0: CArrayFixFlat *rotations=new(ELeave) CArrayFixFlat(1); sl@0: screen->GetRotationsList(aInt==12?1003:-2,rotations); sl@0: } sl@0: break; sl@0: case 100: sl@0: rot=CFbsBitGc::EGraphicsOrientationRotated90; sl@0: goto SetRot; sl@0: case 101: sl@0: rot=CFbsBitGc::EGraphicsOrientationRotated270; sl@0: goto SetRot; sl@0: case 102: sl@0: mode=1; sl@0: rot=CFbsBitGc::EGraphicsOrientationRotated270; sl@0: goto SetRot; sl@0: case 103: sl@0: mode=1; sl@0: #if defined(__EPOC32__) sl@0: rot=CFbsBitGc::EGraphicsOrientationRotated180; sl@0: #else sl@0: rot=CFbsBitGc::EGraphicsOrientationNormal; sl@0: #endif sl@0: goto SetRot; sl@0: } sl@0: ws.Flush(); sl@0: } sl@0: } sl@0: sl@0: return(EWsExitReasonBad); sl@0: } sl@0: sl@0: void SetupTestRWindowLC(RWindow& aWindow, const TPoint& aPos, const TSize& aSize, TDisplayMode aDisplayMode) sl@0: { sl@0: CleanupClosePushL(aWindow); sl@0: User::LeaveIfError(aWindow.Construct(*TheClient->iGroup->GroupWin(), (TUint)&aWindow)); sl@0: aWindow.SetExtent(aPos, aSize); sl@0: User::LeaveIfError(aWindow.SetRequiredDisplayMode(aDisplayMode)); sl@0: aWindow.Activate(); sl@0: } sl@0: sl@0: void CTScrMode::TestPanicsL() sl@0: { sl@0: TInt ii; sl@0: for (ii=0;ii<16;++ii) sl@0: TEST(iTest->TestWsPanicL(DoPanicTest,EWservPanicScreenModeNumber,ii,(TAny*)iTest->iScreenNumber)); sl@0: for (ii=100;ii<104;++ii) sl@0: TEST(iTest->TestWsPanicL(DoPanicTest,EWservPanicRotation,ii,(TAny*)iTest->iScreenNumber)); sl@0: iTest->CloseAllPanicWindows(); sl@0: } sl@0: sl@0: CTScrMode::~CTScrMode() sl@0: { sl@0: ((CTScrModeStep*)iStep)->CloseTMSGraphicsStep(); sl@0: delete iSecondConnection; sl@0: TheClient->iGroup->GroupWin()->DisableScreenChangeEvents(); sl@0: SetScreenModeEnforcement(iOldEnfMode); sl@0: } sl@0: sl@0: void CTScrMode::ConstructL() sl@0: { sl@0: //Remove next line when bitmaps are stored correctly sl@0: TestWin->Win()->EnableRedrawStore(EFalse); sl@0: BaseWin->Win()->EnableRedrawStore(EFalse); sl@0: // sl@0: TheClient->iGroup->GroupWin()->EnableScreenChangeEvents(); sl@0: // sl@0: //TheClient->iWs.SetAutoFlush(ETrue); sl@0: ValidateWin(BaseWin,TRgb::Gray256(204)); sl@0: ValidateWin(TestWin,TRgb::Gray256(204)); sl@0: // sl@0: iWinState=0; sl@0: iWinPos=TPoint(2*TheClient->iGroup->Size().iWidth/3,0); sl@0: // sl@0: iSecondConnection=new(ELeave) CSecondConnection; sl@0: iSecondConnection->ConstructL(iTest->iScreenNumber, TRect(KBlankWinPosX,KBlankWinPosY,KBlankWinPosX+KBlankWinSizeX,KBlankWinPosY+KBlankWinSizeY),iTest,iStep); sl@0: // sl@0: iOldEnfMode=TheClient->iScreen->ScreenModeEnforcement(); sl@0: if (TheClient->iScreenModes.Count()<2) sl@0: { sl@0: iTest->iState=1000; // Miss all tests sl@0: _LIT(KLog,"Skipping all tests as less that 2 screen size modes"); sl@0: LOG_MESSAGE(KLog); sl@0: } sl@0: else sl@0: { sl@0: SetScreenModeEnforcement(ESizeEnforcementNone); sl@0: TheClient->iScreen->SetScreenMode(TheClient->iScreenModes[0]); sl@0: } sl@0: } sl@0: sl@0: void CTScrMode::SetScreenModeEnforcement(TScreenModeEnforcement aMode) sl@0: { sl@0: iCurEnforcement=aMode; sl@0: TheClient->iScreen->SetScreenModeEnforcement(iCurEnforcement); sl@0: } sl@0: sl@0: void CTScrMode::ScaledDrawingL() sl@0: { sl@0: const TInt KLineXPos=10; sl@0: const TInt KLineYPos=30; sl@0: const TInt KLineLength=10; sl@0: const TInt KXScaleFactor=4; sl@0: const TInt KYScaleFactor=3; sl@0: // sl@0: // Draw rectangle onto TestWin sl@0: CWindowGc *gc=TheClient->iGc; sl@0: gc->Activate(*(TestWin->Win())); sl@0: gc->SetBrushColor(KRgbBlack); sl@0: gc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: gc->DrawRect(TRect(TPoint(KLineXPos,KLineYPos),TSize(KLineLength*KXScaleFactor,KYScaleFactor))); sl@0: gc->Deactivate(); sl@0: // sl@0: // Draw scaled bitmap onto BaseWin sl@0: TSize bitSize(KLineLength,1); sl@0: TSize bitTwipSize(TheClient->iScreen->HorizontalPixelsToTwips(bitSize.iWidth*KXScaleFactor), sl@0: TheClient->iScreen->VerticalPixelsToTwips(bitSize.iHeight*KYScaleFactor)); sl@0: CFbsBitGc *bitGc=NULL; sl@0: CFbsBitmapDevice *device=NULL; sl@0: CFbsBitmap *bitmap=NULL; sl@0: bitmap=new(ELeave) CFbsBitmap(); sl@0: CleanupStack::PushL(bitmap); sl@0: User::LeaveIfError(bitmap->Create(bitSize,EGray16)); sl@0: bitmap->SetSizeInTwips(bitTwipSize); sl@0: device=CFbsBitmapDevice::NewL(bitmap); sl@0: CleanupStack::PushL(device); sl@0: User::LeaveIfError(device->CreateContext(bitGc)); sl@0: bitGc->SetBrushColor(KRgbBlack); sl@0: bitGc->Clear(); sl@0: delete bitGc; sl@0: // sl@0: gc->Activate(*(BaseWin->Win())); sl@0: gc->DrawBitmap(TPoint(KLineXPos,KLineYPos),bitmap); sl@0: gc->Deactivate(); sl@0: // sl@0: TheClient->iWs.Flush(); sl@0: sl@0: CleanupStack::PopAndDestroy(2); // bitmap,device sl@0: sl@0: CompareWindows(_L("CTScrMode::ScaledDrawingL() CompareWindows() failed")); sl@0: } sl@0: sl@0: void CTScrMode::ValidateWin(TestWindow *aWin, TRgb aColor) sl@0: { sl@0: aWin->Win()->Invalidate(); sl@0: RedrawWin(*aWin->Win(),aColor); sl@0: } sl@0: sl@0: void CTScrMode::RedrawWin(RWindow &aWin, TRgb aColor) sl@0: { sl@0: aWin.BeginRedraw(); sl@0: TheClient->iGc->Activate(aWin); sl@0: TheClient->iGc->SetBrushColor(aColor); sl@0: TheClient->iGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheClient->iGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: TheClient->iGc->Clear(); sl@0: TheClient->iGc->Deactivate(); sl@0: aWin.EndRedraw(); sl@0: } sl@0: sl@0: void CTScrMode::CheckWindows(TBool aWinIsVis) sl@0: { sl@0: iSecondConnection->SetWindow2Visibility(aWinIsVis); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: TheClient->iWs.Finish(); sl@0: CompareWindows(_L("CTScrMode::CheckWindows() CompareWindows() failed")); sl@0: } sl@0: sl@0: void CTScrMode::ScreenRotationsL() sl@0: { sl@0: CWsScreenDevice *screen=TheClient->iScreen; sl@0: CArrayFixFlat *rotations=new(ELeave) CArrayFixFlat(1); sl@0: CFbsBitGc::TGraphicsOrientation currentRotation; sl@0: TPixelsAndRotation sizeAndRotation; sl@0: TPixelsTwipsAndRotation sizeAndRotation2; sl@0: TBool found; sl@0: TInt numModes=TheClient->iScreenModes.Count(); sl@0: TInt count; sl@0: TInt ii,jj; sl@0: CleanupStack::PushL(rotations); sl@0: for (ii=0;iiiScreenModes[ii]; sl@0: User::LeaveIfError(screen->GetRotationsList(mode,rotations)); sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation); sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation2); sl@0: TEST(sizeAndRotation.iPixelSize.iWidth==sizeAndRotation2.iPixelSize.iWidth); sl@0: if (sizeAndRotation.iPixelSize.iWidth!=sizeAndRotation2.iPixelSize.iWidth) sl@0: INFO_PRINTF3(_L("sizeAndRotation.iPixelSize.iWidth==sizeAndRotation2.iPixelSize.iWidth - Expected: %d, Actual: %d"), sizeAndRotation.iPixelSize.iWidth, sizeAndRotation2.iPixelSize.iWidth); sl@0: sl@0: TEST(sizeAndRotation.iPixelSize.iHeight==sizeAndRotation2.iPixelSize.iHeight); sl@0: if (sizeAndRotation.iPixelSize.iHeight!=sizeAndRotation2.iPixelSize.iHeight) sl@0: INFO_PRINTF3(_L("sizeAndRotation.iPixelSize.iHeight==sizeAndRotation2.iPixelSize.iHeight - Expected: %d, Actual: %d"), sizeAndRotation.iPixelSize.iHeight, sizeAndRotation2.iPixelSize.iHeight); sl@0: sl@0: count=rotations->Count(); sl@0: TEST(count>=1); sl@0: if (count<1) sl@0: INFO_PRINTF3(_L("rotations->Count() return value - Expected: %d or more, Actual: %d"), 1, count); sl@0: sl@0: TBool retVal; sl@0: sl@0: if (sizeAndRotation.iPixelSize.iWidth!=sizeAndRotation.iPixelSize.iHeight) sl@0: { sl@0: TEST(count<=2); sl@0: if (count>2) sl@0: INFO_PRINTF3(_L("rotations->Count() return value - Expected: %d or less, Actual: %d"), 2, count); sl@0: sl@0: if (count==2) sl@0: { sl@0: retVal = (*rotations)[0]+2==(*rotations)[1]; sl@0: TEST(retVal); //Must only have rotations 180 degrees apart sl@0: if (!retVal) sl@0: INFO_PRINTF3(_L("(*rotations)[0]+2==(*rotations)[1] - Expected: %d, Actual: %d"), ETrue, retVal); sl@0: } sl@0: } sl@0: found=EFalse; sl@0: for (jj=0;jj1) sl@0: { sl@0: currentRotation=sizeAndRotation.iRotation; sl@0: for (jj=0;jjSetCurrentRotations(mode,REINTERPRET_CAST(CFbsBitGc::TGraphicsOrientation&,(*rotations)[jj])); sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation); sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation2); sl@0: retVal = (*rotations)[jj]==sizeAndRotation.iRotation; sl@0: TEST(retVal); sl@0: if (!retVal) sl@0: INFO_PRINTF3(_L("(*rotations)[jj]==sizeAndRotation.iRotation - Expected: %d, Actual: %d"), ETrue, retVal); sl@0: sl@0: retVal = (*rotations)[jj]==sizeAndRotation2.iRotation; sl@0: TEST(retVal); sl@0: if (!retVal) sl@0: INFO_PRINTF3(_L("(*rotations)[jj]==sizeAndRotation2.iRotation - Expected: %d, Actual: %d"), ETrue, retVal); sl@0: sl@0: } sl@0: screen->SetCurrentRotations(mode,REINTERPRET_CAST(CFbsBitGc::TGraphicsOrientation&,currentRotation)); sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation); sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation2); sl@0: sl@0: retVal = currentRotation==sizeAndRotation.iRotation; sl@0: TEST(retVal); sl@0: if (!retVal) sl@0: INFO_PRINTF3(_L("currentRotation==sizeAndRotation.iRotation - Expected: %d, Actual: %d"), ETrue, retVal); sl@0: sl@0: retVal = currentRotation==sizeAndRotation2.iRotation; sl@0: TEST(retVal); sl@0: if (!retVal) sl@0: INFO_PRINTF3(_L("currentRotation==sizeAndRotation2.iRotation - Expected: %d, Actual: %d"), ETrue, retVal); sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(); sl@0: } sl@0: sl@0: void CTScrMode::MoreScreenRotationsL() sl@0: { sl@0: RWindow shield4Gray(TheClient->iWs); sl@0: // The default display mode needs to be updated to EColor64K for Oghma integ sl@0: SetupTestRWindowLC(shield4Gray,TPoint(),TSize(100000,100000),EColor64K); sl@0: // sl@0: CWsScreenDevice *screen=TheClient->iScreen; sl@0: //CFbsBitGc::TGraphicsOrientation currentRotation; sl@0: TPixelsAndRotation sizeAndRotation; sl@0: TInt currentRotation; sl@0: TInt currentMode=FindCurrentMode(); sl@0: TInt numModes=TheClient->iScreenModes.Count(); sl@0: TInt currentScreenMode; sl@0: TInt count; sl@0: TInt ii,jj; sl@0: CArrayFixFlat *currentRotations=new(ELeave) CArrayFixFlat(1); sl@0: CleanupStack::PushL(currentRotations); sl@0: currentRotations->ResizeL(numModes); sl@0: CArrayFixFlat *originalRotation=new(ELeave) CArrayFixFlat(1); sl@0: CleanupStack::PushL(originalRotation); sl@0: originalRotation->ResizeL(numModes); sl@0: CArrayFixFlat *rotations=new(ELeave) CArrayFixFlat(1); sl@0: CleanupStack::PushL(rotations); sl@0: for (ii=0;iiiScreenModes[ii]; sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation); sl@0: (*currentRotations)[ii]=sizeAndRotation.iRotation; sl@0: (*originalRotation)[ii]=sizeAndRotation.iRotation; sl@0: } sl@0: for (ii=0;iiiScreenModes[ii]; sl@0: screen->SetScreenMode(mode); sl@0: currentScreenMode = screen->CurrentScreenMode(); sl@0: TEST(currentScreenMode == mode); sl@0: if (currentScreenMode != mode) sl@0: INFO_PRINTF3(_L("screen->CurrentScreenMode() return value - Expected: %d, Actual: %d"), mode, currentScreenMode); sl@0: sl@0: screen->GetDefaultScreenSizeAndRotation(sizeAndRotation); sl@0: currentRotation=(*currentRotations)[ii]; sl@0: TEST(sizeAndRotation.iRotation==currentRotation); sl@0: sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation); sl@0: TEST(sizeAndRotation.iRotation==currentRotation); sl@0: sl@0: User::LeaveIfError(screen->GetRotationsList(mode,rotations)); sl@0: count=rotations->Count(); sl@0: if (count>1) sl@0: { sl@0: for (jj=0;jjSetCurrentRotations(mode,REINTERPRET_CAST(CFbsBitGc::TGraphicsOrientation&,currentRotation)); sl@0: (*currentRotations)[ii]=currentRotation; sl@0: } sl@0: } sl@0: for (ii=0;iiiScreenModes[ii]; sl@0: screen->SetScreenMode(mode); sl@0: currentScreenMode = screen->CurrentScreenMode(); sl@0: TEST(currentScreenMode == mode); sl@0: if (currentScreenMode != mode) sl@0: INFO_PRINTF3(_L("(screen->CurrentScreenMode() return value - Expected: %d, Actual: %d"), mode, currentScreenMode); sl@0: sl@0: screen->GetDefaultScreenSizeAndRotation(sizeAndRotation); sl@0: currentRotation=(*currentRotations)[ii]; sl@0: TEST(sizeAndRotation.iRotation==currentRotation); sl@0: if (sizeAndRotation.iRotation != currentRotation) sl@0: INFO_PRINTF3(_L("(screen->GetDefaultScreenSizeAndRotation() return value - Expected: %d, Actual: %d"), currentRotation, sizeAndRotation.iRotation); sl@0: sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation); sl@0: TEST(sizeAndRotation.iRotation==currentRotation); sl@0: if (sizeAndRotation.iRotation != currentRotation) sl@0: INFO_PRINTF3(_L("(screen->GetDefaultScreenSizeAndRotation() return value - Expected: %d, Actual: %d"), currentRotation, sizeAndRotation.iRotation); sl@0: sl@0: if (currentRotation!=(*originalRotation)[ii]) sl@0: screen->SetCurrentRotations(mode,REINTERPRET_CAST(CFbsBitGc::TGraphicsOrientation&,(*originalRotation)[ii])); sl@0: } sl@0: screen->SetScreenMode(currentMode); sl@0: currentScreenMode = screen->CurrentScreenMode(); sl@0: TEST(currentScreenMode == currentMode); sl@0: if (currentScreenMode != currentMode) sl@0: INFO_PRINTF3(_L("(screen->CurrentScreenMode() return value - Expected: %d, Actual: %d"), currentMode, currentScreenMode); sl@0: sl@0: CleanupStack::PopAndDestroy(4,&shield4Gray); sl@0: } sl@0: sl@0: TInt CTScrMode::FindCurrentMode() sl@0: { sl@0: CWsScreenDevice *screen=TheClient->iScreen; sl@0: TPixelsTwipsAndRotation sizeAndRotation; sl@0: TPixelsTwipsAndRotation sizeAndRotation2; sl@0: TInt numModes=TheClient->iScreenModes.Count(); sl@0: TInt ii; sl@0: screen->GetDefaultScreenSizeAndRotation(sizeAndRotation); sl@0: for (ii=0;iiiScreenModes[ii]; sl@0: screen->GetScreenModeSizeAndRotation(mode,sizeAndRotation2); sl@0: if (Equal(sizeAndRotation,sizeAndRotation2)) sl@0: return mode; sl@0: } sl@0: TEST(EFalse); sl@0: return -1; sl@0: } sl@0: sl@0: TBool CTScrMode::Equal(const TPixelsTwipsAndRotation& aLeft,const TPixelsTwipsAndRotation& aRight) sl@0: { sl@0: if (aLeft.iPixelSize!=aRight.iPixelSize) sl@0: return EFalse; sl@0: if (aLeft.iRotation!=aRight.iRotation) sl@0: return EFalse; sl@0: if (aLeft.iTwipsSize!=aRight.iTwipsSize) sl@0: return EFalse; sl@0: return ETrue; sl@0: } sl@0: sl@0: TBool CTScrMode::RectClearBugL() sl@0: { sl@0: CWsScreenDevice *screen=TheClient->iScreen; sl@0: TPixelsTwipsAndRotation sizeAndRotation1; sl@0: TPixelsTwipsAndRotation sizeAndRotation2; sl@0: TInt screenMode=FindCurrentMode(); sl@0: TInt largeMode=0; sl@0: TInt smallMode=1; sl@0: INFO_PRINTF1(_L("Rotation 1")); sl@0: screen->GetScreenModeSizeAndRotation(0,sizeAndRotation1); sl@0: INFO_PRINTF1(_L("Rotation 2")); sl@0: screen->GetScreenModeSizeAndRotation(1,sizeAndRotation2); sl@0: TSize winSize=TSize(Max(sizeAndRotation1.iPixelSize.iWidth,sizeAndRotation2.iPixelSize.iWidth) sl@0: ,Max(sizeAndRotation1.iPixelSize.iHeight,sizeAndRotation2.iPixelSize.iHeight)); sl@0: if (sizeAndRotation1.iPixelSize.iWidth<=sizeAndRotation2.iPixelSize.iWidth sl@0: && sizeAndRotation1.iPixelSize.iHeight<=sizeAndRotation2.iPixelSize.iHeight) sl@0: { sl@0: largeMode=1; sl@0: smallMode=0; sl@0: } sl@0: if (screenMode!=largeMode) sl@0: { sl@0: INFO_PRINTF2(_L("Large Mode %d\r\n"),largeMode); sl@0: screen->SetScreenMode(largeMode); sl@0: } sl@0: CBlankWindow *blankWin=new(ELeave) CBlankWindow(TRgb::Gray256(204)); sl@0: CleanupStack::PushL(blankWin); sl@0: blankWin->SetUpL(TPoint(),winSize,TheClient->iGroup,*TheClient->iGc); sl@0: TheClient->iGc->Activate(*blankWin->Win()); //blankWin->Win()->Invalidate(); sl@0: blankWin->Draw(); sl@0: TheClient->iWs.Flush(); sl@0: blankWin->Win()->SetRequiredDisplayMode(EGray4); sl@0: INFO_PRINTF2(_L("Small Mode %d\r\n"),smallMode); sl@0: screen->SetScreenMode(smallMode); sl@0: TheClient->iWs.Flush(); sl@0: TheClient->iGc->Deactivate(); sl@0: CleanupStack::PopAndDestroy(); sl@0: if (screenMode!=smallMode) sl@0: { sl@0: INFO_PRINTF2(_L("Screen Mode %d\r\n"),screenMode); sl@0: screen->SetScreenMode(screenMode); sl@0: } sl@0: sl@0: return ETrue; sl@0: } sl@0: sl@0: void CTScrMode::ScreenModeChange1L() sl@0: { sl@0: CTWin* color64win; sl@0: color64win=new(ELeave) CTWin(); sl@0: CleanupStack::PushL(color64win); sl@0: color64win->ConstructL(*TheClient->iGroup); sl@0: color64win->BaseWin()->SetRequiredDisplayMode(EColor64K); sl@0: //color64win->SetBackgroundColor(TRgb(0,0,255)); sl@0: color64win->Win()->SetBackgroundColor(); sl@0: color64win->Activate(); sl@0: TheClient->Flush(); sl@0: CTWin* color4win; sl@0: color4win=new(ELeave) CTWin(); sl@0: CleanupStack::PushL(color4win); sl@0: color4win->ConstructL(*TheClient->iGroup); sl@0: color4win->BaseWin()->SetRequiredDisplayMode(EColor4K); sl@0: //color4win->SetBackgroundColor(TRgb(255,0,0)); sl@0: color4win->Win()->SetBackgroundColor(); sl@0: color4win->SetSize(TSize(600,200)); sl@0: color4win->Activate(); sl@0: TheClient->Flush(); sl@0: color4win->SetSize(TSize(640,240)); sl@0: TheClient->Flush(); sl@0: color64win->SetSize(TSize(20,20)); sl@0: color64win->WinTreeNode()->SetOrdinalPosition(0); sl@0: TheClient->Flush(); sl@0: CleanupStack::Pop(2,color64win); sl@0: delete color64win; sl@0: TheClient->Flush(); sl@0: delete color4win; sl@0: //CleanupStack::PopAndDestroy(2,color64win); sl@0: } sl@0: sl@0: void CTScrMode::ScreenModeChange2L() sl@0: { sl@0: CTBlankWindow* color64win; sl@0: color64win=new(ELeave) CTBlankWindow(); sl@0: CleanupStack::PushL(color64win); sl@0: color64win->ConstructL(*TheClient->iGroup); sl@0: color64win->BaseWin()->SetRequiredDisplayMode(EColor64K); sl@0: color64win->SetColor(TRgb(0,0,255)); sl@0: //color64win->SetColor(); sl@0: color64win->Activate(); sl@0: TheClient->Flush(); sl@0: CTBlankWindow* color4win; sl@0: color4win=new(ELeave) CTBlankWindow(); sl@0: CleanupStack::PushL(color4win); sl@0: color4win->ConstructL(*TheClient->iGroup); sl@0: color4win->BaseWin()->SetRequiredDisplayMode(EColor4K); sl@0: color4win->SetColor(TRgb(255,0,0)); sl@0: //color4win->SetColor(); sl@0: color4win->SetSize(TSize(600,200)); sl@0: color4win->Activate(); sl@0: TheClient->Flush(); sl@0: color4win->SetSize(TSize(640,240)); sl@0: TheClient->Flush(); sl@0: color64win->SetSize(TSize(20,20)); sl@0: color64win->WinTreeNode()->SetOrdinalPosition(0); sl@0: TheClient->Flush(); sl@0: CleanupStack::Pop(2,color64win); sl@0: delete color64win; sl@0: TheClient->Flush(); sl@0: delete color4win; sl@0: //CleanupStack::PopAndDestroy(2,color64win); sl@0: } sl@0: sl@0: LOCAL_C void ResetAndDestroyWindows(TAny* aPointerArray) sl@0: { sl@0: static_cast*>(aPointerArray)->ResetAndDestroy(); sl@0: } sl@0: sl@0: LOCAL_C TBool WalkThroughTree(RPointerArray aListOfWindows) sl@0: { sl@0: TBool ret=ETrue; sl@0: TInt count = aListOfWindows.Count(); sl@0: while (--count>=0 && ret) sl@0: { sl@0: RRegion region; sl@0: ((aListOfWindows)[count])->Win()->GetInvalidRegion(region); sl@0: ret=region.IsEmpty(); sl@0: } sl@0: return ret; sl@0: } sl@0: sl@0: void CTScrMode::InvisibleWndAndInfiniteRedrawBugL() sl@0: { sl@0: // Current Test client state sl@0: CTClient* clientA=TheClient; sl@0: CWsScreenDevice* screenClientA=clientA->iScreen; sl@0: const TScreenModeEnforcement screenModeEnforcement = screenClientA->ScreenModeEnforcement(); sl@0: const TInt currentScreenMode=FindCurrentMode(); sl@0: TPixelsTwipsAndRotation sizeAndRotation; sl@0: screenClientA->GetScreenModeSizeAndRotation(currentScreenMode,sizeAndRotation); sl@0: sl@0: sl@0: SecondClientConnection* clientB = new(ELeave) SecondClientConnection(); sl@0: CleanupStack::PushL(clientB); sl@0: clientB->SetScreenNumber(iTest->iScreenNumber); sl@0: clientB->ConstructL(currentScreenMode, sizeAndRotation); sl@0: sl@0: // Start test sl@0: CWindowGc& gc=*clientB->iGc; sl@0: RWsSession ws=clientB->iWs; sl@0: CTWindowGroup* group=clientB->iGroup; sl@0: sl@0: const TInt shrinkFactor = 5; sl@0: TRect parentRect(0,0, sizeAndRotation.iPixelSize.iWidth, sizeAndRotation.iPixelSize.iHeight); sl@0: RPointerArray windows; sl@0: CleanupStack::PushL(TCleanupItem(ResetAndDestroyWindows, &windows)); sl@0: // create several children sl@0: const TInt count = (iTest->iTestLevel==iTest->ELevelQuick ? 5 : 7); sl@0: CBlankWindow* blankWin=NULL; sl@0: CTWinBase* parent=group; sl@0: for (TInt childNum=0; childNumSetUpL(parentRect.iTl, parentRect.Size(), parent, gc); sl@0: // make it visible and draw it sl@0: blankWin->Win()->Invalidate(); sl@0: gc.Activate(*blankWin->Win()); sl@0: blankWin->Draw(); sl@0: ws.Flush(); sl@0: gc.Deactivate(); sl@0: // prepare for next window sl@0: parent=blankWin; sl@0: parentRect.Shrink(shrinkFactor, shrinkFactor); sl@0: } sl@0: sl@0: // change screen mode and check visibility of all windows sl@0: sl@0: const TInt newScreenMode = (currentScreenMode==KScreenMode0?KScreenMode1:KScreenMode0); sl@0: TPixelsTwipsAndRotation sizeAndRotationForDifferentScreenMode; sl@0: screenClientA->GetScreenModeSizeAndRotation(newScreenMode, sizeAndRotationForDifferentScreenMode); sl@0: screenClientA->SetScreenSizeAndRotation(sizeAndRotationForDifferentScreenMode); sl@0: screenClientA->SetScreenMode(newScreenMode); sl@0: sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: TBool retVal = WalkThroughTree(windows); sl@0: TEST(retVal); sl@0: if (!retVal) sl@0: INFO_PRINTF3(_L("WalkThroughTree(windows) return value - Expected: %d, Actual: %d"), ETrue, retVal); sl@0: sl@0: sl@0: screenClientA->SetScreenModeEnforcement(screenModeEnforcement); sl@0: screenClientA->SetScreenMode(currentScreenMode); sl@0: screenClientA->SetScreenSizeAndRotation(sizeAndRotation); sl@0: sl@0: // destroy all windows sl@0: CleanupStack::PopAndDestroy(2, clientB); // ResetAndDestroyWindows and client sl@0: // Needed to get system back into a good state as this test can leave the shell in front of the test app sl@0: TheClient->iGroup->GroupWin()->SetOrdinalPosition(0); sl@0: } sl@0: sl@0: //To test the APIs GetScreenModeDisplayMode() & GetDefModeMaxNumColors() sl@0: void CTScrMode::GetScreenDisplayMode() sl@0: { sl@0: TInt color,gray; sl@0: CWsScreenDevice *screen=TheClient->iScreen; sl@0: TInt currentScreenMode=screen->CurrentScreenMode(); //finding the current screen mode sl@0: screen->SetScreenMode(KScreenMode1); //changing the current screen mode to 1 sl@0: sl@0: //testing the display mode of Screen Mode using the API GetScreenModeDisplayMode() sl@0: TDisplayMode displayMode=screen->GetScreenModeDisplayMode(KScreenMode1); sl@0: sl@0: TEST(displayMode!=ENone); sl@0: TEST(displayMode!=ERgb); sl@0: //testing the default mode of Screen Mode using the API GetDefModeMaxNumColors() sl@0: TDisplayMode defaultMode=TheClient->iWs.GetDefModeMaxNumColors(color,gray); sl@0: TDisplayMode defaultModeForScreen=TheClient->iWs.GetDefModeMaxNumColors(screen->GetScreenNumber(),color,gray); sl@0: TEST(defaultMode==defaultModeForScreen); sl@0: TEST(defaultMode!=ENone); sl@0: TEST(defaultMode!=ERgb); sl@0: TEST(color == 16777216 || color == 0 || color == 16 || color == 256 || color == 4096 || color == 65536); sl@0: TEST(gray == 0 || gray == 2 || gray == 4 || gray == 16 || gray == 256); sl@0: screen->SetScreenMode(currentScreenMode); sl@0: sl@0: CArrayFixFlat* modeList=new CArrayFixFlat(15); sl@0: TEST(modeList != NULL); sl@0: if(!modeList) sl@0: { sl@0: return; sl@0: } sl@0: TInt res = TheClient->iWs.GetColorModeList(modeList); sl@0: TEST(res == KErrNone); sl@0: TDisplayMode modeMax = ENone; sl@0: for(TInt index = 0; index < modeList->Count(); index++) sl@0: { sl@0: TDisplayMode mode = (TDisplayMode) ((*modeList)[index]); sl@0: if(mode > modeMax) sl@0: { sl@0: modeMax = mode; sl@0: } sl@0: } sl@0: modeList->Reset(); sl@0: delete modeList; sl@0: TInt realColor = 0; sl@0: TInt realGray = 0; sl@0: switch(modeMax) sl@0: { sl@0: case EGray2: sl@0: realColor = 2; sl@0: realGray = 2; sl@0: break; sl@0: case EGray4: sl@0: realColor = 4; sl@0: realGray = 4; sl@0: break; sl@0: case EGray16: sl@0: realColor = 16; sl@0: realGray = 16; sl@0: break; sl@0: case EGray256: sl@0: realColor = 256; sl@0: realGray = 256; sl@0: break; sl@0: case EColor16: sl@0: realColor = 16; sl@0: break; sl@0: case EColor256: sl@0: realColor = 256; sl@0: break; sl@0: case EColor4K: sl@0: realColor = 4096; sl@0: break; sl@0: case EColor64K: sl@0: realColor = 65536; sl@0: break; sl@0: case EColor16M: sl@0: case EColor16MU: sl@0: case EColor16MA: sl@0: case EColor16MAP: sl@0: realColor = 16777216; sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: sl@0: if (realColor > 0) sl@0: TEST(realColor == color); sl@0: if (realGray > 0) sl@0: TEST(gray == realGray); sl@0: } sl@0: sl@0: void CTScrMode::SetScreenModeAfterScreenDeviceDeletedL() sl@0: { sl@0: // A separate session is needed, because this test will delete the primary screen device sl@0: RWsSession ws; sl@0: User::LeaveIfError(ws.Connect()); sl@0: sl@0: // Push the secondary screen device first onto the cleanup stack sl@0: // so that we can pop and destroy the primary screen device first sl@0: CWsScreenDevice* secondaryScreenDevice = new (ELeave) CWsScreenDevice(ws); sl@0: CleanupStack::PushL(secondaryScreenDevice); sl@0: sl@0: CWsScreenDevice* primaryScreenDevice = new (ELeave) CWsScreenDevice(ws); sl@0: CleanupStack::PushL(primaryScreenDevice); sl@0: sl@0: // Construct the primary screen device first to ensure that it is sl@0: // used by the group window sl@0: User::LeaveIfError(primaryScreenDevice->Construct(iTest->iScreenNumber)); sl@0: User::LeaveIfError(secondaryScreenDevice->Construct(iTest->iScreenNumber)); sl@0: sl@0: RWindowGroup group(ws); sl@0: User::LeaveIfError(group.Construct(888)); sl@0: group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close sl@0: sl@0: RArray screenModes; sl@0: primaryScreenDevice->GetScreenSizeModeList(&screenModes); sl@0: primaryScreenDevice->SetScreenMode(screenModes[0]); sl@0: sl@0: // Prematurely destroy the primary screen device used by the group window sl@0: CleanupStack::PopAndDestroy(primaryScreenDevice); sl@0: sl@0: // Simulate screen rotation - call SetScreenMode() sl@0: // This would trigger the defective behaviour and wserv would panic if broken sl@0: secondaryScreenDevice->SetScreenMode(screenModes[0]); sl@0: sl@0: // Tidy up sl@0: screenModes.Close(); sl@0: group.Close(); sl@0: CleanupStack::PopAndDestroy(secondaryScreenDevice); sl@0: ws.Flush(); sl@0: ws.Close(); sl@0: } sl@0: sl@0: void CTScrMode::DrawTestBmpL(CFbsBitmap* aTestBitmap) sl@0: { sl@0: CFbsBitmapDevice* device=CFbsBitmapDevice::NewL(aTestBitmap); sl@0: CleanupStack::PushL(device); sl@0: CGraphicsContext* bmpgc; sl@0: User::LeaveIfError(device->CreateContext(bmpgc)); sl@0: CleanupStack::PushL(bmpgc); sl@0: bmpgc->SetPenColor(KRgbDarkRed); sl@0: bmpgc->SetBrushColor(KRgbYellow); sl@0: bmpgc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: bmpgc->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: bmpgc->DrawRect(TRect(aTestBitmap->SizeInPixels())); sl@0: CleanupStack::PopAndDestroy(2,device); sl@0: } sl@0: sl@0: void CTScrMode::TestDrawingToWindows(CWindowGc* aWinGc1, CWindowGc* aWinGc2, RWindow& aWindow1,RWindow& aWindow2,CFbsBitmap* aBitmap64K,CFbsBitmap* aBitmap16M,CFbsFont* aFont, TBool aAllInRedraw, TBool aUseSystemGc, TBool aUseBmp16M) sl@0: { sl@0: CFbsBitmap* bitmap=aUseBmp16M?aBitmap16M:aBitmap64K; sl@0: TInt ascent=aFont->AscentInPixels(); sl@0: for(TInt win=0;win<2;win++) sl@0: { sl@0: RWindow* winPtr=(win==0)?&aWindow1:&aWindow2; sl@0: winPtr->Invalidate(); sl@0: winPtr->BeginRedraw(); sl@0: CWindowGc* winGc; sl@0: if (aUseSystemGc) sl@0: { sl@0: winGc=TheClient->iGc; sl@0: winGc->Activate(*winPtr); sl@0: } sl@0: else sl@0: { sl@0: winGc=(win==0)?aWinGc1:aWinGc2; sl@0: winGc->Reset(); sl@0: } sl@0: winGc->SetBrushColor(KRgbBlue); sl@0: winGc->Clear(); sl@0: if (!aAllInRedraw) sl@0: winPtr->EndRedraw(); sl@0: // sl@0: winGc->BitBlt(TPoint(0,0),bitmap); sl@0: winGc->UseFont(aFont); sl@0: _LIT(KTestText123,"Test text 123"); sl@0: winGc->DrawText(KTestText123,TPoint(0,ascent)); sl@0: if (aAllInRedraw) sl@0: winPtr->EndRedraw(); sl@0: if (aUseSystemGc) sl@0: winGc->Deactivate(); sl@0: } sl@0: TBool winCheck=DoCheckRectRWin(aWindow1,aWindow2,TRect(aWindow1.Size())); sl@0: if (!winCheck) sl@0: { sl@0: TBuf<256> errBuf(_L("Rot-mode test failed")); sl@0: if (aAllInRedraw) sl@0: errBuf.Append(_L(", All in Redraw")); sl@0: if (aUseSystemGc) sl@0: errBuf.Append(_L(", System Gc")); sl@0: if (aUseBmp16M) sl@0: errBuf.Append(_L(", 16M bmp")); sl@0: else sl@0: errBuf.Append(_L(", 64K bmp")); sl@0: INFO_PRINTF1(errBuf); sl@0: } sl@0: TEST(winCheck); sl@0: } sl@0: sl@0: void SetWsAndAppScreenModes(TInt aMode) sl@0: { sl@0: TheClient->iScreen->SetScreenMode(aMode); sl@0: TheClient->iScreen->SetAppScreenMode(aMode); sl@0: } sl@0: sl@0: TDisplayMode HighestMatch(CArrayFixFlat* aModeList,TInt &aMaxBpp) sl@0: { sl@0: TDisplayMode highMode=ENone; sl@0: TInt highBpp=0; sl@0: for(TInt loop=aModeList->Count()-1;loop>=0;loop--) sl@0: { sl@0: TDisplayMode mode=(TDisplayMode)(*aModeList)[loop]; sl@0: TInt bpp; sl@0: switch(mode) sl@0: { sl@0: case EGray2: sl@0: bpp=1; sl@0: break; sl@0: case EGray4: sl@0: bpp=2; sl@0: break; sl@0: case EGray16: sl@0: case EColor16: sl@0: bpp=4; sl@0: break; sl@0: case EColor256: sl@0: case EGray256: sl@0: bpp=8; sl@0: break; sl@0: case EColor64K: sl@0: bpp=16; sl@0: break; sl@0: case EColor4K: sl@0: bpp=12; sl@0: break; sl@0: case EColor16M: sl@0: case EColor16MU: sl@0: case EColor16MA: sl@0: case EColor16MAP: sl@0: bpp=32; sl@0: break; sl@0: default: sl@0: bpp=0; sl@0: break; sl@0: } sl@0: if (bpp>highBpp && bppiGroup->GroupWin()->SetOrdinalPosition(0); sl@0: // When switching colour modes Wserv takes into account the full device size, not the clipped size sl@0: // associated with any specific screen mode. Therefore any windows designed to influence the screen sl@0: // mode must use the appropriately rotated device base screen size, not any cutdown screen mode sizes. sl@0: TSize baseScreenSize=TheClient->iScreen->SizeInPixels(); sl@0: TSize rotatedBaseSize(baseScreenSize.iHeight,baseScreenSize.iWidth); sl@0: TInt maxScreenDimension=Max(baseScreenSize.iHeight,baseScreenSize.iWidth); sl@0: // sl@0: CArrayFixFlat* modeList=new(ELeave) CArrayFixFlat(15); sl@0: CleanupStack::PushL(modeList); sl@0: User::LeaveIfError(TheClient->iWs.GetColorModeList(modeList)); sl@0: TInt maxBpp=KMaxTInt; sl@0: TDisplayMode testDispModeHigh=HighestMatch(modeList,maxBpp); sl@0: TDisplayMode testDispModeLow=HighestMatch(modeList,maxBpp); sl@0: CleanupStack::PopAndDestroy(modeList); sl@0: // If only one available display mode skip tests sl@0: if (testDispModeLow==ENone) sl@0: return; sl@0: // sl@0: CFbsFont* font; sl@0: TFontSpec fspec; sl@0: fspec.iHeight=240; sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont*&)font,fspec)); sl@0: // Create a massive 16M window to make sure 16M is the fallback mode when any area of the screen is exposed sl@0: RWindow shield16M(TheClient->iWs); sl@0: SetupTestRWindowLC(shield16M,TPoint(),TSize(100000,100000),testDispModeHigh); sl@0: RedrawWin(shield16M,KRgbBlack); sl@0: // sl@0: TInt numModes=TheClient->iScreenModes.Count(); sl@0: for(TInt modeIndex=0;modeIndexiScreenModes[modeIndex]; sl@0: TPoint origin=TheClient->iScreen->GetScreenModeScaledOrigin(screenMode); sl@0: if (origin.iX!=0 || origin.iY!=0) sl@0: continue; sl@0: TPixelsTwipsAndRotation sar; sl@0: TheClient->iScreen->GetScreenModeSizeAndRotation(screenMode,sar); sl@0: TSize screenSize=sar.iPixelSize; sl@0: if (screenSize.iWidth>baseScreenSize.iWidth || screenSize.iHeight>baseScreenSize.iHeight) sl@0: continue; sl@0: TSize rotatedScreenDeviceSize(sar.iRotation==CFbsBitGc::EGraphicsOrientationRotated90 || sar.iRotation==CFbsBitGc::EGraphicsOrientationRotated270? sl@0: rotatedBaseSize:baseScreenSize); sl@0: // sl@0: TheClient->iScreen->SetScreenMode(screenMode); sl@0: // sl@0: TSize screenSize1 = screenSize; sl@0: screenSize1.iWidth = Min(screenSize1.iWidth, rotatedScreenDeviceSize.iWidth); //this is to guarantee we won't compare beyond screen size sl@0: TSize testSize(screenSize1.iWidth/2,screenSize1.iHeight); sl@0: TSize testBmpSize(testSize.iWidth,testSize.iHeight/4); sl@0: // sl@0: CFbsBitmap* testBitmap64=new(ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(testBitmap64); sl@0: User::LeaveIfError(testBitmap64->Create(testBmpSize,testDispModeLow)); sl@0: DrawTestBmpL(testBitmap64); sl@0: // sl@0: CFbsBitmap* testBitmap16M=new(ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(testBitmap16M); sl@0: User::LeaveIfError(testBitmap16M->Create(testBmpSize,testDispModeHigh)); sl@0: DrawTestBmpL(testBitmap16M); sl@0: // sl@0: RWindow window(TheClient->iWs); sl@0: SetupTestRWindowLC(window,TPoint(0,0), testSize,testDispModeHigh); sl@0: RWindow window2(TheClient->iWs); sl@0: SetupTestRWindowLC(window2,TPoint(testSize.iWidth,0),testSize,testDispModeHigh); sl@0: // sl@0: CWindowGc* winGc1=new(ELeave) CWindowGc(TheClient->iScreen); sl@0: CleanupStack::PushL(winGc1); sl@0: User::LeaveIfError(winGc1->Construct()); sl@0: winGc1->Activate(window); sl@0: CWindowGc* winGc2=new(ELeave) CWindowGc(TheClient->iScreen); sl@0: CleanupStack::PushL(winGc2); sl@0: User::LeaveIfError(winGc2->Construct()); sl@0: winGc2->Activate(window2); sl@0: // sl@0: for(TInt modeIndex2=0;modeIndex2iScreenModes[modeIndex2]; sl@0: TPoint origin2=TheClient->iScreen->GetScreenModeScaledOrigin(screenMode2); sl@0: if (origin2.iX!=0 || origin2.iY!=0) sl@0: continue; sl@0: TDisplayMode baseDisplayMode=TheClient->iScreen->DisplayMode(); sl@0: INFO_PRINTF5(_L("Testing with screen modes %d/%d, display modes %d/%d"),modeIndex,modeIndex2,testDispModeLow,testDispModeHigh); sl@0: SetWsAndAppScreenModes(screenMode2); sl@0: TDisplayMode dispMode11 = TheClient->iScreen->DisplayMode(); sl@0: TPixelsTwipsAndRotation sar1; sl@0: TheClient->iScreen->GetScreenModeSizeAndRotation(screenMode2, sar1); sl@0: if(sar1.iRotation == sar.iRotation) sl@0: { sl@0: continue; sl@0: } sl@0: // sl@0: RWindow window64K(TheClient->iWs); sl@0: SetupTestRWindowLC(window64K,TPoint(),TSize(maxScreenDimension,maxScreenDimension),testDispModeLow); sl@0: RedrawWin(window64K,KRgbGreen); sl@0: // Should now have switched Wserv to 64K mode sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeLow); sl@0: // sl@0: RWindow window16M(TheClient->iWs); sl@0: SetupTestRWindowLC(window16M,TPoint(),TSize(maxScreenDimension/2,maxScreenDimension/2),testDispModeHigh); sl@0: RedrawWin(window16M,KRgbCyan); sl@0: // Should switch Wserv back to 16M mode sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeHigh); sl@0: // sl@0: window64K.SetOrdinalPosition(-1); sl@0: window16M.SetOrdinalPosition(-1); sl@0: SetWsAndAppScreenModes(screenMode); sl@0: TEST(TheClient->iScreen->DisplayMode()==baseDisplayMode); sl@0: // sl@0: const TInt KNumTestFlags=3; sl@0: const TInt KMaxTestFlags=1<iScreen->DisplayMode()==testDispModeLow); sl@0: window64K.SetVisible(EFalse); sl@0: TEST(TheClient->iScreen->DisplayMode()==baseDisplayMode); sl@0: window64K.SetVisible(ETrue); sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeLow); sl@0: window64K.SetSize(rotatedScreenDeviceSize); sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeLow); sl@0: // Changing screen mode now should expose the 16M window sl@0: SetWsAndAppScreenModes(screenMode2); sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeHigh); sl@0: SetWsAndAppScreenModes(screenMode); sl@0: // And back to the 64K win covering the screen sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeLow); sl@0: // Create a new group with a 16M window and switching ordinal pos to back and back to front sl@0: RWindowGroup testGroup(TheClient->iWs); sl@0: CleanupClosePushL(testGroup); sl@0: User::LeaveIfError(testGroup.Construct(111,EFalse)); sl@0: RWindow testGroupWin(TheClient->iWs); sl@0: CleanupClosePushL(testGroupWin); sl@0: User::LeaveIfError(testGroupWin.Construct(testGroup, 112)); sl@0: testGroupWin.SetExtent(TPoint(), TSize(1,1)); // Just enough to change mode sl@0: testGroupWin.SetRequiredDisplayMode(testDispModeHigh); sl@0: testGroupWin.Activate(); sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeHigh); sl@0: TInt oldPos=testGroup.OrdinalPosition(); sl@0: testGroup.SetOrdinalPosition(oldPos+1); sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeLow); sl@0: testGroup.SetOrdinalPosition(oldPos); sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeHigh); sl@0: CleanupStack::PopAndDestroy(2,&testGroup); sl@0: TEST(TheClient->iScreen->DisplayMode()==testDispModeLow); sl@0: // sl@0: CleanupStack::PopAndDestroy(2,&window64K); sl@0: } sl@0: CleanupStack::PopAndDestroy(2,winGc1); sl@0: CleanupStack::PopAndDestroy(2,&window); sl@0: CleanupStack::PopAndDestroy(2,testBitmap64); sl@0: } sl@0: CleanupStack::PopAndDestroy(&shield16M); sl@0: TheClient->iScreen->ReleaseFont(font); sl@0: SetWsAndAppScreenModes(TheClient->iScreenModes[0]); sl@0: } sl@0: sl@0: void CTScrMode::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: TBuf<32> buf; sl@0: TBool checkWindowParam=EFalse; sl@0: TInt count=0; sl@0: TInt mode=0; sl@0: TBool enable=EFalse; sl@0: TBool disable=EFalse; sl@0: TInt retVal; sl@0: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch(++iTest->iState) sl@0: { sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0296 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test screen modes can be set while the screen is rotated sl@0: through 180 degrees. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Rotate the screen through 180 degrees while setting each sl@0: of the screen modes available sl@0: sl@0: @SYMTestExpectedResults The screen is rotated and screen modes set correctly sl@0: sl@0: */ sl@0: case 1: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0296")); sl@0: iTest->LogSubTest(_L("Orientation1")); sl@0: ScreenRotationsL(); sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0297 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Change the screen orientation then test screen modes can sl@0: be set while the screen is rotated through 180 degrees. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Rotate the screen through 180 degrees while setting each sl@0: of the screen modes available sl@0: sl@0: @SYMTestExpectedResults The screen is rotated and screen modes set correctly sl@0: sl@0: */ sl@0: case 2: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0297")); sl@0: iTest->LogSubTest(_L("Orientation2")); sl@0: MoreScreenRotationsL(); sl@0: iSubState=0; sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0298 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test for the rect clear defect while setting screen mode sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Change the screen mode and check the rect clear defect is sl@0: not present sl@0: sl@0: @SYMTestExpectedResults The defect is not present sl@0: sl@0: */ sl@0: case 3: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0298")); sl@0: iTest->LogSubTest(_L("Rect Clear Defect")); sl@0: RectClearBugL(); sl@0: break; sl@0: case 4: sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0299 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test display mode can be set for test windows and sl@0: that the windows then function correctly sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Set the display mode in two test windows and then call sl@0: methods on the windows sl@0: sl@0: @SYMTestExpectedResults The windows function correctly sl@0: sl@0: */ sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0299")); sl@0: sl@0: iTest->LogSubTest(_L("ScreenModeChange")); sl@0: ScreenModeChange1L(); sl@0: ScreenModeChange2L(); sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0300 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test display mode can be set and retrieved sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Set the display mode in a window and the retrieve it sl@0: sl@0: @SYMTestExpectedResults The display mode retrieved is the same as the sl@0: one set. sl@0: sl@0: */ sl@0: case 5: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0300")); sl@0: iTest->LogSubTest(KScreenModeDisplayMode); sl@0: GetScreenDisplayMode(); sl@0: break; sl@0: sl@0: sl@0: #if defined(SCREEN_MODE_TESTING) sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0301 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Case 101 to 105 tests that the screen is drawn correctly sl@0: as different screen modes and screen orientation are sl@0: set for the screen sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Set different screen modes and orientations for the screen and sl@0: redraw the screen sl@0: sl@0: @SYMTestExpectedResults The screen is drawn correctly for each setting sl@0: sl@0: */ sl@0: case 101: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0301")); sl@0: iSubState = 0; sl@0: buf.Format(TRefByValue(_L("Screen mode %d:%d")),101,iSubState); sl@0: INFO_PRINTF1(buf); sl@0: checkWindowParam=ETrue; sl@0: mode=1; sl@0: if (iCurEnforcement==ESizeEnforcementPixelsAndRotation) sl@0: count+=3; sl@0: else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation) sl@0: count+=6; sl@0: if (iSecondConnection->DeviceMessageCount()!=count) sl@0: { sl@0: TLogMessageText buf; sl@0: _LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d"); sl@0: buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount()); sl@0: TheClient->iWs.LogMessage(buf); sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: retVal = iSecondConnection->DeviceMessageCount(); sl@0: TEST(retVal==count); sl@0: if (retVal!=count) sl@0: INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal); sl@0: sl@0: CheckWindows(iCurEnforcement==ESizeEnforcementNone?ETrue:checkWindowParam); sl@0: if (enable) sl@0: iSecondConnection->EnableMessages(); sl@0: if (disable) sl@0: iSecondConnection->DisableMessages(); sl@0: TheClient->iScreen->SetScreenMode(mode); sl@0: TheClient->iWs.Flush(); sl@0: iSubState++; sl@0: break; sl@0: case 102: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0521 sl@0: */ sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0521")); sl@0: buf.Format(TRefByValue(_L("Screen mode %d:%d")),101,iSubState); sl@0: INFO_PRINTF1(buf); sl@0: checkWindowParam=EFalse; sl@0: enable=ETrue; sl@0: if (iCurEnforcement==ESizeEnforcementPixelsAndRotation) sl@0: count+=3; sl@0: else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation) sl@0: count+=6; sl@0: if (iSecondConnection->DeviceMessageCount()!=count) sl@0: { sl@0: TLogMessageText buf; sl@0: _LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d"); sl@0: buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount()); sl@0: TheClient->iWs.LogMessage(buf); sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: retVal = iSecondConnection->DeviceMessageCount(); sl@0: TEST(retVal==count); sl@0: if (retVal!=count) sl@0: INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal); sl@0: sl@0: if (enable) sl@0: iSecondConnection->EnableMessages(); sl@0: if (disable) sl@0: iSecondConnection->DisableMessages(); sl@0: TheClient->iScreen->SetScreenMode(mode); sl@0: TheClient->iWs.Flush(); sl@0: iSubState++; sl@0: break; sl@0: case 103: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0522 sl@0: */ sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0522")); sl@0: buf.Format(TRefByValue(_L("Screen mode %d:%d")),101,iSubState); sl@0: INFO_PRINTF1(buf); sl@0: count=1; sl@0: mode=1; sl@0: checkWindowParam=ETrue; sl@0: if (iCurEnforcement==ESizeEnforcementPixelsAndRotation) sl@0: count+=3; sl@0: else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation) sl@0: count+=6; sl@0: if (iSecondConnection->DeviceMessageCount()!=count) sl@0: { sl@0: TLogMessageText buf; sl@0: _LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d"); sl@0: buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount()); sl@0: TheClient->iWs.LogMessage(buf); sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: retVal = iSecondConnection->DeviceMessageCount(); sl@0: TEST(retVal==count); sl@0: if (retVal!=count) sl@0: INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal); sl@0: sl@0: CheckWindows(iCurEnforcement==ESizeEnforcementNone?ETrue:checkWindowParam); sl@0: if (enable) sl@0: iSecondConnection->EnableMessages(); sl@0: if (disable) sl@0: iSecondConnection->DisableMessages(); sl@0: TheClient->iScreen->SetScreenMode(mode); sl@0: TheClient->iWs.Flush(); sl@0: iSubState++; sl@0: break; sl@0: case 104: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0523 sl@0: */ sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0523")); sl@0: buf.Format(TRefByValue(_L("Screen mode %d:%d")),101,iSubState); sl@0: INFO_PRINTF1(buf); sl@0: checkWindowParam=ETrue; sl@0: count=2; sl@0: disable=ETrue; sl@0: if (iCurEnforcement==ESizeEnforcementPixelsAndRotation) sl@0: count+=3; sl@0: else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation) sl@0: count+=6; sl@0: if (iSecondConnection->DeviceMessageCount()!=count) sl@0: { sl@0: TLogMessageText buf; sl@0: _LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d"); sl@0: buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount()); sl@0: TheClient->iWs.LogMessage(buf); sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: retVal = iSecondConnection->DeviceMessageCount(); sl@0: TEST(retVal==count); sl@0: if (retVal!=count) sl@0: INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal); sl@0: sl@0: if (enable) sl@0: iSecondConnection->EnableMessages(); sl@0: if (disable) sl@0: iSecondConnection->DisableMessages(); sl@0: TheClient->iScreen->SetScreenMode(mode); sl@0: TheClient->iWs.Flush(); sl@0: iSubState++; sl@0: break; sl@0: case 105: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0524 sl@0: */ sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0524")); sl@0: buf.Format(TRefByValue(_L("Screen mode %d:%d")),101,iSubState); sl@0: INFO_PRINTF1(buf); sl@0: checkWindowParam=EFalse; sl@0: count=2; sl@0: enable=ETrue; sl@0: if (iCurEnforcement==ESizeEnforcementPixelsAndRotation) sl@0: count+=3; sl@0: else if (iCurEnforcement==ESizeEnforcementPixelsTwipsAndRotation) sl@0: count+=6; sl@0: if (iSecondConnection->DeviceMessageCount()!=count) sl@0: { sl@0: TLogMessageText buf; sl@0: _LIT(KFailCount,"Event Mismatch, Exp=%d, Act=%d"); sl@0: buf.Format(KFailCount,count,iSecondConnection->DeviceMessageCount()); sl@0: TheClient->iWs.LogMessage(buf); sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: retVal = iSecondConnection->DeviceMessageCount(); sl@0: TEST(retVal==count); sl@0: if (retVal!=count) sl@0: INFO_PRINTF3(_L("(iSecondConnection->DeviceMessageCount() return value - Expected: %d, Actual: %d"),count ,retVal); sl@0: sl@0: CheckWindows(iCurEnforcement==ESizeEnforcementNone?ETrue:checkWindowParam); sl@0: if (enable) sl@0: iSecondConnection->EnableMessages(); sl@0: if (disable) sl@0: iSecondConnection->DisableMessages(); sl@0: TheClient->iScreen->SetScreenMode(mode); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: sl@0: iSecondConnection->DisableMessages(); sl@0: if (iCurEnforcement==ESizeEnforcementNone) sl@0: { // Do it again with different enforcement mode sl@0: SetScreenModeEnforcement(ESizeEnforcementPixelsAndRotation); sl@0: ResetCounter(100); sl@0: } sl@0: else if (iCurEnforcement==ESizeEnforcementPixelsAndRotation) sl@0: { // Do it again with different enforcement mode sl@0: SetScreenModeEnforcement(ESizeEnforcementPixelsTwipsAndRotation); sl@0: ResetCounter(100); sl@0: } sl@0: else sl@0: { sl@0: SetScreenModeEnforcement(ESizeEnforcementNone); sl@0: delete iSecondConnection; sl@0: iSecondConnection=NULL; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0302 sl@0: sl@0: @SYMDEF DEF099638 sl@0: sl@0: @SYMTestCaseDesc Test that a drawing can be scaled while different screen sl@0: modes are set sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Set different screen modes and scale a drawing sl@0: sl@0: @SYMTestExpectedResults The drawing is redrawn to scale sl@0: sl@0: */ sl@0: case 110: sl@0: { sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0302")); sl@0: // Ensure that the TestWin and BaseWin will be drawn properly in all screen modes sl@0: SetScreenModeEnforcement(ESizeEnforcementPixelsAndRotation); sl@0: TheClient->SetTestClientScreenMode(0); sl@0: INFO_PRINTF1(_L("Scaled drawing - screen mode 0")); sl@0: ScaledDrawingL(); sl@0: TheClient->SetTestClientScreenMode(1); sl@0: INFO_PRINTF1(_L("Scaled drawing - screen mode 1")); sl@0: ScaledDrawingL(); sl@0: // Restore screen mode and enforcement mode sl@0: TheClient->SetTestClientScreenMode(0); sl@0: SetScreenModeEnforcement(iOldEnfMode); sl@0: break; sl@0: } sl@0: sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0303 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test screen mode and rotation panic messages sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Test the panics fro screen mode and rotation respond as sl@0: expected sl@0: sl@0: @SYMTestExpectedResults Panics respond as expected sl@0: sl@0: */ sl@0: case 111: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0303")); sl@0: INFO_PRINTF1(_L("Panic")); sl@0: TestPanicsL(); sl@0: break; sl@0: #endif sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0304 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test that if there are invisible windows and then the sl@0: screen mode is changed, the windows are redrawn correctly sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create some windows, make some invisible, change the screen sl@0: mode and redraw the windows sl@0: sl@0: @SYMTestExpectedResults The windows are redrawn without error sl@0: sl@0: */ sl@0: case 112: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0304")); sl@0: INFO_PRINTF1(_L("Invisible Wnds And Infinite Redraw Bugs")); // two defects one problem sl@0: InvisibleWndAndInfiniteRedrawBugL(); sl@0: break; sl@0: /** sl@0: sl@0: @SYMTestCaseID GRAPHICS-WSERV-0358 sl@0: sl@0: @SYMDEF PDEF096151 sl@0: sl@0: @SYMTestCaseDesc Ensure that wserv does not panic when calling CWsScreenDevice::SetScreenMode() sl@0: after a client has deleted a screen device used by an active group window sl@0: sl@0: @SYMTestPriority Critical sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Creates a RWsSession sl@0: Creates a primary screen device sl@0: Creates another screen device sl@0: Creates a group window sl@0: Gets all the valid screen modes sl@0: Deletes the primary screen device sl@0: Calls SetScreenMode on the second screen device sl@0: (this step triggered the defect - panicking wserv) sl@0: Cleans up the above sl@0: sl@0: @SYMTestExpectedResults The call to SetScreenMode should not cause wserv to panic sl@0: sl@0: */ sl@0: case 113: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0358")); sl@0: INFO_PRINTF1(_L("Set screen mode after a client has deleted the screen device")); sl@0: SetScreenModeAfterScreenDeviceDeletedL(); sl@0: break; sl@0: case 114: sl@0: INFO_PRINTF1(_L("Rotate/screen mode test")); sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0525 sl@0: */ sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0525")); sl@0: TestRotateAndScreenModeL(); sl@0: break; sl@0: default: sl@0: ((CTScrModeStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: if (iTest->iState==115 || iTest->iState>1000) sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTScrModeStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: // sl@0: // CSecondConnection sl@0: // sl@0: sl@0: CSecondConnection::~CSecondConnection() sl@0: { sl@0: delete iWindow; sl@0: delete iWindow2; sl@0: iGroup->GroupWin()->EnableReceiptOfFocus(EFalse); // Stop auto group switching on close sl@0: delete iGroup; sl@0: delete iClient; sl@0: } sl@0: sl@0: void CSecondConnection::ConstructL(TInt aScreenNumber,const TRect &aWinRect, CTestBase *aTest, CTestStep* aTestStep) sl@0: { sl@0: iClient=new(ELeave) CTClient; sl@0: iClient->SetScreenNumber(aScreenNumber); sl@0: iClient->ConstructL(); sl@0: iGroup=new(ELeave) CSecondConnectionGroup(iClient,this,aTest,aTestStep); sl@0: iGroup->ConstructL(); sl@0: // sl@0: iWindow=new(ELeave) CTBlankWindow; sl@0: iWindow->ConstructL(*iGroup); sl@0: iWindow->BaseWin()->SetShadowDisabled(ETrue); sl@0: iWindow->SetColor(TRgb::Gray4(1)); sl@0: TPoint offset=BaseWin->BaseWin()->InquireOffset((*iGroup->GroupWin())); sl@0: iWindow->SetExtL(offset+aWinRect.iTl,aWinRect.Size()); sl@0: iWindow->Activate(); sl@0: // sl@0: iWindow2=new(ELeave) CTBlankWindow; sl@0: iWindow2->ConstructL(*iGroup); sl@0: iWindow2->BaseWin()->SetShadowDisabled(ETrue); sl@0: iWindow2->SetColor(TRgb::Gray4(1)); sl@0: TPoint offset2=TestWin->BaseWin()->InquireOffset((*iGroup->GroupWin())); sl@0: iWindow2->SetExtL(offset2+aWinRect.iTl,aWinRect.Size()); sl@0: iWindow2->BaseWin()->SetVisible(EFalse); sl@0: iWindow2->Activate(); sl@0: } sl@0: sl@0: void CSecondConnection::SetWindow2Visibility(TBool aVisible) sl@0: { sl@0: iWindow2->BaseWin()->SetVisible(aVisible); sl@0: iClient->iWs.Flush(); sl@0: iClient->iWs.Finish(); sl@0: } sl@0: sl@0: void CSecondConnection::EnableMessages() sl@0: { sl@0: iGroup->GroupWin()->EnableScreenChangeEvents(); sl@0: iClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CSecondConnection::DisableMessages() sl@0: { sl@0: iGroup->GroupWin()->DisableScreenChangeEvents(); sl@0: iClient->iWs.Flush(); sl@0: } sl@0: sl@0: TInt CSecondConnection::DeviceMessageCount() const sl@0: { sl@0: return(iMessageCount); sl@0: } sl@0: sl@0: void CSecondConnection::ScreenDeviceChanged() sl@0: { sl@0: iMessageCount++; sl@0: } sl@0: sl@0: // sl@0: // CSecondConnectionGroup sl@0: // sl@0: sl@0: CSecondConnectionGroup::CSecondConnectionGroup(CTClient *aClient, CSecondConnection *aSecondConnection, CTestBase *aTest, CTestStep* aTestStep) : CTWindowGroup(aClient), iTest(aTest), iSecondConnection(aSecondConnection), iTestStep(aTestStep) sl@0: {} sl@0: sl@0: void CSecondConnectionGroup::ScreenDeviceChanged() sl@0: { sl@0: iSecondConnection->ScreenDeviceChanged(); sl@0: TPixelsTwipsAndRotation sar; sl@0: Client()->iScreen->GetDefaultScreenSizeAndRotation(sar); sl@0: Client()->iScreen->SetScreenSizeAndRotation(sar); sl@0: // sl@0: iTestStep->TEST(Client()->iScreen->SizeInPixels()==sar.iPixelSize); sl@0: iTestStep->TEST(Client()->iScreen->SizeInTwips()==sar.iTwipsSize); sl@0: TSize pixelConv; sl@0: pixelConv.iWidth=Client()->iScreen->HorizontalTwipsToPixels(sar.iTwipsSize.iWidth); sl@0: pixelConv.iHeight=Client()->iScreen->VerticalTwipsToPixels(sar.iTwipsSize.iHeight); sl@0: iTestStep->TEST(pixelConv==sar.iPixelSize); sl@0: } sl@0: sl@0: sl@0: // sl@0: // SecondClientConnection sl@0: // sl@0: sl@0: SecondClientConnection::SecondClientConnection() sl@0: { sl@0: } sl@0: sl@0: SecondClientConnection::~SecondClientConnection() sl@0: { sl@0: } sl@0: sl@0: void SecondClientConnection::ConstructL(TInt aScreenMode, const TPixelsTwipsAndRotation& aSizeAndRotation) sl@0: { sl@0: CTClient::ConstructL(); sl@0: iGroup=new(ELeave) TestWindowGroup(this); sl@0: iGroup->ConstructL(); sl@0: iScreen->SetScreenModeEnforcement(ESizeEnforcementPixelsAndRotation); sl@0: iScreen->SetScreenSizeAndRotation(aSizeAndRotation); sl@0: iScreen->SetScreenMode(aScreenMode); sl@0: } sl@0: sl@0: __WS_CONSTRUCT_STEP__(ScrMode)