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.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent - Internal Symbian test code
sl@0
    20
*/
sl@0
    21
sl@0
    22
#ifndef __TGC_H__
sl@0
    23
#define __TGC_H__
sl@0
    24
sl@0
    25
#include "AUTO.H"
sl@0
    26
#include "TGraphicsHarness.h"
sl@0
    27
#include <graphics/sgimage.h>
sl@0
    28
#include <graphics/sgimagecollection.h>
sl@0
    29
sl@0
    30
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
    31
/*
sl@0
    32
 * The following classes are only required for the RemoteGc DrawText tests: .
sl@0
    33
 * CDrawTextInContextTest : is the Abstract base class
sl@0
    34
 * CDrawTextInContextTestPoint : Test DrawText(const TDesC&,const TTextParameters*,const TPoint&)
sl@0
    35
 * CDrawTextInContextTestBox : Test DrawText(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt)
sl@0
    36
 * CDrawTextInContextTestPointVertical : Test DrawTextVertical(const TDesC&,const TTextParameters*,const TPoint&)
sl@0
    37
 * CDrawTextInContextTestBoxVertical : Test DrawTextVertical(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt)
sl@0
    38
 */
sl@0
    39
class CDirectGdiGcWrapper;
sl@0
    40
class CRemoteGc;
sl@0
    41
class CCommandBuffer;
sl@0
    42
class CWSGraphicsRes;
sl@0
    43
class RDirectGdiImageTarget;
sl@0
    44
sl@0
    45
const TSize KBitmapSize(620, 240);
sl@0
    46
const TRect KBitmapRect(TPoint(0,0),TSize(620, 240));
sl@0
    47
const TRegionFix<1> KBitmapRegion(KBitmapRect);
sl@0
    48
sl@0
    49
//CDrawTextInContextTest
sl@0
    50
class CDrawTextInContextTest : public CBase
sl@0
    51
	{
sl@0
    52
public:
sl@0
    53
	void Test();
sl@0
    54
	TBool HasPassedTest();
sl@0
    55
protected:
sl@0
    56
	CDrawTextInContextTest();
sl@0
    57
	~CDrawTextInContextTest();
sl@0
    58
	void BaseConstructL();
sl@0
    59
	virtual void DoDrawTextBitGc() = 0;
sl@0
    60
	virtual void DoDrawTextRemoteGc() = 0;
sl@0
    61
protected:
sl@0
    62
	CFont *iFont;
sl@0
    63
	CGraphicsContext::TTextParameters iParam;
sl@0
    64
	TPtrC iText;
sl@0
    65
	
sl@0
    66
	//For reference bitmap
sl@0
    67
	CFbsBitmap* iRefBitmap;
sl@0
    68
	CFbsBitmapDevice* iRefDevice;
sl@0
    69
	CFbsBitGc* iRefBitGc;
sl@0
    70
	
sl@0
    71
	//For CDirectGdiGcWrapper
sl@0
    72
	RSgImage iWrapperImage;
sl@0
    73
	RDirectGdiImageTarget* iWrapperImageTarget;
sl@0
    74
	RSgImageCollection iWrapperImageCollection;
sl@0
    75
	CDirectGdiGcWrapper* iDirectGdiGcWrapper;
sl@0
    76
	
sl@0
    77
	
sl@0
    78
	//For CRemoteGc
sl@0
    79
	CRemoteGc* iRemoteGc;
sl@0
    80
	RWsGraphicMsgBuf iMsgBuf;
sl@0
    81
	CCommandBuffer* iCommandBuffer;
sl@0
    82
	CWSGraphicsRes* iWsGraphicRes;
sl@0
    83
	TPoint iOffset;
sl@0
    84
	
sl@0
    85
	//Test result
sl@0
    86
	TBool iHasPassedTest;
sl@0
    87
	};
sl@0
    88
sl@0
    89
//CDrawTextInContextTestPoint
sl@0
    90
class CDrawTextInContextTestPoint : public CDrawTextInContextTest
sl@0
    91
	{
sl@0
    92
public:
sl@0
    93
	static CDrawTextInContextTestPoint* NewL();
sl@0
    94
	~CDrawTextInContextTestPoint();
sl@0
    95
	void DoDrawTextBitGc();
sl@0
    96
	void DoDrawTextRemoteGc();
sl@0
    97
private:
sl@0
    98
	CDrawTextInContextTestPoint();
sl@0
    99
	void ConstructL();
sl@0
   100
private:
sl@0
   101
	TPoint iPosition;
sl@0
   102
	};
sl@0
   103
sl@0
   104
//CDrawTextInContextTestBox
sl@0
   105
