First public contribution.
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
26 #include "TGraphicsHarness.h"
27 #include <graphics/sgimage.h>
28 #include <graphics/sgimagecollection.h>
30 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
32 * The following classes are only required for the RemoteGc DrawText tests: .
33 * CDrawTextInContextTest : is the Abstract base class
34 * CDrawTextInContextTestPoint : Test DrawText(const TDesC&,const TTextParameters*,const TPoint&)
35 * CDrawTextInContextTestBox : Test DrawText(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt)
36 * CDrawTextInContextTestPointVertical : Test DrawTextVertical(const TDesC&,const TTextParameters*,const TPoint&)
37 * CDrawTextInContextTestBoxVertical : Test DrawTextVertical(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt)
39 class CDirectGdiGcWrapper;
43 class RDirectGdiImageTarget;
45 const TSize KBitmapSize(620, 240);
46 const TRect KBitmapRect(TPoint(0,0),TSize(620, 240));
47 const TRegionFix<1> KBitmapRegion(KBitmapRect);
49 //CDrawTextInContextTest
50 class CDrawTextInContextTest : public CBase
54 TBool HasPassedTest();
56 CDrawTextInContextTest();
57 ~CDrawTextInContextTest();
58 void BaseConstructL();
59 virtual void DoDrawTextBitGc() = 0;
60 virtual void DoDrawTextRemoteGc() = 0;
63 CGraphicsContext::TTextParameters iParam;
66 //For reference bitmap
67 CFbsBitmap* iRefBitmap;
68 CFbsBitmapDevice* iRefDevice;
71 //For CDirectGdiGcWrapper
72 RSgImage iWrapperImage;
73 RDirectGdiImageTarget* iWrapperImageTarget;
74 RSgImageCollection iWrapperImageCollection;
75 CDirectGdiGcWrapper* iDirectGdiGcWrapper;
80 RWsGraphicMsgBuf iMsgBuf;
81 CCommandBuffer* iCommandBuffer;
82 CWSGraphicsRes* iWsGraphicRes;
89 //CDrawTextInContextTestPoint
90 class CDrawTextInContextTestPoint : public CDrawTextInContextTest
93 static CDrawTextInContextTestPoint* NewL();
94 ~CDrawTextInContextTestPoint();
95 void DoDrawTextBitGc();
96 void DoDrawTextRemoteGc();
98 CDrawTextInContextTestPoint();
104 //CDrawTextInContextTestBox
105 class CDrawTextInContextTestBox : public CDrawTextInContextTest
108 static CDrawTextInContextTestBox* NewL();
109 ~CDrawTextInContextTestBox();
110 void DoDrawTextBitGc();
111 void DoDrawTextRemoteGc();
113 CDrawTextInContextTestBox();
117 TInt iBaselineOffset;
118 CGraphicsContext::TTextAlign iTTextAlign;
121 //CDrawTextInContextTestPointVertical
122 class CDrawTextInContextTestPointVertical : public CDrawTextInContextTest
125 static CDrawTextInContextTestPointVertical* NewL();
126 ~CDrawTextInContextTestPointVertical();
127 void DoDrawTextBitGc();
128 void DoDrawTextRemoteGc();
130 CDrawTextInContextTestPointVertical();
137 //CDrawTextInContextTestBoxVertical
138 class CDrawTextInContextTestBoxVertical : public CDrawTextInContextTest
141 static CDrawTextInContextTestBoxVertical* NewL();
142 ~CDrawTextInContextTestBoxVertical();
143 void DoDrawTextBitGc();
144 void DoDrawTextRemoteGc();
146 CDrawTextInContextTestBoxVertical();
150 TInt iBaselineOffset;
152 CGraphicsContext::TTextAlign iTTextAlign;
155 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
157 class CTGc : public CTWsGraphicsBase
160 CTGc(CTestStep* aStep);
163 void TestOutlineAndShadowL();
164 void TestGcClipRectOrigin();
165 void TestResetWithBackgroundColorL();
166 void TestCommandBufferL();
167 void TestEmptyCommandBufferL();
168 void TestGcSetBrushPatternL();
169 void TestGcDeleteBitmap1L();
170 void TestGcDeleteBitmap2L();
171 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
172 void TestCRemoteGcAndMWsGraphicsContextClippingRectL();
173 void TestCRemoteGcDrawTextInContextPointL();
174 void TestCRemoteGcDrawTextInContextBoxL();
175 void TestCRemoteGcDrawTextInContextPointVerticalL();
176 void TestCRemoteGcDrawTextInContextBoxVerticalL();
180 void TestGcClipRectOrigin_DrawContent(TestWindow& aWindow, TBool bActivateBeforeRedraw = ETrue);
182 //from CTWsGraphicsBase
183 virtual void RunTestCaseL(TInt aCurTestCase);
188 class CTGcStep : public CTGraphicsStep
193 //from CTGraphicsStep
194 virtual CTGraphicsBase* CreateTestL();
197 _LIT(KTGcStep,"TGc");