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: sl@0: #ifndef __TGC_H__ sl@0: #define __TGC_H__ sl@0: sl@0: #include "AUTO.H" sl@0: #include "TGraphicsHarness.h" sl@0: #include sl@0: #include sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: /* sl@0: * The following classes are only required for the RemoteGc DrawText tests: . sl@0: * CDrawTextInContextTest : is the Abstract base class sl@0: * CDrawTextInContextTestPoint : Test DrawText(const TDesC&,const TTextParameters*,const TPoint&) sl@0: * CDrawTextInContextTestBox : Test DrawText(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt) sl@0: * CDrawTextInContextTestPointVertical : Test DrawTextVertical(const TDesC&,const TTextParameters*,const TPoint&) sl@0: * CDrawTextInContextTestBoxVertical : Test DrawTextVertical(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt) sl@0: */ sl@0: class CDirectGdiGcWrapper; sl@0: class CRemoteGc; sl@0: class CCommandBuffer; sl@0: class CWSGraphicsRes; sl@0: class RDirectGdiImageTarget; sl@0: sl@0: const TSize KBitmapSize(620, 240); sl@0: const TRect KBitmapRect(TPoint(0,0),TSize(620, 240)); sl@0: const TRegionFix<1> KBitmapRegion(KBitmapRect); sl@0: sl@0: //CDrawTextInContextTest sl@0: class CDrawTextInContextTest : public CBase sl@0: { sl@0: public: sl@0: void Test(); sl@0: TBool HasPassedTest(); sl@0: protected: sl@0: CDrawTextInContextTest(); sl@0: ~CDrawTextInContextTest(); sl@0: void BaseConstructL(); sl@0: virtual void DoDrawTextBitGc() = 0; sl@0: virtual void DoDrawTextRemoteGc() = 0; sl@0: protected: sl@0: CFont *iFont; sl@0: CGraphicsContext::TTextParameters iParam; sl@0: TPtrC iText; sl@0: sl@0: //For reference bitmap sl@0: CFbsBitmap* iRefBitmap; sl@0: CFbsBitmapDevice* iRefDevice; sl@0: CFbsBitGc* iRefBitGc; sl@0: sl@0: //For CDirectGdiGcWrapper sl@0: RSgImage iWrapperImage; sl@0: RDirectGdiImageTarget* iWrapperImageTarget; sl@0: RSgImageCollection iWrapperImageCollection; sl@0: CDirectGdiGcWrapper* iDirectGdiGcWrapper; sl@0: sl@0: sl@0: //For CRemoteGc sl@0: CRemoteGc* iRemoteGc; sl@0: RWsGraphicMsgBuf iMsgBuf; sl@0: CCommandBuffer* iCommandBuffer; sl@0: CWSGraphicsRes* iWsGraphicRes; sl@0: TPoint iOffset; sl@0: sl@0: //Test result sl@0: TBool iHasPassedTest; sl@0: }; sl@0: sl@0: //CDrawTextInContextTestPoint sl@0: class CDrawTextInContextTestPoint : public CDrawTextInContextTest sl@0: { sl@0: public: sl@0: static CDrawTextInContextTestPoint* NewL(); sl@0: ~CDrawTextInContextTestPoint(); sl@0: void DoDrawTextBitGc(); sl@0: void DoDrawTextRemoteGc(); sl@0: private: sl@0: CDrawTextInContextTestPoint(); sl@0: void ConstructL(); sl@0: private: sl@0: TPoint iPosition; sl@0: }; sl@0: sl@0: //CDrawTextInContextTestBox sl@0: class CDrawTextInContextTestBox : public CDrawTextInContextTest sl@0: { sl@0: public: sl@0: static CDrawTextInContextTestBox* NewL(); sl@0: ~CDrawTextInContextTestBox(); sl@0: void DoDrawTextBitGc(); sl@0: void DoDrawTextRemoteGc(); sl@0: private: sl@0: CDrawTextInContextTestBox(); sl@0: void ConstructL(); sl@0: private: sl@0: TRect iClipFillRect; sl@0: TInt iBaselineOffset; sl@0: CGraphicsContext::TTextAlign iTTextAlign; sl@0: }; sl@0: sl@0: //CDrawTextInContextTestPointVertical sl@0: class CDrawTextInContextTestPointVertical : public CDrawTextInContextTest sl@0: { sl@0: public: sl@0: static CDrawTextInContextTestPointVertical* NewL(); sl@0: ~CDrawTextInContextTestPointVertical(); sl@0: void DoDrawTextBitGc(); sl@0: void DoDrawTextRemoteGc(); sl@0: private: sl@0: CDrawTextInContextTestPointVertical(); sl@0: void ConstructL(); sl@0: private: sl@0: TPoint iPosition; sl@0: TBool iUp; sl@0: }; sl@0: sl@0: //CDrawTextInContextTestBoxVertical sl@0: class CDrawTextInContextTestBoxVertical : public CDrawTextInContextTest sl@0: { sl@0: public: sl@0: static CDrawTextInContextTestBoxVertical* NewL(); sl@0: ~CDrawTextInContextTestBoxVertical(); sl@0: void DoDrawTextBitGc(); sl@0: void DoDrawTextRemoteGc(); sl@0: private: sl@0: CDrawTextInContextTestBoxVertical(); sl@0: void ConstructL(); sl@0: private: sl@0: TRect iClipFillRect; sl@0: TInt iBaselineOffset; sl@0: TBool iUp; sl@0: CGraphicsContext::TTextAlign iTTextAlign; sl@0: }; sl@0: sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: sl@0: class CTGc : public CTWsGraphicsBase sl@0: { sl@0: public: sl@0: CTGc(CTestStep* aStep); sl@0: ~CTGc(); sl@0: void ConstructL(); sl@0: void TestOutlineAndShadowL(); sl@0: void TestGcClipRectOrigin(); sl@0: void TestResetWithBackgroundColorL(); sl@0: void TestCommandBufferL(); sl@0: void TestEmptyCommandBufferL(); sl@0: void TestGcSetBrushPatternL(); sl@0: void TestGcDeleteBitmap1L(); sl@0: void TestGcDeleteBitmap2L(); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA sl@0: void TestCRemoteGcAndMWsGraphicsContextClippingRectL(); sl@0: void TestCRemoteGcDrawTextInContextPointL(); sl@0: void TestCRemoteGcDrawTextInContextBoxL(); sl@0: void TestCRemoteGcDrawTextInContextPointVerticalL(); sl@0: void TestCRemoteGcDrawTextInContextBoxVerticalL(); sl@0: #endif sl@0: sl@0: protected: sl@0: void TestGcClipRectOrigin_DrawContent(TestWindow& aWindow, TBool bActivateBeforeRedraw = ETrue); sl@0: sl@0: //from CTWsGraphicsBase sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: private: sl@0: CTestBase *iTest; sl@0: }; sl@0: sl@0: class CTGcStep : public CTGraphicsStep sl@0: { sl@0: public: sl@0: CTGcStep(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual CTGraphicsBase* CreateTestL(); sl@0: }; sl@0: sl@0: _LIT(KTGcStep,"TGc"); sl@0: sl@0: #endif