class CDrawTextInContextTestBox : public CDrawTextInContextTest
sl@0
   106
	{
sl@0
   107
public:
sl@0
   108
	static CDrawTextInContextTestBox* NewL();
sl@0
   109
	~CDrawTextInContextTestBox();
sl@0
   110
	void DoDrawTextBitGc();
sl@0
   111
	void DoDrawTextRemoteGc();
sl@0
   112
private:
sl@0
   113
	CDrawTextInContextTestBox();
sl@0
   114
	void ConstructL();
sl@0
   115
private:
sl@0
   116
	TRect iClipFillRect;
sl@0
   117
	TInt iBaselineOffset;
sl@0
   118
	CGraphicsContext::TTextAlign iTTextAlign;
sl@0
   119
	};
sl@0
   120
sl@0
   121
//CDrawTextInContextTestPointVertical
sl@0
   122
class CDrawTextInContextTestPointVertical : public CDrawTextInContextTest
sl@0
   123
	{
sl@0
   124
public:
sl@0
   125
	static CDrawTextInContextTestPointVertical* NewL();
sl@0
   126
	~CDrawTextInContextTestPointVertical();
sl@0
   127
	void DoDrawTextBitGc();
sl@0
   128
	void DoDrawTextRemoteGc();
sl@0
   129
private:
sl@0
   130
	CDrawTextInContextTestPointVertical();
sl@0
   131
	void ConstructL();
sl@0
   132
private:
sl@0
   133
	TPoint iPosition;
sl@0
   134
	TBool iUp;
sl@0
   135
	};
sl@0
   136
sl@0
   137
//CDrawTextInContextTestBoxVertical
sl@0
   138
class CDrawTextInContextTestBoxVertical : public CDrawTextInContextTest
sl@0
   139
	{
sl@0
   140
public:
sl@0
   141
	static CDrawTextInContextTestBoxVertical* NewL();
sl@0
   142
	~CDrawTextInContextTestBoxVertical();
sl@0
   143
	void DoDrawTextBitGc();
sl@0
   144
	void DoDrawTextRemoteGc();
sl@0
   145
private:
sl@0
   146
	CDrawTextInContextTestBoxVertical();
sl@0
   147
	void ConstructL();
sl@0
   148
private:
sl@0
   149
	TRect iClipFillRect;
sl@0
   150
	TInt iBaselineOffset;
sl@0
   151
	TBool iUp;
sl@0
   152
	CGraphicsContext::TTextAlign iTTextAlign;
sl@0
   153
	};
sl@0
   154
sl@0
   155
#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   156
sl@0
   157
class CTGc : public CTWsGraphicsBase
sl@0
   158
	{
sl@0
   159
public:
sl@0
   160
	CTGc(CTestStep* aStep);
sl@0
   161
	~CTGc();
sl@0
   162
	void ConstructL();
sl@0
   163
	void TestOutlineAndShadowL();
sl@0
   164
	void TestGcClipRectOrigin();
sl@0
   165
	void TestResetWithBackgroundColorL();
sl@0
   166
	void TestCommandBufferL();
sl@0
   167
	void TestEmptyCommandBufferL();
sl@0
   168
	void TestGcSetBrushPatternL();
sl@0
   169
	void TestGcDeleteBitmap1L();
sl@0
   170
	void TestGcDeleteBitmap2L();
sl@0
   171
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   172
	void TestCRemoteGcAndMWsGraphicsContextClippingRectL();
sl@0
   173
	void TestCRemoteGcDrawTextInContextPointL();
sl@0
   174
	void TestCRemoteGcDrawTextInContextBoxL();
sl@0
   175
	void TestCRemoteGcDrawTextInContextPointVerticalL();
sl@0
   176
	void TestCRemoteGcDrawTextInContextBoxVerticalL();
sl@0
   177
#endif
sl@0
   178
sl@0
   179
protected:
sl@0
   180
	void TestGcClipRectOrigin_DrawContent(TestWindow& aWindow, TBool bActivateBeforeRedraw = ETrue);
sl@0
   181
	
sl@0
   182
//from 	CTWsGraphicsBase
sl@0
   183
	virtual void RunTestCaseL(TInt aCurTestCase);
sl@0
   184
private:
sl@0
   185
	CTestBase *iTest;
sl@0
   186
	};
sl@0
   187
sl@0
   188
class CTGcStep : public CTGraphicsStep
sl@0
   189
	{
sl@0
   190
public:
sl@0
   191
	CTGcStep();
sl@0
   192
protected:
sl@0
   193
	//from CTGraphicsStep
sl@0
   194
	virtual CTGraphicsBase* CreateTestL();
sl@0
   195
	};
sl@0
   196
sl@0
   197
_LIT(KTGcStep,"TGc");
sl@0
   198
sl@0
   199
#endif