1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/tgc.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,199 @@
1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +#ifndef __TGC_H__
1.26 +#define __TGC_H__
1.27 +
1.28 +#include "AUTO.H"
1.29 +#include "TGraphicsHarness.h"
1.30 +#include <graphics/sgimage.h>
1.31 +#include <graphics/sgimagecollection.h>
1.32 +
1.33 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.34 +/*
1.35 + * The following classes are only required for the RemoteGc DrawText tests: .
1.36 + * CDrawTextInContextTest : is the Abstract base class
1.37 + * CDrawTextInContextTestPoint : Test DrawText(const TDesC&,const TTextParameters*,const TPoint&)
1.38 + * CDrawTextInContextTestBox : Test DrawText(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt)
1.39 + * CDrawTextInContextTestPointVertical : Test DrawTextVertical(const TDesC&,const TTextParameters*,const TPoint&)
1.40 + * CDrawTextInContextTestBoxVertical : Test DrawTextVertical(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt)
1.41 + */
1.42 +class CDirectGdiGcWrapper;
1.43 +class CRemoteGc;
1.44 +class CCommandBuffer;
1.45 +class CWSGraphicsRes;
1.46 +class RDirectGdiImageTarget;
1.47 +
1.48 +const TSize KBitmapSize(620, 240);
1.49 +const TRect KBitmapRect(TPoint(0,0),TSize(620, 240));
1.50 +const TRegionFix<1> KBitmapRegion(KBitmapRect);
1.51 +
1.52 +//CDrawTextInContextTest
1.53 +class CDrawTextInContextTest : public CBase
1.54 + {
1.55 +public:
1.56 + void Test();
1.57 + TBool HasPassedTest();
1.58 +protected:
1.59 + CDrawTextInContextTest();
1.60 + ~CDrawTextInContextTest();
1.61 + void BaseConstructL();
1.62 + virtual void DoDrawTextBitGc() = 0;
1.63 + virtual void DoDrawTextRemoteGc() = 0;
1.64 +protected:
1.65 + CFont *iFont;
1.66 + CGraphicsContext::TTextParameters iParam;
1.67 + TPtrC iText;
1.68 +
1.69 + //For reference bitmap
1.70 + CFbsBitmap* iRefBitmap;
1.71 + CFbsBitmapDevice* iRefDevice;
1.72 + CFbsBitGc* iRefBitGc;
1.73 +
1.74 + //For CDirectGdiGcWrapper
1.75 + RSgImage iWrapperImage;
1.76 + RDirectGdiImageTarget* iWrapperImageTarget;
1.77 + RSgImageCollection iWrapperImageCollection;
1.78 + CDirectGdiGcWrapper* iDirectGdiGcWrapper;
1.79 +
1.80 +
1.81 + //For CRemoteGc
1.82 + CRemoteGc* iRemoteGc;
1.83 + RWsGraphicMsgBuf iMsgBuf;
1.84 + CCommandBuffer* iCommandBuffer;
1.85 + CWSGraphicsRes* iWsGraphicRes;
1.86 + TPoint iOffset;
1.87 +
1.88 + //Test result
1.89 + TBool iHasPassedTest;
1.90 + };
1.91 +
1.92 +//CDrawTextInContextTestPoint
1.93 +class CDrawTextInContextTestPoint : public CDrawTextInContextTest
1.94 + {
1.95 +public:
1.96 + static CDrawTextInContextTestPoint* NewL();
1.97 + ~CDrawTextInContextTestPoint();
1.98 + void DoDrawTextBitGc();
1.99 + void DoDrawTextRemoteGc();
1.100 +private:
1.101 + CDrawTextInContextTestPoint();
1.102 + void ConstructL();
1.103 +private:
1.104 + TPoint iPosition;
1.105 + };
1.106 +
1.107 +//CDrawTextInContextTestBox
1.108 +class CDrawTextInContextTestBox : public CDrawTextInContextTest
1.109 + {
1.110 +public:
1.111 + static CDrawTextInContextTestBox* NewL();
1.112 + ~CDrawTextInContextTestBox();
1.113 + void DoDrawTextBitGc();
1.114 + void DoDrawTextRemoteGc();
1.115 +private:
1.116 + CDrawTextInContextTestBox();
1.117 + void ConstructL();
1.118 +private:
1.119 + TRect iClipFillRect;
1.120 + TInt iBaselineOffset;
1.121 + CGraphicsContext::TTextAlign iTTextAlign;
1.122 + };
1.123 +
1.124 +//CDrawTextInContextTestPointVertical
1.125 +class CDrawTextInContextTestPointVertical : public CDrawTextInContextTest
1.126 + {
1.127 +public:
1.128 + static CDrawTextInContextTestPointVertical* NewL();
1.129 + ~CDrawTextInContextTestPointVertical();
1.130 + void DoDrawTextBitGc();
1.131 + void DoDrawTextRemoteGc();
1.132 +private:
1.133 + CDrawTextInContextTestPointVertical();
1.134 + void ConstructL();
1.135 +private:
1.136 + TPoint iPosition;
1.137 + TBool iUp;
1.138 + };
1.139 +
1.140 +//CDrawTextInContextTestBoxVertical
1.141 +class CDrawTextInContextTestBoxVertical : public CDrawTextInContextTest
1.142 + {
1.143 +public:
1.144 + static CDrawTextInContextTestBoxVertical* NewL();
1.145 + ~CDrawTextInContextTestBoxVertical();
1.146 + void DoDrawTextBitGc();
1.147 + void DoDrawTextRemoteGc();
1.148 +private:
1.149 + CDrawTextInContextTestBoxVertical();
1.150 + void ConstructL();
1.151 +private:
1.152 + TRect iClipFillRect;
1.153 + TInt iBaselineOffset;
1.154 + TBool iUp;
1.155 + CGraphicsContext::TTextAlign iTTextAlign;
1.156 + };
1.157 +
1.158 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.159 +
1.160 +class CTGc : public CTWsGraphicsBase
1.161 + {
1.162 +public:
1.163 + CTGc(CTestStep* aStep);
1.164 + ~CTGc();
1.165 + void ConstructL();
1.166 + void TestOutlineAndShadowL();
1.167 + void TestGcClipRectOrigin();
1.168 + void TestResetWithBackgroundColorL();
1.169 + void TestCommandBufferL();
1.170 + void TestEmptyCommandBufferL();
1.171 + void TestGcSetBrushPatternL();
1.172 + void TestGcDeleteBitmap1L();
1.173 + void TestGcDeleteBitmap2L();
1.174 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
1.175 + void TestCRemoteGcAndMWsGraphicsContextClippingRectL();
1.176 + void TestCRemoteGcDrawTextInContextPointL();
1.177 + void TestCRemoteGcDrawTextInContextBoxL();
1.178 + void TestCRemoteGcDrawTextInContextPointVerticalL();
1.179 + void TestCRemoteGcDrawTextInContextBoxVerticalL();
1.180 +#endif
1.181 +
1.182 +protected:
1.183 + void TestGcClipRectOrigin_DrawContent(TestWindow& aWindow, TBool bActivateBeforeRedraw = ETrue);
1.184 +
1.185 +//from CTWsGraphicsBase
1.186 + virtual void RunTestCaseL(TInt aCurTestCase);
1.187 +private:
1.188 + CTestBase *iTest;
1.189 + };
1.190 +
1.191 +class CTGcStep : public CTGraphicsStep
1.192 + {
1.193 +public:
1.194 + CTGcStep();
1.195 +protected:
1.196 + //from CTGraphicsStep
1.197 + virtual CTGraphicsBase* CreateTestL();
1.198 + };
1.199 +
1.200 +_LIT(KTGcStep,"TGc");
1.201 +
1.202 +#endif