sl@0: // Copyright (c) 2007-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: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: #include "tgc.h" sl@0: #include "RemoteGc.h" sl@0: #include "CommandBuffer.h" sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: #include "directgdigcwrapper.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #endif sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: GLDEF_C void CopyImageToBitmapL(CFbsBitmap* aBitmap, const RSgImage& aImage, const TRect& aRect); sl@0: GLDEF_C void CopyImageToDestination(TAny* aDataAddressDest, TInt aDataStrideDest, TDisplayMode aDisplayModeDest, sl@0: TAny* aDataAddressSrc, TInt aDataStrideSrc, TDisplayMode aDisplayModeSrc, const TRect& aRect); sl@0: GLDEF_C void CopyImageToDestination64K(TAny* aDataAddressDest, TInt aDataStrideDest, TDisplayMode aDisplayModeDest, sl@0: TUint16* aDataAddressSrc, TInt aDataStrideSrc, const TRect& aRect); sl@0: sl@0: GLDEF_C void CopyImageToBitmapL(CFbsBitmap* aBitmap, const RSgImage& aImage, const TRect& aRect) sl@0: { sl@0: TSgImageInfo info; sl@0: TInt res = aImage.GetInfo(info); sl@0: if(res == KErrNone) sl@0: { sl@0: info.iUsage = ESgUsageNone; sl@0: info.iCpuAccess = ESgCpuAccessReadOnly; sl@0: RSgImage image; sl@0: res = image.Create(info, aImage); sl@0: if(res == KErrNone) sl@0: { sl@0: const TAny* dataAddressSrc = NULL; sl@0: TInt dataStrideSrc = 0; sl@0: res = image.MapReadOnly(dataAddressSrc, dataStrideSrc); sl@0: if(res == KErrNone) sl@0: { sl@0: const TDisplayMode displayModeDest = aBitmap->DisplayMode(); sl@0: const TDisplayMode displayModeSrc = SgUtils::PixelFormatToDisplayMode(info.iPixelFormat); sl@0: TUint32* dataAddressDest = aBitmap->DataAddress(); sl@0: const TInt dataStrideDest = aBitmap -> DataStride(); sl@0: TSize bitmapSize = aBitmap->SizeInPixels(); sl@0: TRect rect = aRect; sl@0: TRect rectDest = info.iSizeInPixels; sl@0: rect.Intersection(rectDest); sl@0: if(rect.Height() > bitmapSize.iHeight) sl@0: { sl@0: rect.SetHeight(bitmapSize.iHeight); sl@0: } sl@0: if(rect.Width() > bitmapSize.iWidth) sl@0: { sl@0: rect.SetWidth(bitmapSize.iWidth); sl@0: } sl@0: CopyImageToDestination((TAny*)dataAddressDest, dataStrideDest, displayModeDest, (TAny*)dataAddressSrc, sl@0: dataStrideSrc, displayModeSrc, rect); sl@0: sl@0: image.Unmap(); sl@0: } sl@0: image.Close(); sl@0: } sl@0: } sl@0: } sl@0: sl@0: GLDEF_C void CopyImageToDestination(TAny* aDataAddressDest, TInt aDataStrideDest, TDisplayMode aDisplayModeDest, sl@0: TAny* aDataAddressSrc, TInt aDataStrideSrc, TDisplayMode aDisplayModeSrc, const TRect& aRect) sl@0: { sl@0: if(aRect.IsEmpty()) sl@0: return; sl@0: sl@0: if((aDisplayModeDest == aDisplayModeSrc) && (aDataStrideSrc == aDataStrideDest)) sl@0: { sl@0: Mem::Copy(aDataAddressDest, aDataAddressSrc, aDataStrideDest * aRect.Height()); sl@0: return; sl@0: } sl@0: sl@0: switch(aDisplayModeSrc) sl@0: { sl@0: case EColor64K: sl@0: { sl@0: CopyImageToDestination64K(aDataAddressDest, aDataStrideDest, aDisplayModeDest, sl@0: (TUint16*)aDataAddressSrc, aDataStrideSrc, aRect); sl@0: break; sl@0: } sl@0: default: sl@0: break; sl@0: } sl@0: } sl@0: sl@0: GLDEF_C void CopyImageToDestination64K(TAny* aDataAddressDest, TInt aDataStrideDest, TDisplayMode aDisplayModeDest, sl@0: TUint16* aDataAddressSrc, TInt aDataStrideSrc, const TRect& aRect) sl@0: { sl@0: const TInt bppSrc = 2; sl@0: const TInt width = aRect.Width(); sl@0: const TInt height = aRect.Height(); sl@0: const TInt dataStrideLengthSrc = aDataStrideSrc / bppSrc; sl@0: TUint16* dataAddressSrc = aDataAddressSrc + aRect.iTl.iY * dataStrideLengthSrc + aRect.iTl.iX; sl@0: const TUint16* dataAddressSrcEnd = dataAddressSrc + dataStrideLengthSrc * height; sl@0: sl@0: switch(aDisplayModeDest) sl@0: { sl@0: case EColor64K: sl@0: { sl@0: TUint16* dataAddressDest = static_cast (aDataAddressDest); sl@0: const TInt dataStrideLengthDest = aDataStrideDest / bppSrc; sl@0: while(dataAddressSrcEnd > dataAddressSrc) sl@0: { sl@0: Mem::Copy(dataAddressDest, dataAddressSrc, width * bppSrc); sl@0: dataAddressSrc += dataStrideLengthSrc; sl@0: dataAddressDest += dataStrideLengthDest; sl@0: } sl@0: break; sl@0: } sl@0: case EColor16MU: sl@0: { sl@0: const TInt bppDest = 4; sl@0: TUint32* dataAddressDest = static_cast (aDataAddressDest); sl@0: const TInt dataStrideLengthDest = aDataStrideDest / bppDest; sl@0: sl@0: while(dataAddressSrcEnd > dataAddressSrc) sl@0: { sl@0: const TUint16* dataAddressSrcLineEnd = dataAddressSrc + width; sl@0: TUint32* dataAddressDestCur = dataAddressDest; sl@0: TUint16* dataAddressSrcCur = dataAddressSrc; sl@0: sl@0: while(dataAddressSrcLineEnd > dataAddressSrcCur) sl@0: { sl@0: *dataAddressDestCur = TRgb::Color64K(*dataAddressSrcCur).Color16MU(); sl@0: dataAddressDestCur++; sl@0: dataAddressSrcCur++; sl@0: } sl@0: dataAddressSrc += dataStrideLengthSrc; sl@0: dataAddressDest += dataStrideLengthDest; sl@0: } sl@0: break; sl@0: } sl@0: case EGray4: sl@0: { sl@0: TUint8* dataAddressDest = static_cast (aDataAddressDest); sl@0: const TInt dataStrideLengthDest = aDataStrideDest; sl@0: sl@0: while(dataAddressSrcEnd > dataAddressSrc) sl@0: { sl@0: const TUint8* dataAddressDstLineEnd = dataAddressDest + aDataStrideDest; sl@0: TUint8* dataAddressDestCur = dataAddressDest; sl@0: TUint16* dataAddressSrcCur = dataAddressSrc; sl@0: sl@0: while(dataAddressDstLineEnd > dataAddressDestCur) sl@0: { sl@0: *dataAddressDestCur = 0; sl@0: for(TInt index = 0; index < 8; index +=2) sl@0: { sl@0: TInt col = TRgb::Color64K(*dataAddressSrcCur).Gray4(); sl@0: col <<= index; sl@0: *dataAddressDestCur |= col; sl@0: dataAddressSrcCur++; sl@0: } sl@0: dataAddressDestCur++; sl@0: } sl@0: dataAddressSrc += dataStrideLengthSrc; sl@0: dataAddressDest += dataStrideLengthDest; sl@0: } sl@0: break; sl@0: } sl@0: case EColor256: sl@0: { sl@0: TUint8* dataAddressDest = static_cast (aDataAddressDest); sl@0: const TInt dataStrideLengthDest = aDataStrideDest; sl@0: sl@0: while(dataAddressSrcEnd > dataAddressSrc) sl@0: { sl@0: const TUint8* dataAddressDstLineEnd = dataAddressDest + aDataStrideDest; sl@0: TUint8* dataAddressDestCur = dataAddressDest; sl@0: TUint16* dataAddressSrcCur = dataAddressSrc; sl@0: sl@0: while(dataAddressDstLineEnd > dataAddressDestCur) sl@0: { sl@0: *dataAddressDestCur = TRgb::Color64K(*dataAddressSrcCur).Color256(); sl@0: dataAddressSrcCur++; sl@0: dataAddressDestCur++; sl@0: } sl@0: dataAddressSrc += dataStrideLengthSrc; sl@0: dataAddressDest += dataStrideLengthDest; sl@0: } sl@0: break; sl@0: } sl@0: default: sl@0: break; sl@0: } sl@0: } sl@0: sl@0: TDisplayMode DisplayModeFromPixelFormat(TUidPixelFormat aPixelFormat) sl@0: { sl@0: switch(aPixelFormat) sl@0: { sl@0: case EUidPixelFormatARGB_8888_PRE: sl@0: return EColor16MAP; sl@0: case EUidPixelFormatARGB_8888: sl@0: return EColor16MA; sl@0: case EUidPixelFormatRGB_565: sl@0: return EColor64K; sl@0: default: sl@0: break; sl@0: } sl@0: return ENone; sl@0: } sl@0: sl@0: TUidPixelFormat PixelFormatFromDisplayMode(TDisplayMode aDisplayMode) sl@0: { sl@0: switch (aDisplayMode) sl@0: { sl@0: case EGray2: sl@0: case EGray4: sl@0: case EGray16: sl@0: case EGray256: sl@0: case EColor16: sl@0: case EColor256: sl@0: case EColor16M: sl@0: case EColor16MU: sl@0: { sl@0: return EUidPixelFormatXRGB_8888; sl@0: } sl@0: case EColor4K: sl@0: { sl@0: return EUidPixelFormatXRGB_4444; sl@0: } sl@0: case EColor64K: sl@0: { sl@0: return EUidPixelFormatRGB_565; sl@0: } sl@0: case EColor16MA: sl@0: { sl@0: return EUidPixelFormatARGB_8888; sl@0: } sl@0: case EColor16MAP: sl@0: { sl@0: return EUidPixelFormatARGB_8888_PRE; sl@0: } sl@0: default: sl@0: { sl@0: return EUidPixelFormatUnknown; sl@0: } sl@0: } sl@0: } sl@0: #endif sl@0: sl@0: CTGc::CTGc(CTestStep* aStep) : CTWsGraphicsBase(aStep) sl@0: { sl@0: } sl@0: sl@0: CTGc::~CTGc() sl@0: { sl@0: delete iTest; sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: SgDriver::Close(); sl@0: CDirectGdiDriver *directGdiDriver = CDirectGdiDriver::Static(); sl@0: if(directGdiDriver) sl@0: { sl@0: directGdiDriver->Close(); sl@0: } sl@0: #endif sl@0: } sl@0: sl@0: void CTGc::ConstructL() sl@0: { sl@0: _LIT(KTestName,"GC Test"); sl@0: iTest=new(ELeave) CTestBase(KTestName,this); sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: TInt err = CDirectGdiDriver::Open(); sl@0: User::LeaveIfError(err); sl@0: err = SgDriver::Open(); sl@0: if(err != KErrNone) sl@0: { sl@0: CDirectGdiDriver *directGdiDriver = CDirectGdiDriver::Static(); sl@0: if(directGdiDriver) sl@0: { sl@0: directGdiDriver->Close(); sl@0: } sl@0: User::Leave(err); sl@0: } sl@0: #endif sl@0: } sl@0: sl@0: //Class derived from MWsGraphicResolver. Used for playing the commands from command buffer sl@0: class CWSGraphicsRes: public CBase, public MWsGraphicResolver sl@0: { sl@0: public: sl@0: void DrawWsGraphic(TInt /*aId*/, TBool /*aIsUid*/, const TRect& /*aRect*/, const TDesC8& /*aData*/) const sl@0: { sl@0: //Orveriding by giving empty implemention sl@0: } sl@0: }; sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: // sl@0: //Class CDrawTextInContextTest sl@0: // sl@0: sl@0: CDrawTextInContextTest::CDrawTextInContextTest(){} sl@0: sl@0: CDrawTextInContextTest::~CDrawTextInContextTest() sl@0: { sl@0: delete iRefBitmap; sl@0: delete iRefDevice; sl@0: delete iRefBitGc; sl@0: delete iRemoteGc; sl@0: iMsgBuf.Close(); sl@0: delete iCommandBuffer; sl@0: delete iWsGraphicRes; sl@0: sl@0: TheClient->iScreen->ReleaseFont(iFont); sl@0: sl@0: delete iDirectGdiGcWrapper; sl@0: if(iWrapperImageTarget) sl@0: { sl@0: iWrapperImageTarget->Close(); sl@0: } sl@0: delete iWrapperImageTarget; sl@0: iWrapperImage.Close(); sl@0: iWrapperImageCollection.Close(); sl@0: } sl@0: sl@0: void CDrawTextInContextTest::BaseConstructL() sl@0: { sl@0: //Initialise font settings sl@0: TFontSpec fsp; sl@0: fsp.iTypeface.iName=_L("Series 60 Sans"); sl@0: fsp.iHeight=430; sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont*&)iFont,fsp)); sl@0: sl@0: //Initialise TTextParameter sl@0: iParam.iStart = 27; sl@0: iParam.iEnd = 60; sl@0: sl@0: //Text to draw sl@0: iText.Set(_L("This text will not be drawnK.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Latin This text will not be drawn")); sl@0: sl@0: //For reference bitmap sl@0: iRefBitmap = new(ELeave) CFbsBitmap(); sl@0: User::LeaveIfError(iRefBitmap->Create(KBitmapSize, EColor64K)); sl@0: iRefDevice = CFbsBitmapDevice::NewL(iRefBitmap); sl@0: User::LeaveIfError(iRefDevice->CreateContext(iRefBitGc)); sl@0: sl@0: CDirectGdiDriver* theDGdiDriver = CDirectGdiDriver::Static(); sl@0: User::LeaveIfNull(theDGdiDriver); sl@0: sl@0: TSgImageInfo info; sl@0: info.iUsage = ESgUsageDirectGdiTarget | ESgUsageDirectGdiSource | ESgUsageCompositionSource; sl@0: info.iSizeInPixels = KBitmapSize; sl@0: info.iPixelFormat = EUidPixelFormatRGB_565; sl@0: sl@0: TInt res = iWrapperImageCollection.Create(info, 1); sl@0: User::LeaveIfError(res); sl@0: res = iWrapperImageCollection.OpenImage(0, iWrapperImage); sl@0: User::LeaveIfError(res); sl@0: iWrapperImageTarget = new (ELeave) RDirectGdiImageTarget(*theDGdiDriver); sl@0: res = iWrapperImageTarget->Create(iWrapperImage); sl@0: User::LeaveIfError(res); sl@0: iDirectGdiGcWrapper = CDirectGdiGcWrapper::NewL(*iWrapperImageTarget); sl@0: sl@0: //clean image----------------- sl@0: CDirectGdiGcWrapper* directGdiGcWrapper = CDirectGdiGcWrapper::NewL(*iWrapperImageTarget); sl@0: CleanupStack::PushL(directGdiGcWrapper); sl@0: sl@0: directGdiGcWrapper->SetDrawMode(MWsGraphicsContext::EDrawModeWriteAlpha); sl@0: directGdiGcWrapper->SetBrushColor(KRgbWhite); sl@0: directGdiGcWrapper->Clear(); sl@0: sl@0: CleanupStack::PopAndDestroy(1, directGdiGcWrapper); sl@0: //------------------ sl@0: sl@0: //Used to record draw commands sl@0: iRemoteGc = CRemoteGc::NewL(TheClient->iScreen); sl@0: sl@0: //Used to play recorded draw commands sl@0: iCommandBuffer = CCommandBuffer::NewL(); sl@0: sl@0: //Dummy class created required for CCommandBuffer::Play sl@0: iWsGraphicRes = new (ELeave) CWSGraphicsRes(); sl@0: sl@0: //Offset for CCommandBuffer::Play sl@0: iOffset = TPoint(0,0); sl@0: sl@0: //Result of doing the test sl@0: iHasPassedTest = EFalse; sl@0: } sl@0: sl@0: void CDrawTextInContextTest::Test() sl@0: { sl@0: /* Create reference bitmap by drawing using bitgc */ sl@0: iRefBitGc->UseFont(iFont); sl@0: DoDrawTextBitGc(); sl@0: iRefBitGc->DiscardFont(); sl@0: sl@0: /* Drawing using CBitGcWrapper via CRemotGc*/ sl@0: sl@0: //Capturing the commands in remote gc sl@0: iRemoteGc->BeginDraw(KBitmapRect); sl@0: iRemoteGc->UseFont(iFont); sl@0: DoDrawTextRemoteGc(); sl@0: iRemoteGc->DiscardFont(); sl@0: iRemoteGc->EndDraw(); sl@0: sl@0: //Externalize the captured commands from remote gc in to a buffer sl@0: iRemoteGc->ExternalizeL(iMsgBuf, ETrue); sl@0: sl@0: //Internalize the buffer with captured commands (from CRemoteGC) in to CCommandBuffer sl@0: iCommandBuffer->InternalizeL(iMsgBuf.Pckg()); sl@0: sl@0: //Play the commands on test window using command buffer sl@0: iCommandBuffer->Play(iOffset,&KBitmapRegion,KBitmapRect,*iWsGraphicRes,*iDirectGdiGcWrapper); sl@0: sl@0: //Test to see if the bitmap drawn to using CRemoteGc is the same as the reference bitmap sl@0: CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmap); sl@0: sl@0: TSgImageInfo info; sl@0: iWrapperImage.GetInfo(info); sl@0: TDisplayMode displayMode = DisplayModeFromPixelFormat(info.iPixelFormat); sl@0: bitmap->Create(info.iSizeInPixels, displayMode); sl@0: TRect rect(info.iSizeInPixels); sl@0: CopyImageToBitmapL(bitmap, iWrapperImage, rect); sl@0: sl@0: iHasPassedTest = LossyCompareBitmap(*iRefBitmap, *bitmap, KBitmapRect, EFalse); sl@0: sl@0: CleanupStack::PopAndDestroy(bitmap); sl@0: } sl@0: sl@0: TBool CDrawTextInContextTest::HasPassedTest() sl@0: { sl@0: return iHasPassedTest; sl@0: } sl@0: sl@0: // sl@0: // Class DrawTextInContextTestPoint sl@0: // sl@0: sl@0: CDrawTextInContextTestPoint::CDrawTextInContextTestPoint(){} sl@0: sl@0: CDrawTextInContextTestPoint::~CDrawTextInContextTestPoint(){} sl@0: sl@0: CDrawTextInContextTestPoint* CDrawTextInContextTestPoint::NewL() sl@0: { sl@0: CDrawTextInContextTestPoint* self = new(ELeave) CDrawTextInContextTestPoint; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: void CDrawTextInContextTestPoint::ConstructL() sl@0: { sl@0: BaseConstructL(); sl@0: iPosition = TPoint(0,0); sl@0: } sl@0: sl@0: void CDrawTextInContextTestPoint::DoDrawTextBitGc() sl@0: { sl@0: iRefBitGc->DrawText(iText,&iParam,iPosition); sl@0: } sl@0: sl@0: void CDrawTextInContextTestPoint::DoDrawTextRemoteGc() sl@0: { sl@0: iRemoteGc->DrawText(iText,&iParam,iPosition); sl@0: } sl@0: sl@0: // sl@0: // Class DrawTextInContextTestBox sl@0: // sl@0: sl@0: CDrawTextInContextTestBox::CDrawTextInContextTestBox(){} sl@0: sl@0: CDrawTextInContextTestBox::~CDrawTextInContextTestBox(){} sl@0: sl@0: CDrawTextInContextTestBox* CDrawTextInContextTestBox::NewL() sl@0: { sl@0: CDrawTextInContextTestBox* self = new(ELeave) CDrawTextInContextTestBox; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: void CDrawTextInContextTestBox::ConstructL() sl@0: { sl@0: BaseConstructL(); sl@0: iClipFillRect = TRect(10,50,640,120); sl@0: iBaselineOffset = 40; sl@0: iTTextAlign = CGraphicsContext::ELeft; sl@0: } sl@0: sl@0: void CDrawTextInContextTestBox::DoDrawTextBitGc() sl@0: { sl@0: iRefBitGc->DrawText(iText,&iParam,iClipFillRect,iBaselineOffset,iTTextAlign); sl@0: } sl@0: sl@0: void CDrawTextInContextTestBox::DoDrawTextRemoteGc() sl@0: { sl@0: iRemoteGc->DrawText(iText,&iParam,iClipFillRect,iBaselineOffset,iTTextAlign); sl@0: } sl@0: sl@0: // sl@0: // Class CDrawTextInContextTestPointVertical sl@0: // sl@0: sl@0: CDrawTextInContextTestPointVertical::CDrawTextInContextTestPointVertical(){} sl@0: sl@0: CDrawTextInContextTestPointVertical::~CDrawTextInContextTestPointVertical(){} sl@0: sl@0: CDrawTextInContextTestPointVertical* CDrawTextInContextTestPointVertical::NewL() sl@0: { sl@0: CDrawTextInContextTestPointVertical* self = new(ELeave) CDrawTextInContextTestPointVertical; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: void CDrawTextInContextTestPointVertical::ConstructL() sl@0: { sl@0: BaseConstructL(); sl@0: iPosition = TPoint(0,0); sl@0: iUp = EFalse; sl@0: } sl@0: sl@0: void CDrawTextInContextTestPointVertical::DoDrawTextBitGc() sl@0: { sl@0: iRefBitGc->DrawTextVertical(iText,&iParam,iPosition,iUp); sl@0: } sl@0: sl@0: void CDrawTextInContextTestPointVertical::DoDrawTextRemoteGc() sl@0: { sl@0: iRemoteGc->DrawTextVertical(iText,&iParam,iPosition,iUp); sl@0: } sl@0: sl@0: // sl@0: // Class CDrawTextInContextTestBoxVertical sl@0: // sl@0: sl@0: CDrawTextInContextTestBoxVertical::CDrawTextInContextTestBoxVertical(){} sl@0: sl@0: CDrawTextInContextTestBoxVertical::~CDrawTextInContextTestBoxVertical(){} sl@0: sl@0: CDrawTextInContextTestBoxVertical* CDrawTextInContextTestBoxVertical::NewL() sl@0: { sl@0: CDrawTextInContextTestBoxVertical* self = new(ELeave) CDrawTextInContextTestBoxVertical; sl@0: CleanupStack::PushL(self); sl@0: self->ConstructL(); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: void CDrawTextInContextTestBoxVertical::ConstructL() sl@0: { sl@0: BaseConstructL(); sl@0: iClipFillRect = TRect(10,50,640,120); sl@0: iBaselineOffset = 40; sl@0: iUp = EFalse; sl@0: iTTextAlign = CGraphicsContext::ELeft; sl@0: } sl@0: sl@0: void CDrawTextInContextTestBoxVertical::DoDrawTextBitGc() sl@0: { sl@0: iRefBitGc->DrawTextVertical(iText,&iParam,iClipFillRect,iBaselineOffset,iUp,iTTextAlign); sl@0: } sl@0: sl@0: void CDrawTextInContextTestBoxVertical::DoDrawTextRemoteGc() sl@0: { sl@0: iRemoteGc->DrawTextVertical(iText,&iParam,iClipFillRect,iBaselineOffset,iUp,iTTextAlign); sl@0: } sl@0: #endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: sl@0: void CleanUpFont(TAny* aFont) sl@0: { sl@0: //Will be called in case of a leave to release the font sl@0: CFont* font= static_cast(aFont); sl@0: TheClient->iScreen->ReleaseFont(font); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0437 sl@0: @SYMPREQ PREQ1543 sl@0: @SYMTestCaseDesc Draw text using CWindowGc and CRemoteGc with both outline and shadow sl@0: effect on. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Create a font with both outline and shadow effects. Record the commands sl@0: (like setting colours,drawing text etc) using CRemoteGc and play the recorded commands on a window. Use the same sl@0: commands in CWindowGc and draw text on a different window sl@0: @SYMTestExpectedResults Text drawn using CWindowGc and CRemoteGc should be same sl@0: */ sl@0: void CTGc::TestOutlineAndShadowL() sl@0: { sl@0: TRect sourceRect(0, 0, TestWin->Size().iWidth, TestWin->Size().iHeight); sl@0: TRegionFix<1> clippingRegion(sourceRect); sl@0: sl@0: CWsScreenDevice* device = TheClient->iScreen; sl@0: sl@0: _LIT(KText,"Outline and shadow"); sl@0: TFontSpec fSpec(KTestFontTypefaceName,23); sl@0: fSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); sl@0: fSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue); sl@0: fSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue); sl@0: sl@0: CFont *font; sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont *&)font, fSpec)); sl@0: CleanupStack::PushL(TCleanupItem(CleanUpFont, font)); sl@0: sl@0: CRemoteGc* remoteGc = CRemoteGc::NewL(device); sl@0: CleanupStack::PushL(remoteGc); sl@0: remoteGc->BeginDraw(sourceRect); sl@0: //Capturing the commands in remote gc sl@0: remoteGc->SetBrushColor(KRgbGreen); sl@0: remoteGc->SetShadowColor(KRgbDarkRed); sl@0: remoteGc->SetPenColor(KRgbBlack); sl@0: remoteGc->UseFont(font); sl@0: remoteGc->DrawText(KText, TPoint(2,40)); sl@0: remoteGc->DiscardFont(); sl@0: remoteGc->EndDraw(); sl@0: sl@0: RWsGraphicMsgBuf msgBuf; sl@0: CleanupClosePushL(msgBuf); sl@0: //Externalize the captured commands from remote gc in to a buffer sl@0: remoteGc->ExternalizeL(msgBuf, ETrue); sl@0: sl@0: CWSGraphicsRes* wsGrap = new (ELeave) CWSGraphicsRes(); sl@0: CleanupStack::PushL(wsGrap); sl@0: sl@0: CCommandBuffer* cmdBuf = CCommandBuffer::NewL(); sl@0: CleanupStack::PushL(cmdBuf); sl@0: //Internalize the buffer with captured commands (from CRemoteGC) sl@0: //in to CCommandBuffer sl@0: cmdBuf->InternalizeL(msgBuf.Pckg()); sl@0: sl@0: TestWin->Win()->Invalidate(); sl@0: TestWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->Clear(); sl@0: //Play the commands on test window using command buffer sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: cmdBuf->Play(TPoint(0, 0), &clippingRegion, sourceRect, TheClient->iWs, *TheGc); sl@0: #else sl@0: cmdBuf->Play(TPoint(),TRect(TestWin->Size()),*wsGrap,*TheGc); sl@0: #endif sl@0: TheGc->Deactivate(); sl@0: TestWin->Win()->EndRedraw(); sl@0: sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->Clear(); sl@0: TheGc->SetBrushColor(KRgbGreen); sl@0: TheGc->SetShadowColor(KRgbDarkRed); sl@0: TheGc->SetPenColor(KRgbBlack); sl@0: TheGc->UseFont(font); sl@0: //Draw the text on base window using CWindowGC sl@0: TheGc->DrawText(KText, TPoint(2, 40)); sl@0: TheGc->DiscardFont(); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Finish(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: sl@0: //Check the text drawn on base and test windows. sl@0: CheckRect(BaseWin, TestWin, TRect(0, 0, BaseWin->Size().iWidth, BaseWin->Size().iHeight), _L("CTGc::TestOutlineAndShadowL()")); sl@0: sl@0: CleanupStack::PopAndDestroy(4, remoteGc); //cmdBuf, wsGrap, msgBuf and remoteGc sl@0: CleanupStack::Pop();//font sl@0: TheClient->iScreen->ReleaseFont(font); sl@0: } sl@0: sl@0: void CTGc::TestGcClipRectOrigin_DrawContent(TestWindow& aWindow, TBool bActivateBeforeRedraw /*= ETrue*/) sl@0: { sl@0: TSize winSize = aWindow.Size(); sl@0: TPoint gcOrigin(winSize.iWidth >> 3, winSize.iWidth >> 3); sl@0: TRect gcClipRect(0, 0, (winSize.iWidth * 3) >> 2, (winSize.iHeight * 3) >> 2); sl@0: TRect ellipseRect(gcClipRect); sl@0: // Shrink the ellipse for better visibility and to fit well within the clip area. sl@0: ellipseRect.Shrink(3, 3); sl@0: TSize penSize(1, 1); sl@0: sl@0: aWindow.Win()->SetBackgroundColor(KRgbGreen); sl@0: aWindow.ClearWin(); sl@0: aWindow.Win()->Invalidate(); sl@0: sl@0: if(!bActivateBeforeRedraw) sl@0: { sl@0: aWindow.Win()->BeginRedraw(); sl@0: } sl@0: sl@0: TheGc->Activate(*(aWindow.Win())); sl@0: TheGc->SetOrigin(gcOrigin); sl@0: TheGc->SetClippingRect(gcClipRect); sl@0: sl@0: if(bActivateBeforeRedraw) sl@0: { sl@0: aWindow.Win()->BeginRedraw(); sl@0: } sl@0: sl@0: TheGc->SetBrushColor(KRgbDarkRed); sl@0: TheGc->SetPenColor(KRgbDarkRed); sl@0: TheGc->SetPenSize(penSize); sl@0: TheGc->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->DrawEllipse(ellipseRect); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ENullBrush); sl@0: TheGc->SetPenColor(KRgbYellow); sl@0: TheGc->SetPenStyle(CGraphicsContext::EDashedPen); sl@0: TheGc->DrawRect(gcClipRect); sl@0: sl@0: aWindow.Win()->EndRedraw(); sl@0: TheGc->Deactivate(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0471 sl@0: @SYMTestCaseDesc This test is to verify that the GC correctly applies the clip rect and sl@0: origin attributes irrespective of whether the GC is activated on the sl@0: window before or after the BeginRedraw. sl@0: @SYMDEF PDEF120091 sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions The test has following steps: sl@0: 1. For the Test window follow the steps: sl@0: A. Activate the GC on Test window. sl@0: B. Set the Origin of the GC to centre of the window. sl@0: C. Set the Clipping rectangle of the GC to half the size of the window. sl@0: D. In the BeginDraw and EndDraw call bracket perform the following: sl@0: a. Draw an ellipse with the rectangle smaller by 5 pixels than the clip rectangle. sl@0: b. Draw a rectangle that is size of the clip rectangle. sl@0: E. Deactivate the GC. sl@0: 2. For the Base window follow the steps: sl@0: A. In the BeginDraw and EndDraw call bracket perform the following: sl@0: a. Activate the GC on Base window. sl@0: b. Set the Origin of the GC to centre of the window. sl@0: c. Set the Clipping rectangle of the GC to half the size of the window. sl@0: d. Draw an ellipse with the rectangle smaller by 5 pixels than the clip rectangle. sl@0: e. Draw a rectangle that is size of the clip rectangle. sl@0: f. Deactivate the GC. sl@0: 3. Compare Test and Base window. sl@0: @SYMTestExpectedResults Both the Test and Base window should have the complete sl@0: non-clipped ellipse completely encapsulated within the rectangle. sl@0: */ sl@0: void CTGc::TestGcClipRectOrigin() sl@0: { sl@0: TestGcClipRectOrigin_DrawContent(*BaseWin, EFalse); sl@0: TestGcClipRectOrigin_DrawContent(*TestWin, ETrue); sl@0: sl@0: TheClient->Flush(); sl@0: sl@0: CheckRect(BaseWin, TestWin, TRect(0, 0, BaseWin->Size().iWidth, BaseWin->Size().iHeight), _L("CTGc::TestGcClipRectOriginL()")); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0469 sl@0: @SYMDEF INC116406 sl@0: @SYMTestCaseDesc Try playback on MWsGraphicsContext and CWindowGc to check that the background colour is sl@0: set correctly. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions sl@0: @SYMTestExpectedResults Text drawn using CWindowGc should use the background colour of sl@0: the window, and MWsGraphicsContext should use transparent white. sl@0: */ sl@0: void CTGc::TestResetWithBackgroundColorL() sl@0: { sl@0: const TRect KSourceRect(0, 0, TestWin->Size().iWidth, TestWin->Size().iHeight); sl@0: const TRegionFix<1> KClippingRegion(KSourceRect); sl@0: sl@0: CWsScreenDevice* device = TheClient->iScreen; sl@0: sl@0: CRemoteGc* remoteGc = CRemoteGc::NewL(device); sl@0: CleanupStack::PushL(remoteGc); sl@0: sl@0: //note this remote GC has not been activated on any window sl@0: remoteGc->BeginDraw(KSourceRect); sl@0: sl@0: //Draw the commands in remote gc sl@0: remoteGc->SetBrushColor(KRgbGreen); //nothing green is seen in this test sl@0: sl@0: remoteGc->Reset(); //This resets the brush colour to the background colour of the window sl@0: //where playback is, in the case of playing back to a window sl@0: //however with a CFbsBitGc the color is transparent white, as there is no window. sl@0: remoteGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: remoteGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); sl@0: remoteGc->DrawRect(KSourceRect); sl@0: remoteGc->EndDraw(); sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: CDirectGdiDriver* theDGdiDriver = CDirectGdiDriver::Static(); sl@0: User::LeaveIfNull(theDGdiDriver); sl@0: sl@0: TSgImageInfo info; sl@0: info.iUsage = ESgUsageDirectGdiTarget | ESgUsageCompositionSource; sl@0: info.iSizeInPixels = TSize(TestWin->Size().iWidth, TestWin->Size().iHeight); sl@0: info.iPixelFormat = EUidPixelFormatXRGB_8888;//among display modes with alpha channel only pre-multiply alpha is supported in directGDI currently sl@0: sl@0: RSgImageCollection imageCollection; sl@0: CleanupClosePushL(imageCollection); sl@0: TInt res = imageCollection.Create(info, 1); sl@0: User::LeaveIfError(res); sl@0: RSgImage image; sl@0: CleanupClosePushL(image); sl@0: res = imageCollection.OpenImage(0, image); sl@0: User::LeaveIfError(res); sl@0: RDirectGdiImageTarget imageTarget(*theDGdiDriver); sl@0: CleanupClosePushL(imageTarget); sl@0: res = imageTarget.Create(image); sl@0: User::LeaveIfError(res); sl@0: #endif sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: //create a bitmap sl@0: CFbsBitmap *bitmap = new (ELeave) CFbsBitmap(); sl@0: User::LeaveIfError(bitmap->Create(TSize(TestWin->Size().iWidth, TestWin->Size().iHeight), EColor16MA)); sl@0: CleanupStack::PushL(bitmap); sl@0: sl@0: CFbsBitmapDevice *fbsDevice = CFbsBitmapDevice::NewL(bitmap); sl@0: CleanupStack::PushL(fbsDevice); sl@0: #endif sl@0: sl@0: //prepare the command buffer for playback sl@0: RWsGraphicMsgBuf msgBuf; sl@0: CleanupClosePushL(msgBuf); sl@0: sl@0: //Externalize the captured commands from remote gc in to a buffer sl@0: remoteGc->ExternalizeL(msgBuf, ETrue); sl@0: sl@0: CWSGraphicsRes* wsGrap = new (ELeave) CWSGraphicsRes(); sl@0: CleanupStack::PushL(wsGrap); sl@0: sl@0: CCommandBuffer* cmdBuf = CCommandBuffer::NewL(); sl@0: CleanupStack::PushL(cmdBuf); sl@0: cmdBuf->InternalizeL(msgBuf.Pckg()); sl@0: sl@0: TRgb color; sl@0: TRgb testColor(KRgbWhite); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: CDirectGdiGcWrapper* directGdiGcWrapper=CDirectGdiGcWrapper::NewL(imageTarget); sl@0: CleanupStack::PushL(directGdiGcWrapper); sl@0: cmdBuf->Play(TPoint(),&KClippingRegion,KSourceRect,*wsGrap,*directGdiGcWrapper); sl@0: sl@0: //check that the background has been cleared to transparent white. sl@0: image.GetInfo(info); sl@0: info.iUsage = ESgUsageNone; sl@0: info.iCpuAccess = ESgCpuAccessReadOnly; sl@0: RSgImage image1; sl@0: CleanupClosePushL(image1); sl@0: res = image1.Create(info, image); sl@0: const TAny* data; sl@0: TInt stride = 0; sl@0: res = image1.MapReadOnly(data, stride); sl@0: User::LeaveIfError(res); sl@0: TPoint pixel(10,10); sl@0: TInt offset = pixel.iY * stride + pixel.iX * 4; sl@0: TAny* non_const_data = const_cast (data); sl@0: TUint8* pointData = static_cast (non_const_data) + offset; sl@0: color = *(reinterpret_cast (pointData)); sl@0: image1.Unmap(); sl@0: #endif sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: CFbsBitGc* fbsBitGc=NULL; sl@0: User::LeaveIfError(fbsDevice->CreateContext(fbsBitGc)); sl@0: CleanupStack::PushL(fbsBitGc); sl@0: fbsBitGc->Activate(fbsDevice); sl@0: cmdBuf->Play(TPoint(0, 0), KSourceRect, *wsGrap, *fbsBitGc); sl@0: bitmap->GetPixel(color, TPoint(10,10)); sl@0: testColor.SetAlpha(0); sl@0: #endif sl@0: iStep->TEST(color==testColor); sl@0: sl@0: //now test drawing to a window to ensure that the brush colour is sl@0: //the window background colour sl@0: sl@0: //display a blue window sl@0: BaseWin->Win()->SetBackgroundColor(KRgbBlue); sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->Clear(); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Finish(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: sl@0: //start drawing the display commands with a green background sl@0: sl@0: BaseWin->Win()->SetBackgroundColor(KRgbYellow); sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: sl@0: //Play the commands on test window using command buffer sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: cmdBuf->Play(TPoint(0, 0), &KClippingRegion, KSourceRect, TheClient->iWs, *TheGc); sl@0: #else sl@0: cmdBuf->Play(TPoint(0, 0), KSourceRect, *wsGrap, *TheGc); sl@0: #endif sl@0: sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Finish(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: sl@0: //check that the background has been cleared to yellow, using brush colour sl@0: TPoint position = BaseWin->Win()->InquireOffset(*TheClient->iGroup->WinTreeNode()); sl@0: position.iX+=10; sl@0: position.iY+=10; sl@0: TheClient->iScreen->GetPixel(color, position); sl@0: iStep->TEST(color==KRgbYellow); sl@0: sl@0: BaseWin->Win()->SetBackgroundColor(KRgbGreen); //set back to original backgroundcolor sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: CleanupStack::PopAndDestroy(9, remoteGc); sl@0: #else sl@0: CleanupStack::PopAndDestroy(7, remoteGc); sl@0: #endif sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0481 sl@0: @SYMPREQ 1841 sl@0: @SYMTestCaseDesc Create font and graphics with various effect effects. Record the commands sl@0: (like setting colours,drawing text etc) using CRemoteGc and play the recorded commands on a window. Use the same sl@0: commands in CWindowGc and draw text on a different window sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions sl@0: @SYMTestExpectedResults Text/graphics drawn using CWindowGc and CRemoteGc should be same sl@0: */ sl@0: void CTGc::TestCommandBufferL() sl@0: { sl@0: CWsScreenDevice* device = TheClient->iScreen; sl@0: sl@0: _LIT(KBuffText,"Command Buffer"); sl@0: TFontSpec fSpec(KTestFontTypefaceName,23); sl@0: fSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); sl@0: fSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue); sl@0: fSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue); sl@0: sl@0: CFont *font; sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont *&)font, fSpec)); sl@0: CleanupStack::PushL(TCleanupItem(CleanUpFont, font)); sl@0: sl@0: CRemoteGc* remoteGc = CRemoteGc::NewL(device); sl@0: CleanupStack::PushL(remoteGc); sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: //-------create image--------- sl@0: CDirectGdiDriver* theDGdiDriver = CDirectGdiDriver::Static(); sl@0: User::LeaveIfNull(theDGdiDriver); sl@0: const TSize KImageSize = TSize(2, 2); sl@0: TSgImageInfo info; sl@0: info.iUsage = ESgUsageWindowGcSource; sl@0: info.iSizeInPixels = KImageSize; sl@0: info.iPixelFormat = EUidPixelFormatRGB_565; sl@0: info.iShareable = ETrue; sl@0: const TInt stride = KImageSize.iWidth * 2; sl@0: TUint8* buf = (TUint8*) (User::AllocL(KImageSize.iHeight * stride)); sl@0: CleanupStack::PushL(buf); sl@0: TUint16* bufCur = ((TUint16*)buf); sl@0: *bufCur = KRgbRed.Color64K(); sl@0: *(bufCur + 1) = KRgbRed.Color64K(); sl@0: *(bufCur + 2) = KRgbRed.Color64K(); sl@0: *(bufCur + 3) = KRgbRed.Color64K(); sl@0: sl@0: RSgImage image; sl@0: TInt res = image.Create(info, buf, stride); sl@0: User::LeaveIfError(res); sl@0: CleanupClosePushL(image); sl@0: RWsDrawableSource drawableSource(TheClient->iWs); sl@0: res = drawableSource.Create(image, TheClient->iScreen->GetScreenNumber()); sl@0: if(res == KErrNotSupported) sl@0: { sl@0: INFO_PRINTF1(_L("The current screen is not supports drawable source. This test case terminates now.")); sl@0: CleanupStack::PopAndDestroy(3, remoteGc); sl@0: CleanupStack::Pop();//font sl@0: TheClient->iScreen->ReleaseFont(font); sl@0: return; sl@0: } sl@0: User::LeaveIfError(res); sl@0: CleanupClosePushL(drawableSource); sl@0: //-------end create image--------- sl@0: #endif sl@0: remoteGc->ResetCommandBuffer(); sl@0: remoteGc->BeginDraw(TRect(0, 0, TestWin->Size().iWidth, TestWin->Size().iHeight)); sl@0: //Capturing the commands in remote gc sl@0: remoteGc->Clear(); sl@0: remoteGc->DrawRect(TRect(10,10,30,30)); sl@0: remoteGc->Clear(TRect(10,10,11,11)); sl@0: remoteGc->CopyRect(TPoint(5,5), TRect(25,25,30,30)); sl@0: CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; sl@0: CFbsBitmap* bitmapMask = new (ELeave) CFbsBitmap; sl@0: User::LeaveIfError(bitmap->Load(_L("Z:\\WSTEST\\WSAUTOTEST.MBM"), EMbmWsautotestCircles24b)); sl@0: User::LeaveIfError(bitmapMask->Load(_L("Z:\\WSTEST\\WSAUTOTEST.MBM"), EMbmWsautotestCircles_mask2b)); sl@0: remoteGc->BitBlt(TPoint(100,100), bitmap); sl@0: remoteGc->BitBlt(TPoint(0,0), bitmap, TRect(0,0,1,1)); sl@0: remoteGc->BitBltMasked(TPoint(0,5), bitmap, TRect(0,0,1,1), bitmapMask, EFalse); sl@0: CWsBitmap* bitmapWs = new (ELeave) CWsBitmap(TheClient->iWs); sl@0: CWsBitmap* bitmapWsMask = new (ELeave) CWsBitmap(TheClient->iWs); sl@0: User::LeaveIfError(bitmapWs->Load(_L("Z:\\WSTEST\\TEST.MBM"), 0)); sl@0: remoteGc->BitBlt(TPoint(110,110), bitmapWs); sl@0: remoteGc->BitBlt(TPoint(5,0), bitmapWs, TRect(0,0,1,1)); sl@0: remoteGc->BitBltMasked(TPoint(10,0), bitmap, TRect(0,0,1,1), bitmapWsMask, EFalse); sl@0: remoteGc->SetFadingParameters(128,128); sl@0: remoteGc->SetFaded(EFalse); sl@0: remoteGc->AlphaBlendBitmaps(TPoint(2,2), bitmap, TRect(0,0,1,1), bitmapMask, TPoint(2,2)); sl@0: remoteGc->AlphaBlendBitmaps(TPoint(3,3), bitmapWs, TRect(0,0,1,1), bitmapWsMask, TPoint(2,2)); sl@0: remoteGc->SetOrigin(TPoint(0,30)); sl@0: remoteGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: remoteGc->SetClippingRect(TRect(0,0,10,10)); sl@0: remoteGc->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: remoteGc->SetPenSize(TSize(1,2)); sl@0: remoteGc->UseBrushPattern(bitmap); sl@0: remoteGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: remoteGc->SetBrushOrigin(TPoint(0,0)); sl@0: remoteGc->DrawPie(TRect(0,0,15,15),TPoint(0,8),TPoint(15,8)); sl@0: remoteGc->CancelClippingRect(); sl@0: remoteGc->DiscardBrushPattern(); sl@0: remoteGc->CancelClippingRegion(); sl@0: remoteGc->Reset(); sl@0: remoteGc->SetOrigin(TPoint(0,0)); sl@0: remoteGc->SetUnderlineStyle(EUnderlineOff); sl@0: remoteGc->SetStrikethroughStyle(EStrikethroughOff); sl@0: remoteGc->SetWordJustification(1,2); sl@0: remoteGc->SetCharJustification(1,2); sl@0: remoteGc->UseFont(font); sl@0: remoteGc->DrawText(KBuffText,TRect(50,0,100,50),10,CGraphicsContext::ELeft,0); sl@0: remoteGc->DrawTextVertical(KBuffText,TPoint(170,20),EFalse); sl@0: remoteGc->DrawTextVertical(KBuffText,TRect(120,20,150,100),5,EFalse,CGraphicsContext::ELeft,0); sl@0: remoteGc->MoveTo(TPoint(25,150)); sl@0: remoteGc->MoveBy(TPoint(5,5)); sl@0: remoteGc->DrawLineTo(TPoint(35,160)); sl@0: remoteGc->DrawLine(TPoint(35,160),TPoint(25,150)); sl@0: remoteGc->DrawLineBy(TPoint(15,6)); sl@0: remoteGc->Plot(TPoint(5,5)); sl@0: remoteGc->DrawArc(TRect(0,80,10,90),TPoint(0,85),TPoint(10,85)); sl@0: remoteGc->DrawEllipse(TRect(0,90,10,100)); sl@0: remoteGc->DrawRoundRect(TRect(30,80,50,100),TSize(5,5)); sl@0: remoteGc->DrawBitmap(TPoint(150,150),bitmap); sl@0: remoteGc->DrawBitmap(TRect(160,160,170,170), bitmap); sl@0: remoteGc->DrawBitmap(TRect(175,175,180,180), bitmap, TRect(0,5,5,10)); sl@0: remoteGc->DrawBitmapMasked(TRect(185,185,190,190), bitmap, TRect(0,50,5,55),bitmapMask,EFalse); sl@0: remoteGc->DrawBitmapMasked(TRect(195,195,200,200), bitmapWs, TRect(0,50,5,55),bitmapWsMask,EFalse); sl@0: CArrayFixFlat* polyPoints = new(ELeave) CArrayFixFlat(3); //CArrayFixFlat sl@0: CleanupStack::PushL(polyPoints); sl@0: TRect rect (200,0,200,100); sl@0: polyPoints->AppendL(rect.iTl); sl@0: polyPoints->AppendL(rect.Center()); sl@0: polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY)); sl@0: remoteGc->DrawPolyLine(polyPoints); sl@0: remoteGc->DrawPolyLine(&polyPoints->At(0), 3); sl@0: remoteGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding); sl@0: remoteGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: MWsDrawResource* dr = static_cast(remoteGc->Interface(KMWsDrawResourceInterfaceUid)); sl@0: if(dr) sl@0: dr->DrawResource(TPoint(30, 40), drawableSource); sl@0: #endif sl@0: RRegion region; sl@0: remoteGc->SetClippingRegion(region); sl@0: remoteGc->DiscardFont(); sl@0: remoteGc->EndDraw(); sl@0: sl@0: RWsGraphicMsgBuf msgBuf; sl@0: CleanupClosePushL(msgBuf); sl@0: //Externalize the captured commands from remote gc in to a buffer sl@0: remoteGc->ExternalizeL(msgBuf, EFalse); sl@0: sl@0: CCommandBuffer* cmdBuf = CCommandBuffer::NewL(); sl@0: CleanupStack::PushL(cmdBuf); sl@0: const CCommandBuffer* testCmdBuf = CCommandBuffer::NewL(); sl@0: if(cmdBuf->IsIdentical(*testCmdBuf)==EFalse) sl@0: { sl@0: User::Panic(_L("TestCommandBufferL"), KErrGeneral); sl@0: } sl@0: delete testCmdBuf; sl@0: //Internalize the buffer with captured commands (from CRemoteGC) sl@0: //in to CCommandBuffer sl@0: cmdBuf->InternalizeL(msgBuf.Pckg()); sl@0: sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TestWin->Win()->Invalidate(); sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: /* sl@0: * Make sure anything that can leave is done outside the sl@0: * BeginRedraw/EndRedraw bracket. sl@0: */ sl@0: CWSGraphicsRes* wsGrap=new(ELeave) CWSGraphicsRes(); sl@0: CleanupStack::PushL(wsGrap); sl@0: #endif sl@0: /* sl@0: * Note we need to still do BeginRedraw/EndRedraw for the TestWin Window sl@0: * even though the CRemoteGc we are going to Play into TestWin already has sl@0: * BeginRedraw/EndRedraw commands issued into it. Those commands just allow sl@0: * for replacement of draw ops already in the CRemoteGc to be replaced by sl@0: * new draw ops covering the same area. The BeginRedraw/EndRedraws never sl@0: * get Play()'ed into TestWin. sl@0: */ sl@0: TestWin->Win()->BeginRedraw(); sl@0: TheGc->Clear(); sl@0: //Play the commands on test window using command buffer sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: cmdBuf->Play(TPoint(), NULL, TRect(TestWin->Size()), TheClient->iWs, *TheGc); sl@0: #endif sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: cmdBuf->Play(TPoint(),TRect(TestWin->Size()),*wsGrap,*TheGc); sl@0: CleanupStack::PopAndDestroy(wsGrap); sl@0: #endif sl@0: TheGc->Deactivate(); sl@0: TestWin->Win()->EndRedraw(); sl@0: remoteGc->ResetCommandBuffer(); sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->Clear(); sl@0: TheGc->DrawRect(TRect(10,10,30,30)); sl@0: TheGc->Clear(TRect(10,10,11,11)); sl@0: TheGc->CopyRect(TPoint(5,5), TRect(25,25,30,30)); sl@0: TheGc->BitBlt(TPoint(100,100), bitmap); sl@0: TheGc->BitBlt(TPoint(0,0), bitmap, TRect(0,0,1,1)); sl@0: TheGc->BitBltMasked(TPoint(0,5), bitmap, TRect(0,0,1,1), bitmapMask, EFalse); sl@0: TheGc->BitBlt(TPoint(110,110), bitmapWs); sl@0: TheGc->BitBlt(TPoint(5,0), bitmapWs, TRect(0,0,1,1)); sl@0: TheGc->BitBltMasked(TPoint(10,0), bitmap, TRect(0,0,1,1), bitmapWsMask, EFalse); sl@0: TheGc->SetFadingParameters(128,128); sl@0: TheGc->SetFaded(EFalse); sl@0: TheGc->AlphaBlendBitmaps(TPoint(2,2), bitmap, TRect(0,0,1,1), bitmapMask, TPoint(2,2)); sl@0: TheGc->AlphaBlendBitmaps(TPoint(3,3), bitmapWs, TRect(0,0,1,1), bitmapWsMask, TPoint(2,2)); sl@0: TheGc->SetOrigin(TPoint(0,30)); sl@0: TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: TheGc->SetClippingRect(TRect(0,0,10,10)); sl@0: TheGc->SetPenStyle(CGraphicsContext::ESolidPen); sl@0: TheGc->SetPenSize(TSize(1,2)); sl@0: TheGc->UseBrushPattern(bitmap); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetBrushOrigin(TPoint(0,0)); sl@0: TheGc->DrawPie(TRect(0,0,15,15),TPoint(0,8),TPoint(15,8)); sl@0: TheGc->CancelClippingRect(); sl@0: TheGc->DiscardBrushPattern(); sl@0: TheGc->CancelClippingRegion(); sl@0: TheGc->Reset(); sl@0: TheGc->SetOrigin(TPoint(0,0)); sl@0: TheGc->SetUnderlineStyle(EUnderlineOff); sl@0: TheGc->SetStrikethroughStyle(EStrikethroughOff); sl@0: TheGc->SetWordJustification(1,2); sl@0: TheGc->SetCharJustification(1,2); sl@0: TheGc->UseFont(font); sl@0: TheGc->DrawText(KBuffText,TRect(50,0,100,50),10,CGraphicsContext::ELeft,0); sl@0: TheGc->DrawTextVertical(KBuffText,TPoint(170,20),EFalse); sl@0: TheGc->DrawTextVertical(KBuffText,TRect(120,20,150,100),5,EFalse,CGraphicsContext::ELeft,0); sl@0: TheGc->MoveTo(TPoint(25,150)); sl@0: TheGc->MoveBy(TPoint(5,5)); sl@0: TheGc->DrawLineTo(TPoint(35,160)); sl@0: TheGc->DrawLine(TPoint(35,160),TPoint(25,150)); sl@0: TheGc->DrawLineBy(TPoint(15,6)); sl@0: TheGc->Plot(TPoint(5,5)); sl@0: TheGc->DrawArc(TRect(0,80,10,90),TPoint(0,85),TPoint(10,85)); sl@0: TheGc->DrawEllipse(TRect(0,90,10,100)); sl@0: TheGc->DrawRoundRect(TRect(30,80,50,100),TSize(5,5)); sl@0: TheGc->DrawBitmap(TPoint(150,150),bitmap); sl@0: TheGc->DrawBitmap(TRect(160,160,170,170), bitmap); sl@0: TheGc->DrawBitmap(TRect(175,175,180,180), bitmap, TRect(0,5,5,10)); sl@0: TheGc->DrawBitmapMasked(TRect(185,185,190,190), bitmap, TRect(0,50,5,55),bitmapMask,EFalse); sl@0: TheGc->DrawBitmapMasked(TRect(195,195,200,200), bitmapWs, TRect(0,50,5,55),bitmapWsMask,EFalse); sl@0: TheGc->DrawPolyLine(polyPoints); sl@0: TheGc->DrawPolyLine(&polyPoints->At(0), 3); sl@0: TheGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding); sl@0: TheGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetBrushColor(KRgbRed); sl@0: TheGc->SetPenColor(KRgbRed); sl@0: TheGc->DrawRect(TRect(30, 40, 32, 42)); sl@0: #endif sl@0: TheGc->DiscardFont(); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->Flush(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: sl@0: //Check the text drawn on base and test windows. sl@0: TBool err = CheckRect(BaseWin, TestWin, TRect(0, 0, BaseWin->Size().iWidth, BaseWin->Size().iHeight), _L("CTGc::TestCommandBufferL()")); sl@0: if (err) sl@0: { sl@0: INFO_PRINTF1(_L("The CheckRect function returned error.")); sl@0: } sl@0: delete bitmap; sl@0: INFO_PRINTF1(_L("bitmap deleted.")); sl@0: delete bitmapMask; sl@0: INFO_PRINTF1(_L("bitmapMask deleted.")); sl@0: delete bitmapWs; sl@0: INFO_PRINTF1(_L("bitmapWs deleted.")); sl@0: delete bitmapWsMask; sl@0: INFO_PRINTF1(_L("bitmapWsMask deleted.")); sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: CleanupStack::PopAndDestroy(7, remoteGc); sl@0: #else sl@0: CleanupStack::PopAndDestroy(4, remoteGc); sl@0: #endif sl@0: CleanupStack::Pop();//font sl@0: INFO_PRINTF1(_L("CleanupStack popped.")); sl@0: TheClient->iScreen->ReleaseFont(font); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0482 sl@0: @SYMPREQ 1841 sl@0: @SYMTestCaseDesc Play empty command buffer. sl@0: @SYMTestPriority Medium sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions sl@0: @SYMTestExpectedResults return KErrEof error sl@0: */ sl@0: void CTGc::TestEmptyCommandBufferL() sl@0: { sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: CWSGraphicsRes* wsGrap = new (ELeave) CWSGraphicsRes(); sl@0: CleanupStack::PushL(wsGrap); sl@0: #endif sl@0: sl@0: CCommandBuffer* cmdBuf = CCommandBuffer::NewL(); sl@0: CleanupStack::PushL(cmdBuf); sl@0: sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->Clear(); sl@0: //Play the commands on test window using command buffer sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: TInt err = cmdBuf->Play(TPoint(),TRect(TestWin->Size()),*wsGrap,*TheGc); sl@0: #else sl@0: TInt err = cmdBuf->Play(TPoint(),NULL,TRect(TestWin->Size()),TheClient->iWs,*TheGc); sl@0: #endif sl@0: if(err!=KErrEof) sl@0: { sl@0: User::Panic(_L("TestEmptyCommandBufferL"), KErrGeneral); sl@0: } sl@0: TheGc->Deactivate(); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: CleanupStack::PopAndDestroy(2, wsGrap); //cmdBuf, wsGrap, msgBuf and remoteGc sl@0: #else sl@0: CleanupStack::PopAndDestroy(cmdBuf); sl@0: #endif sl@0: } sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0486 sl@0: @SYMPREQ PREQ2095 sl@0: @SYMTestCaseDesc Draw text using CWindowGc and CRemoteGc with both outline and shadow sl@0: effect on. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Create a font with both outline and shadow effects, also use ClippingRect sl@0: and ClippingRegion. Record the commands using CRemoteGc and play the recorded commands on a sl@0: bitmap using MWsGraphicsContext. Use the same commands in CWindowGc and draw text on a sl@0: different window sl@0: @SYMTestExpectedResults Text drawn using CWindowGc and CRemoteGc(MWsGraphicsContext) should be same sl@0: */ sl@0: void CTGc::TestCRemoteGcAndMWsGraphicsContextClippingRectL() sl@0: { sl@0: const TRect KTestRect(0, 0, TestWin->Size().iWidth, TestWin->Size().iHeight); sl@0: const TRegionFix<1> KTestRegion(KTestRect); sl@0: const TRect KClippingRect1(5, 5, TestWin->Size().iWidth-10, 90); sl@0: const TRegionFix<1> KClippingRegion(KClippingRect1); sl@0: const TRect KClippingRect2(15, 15, TestWin->Size().iWidth-10, TestWin->Size().iHeight-10); sl@0: sl@0: CWsScreenDevice* device = TheClient->iScreen; sl@0: /* sl@0: * On hardware, the first screen runs in 64K colors, but the second screen (TV OUT) sl@0: * cannot run in this mode, it instead falls back to 16M colors. We need to ensure sl@0: * that we use matching color depths for our off-screen bitmaps so that accuracy is sl@0: * not lost since we compare bitmaps from the screen versus off-screen. sl@0: */ sl@0: TDisplayMode displayMode = device->DisplayMode(); sl@0: if (TDisplayModeUtils::NumDisplayModeBitsPerPixel(displayMode) == 32) sl@0: { sl@0: displayMode = EColor16MAP; sl@0: } sl@0: sl@0: _LIT(KText,"RemoteGc & MWsGraphicsContext"); sl@0: TFontSpec fSpec(KTestFontTypefaceName,23); sl@0: fSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap); sl@0: fSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue); sl@0: fSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue); sl@0: sl@0: CFont *font; sl@0: User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont *&)font, fSpec)); sl@0: CleanupStack::PushL(TCleanupItem(CleanUpFont, font)); sl@0: sl@0: //Record the commands using CRemoteGc sl@0: CRemoteGc* remoteGc = CRemoteGc::NewL(device); sl@0: CleanupStack::PushL(remoteGc); sl@0: remoteGc->BeginDraw(KTestRect); sl@0: //fill background with white sl@0: remoteGc->SetPenStyle(CFbsBitGc::ENullPen); sl@0: remoteGc->SetBrushStyle(CFbsBitGc::ESolidBrush); sl@0: remoteGc->SetBrushColor(KRgbWhite); sl@0: remoteGc->DrawRect(TRect(TPoint(0,0), TestWin->Size())); sl@0: remoteGc->SetPenStyle(CFbsBitGc::ESolidPen); sl@0: //Capturing the commands in remote gc sl@0: remoteGc->SetClippingRect(KClippingRect2); sl@0: remoteGc->SetClippingRegion(KClippingRegion); sl@0: remoteGc->SetBrushStyle(CFbsBitGc::ESolidBrush); sl@0: remoteGc->SetBrushColor(TRgb(0,150,150)); sl@0: remoteGc->DrawRect(TRect(TPoint(0,0), TSize(160,60))); sl@0: remoteGc->SetBrushColor(TRgb(150,100,150)); sl@0: remoteGc->DrawRect(TRect(TPoint(0,60), TSize(160,60))); sl@0: remoteGc->SetBrushColor(KRgbGreen); sl@0: remoteGc->SetShadowColor(KRgbDarkRed); sl@0: remoteGc->SetPenColor(KRgbBlack); sl@0: remoteGc->UseFont(font); sl@0: remoteGc->DrawText(KText, TPoint(2,40)); sl@0: remoteGc->DiscardFont(); sl@0: remoteGc->EndDraw(); sl@0: sl@0: RWsGraphicMsgBuf msgBuf; sl@0: CleanupClosePushL(msgBuf); sl@0: //Externalize the captured commands from remote gc in to a buffer sl@0: remoteGc->ExternalizeL(msgBuf, ETrue); sl@0: sl@0: CCommandBuffer* cmdBuf = CCommandBuffer::NewL(); sl@0: CleanupStack::PushL(cmdBuf); sl@0: //Internalize the buffer with captured commands (from CRemoteGC) sl@0: //in to CCommandBuffer sl@0: cmdBuf->InternalizeL(msgBuf.Pckg()); sl@0: sl@0: CDirectGdiDriver* theDGdiDriver = CDirectGdiDriver::Static(); sl@0: User::LeaveIfNull(theDGdiDriver); sl@0: sl@0: TSgImageInfo info; sl@0: info.iUsage = ESgUsageDirectGdiTarget | ESgUsageDirectGdiSource | ESgUsageCompositionSource; sl@0: info.iSizeInPixels = TestWin->Size(); sl@0: info.iPixelFormat = PixelFormatFromDisplayMode(displayMode); sl@0: sl@0: RSgImageCollection imageCollection; sl@0: CleanupClosePushL(imageCollection); sl@0: TInt res = imageCollection.Create(info, 1); sl@0: User::LeaveIfError(res); sl@0: RSgImage image; sl@0: CleanupClosePushL(image); sl@0: res = imageCollection.OpenImage(0, image); sl@0: User::LeaveIfError(res); sl@0: RDirectGdiImageTarget imageTarget(*theDGdiDriver); sl@0: CleanupClosePushL(imageTarget); sl@0: sl@0: res = imageTarget.Create(image); sl@0: User::LeaveIfError(res); sl@0: sl@0: CDirectGdiGcWrapper* directGdiGcWrapper = CDirectGdiGcWrapper::NewL(imageTarget); sl@0: CleanupStack::PushL(directGdiGcWrapper); sl@0: sl@0: //Dummy class created sl@0: CWSGraphicsRes* wsGrap = new (ELeave) CWSGraphicsRes(); sl@0: CleanupStack::PushL(wsGrap); sl@0: sl@0: //Play the commands on test window using command buffer sl@0: cmdBuf->Play(TPoint(),&KTestRegion,KTestRect,*wsGrap,*directGdiGcWrapper); sl@0: sl@0: //Set window back to same as test bitmap background sl@0: BaseWin->Win()->SetBackgroundColor(KRgbWhite); sl@0: sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->Clear(); sl@0: TheGc->SetClippingRect(KClippingRect2); sl@0: TheGc->SetClippingRegion(KClippingRegion); sl@0: TheGc->SetBrushStyle(CFbsBitGc::ESolidBrush); sl@0: TheGc->SetBrushColor(TRgb(0,150,150)); sl@0: TheGc->DrawRect(TRect(TPoint(0,0), TSize(160,60))); sl@0: TheGc->SetBrushColor(TRgb(150,100,150)); sl@0: TheGc->DrawRect(TRect(TPoint(0,60), TSize(160,60))); sl@0: TheGc->SetBrushColor(KRgbGreen); sl@0: TheGc->SetShadowColor(KRgbDarkRed); sl@0: TheGc->SetPenColor(KRgbBlack); sl@0: TheGc->UseFont(font); sl@0: //Draw the text on base window using CWindowGC sl@0: TheGc->DrawText(KText, TPoint(2, 40)); sl@0: TheGc->DiscardFont(); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Finish(); sl@0: TheClient->WaitForRedrawsToFinish(); sl@0: sl@0: //Create a bitmap and then copy the screen to it sl@0: TRect rc(TRect(BaseWin->Win()->AbsPosition(), BaseWin->Win()->Size())); sl@0: CFbsBitmap *screenBitmap = new (ELeave) CFbsBitmap(); sl@0: User::LeaveIfError(screenBitmap->Create(rc.Size(), displayMode)); sl@0: CleanupStack::PushL(screenBitmap); sl@0: TheClient->iScreen->CopyScreenToBitmap(screenBitmap, rc); sl@0: sl@0: CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmap); sl@0: sl@0: image.GetInfo(info); sl@0: bitmap->Create(info.iSizeInPixels, displayMode); sl@0: TRect rect(info.iSizeInPixels); sl@0: CopyImageToBitmapL(bitmap, image, rect); sl@0: sl@0: //Test to see if the bitmap drawn to using CRemoteGc is the same as the screen copy bitmap sl@0: TInt differentPixels = 0; sl@0: res = LossyCompareBitmapRecord(*bitmap, *screenBitmap, KTestRect, EFalse, differentPixels, Logger()); sl@0: if (differentPixels != 0) sl@0: { sl@0: INFO_PRINTF2(_L(" Pixels different %d"), differentPixels); sl@0: } sl@0: TEST(res); sl@0: CleanupStack::PopAndDestroy(10, remoteGc); //screenBitmap, imageCollection, image, imageTarget, directGdiGcWrapper, cmdBuf, wsGrap, msgBuf, remoteGc, bitmap sl@0: CleanupStack::Pop();//font sl@0: TheClient->iScreen->ReleaseFont(font); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0487 sl@0: @SYMPREQ PREQ2095 sl@0: @SYMTestCaseDesc Draw text using CRemoteGc and DrawText(const TDesC&,const TTextParameters*,const TPoint&) sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Create a font. Draw text to a bitmap with the font using CFbsBitGc::DrawText. Draw text with the font using CFbsBitGc::DrawText. sl@0: Record the same DrawText commands using CRemoteGc and play the recorded commands on a sl@0: bitmap using MWsGraphicsContext. Compare the two bitmaps. sl@0: @SYMTestExpectedResults Text drawn using CFbsBitGc and CRemoteGc(MWsGraphicsContext) should be the same sl@0: */ sl@0: void CTGc::TestCRemoteGcDrawTextInContextPointL() sl@0: { sl@0: CDrawTextInContextTestPoint* test = CDrawTextInContextTestPoint::NewL(); sl@0: CleanupStack::PushL(test); sl@0: test->Test(); sl@0: TEST(test->HasPassedTest()); sl@0: CleanupStack::PopAndDestroy(); //test sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0488 sl@0: @SYMPREQ PREQ2095 sl@0: @SYMTestCaseDesc Draw text using CRemoteGc and DrawText(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt) sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Create a font. Draw text to a bitmap with the font using CFbsBitGc::DrawText. Draw text with the font using CFbsBitGc::DrawText. sl@0: Record the same DrawText commands using CRemoteGc and play the recorded commands on a sl@0: bitmap using MWsGraphicsContext. Compare the two bitmaps. sl@0: @SYMTestExpectedResults Text drawn using CFbsBitGc and CRemoteGc(MWsGraphicsContext) should be the same sl@0: */ sl@0: void CTGc::TestCRemoteGcDrawTextInContextBoxL() sl@0: { sl@0: CDrawTextInContextTestBox* test = CDrawTextInContextTestBox::NewL(); sl@0: CleanupStack::PushL(test); sl@0: test->Test(); sl@0: TEST(test->HasPassedTest()); sl@0: CleanupStack::PopAndDestroy(); //test sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0489 sl@0: @SYMPREQ PREQ2095 sl@0: @SYMTestCaseDesc Draw text using CRemoteGc and DrawTextVertical(const TDesC&,const TTextParameters*,const TPoint&) sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Create a font. Draw text to a bitmap with the font using CFbsBitGc::DrawTextVertical. Draw text with the font using CFbsBitGc::DrawText. sl@0: Record the same DrawText commands using CRemoteGc and play the recorded commands on a sl@0: bitmap using MWsGraphicsContext. Compare the two bitmaps. sl@0: @SYMTestExpectedResults Text drawn using CFbsBitGc and CRemoteGc(MWsGraphicsContext) should be the same sl@0: */ sl@0: void CTGc::TestCRemoteGcDrawTextInContextPointVerticalL() sl@0: { sl@0: CDrawTextInContextTestPointVertical* test = CDrawTextInContextTestPointVertical::NewL(); sl@0: CleanupStack::PushL(test); sl@0: test->Test(); sl@0: TEST(test->HasPassedTest()); sl@0: CleanupStack::PopAndDestroy(); //test sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0490 sl@0: @SYMPREQ PREQ2095 sl@0: @SYMTestCaseDesc Draw text using CRemoteGc and DrawTextVertical(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt) sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Create a font. Draw text to a bitmap with the font using CFbsBitGc::DrawTextVertical. Draw text with the font using CFbsBitGc::DrawText. sl@0: Record the same DrawText commands using CRemoteGc and play the recorded commands on a sl@0: bitmap using MWsGraphicsContext. Compare the two bitmaps. sl@0: @SYMTestExpectedResults Text drawn using CFbsBitGc and CRemoteGc(MWsGraphicsContext) should be the same sl@0: */ sl@0: void CTGc::TestCRemoteGcDrawTextInContextBoxVerticalL() sl@0: { sl@0: CDrawTextInContextTestBoxVertical* test = CDrawTextInContextTestBoxVertical::NewL(); sl@0: CleanupStack::PushL(test); sl@0: test->Test(); sl@0: TEST(test->HasPassedTest()); sl@0: CleanupStack::PopAndDestroy(); //test sl@0: } sl@0: #endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0494 sl@0: @SYMDEF DEF131255 sl@0: @SYMTestCaseDesc Negative test to show that using SetBrushStyle() will not panic WServ with different sl@0: brush bitmaps. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Four seperate panic situations are tested: sl@0: 1) sl@0: Create a regular CFbsBitmap, set as brush pattern, and set brush style to EPatternedBrush. sl@0: Draw a line to force the playback to occur. sl@0: Call Finish on the GC. sl@0: Destroy the brush bitmap. sl@0: 2) sl@0: Create a regular CFbsBitmap, set as brush pattern, and set brush style to EPatternedBrush. sl@0: Draw a line to force the playback to occur. sl@0: Destroy the brush bitmap. sl@0: Call Finish on the GC. sl@0: 3+4) sl@0: Create an extended bitmap, set as the brush pattern, and set the brush style to EPatternedBrush. sl@0: Draw a line to force the playback to occur. sl@0: Set the brush bitmap and style again. sl@0: Call Finish on the GC. sl@0: Destroy the brush bitmap. sl@0: @SYMTestExpectedResults The calls to SetBrushStyle() should not cause WServ to panic when Finish() is called. sl@0: */ sl@0: void CTGc::TestGcSetBrushPatternL() sl@0: { sl@0: // Extended bitmap test data. sl@0: const TUint8 KTestData[] = "TEST DATA"; sl@0: const TInt KTestDataSize = sizeof(KTestData); sl@0: const TUid KTestExtendedBitmapUid = TUid::Uid(0xFFFFFFFF); sl@0: sl@0: // First try using a regular bitmap as the brush pattern. sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: CFbsBitmap* bitmapRegular = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmapRegular); sl@0: TInt res = bitmapRegular->Create(TSize(10,10), EColor64K); sl@0: TEST(res == KErrNone); sl@0: //Record the commands using CWindowGc. sl@0: TheGc->UseBrushPattern(bitmapRegular); sl@0: TheGc->SetBrushStyle(CGraphicsContext::EPatternedBrush); sl@0: // DrawLine() is only used here to force playback of the commands. sl@0: TheGc->DrawLine(TPoint(0,0), TPoint(1,1)); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Finish(); sl@0: CleanupStack::PopAndDestroy(1, bitmapRegular); sl@0: sl@0: // Secondly, try using a regular bitmap as the brush pattern, but deleting the bitmap sl@0: // before calling Finish(). sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: bitmapRegular = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmapRegular); sl@0: res = bitmapRegular->Create(TSize(10,10), EColor64K); sl@0: TEST(res == KErrNone); sl@0: //Record the commands using CWindowGc. sl@0: TheGc->UseBrushPattern(bitmapRegular); sl@0: TheGc->SetBrushStyle(CGraphicsContext::EPatternedBrush); sl@0: TheGc->DrawLine(TPoint(0,0), TPoint(1,1)); sl@0: CleanupStack::PopAndDestroy(1, bitmapRegular); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: // Thirdly, try using an extended bitmap (which is unsupported by DirectGDI) as sl@0: // the brush pattern. sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: // Create a dummy extended bitmap to use as a brush bitmap. sl@0: // This is unsupported by the default implementation of DirectGDI. sl@0: CFbsBitmap* bitmapExtended = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmapExtended); sl@0: res = bitmapExtended->CreateExtendedBitmap(TSize(10,10), EColor64K, KTestExtendedBitmapUid, KTestData, KTestDataSize); sl@0: TEST(res == KErrNone); sl@0: //Record the commands using CWindowGc. sl@0: TheGc->UseBrushPattern(bitmapExtended); sl@0: TheGc->SetBrushStyle(CGraphicsContext::EPatternedBrush); sl@0: TheGc->DrawLine(TPoint(0,0), TPoint(100,100)); sl@0: TheGc->UseBrushPattern(bitmapExtended); sl@0: // Forth, do it twice so that we test the state commands and the drawops commands. sl@0: TheGc->SetBrushStyle(CGraphicsContext::EPatternedBrush); sl@0: TheGc->DrawLine(TPoint(0,0), TPoint(100,100)); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Finish(); sl@0: CleanupStack::PopAndDestroy(1, bitmapExtended); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0576 sl@0: @SYMDEF sl@0: @SYMTestCaseDesc Checks window server is still able to draw a bitmap, even after the client has released its handle to the bitmap. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions - Draw the bitmap to TestWin (keeping the window hidden) sl@0: - Delete the bitmap sl@0: - Show TestWin to cause it to be drawn on screen (after the bitmap has been deleted) sl@0: - Draw the same bitmap (same image, different bitmap object instance) to BaseWin sl@0: - Compare contents of TestWin with BaseWin sl@0: @SYMTestExpectedResults TestWin and BaseWin should both show the bitmap. sl@0: */ sl@0: void CTGc::TestGcDeleteBitmap1L() sl@0: { sl@0: CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmap); sl@0: TInt ret = bitmap->Load(TEST_BITMAP_NAME,0); sl@0: TEST(ret == KErrNone); sl@0: sl@0: // send drawing to hidden window sl@0: TestWin->SetVisible(EFalse); sl@0: TestWin->Win()->Invalidate(); sl@0: TestWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: TheGc->SetBrushColor(TRgb(255, 0, 0)); sl@0: TheGc->Clear(); sl@0: TheGc->BitBlt(TPoint(0,0), bitmap); sl@0: CleanupStack::PopAndDestroy(bitmap); // before the bitmap is actually deleted, WsFbsDestroyCallBack flushes the command buffer to ensure the bitmap is duplicated in the window server thread sl@0: bitmap = NULL; sl@0: TheGc->Deactivate(); sl@0: TestWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Flush(); // calling Flush rather than Finish, as we don't need to wait for any drawing to happen (as the window is currently hidden) sl@0: sl@0: // make window visible (forcing it to draw) sl@0: TestWin->SetVisible(ETrue); sl@0: TheClient->iWs.Finish(); // ensure the bitmap has been drawn on test win sl@0: sl@0: // window server should have duplicated the bitmap when the BitBlt was added to the redraw store, so drawing sl@0: // the window now (by making it visible above) should display the bitmap on screen, even sl@0: // though we've deleted it in this thread sl@0: sl@0: // now create the bitmap again, and draw it to the base win (for comparison with test win) sl@0: bitmap = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmap); sl@0: ret = bitmap->Load(TEST_BITMAP_NAME,0); sl@0: TEST(ret == KErrNone); sl@0: BaseWin->SetVisible(ETrue); sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: TheGc->SetBrushColor(TRgb(255, 0, 0)); sl@0: TheGc->Clear(); sl@0: TheGc->BitBlt(TPoint(0,0), bitmap); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheClient->iWs.Finish(); // ensure the bitmap has been drawn on base win sl@0: sl@0: CleanupStack::PopAndDestroy(bitmap); sl@0: sl@0: // the test bitmap should be shown in both base win and test win, so we now check that the sl@0: // contents of base win and test win are the same sl@0: CheckRect(BaseWin, TestWin, TRect(0, 0, BaseWin->Size().iWidth, BaseWin->Size().iHeight), _L("CTGc::TestGcDeleteBitmap1L()")); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0577 sl@0: @SYMDEF sl@0: @SYMTestCaseDesc Check window server is still able to use a bitmap required by window drawing, even sl@0: after the client has released its handle to the bitmap. Also check window server sl@0: releases the bitmap, when it's no longer used by window drawing. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions - Clean BaseWin and TestWin from content that has been left over from previous test sl@0: - Draw test bitmap to TestWin sl@0: - Delete the bitmap sl@0: - Using a different bitmap object instance, duplicate bitmap (the bitmap is still used by window drawing) sl@0: - Delete the bitmap sl@0: - Draw new content to TestWin, so that previously drawn bitmap is covered sl@0: - Duplicate bitmap (the bitmap is no longer used by window drawing) sl@0: @SYMTestExpectedResults Bitmap duplication succeeds, when the bitmap used by window drawing, whereas sl@0: bitmap duplication fails, when the bitmap is no longer used by window drawing. sl@0: */ sl@0: void CTGc::TestGcDeleteBitmap2L() sl@0: { sl@0: //send new drawing to test and base windows, in order to cover sl@0: //any content has been left on them (through previous test) sl@0: BaseWin->SetVisible(ETrue); sl@0: BaseWin->Win()->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: TheGc->SetBrushColor(TRgb(0, 0, 255)); sl@0: TheGc->Clear(); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: sl@0: TestWin->SetVisible(ETrue); sl@0: TestWin->Win()->Invalidate(); sl@0: TestWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: TheGc->SetBrushColor(TRgb(0, 0, 255)); sl@0: TheGc->Clear(); sl@0: TheGc->Deactivate(); sl@0: TestWin->Win()->EndRedraw(); sl@0: sl@0: TheClient->iWs.Flush(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: //load test bitmap sl@0: CFbsBitmap* bitmap = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmap); sl@0: TInt ret = bitmap->Load(_L("Z:\\WSTEST\\TESTCIRCLES.MBM"),0); sl@0: TEST(ret == KErrNone); sl@0: TInt bitmapHandle = bitmap->Handle(); sl@0: sl@0: //send bitmap drawing to test window sl@0: TestWin->Win()->Invalidate(); sl@0: TestWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: TheGc->SetBrushColor(TRgb(0, 255, 0)); sl@0: TheGc->Clear(); sl@0: TheGc->BitBlt(TPoint(0,0), bitmap); sl@0: TheGc->Deactivate(); sl@0: TestWin->Win()->EndRedraw(); sl@0: sl@0: CleanupStack::PopAndDestroy(bitmap); sl@0: sl@0: TheClient->iWs.Flush(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: //using a new bitmap object instance check that wserv can still duplicate test bitmap (even though sl@0: //the initial bitmap object is deleted) , since there is a window segment using it sl@0: bitmap = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmap); sl@0: ret = bitmap->Duplicate(bitmapHandle); sl@0: TEST(ret == KErrNone); sl@0: CleanupStack::PopAndDestroy(bitmap); sl@0: sl@0: //send new drawing to test window, in order to cover the bitmap that was previously drawn sl@0: TestWin->Win()->Invalidate(); sl@0: TestWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN); sl@0: TheGc->SetBrushColor(TRgb(0, 0, 255)); sl@0: TheGc->Clear(); sl@0: TheGc->Deactivate(); sl@0: TestWin->Win()->EndRedraw(); sl@0: sl@0: TheClient->iWs.Flush(); sl@0: TheClient->iWs.Finish(); sl@0: sl@0: //check that wserv can't duplicate test bitmap, since no window segment uses it any more sl@0: bitmap = new (ELeave) CFbsBitmap; sl@0: CleanupStack::PushL(bitmap); sl@0: ret = bitmap->Duplicate(bitmapHandle); sl@0: TEST(ret != KErrNone); sl@0: CleanupStack::PopAndDestroy(bitmap); sl@0: } sl@0: sl@0: void CTGc::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: ((CTGcStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch(++iTest->iState) sl@0: { sl@0: case 1: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0437")); sl@0: iTest->LogSubTest(_L("CRemoteGc&CWindowGc, outline and shadow text")); sl@0: TestOutlineAndShadowL(); sl@0: break; sl@0: case 2: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0471")); sl@0: iTest->LogSubTest(_L("Test GC clip rect and origin attributes.")); sl@0: TestGcClipRectOrigin(); sl@0: break; sl@0: case 3: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0469")); sl@0: iTest->LogSubTest(_L("CRemoteGc&CWindowGc, reset with background colour")); sl@0: TestResetWithBackgroundColorL(); sl@0: break; sl@0: case 4: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0481")); sl@0: iTest->LogSubTest(_L("CRemoteGc&CCommandBuffer, coverage tests")); sl@0: TestCommandBufferL(); sl@0: break; sl@0: case 5: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0482")); sl@0: iTest->LogSubTest(_L("CCommandBuffer, coverage tests")); sl@0: TestEmptyCommandBufferL(); sl@0: break; sl@0: case 6: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0494")); sl@0: iTest->LogSubTest(_L("CWindowGc, Brush Pattern test")); sl@0: TestGcSetBrushPatternL(); sl@0: break; sl@0: case 7: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0576")); sl@0: iTest->LogSubTest(_L("CWindowGc, delete bitmap 1")); sl@0: TestGcDeleteBitmap1L(); sl@0: break; sl@0: case 8: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0577")); sl@0: iTest->LogSubTest(_L("CWindowGc, delete bitmap 2")); sl@0: TestGcDeleteBitmap2L(); sl@0: break; sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: case 9: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0471")); sl@0: iTest->LogSubTest(_L("Test GC clip rect and origin attributes.")); sl@0: TestGcClipRectOrigin(); sl@0: break; sl@0: case 10: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0469")); sl@0: iTest->LogSubTest(_L("CRemoteGc&CWindowGc, reset with background colour")); sl@0: TestResetWithBackgroundColorL(); sl@0: break; sl@0: case 11: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0486")); sl@0: iTest->LogSubTest(_L("CRemoteGc&MWsGraphicsContext, clipping rect test")); sl@0: TestCRemoteGcAndMWsGraphicsContextClippingRectL(); sl@0: break; sl@0: case 12: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0487")); sl@0: iTest->LogSubTest(_L("CRemoteGc, DrawTextInContext Position test")); sl@0: TestCRemoteGcDrawTextInContextPointL(); sl@0: break; sl@0: case 13: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0488")); sl@0: iTest->LogSubTest(_L("CRemoteGc, DrawTextInContext ClipRect test")); sl@0: TestCRemoteGcDrawTextInContextBoxL(); sl@0: break; sl@0: case 14: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0489")); sl@0: iTest->LogSubTest(_L("CRemoteGc, DrawTextInContext Pos Vertical test")); sl@0: TestCRemoteGcDrawTextInContextPointVerticalL(); sl@0: break; sl@0: case 15: sl@0: ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0490")); sl@0: iTest->LogSubTest(_L("CRemoteGc, DrawTextInContext ClipRect Vert test")); sl@0: TestCRemoteGcDrawTextInContextBoxVerticalL(); sl@0: break; sl@0: #endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: default: sl@0: ((CTGcStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTGcStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTGcStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: __CONSTRUCT_STEP__(Gc)