os/graphics/windowing/windowserver/test/tauto/tgc.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @test
    19  @internalComponent - Internal Symbian test code
    20 */
    21 
    22 #ifndef __TGC_H__
    23 #define __TGC_H__
    24 
    25 #include "AUTO.H"
    26 #include "TGraphicsHarness.h"
    27 #include <graphics/sgimage.h>
    28 #include <graphics/sgimagecollection.h>
    29 
    30 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
    31 /*
    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)
    38  */
    39 class CDirectGdiGcWrapper;
    40 class CRemoteGc;
    41 class CCommandBuffer;
    42 class CWSGraphicsRes;
    43 class RDirectGdiImageTarget;
    44 
    45 const TSize KBitmapSize(620, 240);
    46 const TRect KBitmapRect(TPoint(0,0),TSize(620, 240));
    47 const TRegionFix<1> KBitmapRegion(KBitmapRect);
    48 
    49 //CDrawTextInContextTest
    50 class CDrawTextInContextTest : public CBase
    51 	{
    52 public:
    53 	void Test();
    54 	TBool HasPassedTest();
    55 protected:
    56 	CDrawTextInContextTest();
    57 	~CDrawTextInContextTest();
    58 	void BaseConstructL();
    59 	virtual void DoDrawTextBitGc() = 0;
    60 	virtual void DoDrawTextRemoteGc() = 0;
    61 protected:
    62 	CFont *iFont;
    63 	CGraphicsContext::TTextParameters iParam;
    64 	TPtrC iText;
    65 	
    66 	//For reference bitmap
    67 	CFbsBitmap* iRefBitmap;
    68 	CFbsBitmapDevice* iRefDevice;
    69 	CFbsBitGc* iRefBitGc;
    70 	
    71 	//For CDirectGdiGcWrapper
    72 	RSgImage iWrapperImage;
    73 	RDirectGdiImageTarget* iWrapperImageTarget;
    74 	RSgImageCollection iWrapperImageCollection;
    75 	CDirectGdiGcWrapper* iDirectGdiGcWrapper;
    76 	
    77 	
    78 	//For CRemoteGc
    79 	CRemoteGc* iRemoteGc;
    80 	RWsGraphicMsgBuf iMsgBuf;
    81 	CCommandBuffer* iCommandBuffer;
    82 	CWSGraphicsRes* iWsGraphicRes;
    83 	TPoint iOffset;
    84 	
    85 	//Test result
    86 	TBool iHasPassedTest;
    87 	};
    88 
    89 //CDrawTextInContextTestPoint
    90 class CDrawTextInContextTestPoint : public CDrawTextInContextTest
    91 	{
    92 public:
    93 	static CDrawTextInContextTestPoint* NewL();
    94 	~CDrawTextInContextTestPoint();
    95 	void DoDrawTextBitGc();
    96 	void DoDrawTextRemoteGc();
    97 private:
    98 	CDrawTextInContextTestPoint();
    99 	void ConstructL();
   100 private:
   101 	TPoint iPosition;
   102 	};
   103 
   104 //CDrawTextInContextTestBox
   105 class CDrawTextInContextTestBox : public CDrawTextInContextTest
   106 	{
   107 public:
   108 	static CDrawTextInContextTestBox* NewL();
   109 	~CDrawTextInContextTestBox();
   110 	void DoDrawTextBitGc();
   111 	void DoDrawTextRemoteGc();
   112 private:
   113 	CDrawTextInContextTestBox();
   114 	void ConstructL();
   115 private:
   116 	TRect iClipFillRect;
   117 	TInt iBaselineOffset;
   118 	CGraphicsContext::TTextAlign iTTextAlign;
   119 	};
   120 
   121 //CDrawTextInContextTestPointVertical
   122 class CDrawTextInContextTestPointVertical : public CDrawTextInContextTest
   123 	{
   124 public:
   125 	static CDrawTextInContextTestPointVertical* NewL();
   126 	~CDrawTextInContextTestPointVertical();
   127 	void DoDrawTextBitGc();
   128 	void DoDrawTextRemoteGc();
   129 private:
   130 	CDrawTextInContextTestPointVertical();
   131 	void ConstructL();
   132 private:
   133 	TPoint iPosition;
   134 	TBool iUp;
   135 	};
   136 
   137 //CDrawTextInContextTestBoxVertical
   138 class CDrawTextInContextTestBoxVertical : public CDrawTextInContextTest
   139 	{
   140 public:
   141 	static CDrawTextInContextTestBoxVertical* NewL();
   142 	~CDrawTextInContextTestBoxVertical();
   143 	void DoDrawTextBitGc();
   144 	void DoDrawTextRemoteGc();
   145 private:
   146 	CDrawTextInContextTestBoxVertical();
   147 	void ConstructL();
   148 private:
   149 	TRect iClipFillRect;
   150 	TInt iBaselineOffset;
   151 	TBool iUp;
   152 	CGraphicsContext::TTextAlign iTTextAlign;
   153 	};
   154 
   155 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
   156 
   157 class CTGc : public CTWsGraphicsBase
   158 	{
   159 public:
   160 	CTGc(CTestStep* aStep);
   161 	~CTGc();
   162 	void ConstructL();
   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();
   177 #endif
   178 
   179 protected:
   180 	void TestGcClipRectOrigin_DrawContent(TestWindow& aWindow, TBool bActivateBeforeRedraw = ETrue);
   181 	
   182 //from 	CTWsGraphicsBase
   183 	virtual void RunTestCaseL(TInt aCurTestCase);
   184 private:
   185 	CTestBase *iTest;
   186 	};
   187 
   188 class CTGcStep : public CTGraphicsStep
   189 	{
   190 public:
   191 	CTGcStep();
   192 protected:
   193 	//from CTGraphicsStep
   194 	virtual CTGraphicsBase* CreateTestL();
   195 	};
   196 
   197 _LIT(KTGcStep,"TGc");
   198 
   199 #endif