os/graphics/windowing/windowserver/test/tauto/tgc.cpp
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
#include "tgc.h"
sl@0
    22
#include "RemoteGc.h"
sl@0
    23
#include "CommandBuffer.h"
sl@0
    24
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
    25
#include "directgdigcwrapper.h"
sl@0
    26
#include <graphics/directgdidriver.h>
sl@0
    27
#include <graphics/sgutils.h>
sl@0
    28
#include <graphics/wsdrawresource.h>
sl@0
    29
#endif
sl@0
    30
sl@0
    31
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
    32
GLDEF_C void CopyImageToBitmapL(CFbsBitmap* aBitmap, const RSgImage& aImage, const TRect& aRect);
sl@0
    33
GLDEF_C void CopyImageToDestination(TAny* aDataAddressDest, TInt aDataStrideDest, TDisplayMode aDisplayModeDest, 
sl@0
    34
				TAny* aDataAddressSrc, TInt aDataStrideSrc, TDisplayMode aDisplayModeSrc, const TRect& aRect);
sl@0
    35
GLDEF_C void CopyImageToDestination64K(TAny* aDataAddressDest, TInt aDataStrideDest, TDisplayMode aDisplayModeDest, 
sl@0
    36
		TUint16* aDataAddressSrc, TInt aDataStrideSrc, const TRect& aRect);
sl@0
    37
sl@0
    38
GLDEF_C void CopyImageToBitmapL(CFbsBitmap* aBitmap, const RSgImage& aImage, const TRect& aRect)
sl@0
    39
	{
sl@0
    40
	TSgImageInfo info;
sl@0
    41
	TInt res = aImage.GetInfo(info);
sl@0
    42
	if(res == KErrNone)
sl@0
    43
		{
sl@0
    44
		info.iUsage = ESgUsageNone;
sl@0
    45
		info.iCpuAccess = ESgCpuAccessReadOnly;
sl@0
    46
		RSgImage image;
sl@0
    47
		res = image.Create(info, aImage);
sl@0
    48
		if(res == KErrNone)
sl@0
    49
			{	
sl@0
    50
			const TAny* dataAddressSrc = NULL; 
sl@0
    51
			TInt dataStrideSrc = 0;
sl@0
    52
			res = image.MapReadOnly(dataAddressSrc, dataStrideSrc);
sl@0
    53
			if(res == KErrNone)
sl@0
    54
				{
sl@0
    55
				const TDisplayMode displayModeDest = aBitmap->DisplayMode();
sl@0
    56
				const TDisplayMode displayModeSrc = SgUtils::PixelFormatToDisplayMode(info.iPixelFormat);
sl@0
    57
				TUint32* dataAddressDest = aBitmap->DataAddress();
sl@0
    58
				const TInt dataStrideDest = aBitmap -> DataStride();
sl@0
    59
				TSize bitmapSize = aBitmap->SizeInPixels();
sl@0
    60
				TRect rect = aRect;
sl@0
    61
				TRect rectDest = info.iSizeInPixels;
sl@0
    62
				rect.Intersection(rectDest);
sl@0
    63
				if(rect.Height() > bitmapSize.iHeight)
sl@0
    64
					{
sl@0
    65
					rect.SetHeight(bitmapSize.iHeight);
sl@0
    66
					}
sl@0
    67
				if(rect.Width() > bitmapSize.iWidth)
sl@0
    68
					{
sl@0
    69
					rect.SetWidth(bitmapSize.iWidth);
sl@0
    70
					}
sl@0
    71
				CopyImageToDestination((TAny*)dataAddressDest, dataStrideDest, displayModeDest, (TAny*)dataAddressSrc, 
sl@0
    72
								dataStrideSrc, displayModeSrc, rect);
sl@0
    73
sl@0
    74
				image.Unmap();
sl@0
    75
				}
sl@0
    76
			image.Close();
sl@0
    77
			}
sl@0
    78
		}
sl@0
    79
	}
sl@0
    80
sl@0
    81
GLDEF_C void CopyImageToDestination(TAny* aDataAddressDest, TInt aDataStrideDest, TDisplayMode aDisplayModeDest, 
sl@0
    82
				TAny* aDataAddressSrc, TInt aDataStrideSrc, TDisplayMode aDisplayModeSrc, const TRect& aRect) 
sl@0
    83
	{
sl@0
    84
	if(aRect.IsEmpty())
sl@0
    85
		return;
sl@0
    86
	
sl@0
    87
	if((aDisplayModeDest == aDisplayModeSrc) && (aDataStrideSrc == aDataStrideDest))
sl@0
    88
		{
sl@0
    89
		Mem::Copy(aDataAddressDest, aDataAddressSrc, aDataStrideDest * aRect.Height());
sl@0
    90
		return;
sl@0
    91
		}
sl@0
    92
	
sl@0
    93
	switch(aDisplayModeSrc)
sl@0
    94
		{
sl@0
    95
	case EColor64K:
sl@0
    96
		{
sl@0
    97
		CopyImageToDestination64K(aDataAddressDest, aDataStrideDest, aDisplayModeDest, 
sl@0
    98
						(TUint16*)aDataAddressSrc, aDataStrideSrc, aRect);
sl@0
    99
		break;
sl@0
   100
		}
sl@0
   101
	default:
sl@0
   102
		break;
sl@0
   103
		}
sl@0
   104
	}
sl@0
   105
sl@0
   106
GLDEF_C void CopyImageToDestination64K(TAny* aDataAddressDest, TInt aDataStrideDest, TDisplayMode aDisplayModeDest, 
sl@0
   107
		TUint16* aDataAddressSrc, TInt aDataStrideSrc, const TRect& aRect) 
sl@0
   108
	{
sl@0
   109
	const TInt bppSrc = 2;
sl@0
   110
	const TInt width = aRect.Width();
sl@0
   111
	const TInt height = aRect.Height();
sl@0
   112
	const TInt dataStrideLengthSrc = aDataStrideSrc / bppSrc;
sl@0
   113
	TUint16* dataAddressSrc =  aDataAddressSrc + aRect.iTl.iY * dataStrideLengthSrc + aRect.iTl.iX; 
sl@0
   114
	const TUint16* dataAddressSrcEnd = dataAddressSrc + dataStrideLengthSrc *  height;  
sl@0
   115
sl@0
   116
	switch(aDisplayModeDest)
sl@0
   117
		{
sl@0
   118
	case EColor64K:
sl@0
   119
		{
sl@0
   120
		TUint16* dataAddressDest = static_cast<TUint16*> (aDataAddressDest); 
sl@0
   121
		const TInt dataStrideLengthDest = aDataStrideDest / bppSrc;
sl@0
   122
		while(dataAddressSrcEnd > dataAddressSrc)
sl@0
   123
			{
sl@0
   124
			Mem::Copy(dataAddressDest, dataAddressSrc, width * bppSrc);
sl@0
   125
			dataAddressSrc += dataStrideLengthSrc;
sl@0
   126
			dataAddressDest += dataStrideLengthDest;
sl@0
   127
			}
sl@0
   128
		break;
sl@0
   129
		}
sl@0
   130
	case EColor16MU:
sl@0
   131
		{
sl@0
   132
		const TInt bppDest = 4;
sl@0
   133
		TUint32* dataAddressDest = static_cast<TUint32*> (aDataAddressDest); 
sl@0
   134
		const TInt dataStrideLengthDest = aDataStrideDest / bppDest;
sl@0
   135
		
sl@0
   136
		while(dataAddressSrcEnd > dataAddressSrc)
sl@0
   137
			{
sl@0
   138
			const TUint16* dataAddressSrcLineEnd = dataAddressSrc + width;
sl@0
   139
			TUint32* dataAddressDestCur = dataAddressDest;
sl@0
   140
			TUint16* dataAddressSrcCur = dataAddressSrc;
sl@0
   141
sl@0
   142
			while(dataAddressSrcLineEnd > dataAddressSrcCur)
sl@0
   143
				{
sl@0
   144
				*dataAddressDestCur = TRgb::Color64K(*dataAddressSrcCur).Color16MU();
sl@0
   145
				dataAddressDestCur++;
sl@0
   146
				dataAddressSrcCur++;
sl@0
   147
				}
sl@0
   148
			dataAddressSrc += dataStrideLengthSrc;
sl@0
   149
			dataAddressDest += dataStrideLengthDest;
sl@0
   150
			}
sl@0
   151
		break;
sl@0
   152
		}
sl@0
   153
	case EGray4:
sl@0
   154
		{
sl@0
   155
		TUint8* dataAddressDest = static_cast<TUint8*> (aDataAddressDest);
sl@0
   156
		const TInt dataStrideLengthDest = aDataStrideDest;
sl@0
   157
		
sl@0
   158
		while(dataAddressSrcEnd > dataAddressSrc)
sl@0
   159
			{
sl@0
   160
			const TUint8* dataAddressDstLineEnd = dataAddressDest + aDataStrideDest;
sl@0
   161
			TUint8* dataAddressDestCur = dataAddressDest;
sl@0
   162
			TUint16* dataAddressSrcCur = dataAddressSrc;
sl@0
   163
sl@0
   164
			while(dataAddressDstLineEnd > dataAddressDestCur)
sl@0
   165
				{
sl@0
   166
				*dataAddressDestCur = 0;
sl@0
   167
				for(TInt index = 0; index < 8; index +=2)
sl@0
   168
					{
sl@0
   169
					TInt col = TRgb::Color64K(*dataAddressSrcCur).Gray4();
sl@0
   170
					col <<= index;
sl@0
   171
					*dataAddressDestCur |= col;
sl@0
   172
					dataAddressSrcCur++;
sl@0
   173
					}
sl@0
   174
				dataAddressDestCur++;
sl@0
   175
				}
sl@0
   176
			dataAddressSrc += dataStrideLengthSrc;
sl@0
   177
			dataAddressDest += dataStrideLengthDest;
sl@0
   178
			}
sl@0
   179
		break;
sl@0
   180
		}
sl@0
   181
	case EColor256:
sl@0
   182
		{
sl@0
   183
		TUint8* dataAddressDest = static_cast<TUint8*> (aDataAddressDest);
sl@0
   184
		const TInt dataStrideLengthDest = aDataStrideDest;
sl@0
   185
		
sl@0
   186
		while(dataAddressSrcEnd > dataAddressSrc)
sl@0
   187
			{
sl@0
   188
			const TUint8* dataAddressDstLineEnd = dataAddressDest + aDataStrideDest;
sl@0
   189
			TUint8* dataAddressDestCur = dataAddressDest;
sl@0
   190
			TUint16* dataAddressSrcCur = dataAddressSrc;
sl@0
   191
sl@0
   192
			while(dataAddressDstLineEnd > dataAddressDestCur)
sl@0
   193
				{
sl@0
   194
				*dataAddressDestCur = TRgb::Color64K(*dataAddressSrcCur).Color256();
sl@0
   195
				dataAddressSrcCur++;
sl@0
   196
				dataAddressDestCur++;
sl@0
   197
				}
sl@0
   198
			dataAddressSrc += dataStrideLengthSrc;
sl@0
   199
			dataAddressDest += dataStrideLengthDest;
sl@0
   200
			}
sl@0
   201
		break;
sl@0
   202
		}
sl@0
   203
	default:
sl@0
   204
		break;
sl@0
   205
		}
sl@0
   206
	}
sl@0
   207
sl@0
   208
TDisplayMode DisplayModeFromPixelFormat(TUidPixelFormat aPixelFormat)
sl@0
   209
	{
sl@0
   210
	switch(aPixelFormat)
sl@0
   211
		{
sl@0
   212
	case EUidPixelFormatARGB_8888_PRE:
sl@0
   213
		return EColor16MAP;
sl@0
   214
	case EUidPixelFormatARGB_8888:
sl@0
   215
		return EColor16MA;
sl@0
   216
	case EUidPixelFormatRGB_565:
sl@0
   217
		return EColor64K;
sl@0
   218
	default:
sl@0
   219
		break;
sl@0
   220
		}
sl@0
   221
	return ENone;
sl@0
   222
	}
sl@0
   223
sl@0
   224
TUidPixelFormat PixelFormatFromDisplayMode(TDisplayMode aDisplayMode)
sl@0
   225
	{
sl@0
   226
	switch (aDisplayMode)
sl@0
   227
		{
sl@0
   228
		case EGray2:
sl@0
   229
		case EGray4:
sl@0
   230
		case EGray16:
sl@0
   231
		case EGray256:
sl@0
   232
		case EColor16:
sl@0
   233
		case EColor256:
sl@0
   234
		case EColor16M:
sl@0
   235
		case EColor16MU:
sl@0
   236
			{
sl@0
   237
			return EUidPixelFormatXRGB_8888;
sl@0
   238
			}
sl@0
   239
		case EColor4K:
sl@0
   240
			{
sl@0
   241
			return EUidPixelFormatXRGB_4444;
sl@0
   242
			}
sl@0
   243
		case EColor64K:
sl@0
   244
			{
sl@0
   245
			return EUidPixelFormatRGB_565;
sl@0
   246
			}
sl@0
   247
		case EColor16MA:
sl@0
   248
			{
sl@0
   249
			return EUidPixelFormatARGB_8888;
sl@0
   250
			}
sl@0
   251
		case EColor16MAP:
sl@0
   252
			{
sl@0
   253
			return EUidPixelFormatARGB_8888_PRE;
sl@0
   254
			}
sl@0
   255
		default:
sl@0
   256
			{
sl@0
   257
			return EUidPixelFormatUnknown;
sl@0
   258
			}
sl@0
   259
		}
sl@0
   260
	}
sl@0
   261
#endif
sl@0
   262
sl@0
   263
CTGc::CTGc(CTestStep* aStep) : CTWsGraphicsBase(aStep)
sl@0
   264
	{
sl@0
   265
	}
sl@0
   266
sl@0
   267
CTGc::~CTGc()
sl@0
   268
	{
sl@0
   269
	delete iTest;
sl@0
   270
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   271
	SgDriver::Close();
sl@0
   272
	CDirectGdiDriver *directGdiDriver = CDirectGdiDriver::Static();
sl@0
   273
	if(directGdiDriver)
sl@0
   274
		{
sl@0
   275
		directGdiDriver->Close();
sl@0
   276
		}
sl@0
   277
#endif
sl@0
   278
	}
sl@0
   279
sl@0
   280
void CTGc::ConstructL()
sl@0
   281
	{
sl@0
   282
	_LIT(KTestName,"GC Test");
sl@0
   283
	iTest=new(ELeave) CTestBase(KTestName,this);
sl@0
   284
	
sl@0
   285
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   286
	TInt err = CDirectGdiDriver::Open();
sl@0
   287
	User::LeaveIfError(err);
sl@0
   288
	err = SgDriver::Open();
sl@0
   289
	if(err != KErrNone)
sl@0
   290
		{
sl@0
   291
		CDirectGdiDriver *directGdiDriver = CDirectGdiDriver::Static();
sl@0
   292
		if(directGdiDriver)
sl@0
   293
			{
sl@0
   294
			directGdiDriver->Close();
sl@0
   295
			}
sl@0
   296
		User::Leave(err);
sl@0
   297
		}
sl@0
   298
#endif
sl@0
   299
	}
sl@0
   300
sl@0
   301
//Class derived from MWsGraphicResolver. Used for playing the commands from command buffer
sl@0
   302
class CWSGraphicsRes: public CBase, public MWsGraphicResolver
sl@0
   303
	{
sl@0
   304
public:
sl@0
   305
	void DrawWsGraphic(TInt /*aId*/, TBool /*aIsUid*/, const TRect& /*aRect*/, const TDesC8& /*aData*/) const
sl@0
   306
		{
sl@0
   307
		//Orveriding by giving empty implemention
sl@0
   308
		}
sl@0
   309
	};
sl@0
   310
sl@0
   311
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   312
//
sl@0
   313
//Class CDrawTextInContextTest
sl@0
   314
//
sl@0
   315
sl@0
   316
CDrawTextInContextTest::CDrawTextInContextTest(){}
sl@0
   317
sl@0
   318
CDrawTextInContextTest::~CDrawTextInContextTest()
sl@0
   319
	{
sl@0
   320
	delete iRefBitmap;
sl@0
   321
	delete iRefDevice;
sl@0
   322
	delete iRefBitGc;
sl@0
   323
	delete iRemoteGc;
sl@0
   324
	iMsgBuf.Close();
sl@0
   325
	delete iCommandBuffer;
sl@0
   326
	delete iWsGraphicRes;
sl@0
   327
	
sl@0
   328
	TheClient->iScreen->ReleaseFont(iFont);
sl@0
   329
sl@0
   330
	delete iDirectGdiGcWrapper;
sl@0
   331
	if(iWrapperImageTarget)
sl@0
   332
		{
sl@0
   333
		iWrapperImageTarget->Close();
sl@0
   334
		}
sl@0
   335
	delete iWrapperImageTarget;
sl@0
   336
	iWrapperImage.Close();
sl@0
   337
	iWrapperImageCollection.Close();
sl@0
   338
	}
sl@0
   339
sl@0
   340
void CDrawTextInContextTest::BaseConstructL()
sl@0
   341
	{
sl@0
   342
	//Initialise font settings
sl@0
   343
	TFontSpec fsp;
sl@0
   344
	fsp.iTypeface.iName=_L("Series 60 Sans");
sl@0
   345
	fsp.iHeight=430;
sl@0
   346
	User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips((CFont*&)iFont,fsp));
sl@0
   347
	
sl@0
   348
	//Initialise TTextParameter
sl@0
   349
	iParam.iStart = 27;
sl@0
   350
	iParam.iEnd = 60;
sl@0
   351
	
sl@0
   352
	//Text to draw
sl@0
   353
	iText.Set(_L("This text will not be drawnK.,!\"\x00A3$%^&*()_+-=;'#:@~/<>? Latin This text will not be drawn"));
sl@0
   354
	
sl@0
   355
	//For reference bitmap
sl@0
   356
	iRefBitmap = new(ELeave) CFbsBitmap();
sl@0
   357
	User::LeaveIfError(iRefBitmap->Create(KBitmapSize, EColor64K));
sl@0
   358
	iRefDevice = CFbsBitmapDevice::NewL(iRefBitmap);
sl@0
   359
	User::LeaveIfError(iRefDevice->CreateContext(iRefBitGc));
sl@0
   360
	
sl@0
   361
	CDirectGdiDriver* theDGdiDriver = CDirectGdiDriver::Static();
sl@0
   362
	User::LeaveIfNull(theDGdiDriver);
sl@0
   363
	
sl@0
   364
	TSgImageInfo info;
sl@0
   365
	info.iUsage = ESgUsageDirectGdiTarget | ESgUsageDirectGdiSource | ESgUsageCompositionSource;
sl@0
   366
	info.iSizeInPixels = KBitmapSize;
sl@0
   367
	info.iPixelFormat = EUidPixelFormatRGB_565;
sl@0
   368
	
sl@0
   369
	TInt res = iWrapperImageCollection.Create(info, 1);
sl@0
   370
	User::LeaveIfError(res);
sl@0
   371
	res = iWrapperImageCollection.OpenImage(0, iWrapperImage);
sl@0
   372
	User::LeaveIfError(res);
sl@0
   373
	iWrapperImageTarget = new (ELeave) RDirectGdiImageTarget(*theDGdiDriver);
sl@0
   374
	res = iWrapperImageTarget->Create(iWrapperImage);
sl@0
   375
	User::LeaveIfError(res);
sl@0
   376
	iDirectGdiGcWrapper = CDirectGdiGcWrapper::NewL(*iWrapperImageTarget);
sl@0
   377
sl@0
   378
	//clean image-----------------
sl@0
   379
	CDirectGdiGcWrapper* directGdiGcWrapper = CDirectGdiGcWrapper::NewL(*iWrapperImageTarget);
sl@0
   380
	CleanupStack::PushL(directGdiGcWrapper);
sl@0
   381
sl@0
   382
	directGdiGcWrapper->SetDrawMode(MWsGraphicsContext::EDrawModeWriteAlpha);
sl@0
   383
	directGdiGcWrapper->SetBrushColor(KRgbWhite);
sl@0
   384
	directGdiGcWrapper->Clear();
sl@0
   385
sl@0
   386
	CleanupStack::PopAndDestroy(1, directGdiGcWrapper);
sl@0
   387
	//------------------
sl@0
   388
	
sl@0
   389
	//Used to record draw commands
sl@0
   390
	iRemoteGc = CRemoteGc::NewL(TheClient->iScreen);
sl@0
   391
	
sl@0
   392
	//Used to play recorded draw commands
sl@0
   393
	iCommandBuffer = CCommandBuffer::NewL();
sl@0
   394
	
sl@0
   395
	//Dummy class created required for CCommandBuffer::Play
sl@0
   396
	iWsGraphicRes = new (ELeave) CWSGraphicsRes();
sl@0
   397
	
sl@0
   398
	//Offset for CCommandBuffer::Play
sl@0
   399
	iOffset = TPoint(0,0);
sl@0
   400
	
sl@0
   401
	//Result of doing the test
sl@0
   402
	iHasPassedTest = EFalse;
sl@0
   403
	}
sl@0
   404
sl@0
   405
void CDrawTextInContextTest::Test()
sl@0
   406
	{	
sl@0
   407
	/* Create reference bitmap by drawing using bitgc */
sl@0
   408
	iRefBitGc->UseFont(iFont);
sl@0
   409
	DoDrawTextBitGc();
sl@0
   410
	iRefBitGc->DiscardFont();
sl@0
   411
	
sl@0
   412
	/* Drawing using CBitGcWrapper via CRemotGc*/
sl@0
   413
	
sl@0
   414
	//Capturing the commands in remote gc
sl@0
   415
	iRemoteGc->BeginDraw(KBitmapRect);
sl@0
   416
	iRemoteGc->UseFont(iFont);
sl@0
   417
	DoDrawTextRemoteGc();
sl@0
   418
	iRemoteGc->DiscardFont();
sl@0
   419
	iRemoteGc->EndDraw();
sl@0
   420
		
sl@0
   421
	//Externalize the captured commands from remote gc in to a buffer
sl@0
   422
	iRemoteGc->ExternalizeL(iMsgBuf, ETrue);
sl@0
   423
sl@0
   424
	//Internalize the buffer with captured commands (from CRemoteGC) in to CCommandBuffer
sl@0
   425
	iCommandBuffer->InternalizeL(iMsgBuf.Pckg());
sl@0
   426
	
sl@0
   427
	//Play the commands on test window using command buffer
sl@0
   428
	iCommandBuffer->Play(iOffset,&KBitmapRegion,KBitmapRect,*iWsGraphicRes,*iDirectGdiGcWrapper);
sl@0
   429
	
sl@0
   430
	//Test to see if the bitmap drawn to using CRemoteGc is the same as the reference bitmap
sl@0
   431
	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
sl@0
   432
	CleanupStack::PushL(bitmap);
sl@0
   433
	
sl@0
   434
	TSgImageInfo info;
sl@0
   435
	iWrapperImage.GetInfo(info);
sl@0
   436
	TDisplayMode displayMode = DisplayModeFromPixelFormat(info.iPixelFormat);
sl@0
   437
	bitmap->Create(info.iSizeInPixels, displayMode);
sl@0
   438
	TRect rect(info.iSizeInPixels);
sl@0
   439
	CopyImageToBitmapL(bitmap, iWrapperImage, rect);
sl@0
   440
	
sl@0
   441
	iHasPassedTest = LossyCompareBitmap(*iRefBitmap, *bitmap, KBitmapRect, EFalse);
sl@0
   442
sl@0
   443
	CleanupStack::PopAndDestroy(bitmap);
sl@0
   444
	}
sl@0
   445
sl@0
   446
TBool CDrawTextInContextTest::HasPassedTest()
sl@0
   447
	{
sl@0
   448
	return iHasPassedTest;
sl@0
   449
	}
sl@0
   450
sl@0
   451
//
sl@0
   452
// Class DrawTextInContextTestPoint
sl@0
   453
//
sl@0
   454
sl@0
   455
CDrawTextInContextTestPoint::CDrawTextInContextTestPoint(){}
sl@0
   456
sl@0
   457
CDrawTextInContextTestPoint::~CDrawTextInContextTestPoint(){}
sl@0
   458
sl@0
   459
CDrawTextInContextTestPoint* CDrawTextInContextTestPoint::NewL()
sl@0
   460
	{
sl@0
   461
	CDrawTextInContextTestPoint* self = new(ELeave) CDrawTextInContextTestPoint;
sl@0
   462
	CleanupStack::PushL(self);
sl@0
   463
	self->ConstructL();
sl@0
   464
	CleanupStack::Pop(self);
sl@0
   465
	return self;
sl@0
   466
	}
sl@0
   467
sl@0
   468
void CDrawTextInContextTestPoint::ConstructL()
sl@0
   469
	{
sl@0
   470
	BaseConstructL();
sl@0
   471
	iPosition = TPoint(0,0);
sl@0
   472
	}
sl@0
   473
sl@0
   474
void CDrawTextInContextTestPoint::DoDrawTextBitGc()
sl@0
   475
	{
sl@0
   476
	iRefBitGc->DrawText(iText,&iParam,iPosition);
sl@0
   477
	}
sl@0
   478
sl@0
   479
void CDrawTextInContextTestPoint::DoDrawTextRemoteGc()
sl@0
   480
	{
sl@0
   481
	iRemoteGc->DrawText(iText,&iParam,iPosition);
sl@0
   482
	}
sl@0
   483
sl@0
   484
//
sl@0
   485
// Class DrawTextInContextTestBox
sl@0
   486
//
sl@0
   487
sl@0
   488
CDrawTextInContextTestBox::CDrawTextInContextTestBox(){}
sl@0
   489
sl@0
   490
CDrawTextInContextTestBox::~CDrawTextInContextTestBox(){}
sl@0
   491
sl@0
   492
CDrawTextInContextTestBox* CDrawTextInContextTestBox::NewL()
sl@0
   493
	{
sl@0
   494
	CDrawTextInContextTestBox* self = new(ELeave) CDrawTextInContextTestBox;
sl@0
   495
	CleanupStack::PushL(self);
sl@0
   496
	self->ConstructL();
sl@0
   497
	CleanupStack::Pop(self);
sl@0
   498
	return self;
sl@0
   499
	}
sl@0
   500
sl@0
   501
void CDrawTextInContextTestBox::ConstructL()
sl@0
   502
	{
sl@0
   503
	BaseConstructL();
sl@0
   504
	iClipFillRect = TRect(10,50,640,120);
sl@0
   505
	iBaselineOffset = 40;
sl@0
   506
	iTTextAlign = CGraphicsContext::ELeft;
sl@0
   507
	}
sl@0
   508
sl@0
   509
void CDrawTextInContextTestBox::DoDrawTextBitGc()
sl@0
   510
	{
sl@0
   511
	iRefBitGc->DrawText(iText,&iParam,iClipFillRect,iBaselineOffset,iTTextAlign);
sl@0
   512
	}
sl@0
   513
sl@0
   514
void CDrawTextInContextTestBox::DoDrawTextRemoteGc()
sl@0
   515
	{
sl@0
   516
	iRemoteGc->DrawText(iText,&iParam,iClipFillRect,iBaselineOffset,iTTextAlign);
sl@0
   517
	}
sl@0
   518
sl@0
   519
//
sl@0
   520
// Class CDrawTextInContextTestPointVertical
sl@0
   521
//
sl@0
   522
sl@0
   523
CDrawTextInContextTestPointVertical::CDrawTextInContextTestPointVertical(){}
sl@0
   524
sl@0
   525
CDrawTextInContextTestPointVertical::~CDrawTextInContextTestPointVertical(){}
sl@0
   526
sl@0
   527
CDrawTextInContextTestPointVertical* CDrawTextInContextTestPointVertical::NewL()
sl@0
   528
	{
sl@0
   529
	CDrawTextInContextTestPointVertical* self = new(ELeave) CDrawTextInContextTestPointVertical;
sl@0
   530
	CleanupStack::PushL(self);
sl@0
   531
	self->ConstructL();
sl@0
   532
	CleanupStack::Pop(self);
sl@0
   533
	return self;
sl@0
   534
	}
sl@0
   535
sl@0
   536
void CDrawTextInContextTestPointVertical::ConstructL()
sl@0
   537
	{
sl@0
   538
	BaseConstructL();
sl@0
   539
	iPosition = TPoint(0,0);
sl@0
   540
	iUp = EFalse;
sl@0
   541
	}
sl@0
   542
sl@0
   543
void CDrawTextInContextTestPointVertical::DoDrawTextBitGc()
sl@0
   544
	{
sl@0
   545
	iRefBitGc->DrawTextVertical(iText,&iParam,iPosition,iUp);
sl@0
   546
	}
sl@0
   547
sl@0
   548
void CDrawTextInContextTestPointVertical::DoDrawTextRemoteGc()
sl@0
   549
	{
sl@0
   550
	iRemoteGc->DrawTextVertical(iText,&iParam,iPosition,iUp);
sl@0
   551
	}
sl@0
   552
sl@0
   553
//
sl@0
   554
// Class CDrawTextInContextTestBoxVertical
sl@0
   555
//
sl@0
   556
sl@0
   557
CDrawTextInContextTestBoxVertical::CDrawTextInContextTestBoxVertical(){}
sl@0
   558
sl@0
   559
CDrawTextInContextTestBoxVertical::~CDrawTextInContextTestBoxVertical(){}
sl@0
   560
sl@0
   561
CDrawTextInContextTestBoxVertical* CDrawTextInContextTestBoxVertical::NewL()
sl@0
   562
	{
sl@0
   563
	CDrawTextInContextTestBoxVertical* self = new(ELeave) CDrawTextInContextTestBoxVertical;
sl@0
   564
	CleanupStack::PushL(self);
sl@0
   565
	self->ConstructL();
sl@0
   566
	CleanupStack::Pop(self);
sl@0
   567
	return self;
sl@0
   568
	}
sl@0
   569
sl@0
   570
void CDrawTextInContextTestBoxVertical::ConstructL()
sl@0
   571
	{
sl@0
   572
	BaseConstructL();
sl@0
   573
	iClipFillRect = TRect(10,50,640,120);
sl@0
   574
	iBaselineOffset = 40;
sl@0
   575
	iUp = EFalse;
sl@0
   576
	iTTextAlign = CGraphicsContext::ELeft;
sl@0
   577
	}
sl@0
   578
sl@0
   579
void CDrawTextInContextTestBoxVertical::DoDrawTextBitGc()
sl@0
   580
	{
sl@0
   581
	iRefBitGc->DrawTextVertical(iText,&iParam,iClipFillRect,iBaselineOffset,iUp,iTTextAlign);
sl@0
   582
	}
sl@0
   583
sl@0
   584
void CDrawTextInContextTestBoxVertical::DoDrawTextRemoteGc()
sl@0
   585
	{
sl@0
   586
	iRemoteGc->DrawTextVertical(iText,&iParam,iClipFillRect,iBaselineOffset,iUp,iTTextAlign);
sl@0
   587
	}
sl@0
   588
#endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   589
sl@0
   590
void CleanUpFont(TAny* aFont)
sl@0
   591
	{
sl@0
   592
	//Will be called in case of a leave to release the font
sl@0
   593
	CFont* font= static_cast<CFont*>(aFont);
sl@0
   594
	TheClient->iScreen->ReleaseFont(font);
sl@0
   595
	}
sl@0
   596
sl@0
   597
/**
sl@0
   598
@SYMTestCaseID		GRAPHICS-WSERV-0437
sl@0
   599
@SYMPREQ            PREQ1543
sl@0
   600
@SYMTestCaseDesc    Draw text using CWindowGc and CRemoteGc with both outline and shadow
sl@0
   601
effect on.
sl@0
   602
@SYMTestPriority    High
sl@0
   603
@SYMTestStatus      Implemented
sl@0
   604
@SYMTestActions     Create a font with both outline and shadow effects. Record the commands 
sl@0
   605
(like setting colours,drawing text etc) using CRemoteGc and play the recorded commands on a window. Use the same
sl@0
   606
commands in CWindowGc and draw text on a different window
sl@0
   607
@SYMTestExpectedResults Text drawn using CWindowGc and CRemoteGc should be same
sl@0
   608
*/
sl@0
   609
void CTGc::TestOutlineAndShadowL()
sl@0
   610
	{
sl@0
   611
	TRect sourceRect(0, 0, TestWin->Size().iWidth, TestWin->Size().iHeight);
sl@0
   612
	TRegionFix<1> clippingRegion(sourceRect);
sl@0
   613
	
sl@0
   614
	CWsScreenDevice* device = TheClient->iScreen;
sl@0
   615
sl@0
   616
	_LIT(KText,"Outline and shadow");
sl@0
   617
	TFontSpec fSpec(KTestFontTypefaceName,23);
sl@0
   618
	fSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
sl@0
   619
	fSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue);
sl@0
   620
	fSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue);
sl@0
   621
	
sl@0
   622
	CFont *font;
sl@0
   623
	User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont *&)font, fSpec));
sl@0
   624
	CleanupStack::PushL(TCleanupItem(CleanUpFont, font));
sl@0
   625
	
sl@0
   626
	CRemoteGc* remoteGc = CRemoteGc::NewL(device);
sl@0
   627
	CleanupStack::PushL(remoteGc);
sl@0
   628
	remoteGc->BeginDraw(sourceRect);
sl@0
   629
	//Capturing the commands in remote gc
sl@0
   630
	remoteGc->SetBrushColor(KRgbGreen);
sl@0
   631
	remoteGc->SetShadowColor(KRgbDarkRed);
sl@0
   632
	remoteGc->SetPenColor(KRgbBlack);
sl@0
   633
	remoteGc->UseFont(font);
sl@0
   634
	remoteGc->DrawText(KText, TPoint(2,40));
sl@0
   635
	remoteGc->DiscardFont();
sl@0
   636
	remoteGc->EndDraw();
sl@0
   637
sl@0
   638
	RWsGraphicMsgBuf msgBuf;
sl@0
   639
	CleanupClosePushL(msgBuf);
sl@0
   640
	//Externalize the captured commands from remote gc in to a buffer
sl@0
   641
	remoteGc->ExternalizeL(msgBuf, ETrue);
sl@0
   642
sl@0
   643
	CWSGraphicsRes* wsGrap = new (ELeave) CWSGraphicsRes();
sl@0
   644
	CleanupStack::PushL(wsGrap);
sl@0
   645
	
sl@0
   646
	CCommandBuffer* cmdBuf = CCommandBuffer::NewL();
sl@0
   647
	CleanupStack::PushL(cmdBuf);
sl@0
   648
	//Internalize the buffer with captured commands (from CRemoteGC) 
sl@0
   649
	//in to CCommandBuffer
sl@0
   650
	cmdBuf->InternalizeL(msgBuf.Pckg());
sl@0
   651
	
sl@0
   652
	TestWin->Win()->Invalidate();
sl@0
   653
	TestWin->Win()->BeginRedraw();
sl@0
   654
	TheGc->Activate(*TestWin->Win());
sl@0
   655
	TheGc->Clear();
sl@0
   656
	//Play the commands on test window using command buffer
sl@0
   657
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   658
	cmdBuf->Play(TPoint(0, 0), &clippingRegion, sourceRect, TheClient->iWs, *TheGc);
sl@0
   659
#else
sl@0
   660
	cmdBuf->Play(TPoint(),TRect(TestWin->Size()),*wsGrap,*TheGc);
sl@0
   661
#endif
sl@0
   662
	TheGc->Deactivate();
sl@0
   663
	TestWin->Win()->EndRedraw();
sl@0
   664
	
sl@0
   665
	BaseWin->Win()->Invalidate();
sl@0
   666
	BaseWin->Win()->BeginRedraw();
sl@0
   667
	TheGc->Activate(*BaseWin->Win());
sl@0
   668
	TheGc->Clear();
sl@0
   669
	TheGc->SetBrushColor(KRgbGreen);
sl@0
   670
	TheGc->SetShadowColor(KRgbDarkRed);
sl@0
   671
	TheGc->SetPenColor(KRgbBlack);
sl@0
   672
	TheGc->UseFont(font);
sl@0
   673
	//Draw the text on base window using CWindowGC
sl@0
   674
	TheGc->DrawText(KText, TPoint(2, 40));
sl@0
   675
	TheGc->DiscardFont();
sl@0
   676
	TheGc->Deactivate();
sl@0
   677
	BaseWin->Win()->EndRedraw();
sl@0
   678
	TheClient->iWs.Finish();
sl@0
   679
	TheClient->WaitForRedrawsToFinish();
sl@0
   680
sl@0
   681
	//Check the text drawn on base and test windows.
sl@0
   682
	CheckRect(BaseWin, TestWin, TRect(0, 0, BaseWin->Size().iWidth, BaseWin->Size().iHeight), _L("CTGc::TestOutlineAndShadowL()"));
sl@0
   683
sl@0
   684
	CleanupStack::PopAndDestroy(4, remoteGc); //cmdBuf, wsGrap, msgBuf and remoteGc
sl@0
   685
	CleanupStack::Pop();//font
sl@0
   686
	TheClient->iScreen->ReleaseFont(font);
sl@0
   687
	}
sl@0
   688
sl@0
   689
void CTGc::TestGcClipRectOrigin_DrawContent(TestWindow& aWindow, TBool bActivateBeforeRedraw /*= ETrue*/)
sl@0
   690
	{
sl@0
   691
	TSize winSize = aWindow.Size();
sl@0
   692
	TPoint gcOrigin(winSize.iWidth >> 3, winSize.iWidth >> 3);
sl@0
   693
	TRect gcClipRect(0, 0, (winSize.iWidth * 3) >> 2, (winSize.iHeight * 3) >> 2);
sl@0
   694
	TRect ellipseRect(gcClipRect);
sl@0
   695
	// Shrink the ellipse for better visibility and to fit well within the clip area.
sl@0
   696
	ellipseRect.Shrink(3, 3);
sl@0
   697
	TSize penSize(1, 1);
sl@0
   698
sl@0
   699
	aWindow.Win()->SetBackgroundColor(KRgbGreen);
sl@0
   700
	aWindow.ClearWin();
sl@0
   701
	aWindow.Win()->Invalidate();
sl@0
   702
sl@0
   703
	if(!bActivateBeforeRedraw)
sl@0
   704
		{
sl@0
   705
		aWindow.Win()->BeginRedraw();
sl@0
   706
		}
sl@0
   707
sl@0
   708
	TheGc->Activate(*(aWindow.Win()));
sl@0
   709
	TheGc->SetOrigin(gcOrigin);
sl@0
   710
	TheGc->SetClippingRect(gcClipRect);
sl@0
   711
sl@0
   712
	if(bActivateBeforeRedraw)
sl@0
   713
		{
sl@0
   714
		aWindow.Win()->BeginRedraw();
sl@0
   715
		}
sl@0
   716
sl@0
   717
	TheGc->SetBrushColor(KRgbDarkRed);
sl@0
   718
	TheGc->SetPenColor(KRgbDarkRed);
sl@0
   719
	TheGc->SetPenSize(penSize);
sl@0
   720
	TheGc->SetPenStyle(CGraphicsContext::ESolidPen);
sl@0
   721
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
   722
	TheGc->DrawEllipse(ellipseRect);
sl@0
   723
	TheGc->SetBrushStyle(CGraphicsContext::ENullBrush);
sl@0
   724
	TheGc->SetPenColor(KRgbYellow);
sl@0
   725
	TheGc->SetPenStyle(CGraphicsContext::EDashedPen);
sl@0
   726
	TheGc->DrawRect(gcClipRect);
sl@0
   727
sl@0
   728
	aWindow.Win()->EndRedraw();
sl@0
   729
	TheGc->Deactivate();
sl@0
   730
	}
sl@0
   731
sl@0
   732
/**
sl@0
   733
@SYMTestCaseID		GRAPHICS-WSERV-0471
sl@0
   734
@SYMTestCaseDesc    This test is to verify that the GC correctly applies the clip rect and
sl@0
   735
					origin attributes irrespective of whether the GC is activated on the
sl@0
   736
					window before or after the BeginRedraw.
sl@0
   737
@SYMDEF				PDEF120091
sl@0
   738
@SYMTestPriority    High
sl@0
   739
@SYMTestStatus      Implemented
sl@0
   740
@SYMTestActions     The test has following steps:
sl@0
   741
	1. For the Test window follow the steps:
sl@0
   742
		A. Activate the GC on Test window.
sl@0
   743
		B. Set the Origin of the GC to centre of the window.
sl@0
   744
		C. Set the Clipping rectangle of the GC to half the size of the window.
sl@0
   745
		D. In the BeginDraw and EndDraw call bracket perform the following:
sl@0
   746
			a. Draw an ellipse with the rectangle smaller by 5 pixels than the clip rectangle.
sl@0
   747
			b. Draw a rectangle that is size of the clip rectangle.
sl@0
   748
		E. Deactivate the GC. 
sl@0
   749
	2. For the Base window follow the steps:
sl@0
   750
		A. In the BeginDraw and EndDraw call bracket perform the following:
sl@0
   751
			a. Activate the GC on Base window.
sl@0
   752
			b. Set the Origin of the GC to centre of the window.
sl@0
   753
			c. Set the Clipping rectangle of the GC to half the size of the window.
sl@0
   754
			d. Draw an ellipse with the rectangle smaller by 5 pixels than the clip rectangle.
sl@0
   755
			e. Draw a rectangle that is size of the clip rectangle.
sl@0
   756
			f. Deactivate the GC. 
sl@0
   757
	3. Compare Test and Base window.
sl@0
   758
@SYMTestExpectedResults Both the Test and Base window should have the complete
sl@0
   759
						non-clipped ellipse completely encapsulated within the rectangle. 
sl@0
   760
*/
sl@0
   761
void CTGc::TestGcClipRectOrigin()
sl@0
   762
	{
sl@0
   763
	TestGcClipRectOrigin_DrawContent(*BaseWin, EFalse);
sl@0
   764
	TestGcClipRectOrigin_DrawContent(*TestWin, ETrue);
sl@0
   765
	
sl@0
   766
	TheClient->Flush();
sl@0
   767
	
sl@0
   768
	CheckRect(BaseWin, TestWin, TRect(0, 0, BaseWin->Size().iWidth, BaseWin->Size().iHeight), _L("CTGc::TestGcClipRectOriginL()"));
sl@0
   769
	}
sl@0
   770
sl@0
   771
/**
sl@0
   772
@SYMTestCaseID		GRAPHICS-WSERV-0469
sl@0
   773
@SYMDEF             INC116406
sl@0
   774
@SYMTestCaseDesc    Try playback on MWsGraphicsContext and CWindowGc to check that the background colour is
sl@0
   775
set correctly.
sl@0
   776
@SYMTestPriority    High
sl@0
   777
@SYMTestStatus      Implemented
sl@0
   778
@SYMTestActions
sl@0
   779
@SYMTestExpectedResults Text drawn using CWindowGc should use the background colour of
sl@0
   780
the window, and MWsGraphicsContext should use transparent white.
sl@0
   781
*/
sl@0
   782
void CTGc::TestResetWithBackgroundColorL()
sl@0
   783
	{
sl@0
   784
	const TRect KSourceRect(0, 0, TestWin->Size().iWidth, TestWin->Size().iHeight);
sl@0
   785
	const TRegionFix<1> KClippingRegion(KSourceRect);
sl@0
   786
	
sl@0
   787
	CWsScreenDevice* device = TheClient->iScreen;
sl@0
   788
sl@0
   789
	CRemoteGc* remoteGc = CRemoteGc::NewL(device);
sl@0
   790
	CleanupStack::PushL(remoteGc);
sl@0
   791
	
sl@0
   792
	//note this remote GC has not been activated on any window
sl@0
   793
	remoteGc->BeginDraw(KSourceRect);
sl@0
   794
sl@0
   795
	//Draw the commands in remote gc
sl@0
   796
	remoteGc->SetBrushColor(KRgbGreen);  //nothing green is seen in this test
sl@0
   797
sl@0
   798
	remoteGc->Reset(); //This resets the brush colour to the background colour of the window
sl@0
   799
					   //where playback is, in the case of playing back to a window
sl@0
   800
					   //however with a CFbsBitGc the color is transparent white, as there is no window.
sl@0
   801
	remoteGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
   802
	remoteGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
sl@0
   803
	remoteGc->DrawRect(KSourceRect);
sl@0
   804
	remoteGc->EndDraw();
sl@0
   805
sl@0
   806
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   807
	CDirectGdiDriver* theDGdiDriver = CDirectGdiDriver::Static();
sl@0
   808
	User::LeaveIfNull(theDGdiDriver);
sl@0
   809
	
sl@0
   810
	TSgImageInfo info;
sl@0
   811
	info.iUsage = ESgUsageDirectGdiTarget | ESgUsageCompositionSource;
sl@0
   812
	info.iSizeInPixels = TSize(TestWin->Size().iWidth, TestWin->Size().iHeight);
sl@0
   813
	info.iPixelFormat = EUidPixelFormatXRGB_8888;//among display modes with alpha channel only pre-multiply alpha is supported in directGDI currently
sl@0
   814
	
sl@0
   815
	RSgImageCollection imageCollection;
sl@0
   816
	CleanupClosePushL(imageCollection);
sl@0
   817
	TInt res = imageCollection.Create(info, 1);
sl@0
   818
	User::LeaveIfError(res);
sl@0
   819
	RSgImage image;
sl@0
   820
	CleanupClosePushL(image);
sl@0
   821
	res = imageCollection.OpenImage(0, image);
sl@0
   822
	User::LeaveIfError(res);
sl@0
   823
	RDirectGdiImageTarget imageTarget(*theDGdiDriver);
sl@0
   824
	CleanupClosePushL(imageTarget);
sl@0
   825
	res = imageTarget.Create(image);
sl@0
   826
	User::LeaveIfError(res);
sl@0
   827
#endif
sl@0
   828
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
   829
	//create a bitmap
sl@0
   830
	CFbsBitmap *bitmap = new (ELeave) CFbsBitmap();
sl@0
   831
	User::LeaveIfError(bitmap->Create(TSize(TestWin->Size().iWidth, TestWin->Size().iHeight), EColor16MA));
sl@0
   832
	CleanupStack::PushL(bitmap);
sl@0
   833
sl@0
   834
	CFbsBitmapDevice  *fbsDevice = CFbsBitmapDevice::NewL(bitmap);
sl@0
   835
	CleanupStack::PushL(fbsDevice);
sl@0
   836
#endif
sl@0
   837
sl@0
   838
	//prepare the command buffer for playback
sl@0
   839
	RWsGraphicMsgBuf msgBuf;
sl@0
   840
	CleanupClosePushL(msgBuf);
sl@0
   841
sl@0
   842
	//Externalize the captured commands from remote gc in to a buffer
sl@0
   843
	remoteGc->ExternalizeL(msgBuf, ETrue);
sl@0
   844
sl@0
   845
	CWSGraphicsRes* wsGrap = new (ELeave) CWSGraphicsRes();
sl@0
   846
	CleanupStack::PushL(wsGrap);
sl@0
   847
sl@0
   848
	CCommandBuffer* cmdBuf = CCommandBuffer::NewL();
sl@0
   849
	CleanupStack::PushL(cmdBuf);
sl@0
   850
	cmdBuf->InternalizeL(msgBuf.Pckg());
sl@0
   851
sl@0
   852
	TRgb color;
sl@0
   853
	TRgb testColor(KRgbWhite);
sl@0
   854
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   855
	CDirectGdiGcWrapper* directGdiGcWrapper=CDirectGdiGcWrapper::NewL(imageTarget);
sl@0
   856
	CleanupStack::PushL(directGdiGcWrapper);
sl@0
   857
	cmdBuf->Play(TPoint(),&KClippingRegion,KSourceRect,*wsGrap,*directGdiGcWrapper);
sl@0
   858
sl@0
   859
	//check that the background has been cleared to transparent white.
sl@0
   860
	image.GetInfo(info);
sl@0
   861
	info.iUsage = ESgUsageNone;
sl@0
   862
	info.iCpuAccess = ESgCpuAccessReadOnly;
sl@0
   863
	RSgImage image1;
sl@0
   864
	CleanupClosePushL(image1);
sl@0
   865
	res = image1.Create(info, image);
sl@0
   866
	const TAny* data;
sl@0
   867
	TInt stride = 0;
sl@0
   868
	res = image1.MapReadOnly(data, stride);
sl@0
   869
	User::LeaveIfError(res);
sl@0
   870
	TPoint pixel(10,10);
sl@0
   871
	TInt offset = pixel.iY * stride + pixel.iX * 4;
sl@0
   872
	TAny* non_const_data = const_cast <TAny*> (data);
sl@0
   873
	TUint8* pointData = static_cast <TUint8*> (non_const_data) + offset;
sl@0
   874
	color = *(reinterpret_cast <TRgb*> (pointData));
sl@0
   875
	image1.Unmap();
sl@0
   876
#endif
sl@0
   877
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
   878
	CFbsBitGc* fbsBitGc=NULL;
sl@0
   879
	User::LeaveIfError(fbsDevice->CreateContext(fbsBitGc));
sl@0
   880
	CleanupStack::PushL(fbsBitGc);
sl@0
   881
	fbsBitGc->Activate(fbsDevice);
sl@0
   882
	cmdBuf->Play(TPoint(0, 0), KSourceRect, *wsGrap, *fbsBitGc);
sl@0
   883
	bitmap->GetPixel(color, TPoint(10,10));
sl@0
   884
	testColor.SetAlpha(0);
sl@0
   885
#endif
sl@0
   886
	iStep->TEST(color==testColor);
sl@0
   887
sl@0
   888
	//now test drawing to a window to ensure that the brush colour is
sl@0
   889
	//the window background colour
sl@0
   890
sl@0
   891
	//display a blue window
sl@0
   892
	BaseWin->Win()->SetBackgroundColor(KRgbBlue);
sl@0
   893
	BaseWin->Win()->Invalidate();
sl@0
   894
	BaseWin->Win()->BeginRedraw();
sl@0
   895
	TheGc->Activate(*BaseWin->Win());
sl@0
   896
	TheGc->Clear();
sl@0
   897
	TheGc->Deactivate();
sl@0
   898
	BaseWin->Win()->EndRedraw();
sl@0
   899
	TheClient->iWs.Finish();
sl@0
   900
	TheClient->WaitForRedrawsToFinish();
sl@0
   901
sl@0
   902
	//start drawing the display commands with a green background
sl@0
   903
	
sl@0
   904
	BaseWin->Win()->SetBackgroundColor(KRgbYellow);
sl@0
   905
	BaseWin->Win()->Invalidate();
sl@0
   906
	BaseWin->Win()->BeginRedraw();
sl@0
   907
	TheGc->Activate(*BaseWin->Win());
sl@0
   908
sl@0
   909
	//Play the commands on test window using command buffer
sl@0
   910
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   911
	cmdBuf->Play(TPoint(0, 0), &KClippingRegion, KSourceRect, TheClient->iWs, *TheGc);
sl@0
   912
#else
sl@0
   913
	cmdBuf->Play(TPoint(0, 0), KSourceRect, *wsGrap, *TheGc);
sl@0
   914
#endif
sl@0
   915
sl@0
   916
	TheGc->Deactivate();
sl@0
   917
	BaseWin->Win()->EndRedraw();
sl@0
   918
	TheClient->iWs.Finish();
sl@0
   919
	TheClient->WaitForRedrawsToFinish();
sl@0
   920
sl@0
   921
	//check that the background has been cleared to yellow, using brush colour
sl@0
   922
	TPoint position = BaseWin->Win()->InquireOffset(*TheClient->iGroup->WinTreeNode());
sl@0
   923
	position.iX+=10;
sl@0
   924
	position.iY+=10;
sl@0
   925
	TheClient->iScreen->GetPixel(color, position);
sl@0
   926
	iStep->TEST(color==KRgbYellow);
sl@0
   927
sl@0
   928
	BaseWin->Win()->SetBackgroundColor(KRgbGreen); //set back to original backgroundcolor
sl@0
   929
sl@0
   930
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   931
	CleanupStack::PopAndDestroy(9, remoteGc);
sl@0
   932
#else
sl@0
   933
	CleanupStack::PopAndDestroy(7, remoteGc);
sl@0
   934
#endif
sl@0
   935
	}
sl@0
   936
sl@0
   937
/**
sl@0
   938
@SYMTestCaseID		GRAPHICS-WSERV-0481
sl@0
   939
@SYMPREQ            1841
sl@0
   940
@SYMTestCaseDesc    Create font and graphics with various effect effects. Record the commands 
sl@0
   941
(like setting colours,drawing text etc) using CRemoteGc and play the recorded commands on a window. Use the same
sl@0
   942
commands in CWindowGc and draw text on a different window
sl@0
   943
@SYMTestPriority    Medium
sl@0
   944
@SYMTestStatus      Implemented
sl@0
   945
@SYMTestActions
sl@0
   946
@SYMTestExpectedResults Text/graphics drawn using CWindowGc and CRemoteGc should be same
sl@0
   947
*/
sl@0
   948
void CTGc::TestCommandBufferL()
sl@0
   949
	{	
sl@0
   950
	CWsScreenDevice* device = TheClient->iScreen;
sl@0
   951
sl@0
   952
	_LIT(KBuffText,"Command Buffer");
sl@0
   953
	TFontSpec fSpec(KTestFontTypefaceName,23);
sl@0
   954
	fSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
sl@0
   955
	fSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue);
sl@0
   956
	fSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue);
sl@0
   957
	
sl@0
   958
	CFont *font;
sl@0
   959
	User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont *&)font, fSpec));
sl@0
   960
	CleanupStack::PushL(TCleanupItem(CleanUpFont, font));
sl@0
   961
	
sl@0
   962
	CRemoteGc* remoteGc = CRemoteGc::NewL(device);
sl@0
   963
	CleanupStack::PushL(remoteGc);	
sl@0
   964
sl@0
   965
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
   966
	//-------create image---------
sl@0
   967
	CDirectGdiDriver* theDGdiDriver = CDirectGdiDriver::Static();
sl@0
   968
	User::LeaveIfNull(theDGdiDriver);
sl@0
   969
	const TSize KImageSize = TSize(2, 2);
sl@0
   970
	TSgImageInfo info;
sl@0
   971
	info.iUsage = ESgUsageWindowGcSource;
sl@0
   972
	info.iSizeInPixels = KImageSize;
sl@0
   973
	info.iPixelFormat = EUidPixelFormatRGB_565;
sl@0
   974
	info.iShareable = ETrue;
sl@0
   975
	const TInt stride = KImageSize.iWidth * 2;
sl@0
   976
	TUint8* buf = (TUint8*) (User::AllocL(KImageSize.iHeight * stride));
sl@0
   977
	CleanupStack::PushL(buf);
sl@0
   978
	TUint16* bufCur = ((TUint16*)buf);
sl@0
   979
	*bufCur = KRgbRed.Color64K();
sl@0
   980
	*(bufCur + 1) = KRgbRed.Color64K();
sl@0
   981
	*(bufCur + 2) = KRgbRed.Color64K();
sl@0
   982
	*(bufCur + 3) = KRgbRed.Color64K();
sl@0
   983
sl@0
   984
	RSgImage image;
sl@0
   985
	TInt res = image.Create(info, buf, stride);
sl@0
   986
	User::LeaveIfError(res);
sl@0
   987
	CleanupClosePushL(image);	
sl@0
   988
	RWsDrawableSource drawableSource(TheClient->iWs);
sl@0
   989
	res = drawableSource.Create(image, TheClient->iScreen->GetScreenNumber());
sl@0
   990
	if(res == KErrNotSupported)
sl@0
   991
		{
sl@0
   992
		INFO_PRINTF1(_L("The current screen is not supports drawable source. This test case terminates now."));
sl@0
   993
		CleanupStack::PopAndDestroy(3, remoteGc);
sl@0
   994
		CleanupStack::Pop();//font
sl@0
   995
		TheClient->iScreen->ReleaseFont(font);
sl@0
   996
		return;
sl@0
   997
		}
sl@0
   998
	User::LeaveIfError(res);
sl@0
   999
	CleanupClosePushL(drawableSource);	
sl@0
  1000
	//-------end create image---------
sl@0
  1001
#endif	
sl@0
  1002
	remoteGc->ResetCommandBuffer();
sl@0
  1003
	remoteGc->BeginDraw(TRect(0, 0, TestWin->Size().iWidth, TestWin->Size().iHeight));
sl@0
  1004
	//Capturing the commands in remote gc
sl@0
  1005
	remoteGc->Clear();
sl@0
  1006
	remoteGc->DrawRect(TRect(10,10,30,30));
sl@0
  1007
	remoteGc->Clear(TRect(10,10,11,11));
sl@0
  1008
	remoteGc->CopyRect(TPoint(5,5), TRect(25,25,30,30));
sl@0
  1009
	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
sl@0
  1010
	CFbsBitmap* bitmapMask = new (ELeave) CFbsBitmap;
sl@0
  1011
	User::LeaveIfError(bitmap->Load(_L("Z:\\WSTEST\\WSAUTOTEST.MBM"), EMbmWsautotestCircles24b));
sl@0
  1012
	User::LeaveIfError(bitmapMask->Load(_L("Z:\\WSTEST\\WSAUTOTEST.MBM"), EMbmWsautotestCircles_mask2b));
sl@0
  1013
	remoteGc->BitBlt(TPoint(100,100), bitmap);
sl@0
  1014
	remoteGc->BitBlt(TPoint(0,0), bitmap, TRect(0,0,1,1));	
sl@0
  1015
	remoteGc->BitBltMasked(TPoint(0,5), bitmap, TRect(0,0,1,1), bitmapMask, EFalse);
sl@0
  1016
	CWsBitmap* bitmapWs = new (ELeave) CWsBitmap(TheClient->iWs);
sl@0
  1017
	CWsBitmap* bitmapWsMask = new (ELeave) CWsBitmap(TheClient->iWs);
sl@0
  1018
	User::LeaveIfError(bitmapWs->Load(_L("Z:\\WSTEST\\TEST.MBM"), 0));
sl@0
  1019
	remoteGc->BitBlt(TPoint(110,110), bitmapWs);
sl@0
  1020
	remoteGc->BitBlt(TPoint(5,0), bitmapWs, TRect(0,0,1,1));
sl@0
  1021
	remoteGc->BitBltMasked(TPoint(10,0), bitmap, TRect(0,0,1,1), bitmapWsMask, EFalse);
sl@0
  1022
	remoteGc->SetFadingParameters(128,128);
sl@0
  1023
	remoteGc->SetFaded(EFalse);	
sl@0
  1024
	remoteGc->AlphaBlendBitmaps(TPoint(2,2), bitmap, TRect(0,0,1,1), bitmapMask, TPoint(2,2));
sl@0
  1025
	remoteGc->AlphaBlendBitmaps(TPoint(3,3), bitmapWs, TRect(0,0,1,1), bitmapWsMask, TPoint(2,2));
sl@0
  1026
	remoteGc->SetOrigin(TPoint(0,30));
sl@0
  1027
	remoteGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  1028
	remoteGc->SetClippingRect(TRect(0,0,10,10));
sl@0
  1029
	remoteGc->SetPenStyle(CGraphicsContext::ESolidPen);
sl@0
  1030
	remoteGc->SetPenSize(TSize(1,2));
sl@0
  1031
	remoteGc->UseBrushPattern(bitmap);
sl@0
  1032
	remoteGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1033
	remoteGc->SetBrushOrigin(TPoint(0,0));
sl@0
  1034
	remoteGc->DrawPie(TRect(0,0,15,15),TPoint(0,8),TPoint(15,8));
sl@0
  1035
	remoteGc->CancelClippingRect();
sl@0
  1036
	remoteGc->DiscardBrushPattern();
sl@0
  1037
	remoteGc->CancelClippingRegion();
sl@0
  1038
	remoteGc->Reset();
sl@0
  1039
	remoteGc->SetOrigin(TPoint(0,0));
sl@0
  1040
	remoteGc->SetUnderlineStyle(EUnderlineOff);
sl@0
  1041
	remoteGc->SetStrikethroughStyle(EStrikethroughOff);
sl@0
  1042
	remoteGc->SetWordJustification(1,2);
sl@0
  1043
	remoteGc->SetCharJustification(1,2);
sl@0
  1044
	remoteGc->UseFont(font);
sl@0
  1045
	remoteGc->DrawText(KBuffText,TRect(50,0,100,50),10,CGraphicsContext::ELeft,0);
sl@0
  1046
	remoteGc->DrawTextVertical(KBuffText,TPoint(170,20),EFalse);
sl@0
  1047
	remoteGc->DrawTextVertical(KBuffText,TRect(120,20,150,100),5,EFalse,CGraphicsContext::ELeft,0);	
sl@0
  1048
	remoteGc->MoveTo(TPoint(25,150));
sl@0
  1049
	remoteGc->MoveBy(TPoint(5,5));
sl@0
  1050
	remoteGc->DrawLineTo(TPoint(35,160));
sl@0
  1051
	remoteGc->DrawLine(TPoint(35,160),TPoint(25,150));
sl@0
  1052
	remoteGc->DrawLineBy(TPoint(15,6));	
sl@0
  1053
	remoteGc->Plot(TPoint(5,5));	
sl@0
  1054
	remoteGc->DrawArc(TRect(0,80,10,90),TPoint(0,85),TPoint(10,85));
sl@0
  1055
	remoteGc->DrawEllipse(TRect(0,90,10,100));	
sl@0
  1056
	remoteGc->DrawRoundRect(TRect(30,80,50,100),TSize(5,5));	
sl@0
  1057
	remoteGc->DrawBitmap(TPoint(150,150),bitmap);	
sl@0
  1058
	remoteGc->DrawBitmap(TRect(160,160,170,170), bitmap);	
sl@0
  1059
	remoteGc->DrawBitmap(TRect(175,175,180,180), bitmap, TRect(0,5,5,10));	
sl@0
  1060
	remoteGc->DrawBitmapMasked(TRect(185,185,190,190), bitmap, TRect(0,50,5,55),bitmapMask,EFalse);
sl@0
  1061
	remoteGc->DrawBitmapMasked(TRect(195,195,200,200), bitmapWs, TRect(0,50,5,55),bitmapWsMask,EFalse);		
sl@0
  1062
	CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
sl@0
  1063
	CleanupStack::PushL(polyPoints);
sl@0
  1064
	TRect rect (200,0,200,100);
sl@0
  1065
	polyPoints->AppendL(rect.iTl);
sl@0
  1066
	polyPoints->AppendL(rect.Center());
sl@0
  1067
	polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));	
sl@0
  1068
	remoteGc->DrawPolyLine(polyPoints);
sl@0
  1069
	remoteGc->DrawPolyLine(&polyPoints->At(0), 3);
sl@0
  1070
	remoteGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
sl@0
  1071
	remoteGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
sl@0
  1072
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
  1073
	MWsDrawResource* dr = static_cast<MWsDrawResource*>(remoteGc->Interface(KMWsDrawResourceInterfaceUid));
sl@0
  1074
	if(dr)
sl@0
  1075
		dr->DrawResource(TPoint(30, 40), drawableSource);
sl@0
  1076
#endif
sl@0
  1077
	RRegion region;
sl@0
  1078
	remoteGc->SetClippingRegion(region);
sl@0
  1079
	remoteGc->DiscardFont();
sl@0
  1080
	remoteGc->EndDraw();
sl@0
  1081
sl@0
  1082
	RWsGraphicMsgBuf msgBuf;
sl@0
  1083
	CleanupClosePushL(msgBuf);
sl@0
  1084
	//Externalize the captured commands from remote gc in to a buffer
sl@0
  1085
	remoteGc->ExternalizeL(msgBuf, EFalse);
sl@0
  1086
	
sl@0
  1087
	CCommandBuffer* cmdBuf = CCommandBuffer::NewL();
sl@0
  1088
	CleanupStack::PushL(cmdBuf);
sl@0
  1089
	const CCommandBuffer* testCmdBuf = CCommandBuffer::NewL();
sl@0
  1090
	if(cmdBuf->IsIdentical(*testCmdBuf)==EFalse)
sl@0
  1091
		{
sl@0
  1092
		User::Panic(_L("TestCommandBufferL"), KErrGeneral);
sl@0
  1093
		}
sl@0
  1094
	delete testCmdBuf;
sl@0
  1095
	//Internalize the buffer with captured commands (from CRemoteGC) 
sl@0
  1096
	//in to CCommandBuffer
sl@0
  1097
	cmdBuf->InternalizeL(msgBuf.Pckg());
sl@0
  1098
	
sl@0
  1099
	TheGc->Activate(*TestWin->Win());
sl@0
  1100
	TestWin->Win()->Invalidate();
sl@0
  1101
	
sl@0
  1102
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
  1103
	/*
sl@0
  1104
	 * Make sure anything that can leave is done outside the
sl@0
  1105
	 * BeginRedraw/EndRedraw bracket.
sl@0
  1106
	 */
sl@0
  1107
	CWSGraphicsRes* wsGrap=new(ELeave) CWSGraphicsRes();
sl@0
  1108
	CleanupStack::PushL(wsGrap);
sl@0
  1109
#endif
sl@0
  1110
	/*
sl@0
  1111
	 * Note we need to still do BeginRedraw/EndRedraw for the TestWin Window
sl@0
  1112
	 * even though the CRemoteGc we are going to Play into TestWin already has
sl@0
  1113
	 * BeginRedraw/EndRedraw commands issued into it.  Those commands just allow
sl@0
  1114
	 * for replacement of draw ops already in the CRemoteGc to be replaced by
sl@0
  1115
	 * new draw ops covering the same area.  The BeginRedraw/EndRedraws never 
sl@0
  1116
	 * get Play()'ed into TestWin.
sl@0
  1117
	 */
sl@0
  1118
	TestWin->Win()->BeginRedraw();
sl@0
  1119
	TheGc->Clear();
sl@0
  1120
	//Play the commands on test window using command buffer
sl@0
  1121
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
  1122
	cmdBuf->Play(TPoint(), NULL, TRect(TestWin->Size()), TheClient->iWs, *TheGc);
sl@0
  1123
#endif
sl@0
  1124
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
  1125
	cmdBuf->Play(TPoint(),TRect(TestWin->Size()),*wsGrap,*TheGc);
sl@0
  1126
	CleanupStack::PopAndDestroy(wsGrap);
sl@0
  1127
#endif
sl@0
  1128
	TheGc->Deactivate();
sl@0
  1129
	TestWin->Win()->EndRedraw();
sl@0
  1130
	remoteGc->ResetCommandBuffer();
sl@0
  1131
	BaseWin->Win()->Invalidate();
sl@0
  1132
	BaseWin->Win()->BeginRedraw();
sl@0
  1133
	TheGc->Activate(*BaseWin->Win());
sl@0
  1134
	TheGc->Clear();
sl@0
  1135
	TheGc->DrawRect(TRect(10,10,30,30));
sl@0
  1136
	TheGc->Clear(TRect(10,10,11,11));
sl@0
  1137
	TheGc->CopyRect(TPoint(5,5), TRect(25,25,30,30));
sl@0
  1138
	TheGc->BitBlt(TPoint(100,100), bitmap);
sl@0
  1139
	TheGc->BitBlt(TPoint(0,0), bitmap, TRect(0,0,1,1));	
sl@0
  1140
	TheGc->BitBltMasked(TPoint(0,5), bitmap, TRect(0,0,1,1), bitmapMask, EFalse);
sl@0
  1141
	TheGc->BitBlt(TPoint(110,110), bitmapWs);
sl@0
  1142
	TheGc->BitBlt(TPoint(5,0), bitmapWs, TRect(0,0,1,1));
sl@0
  1143
	TheGc->BitBltMasked(TPoint(10,0), bitmap, TRect(0,0,1,1), bitmapWsMask, EFalse);
sl@0
  1144
	TheGc->SetFadingParameters(128,128);
sl@0
  1145
	TheGc->SetFaded(EFalse);	
sl@0
  1146
	TheGc->AlphaBlendBitmaps(TPoint(2,2), bitmap, TRect(0,0,1,1), bitmapMask, TPoint(2,2));
sl@0
  1147
	TheGc->AlphaBlendBitmaps(TPoint(3,3), bitmapWs, TRect(0,0,1,1), bitmapWsMask, TPoint(2,2));
sl@0
  1148
	TheGc->SetOrigin(TPoint(0,30));
sl@0
  1149
	TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  1150
	TheGc->SetClippingRect(TRect(0,0,10,10));
sl@0
  1151
	TheGc->SetPenStyle(CGraphicsContext::ESolidPen);
sl@0
  1152
	TheGc->SetPenSize(TSize(1,2));
sl@0
  1153
	TheGc->UseBrushPattern(bitmap);
sl@0
  1154
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1155
	TheGc->SetBrushOrigin(TPoint(0,0));
sl@0
  1156
	TheGc->DrawPie(TRect(0,0,15,15),TPoint(0,8),TPoint(15,8));
sl@0
  1157
	TheGc->CancelClippingRect();
sl@0
  1158
	TheGc->DiscardBrushPattern();
sl@0
  1159
	TheGc->CancelClippingRegion();
sl@0
  1160
	TheGc->Reset();
sl@0
  1161
	TheGc->SetOrigin(TPoint(0,0));
sl@0
  1162
	TheGc->SetUnderlineStyle(EUnderlineOff);
sl@0
  1163
	TheGc->SetStrikethroughStyle(EStrikethroughOff);
sl@0
  1164
	TheGc->SetWordJustification(1,2);
sl@0
  1165
	TheGc->SetCharJustification(1,2);
sl@0
  1166
	TheGc->UseFont(font);
sl@0
  1167
	TheGc->DrawText(KBuffText,TRect(50,0,100,50),10,CGraphicsContext::ELeft,0);
sl@0
  1168
	TheGc->DrawTextVertical(KBuffText,TPoint(170,20),EFalse);
sl@0
  1169
	TheGc->DrawTextVertical(KBuffText,TRect(120,20,150,100),5,EFalse,CGraphicsContext::ELeft,0);	
sl@0
  1170
	TheGc->MoveTo(TPoint(25,150));
sl@0
  1171
	TheGc->MoveBy(TPoint(5,5));
sl@0
  1172
	TheGc->DrawLineTo(TPoint(35,160));
sl@0
  1173
	TheGc->DrawLine(TPoint(35,160),TPoint(25,150));
sl@0
  1174
	TheGc->DrawLineBy(TPoint(15,6));	
sl@0
  1175
	TheGc->Plot(TPoint(5,5));	
sl@0
  1176
	TheGc->DrawArc(TRect(0,80,10,90),TPoint(0,85),TPoint(10,85));
sl@0
  1177
	TheGc->DrawEllipse(TRect(0,90,10,100));	
sl@0
  1178
	TheGc->DrawRoundRect(TRect(30,80,50,100),TSize(5,5));	
sl@0
  1179
	TheGc->DrawBitmap(TPoint(150,150),bitmap);	
sl@0
  1180
	TheGc->DrawBitmap(TRect(160,160,170,170), bitmap);	
sl@0
  1181
	TheGc->DrawBitmap(TRect(175,175,180,180), bitmap, TRect(0,5,5,10));	
sl@0
  1182
	TheGc->DrawBitmapMasked(TRect(185,185,190,190), bitmap, TRect(0,50,5,55),bitmapMask,EFalse);
sl@0
  1183
	TheGc->DrawBitmapMasked(TRect(195,195,200,200), bitmapWs, TRect(0,50,5,55),bitmapWsMask,EFalse);
sl@0
  1184
	TheGc->DrawPolyLine(polyPoints);
sl@0
  1185
	TheGc->DrawPolyLine(&polyPoints->At(0), 3);
sl@0
  1186
	TheGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
sl@0
  1187
	TheGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
sl@0
  1188
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
  1189
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1190
	TheGc->SetBrushColor(KRgbRed);
sl@0
  1191
	TheGc->SetPenColor(KRgbRed);
sl@0
  1192
	TheGc->DrawRect(TRect(30, 40, 32, 42));
sl@0
  1193
#endif
sl@0
  1194
	TheGc->DiscardFont();
sl@0
  1195
	TheGc->Deactivate();
sl@0
  1196
	BaseWin->Win()->EndRedraw();
sl@0
  1197
	TheClient->Flush();
sl@0
  1198
	TheClient->WaitForRedrawsToFinish();
sl@0
  1199
sl@0
  1200
	//Check the text drawn on base and test windows.
sl@0
  1201
	TBool err = CheckRect(BaseWin, TestWin, TRect(0, 0, BaseWin->Size().iWidth, BaseWin->Size().iHeight), _L("CTGc::TestCommandBufferL()"));
sl@0
  1202
	if (err)
sl@0
  1203
	    {
sl@0
  1204
	    INFO_PRINTF1(_L("The CheckRect function returned error."));
sl@0
  1205
	    }
sl@0
  1206
	delete bitmap;
sl@0
  1207
	INFO_PRINTF1(_L("bitmap deleted."));
sl@0
  1208
	delete bitmapMask;
sl@0
  1209
	INFO_PRINTF1(_L("bitmapMask deleted."));
sl@0
  1210
	delete bitmapWs;
sl@0
  1211
	INFO_PRINTF1(_L("bitmapWs deleted."));
sl@0
  1212
	delete bitmapWsMask;
sl@0
  1213
	INFO_PRINTF1(_L("bitmapWsMask deleted."));
sl@0
  1214
	
sl@0
  1215
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
  1216
	CleanupStack::PopAndDestroy(7, remoteGc);
sl@0
  1217
#else
sl@0
  1218
	CleanupStack::PopAndDestroy(4, remoteGc);
sl@0
  1219
#endif	
sl@0
  1220
	CleanupStack::Pop();//font
sl@0
  1221
	INFO_PRINTF1(_L("CleanupStack popped."));
sl@0
  1222
	TheClient->iScreen->ReleaseFont(font);
sl@0
  1223
	}
sl@0
  1224
sl@0
  1225
/**
sl@0
  1226
@SYMTestCaseID		GRAPHICS-WSERV-0482
sl@0
  1227
@SYMPREQ            1841
sl@0
  1228
@SYMTestCaseDesc    Play empty command buffer.
sl@0
  1229
@SYMTestPriority    Medium
sl@0
  1230
@SYMTestStatus      Implemented
sl@0
  1231
@SYMTestActions
sl@0
  1232
@SYMTestExpectedResults return KErrEof error
sl@0
  1233
*/
sl@0
  1234
void CTGc::TestEmptyCommandBufferL()
sl@0
  1235
	{
sl@0
  1236
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
  1237
	CWSGraphicsRes* wsGrap = new (ELeave) CWSGraphicsRes();
sl@0
  1238
	CleanupStack::PushL(wsGrap);
sl@0
  1239
#endif
sl@0
  1240
sl@0
  1241
	CCommandBuffer* cmdBuf = CCommandBuffer::NewL();
sl@0
  1242
	CleanupStack::PushL(cmdBuf);
sl@0
  1243
sl@0
  1244
	TheGc->Activate(*TestWin->Win());
sl@0
  1245
	TheGc->Clear();
sl@0
  1246
	//Play the commands on test window using command buffer
sl@0
  1247
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
  1248
	TInt err = cmdBuf->Play(TPoint(),TRect(TestWin->Size()),*wsGrap,*TheGc);
sl@0
  1249
#else
sl@0
  1250
	TInt err = cmdBuf->Play(TPoint(),NULL,TRect(TestWin->Size()),TheClient->iWs,*TheGc);
sl@0
  1251
#endif
sl@0
  1252
	if(err!=KErrEof)
sl@0
  1253
		{
sl@0
  1254
		User::Panic(_L("TestEmptyCommandBufferL"), KErrGeneral);
sl@0
  1255
		}
sl@0
  1256
	TheGc->Deactivate();
sl@0
  1257
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
  1258
	CleanupStack::PopAndDestroy(2, wsGrap); //cmdBuf, wsGrap, msgBuf and remoteGc
sl@0
  1259
#else
sl@0
  1260
	CleanupStack::PopAndDestroy(cmdBuf);
sl@0
  1261
#endif
sl@0
  1262
	}
sl@0
  1263
sl@0
  1264
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
  1265
/**
sl@0
  1266
@SYMTestCaseID		GRAPHICS-WSERV-0486
sl@0
  1267
@SYMPREQ            PREQ2095
sl@0
  1268
@SYMTestCaseDesc    Draw text using CWindowGc and CRemoteGc with both outline and shadow
sl@0
  1269
effect on.
sl@0
  1270
@SYMTestPriority    High
sl@0
  1271
@SYMTestStatus      Implemented
sl@0
  1272
@SYMTestActions     Create a font with both outline and shadow effects, also use ClippingRect 
sl@0
  1273
and ClippingRegion. Record the commands using CRemoteGc and play the recorded commands on a 
sl@0
  1274
bitmap using MWsGraphicsContext. Use the same commands in CWindowGc and draw text on a 
sl@0
  1275
different window
sl@0
  1276
@SYMTestExpectedResults Text drawn using CWindowGc and CRemoteGc(MWsGraphicsContext) should be same
sl@0
  1277
*/
sl@0
  1278
void CTGc::TestCRemoteGcAndMWsGraphicsContextClippingRectL()
sl@0
  1279
	{
sl@0
  1280
	const TRect KTestRect(0, 0, TestWin->Size().iWidth, TestWin->Size().iHeight);
sl@0
  1281
	const TRegionFix<1> KTestRegion(KTestRect);
sl@0
  1282
	const TRect KClippingRect1(5, 5, TestWin->Size().iWidth-10, 90);
sl@0
  1283
	const TRegionFix<1> KClippingRegion(KClippingRect1);
sl@0
  1284
	const TRect KClippingRect2(15, 15, TestWin->Size().iWidth-10, TestWin->Size().iHeight-10);
sl@0
  1285
	
sl@0
  1286
	CWsScreenDevice* device = TheClient->iScreen;
sl@0
  1287
	/*
sl@0
  1288
	 * On hardware, the first screen runs in 64K colors, but the second screen (TV OUT)
sl@0
  1289
	 * cannot run in this mode, it instead falls back to 16M colors.  We need to ensure
sl@0
  1290
	 * that we use matching color depths for our off-screen bitmaps so that accuracy is
sl@0
  1291
	 * not lost since we compare bitmaps from the screen versus off-screen.
sl@0
  1292
	 */
sl@0
  1293
	TDisplayMode displayMode = device->DisplayMode();
sl@0
  1294
	if (TDisplayModeUtils::NumDisplayModeBitsPerPixel(displayMode) == 32)
sl@0
  1295
	    {
sl@0
  1296
	    displayMode = EColor16MAP;
sl@0
  1297
	    }
sl@0
  1298
		
sl@0
  1299
	_LIT(KText,"RemoteGc & MWsGraphicsContext");
sl@0
  1300
	TFontSpec fSpec(KTestFontTypefaceName,23);
sl@0
  1301
	fSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
sl@0
  1302
	fSpec.iFontStyle.SetEffects(FontEffect::EDropShadow, ETrue);
sl@0
  1303
	fSpec.iFontStyle.SetEffects(FontEffect::EOutline, ETrue);
sl@0
  1304
	
sl@0
  1305
	CFont *font;
sl@0
  1306
	User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont *&)font, fSpec));
sl@0
  1307
	CleanupStack::PushL(TCleanupItem(CleanUpFont, font));
sl@0
  1308
sl@0
  1309
	//Record the commands using CRemoteGc
sl@0
  1310
	CRemoteGc* remoteGc = CRemoteGc::NewL(device);
sl@0
  1311
	CleanupStack::PushL(remoteGc);
sl@0
  1312
	remoteGc->BeginDraw(KTestRect);
sl@0
  1313
	//fill background with white
sl@0
  1314
	remoteGc->SetPenStyle(CFbsBitGc::ENullPen);
sl@0
  1315
	remoteGc->SetBrushStyle(CFbsBitGc::ESolidBrush);
sl@0
  1316
	remoteGc->SetBrushColor(KRgbWhite);
sl@0
  1317
	remoteGc->DrawRect(TRect(TPoint(0,0), TestWin->Size()));
sl@0
  1318
	remoteGc->SetPenStyle(CFbsBitGc::ESolidPen);
sl@0
  1319
	//Capturing the commands in remote gc
sl@0
  1320
	remoteGc->SetClippingRect(KClippingRect2);
sl@0
  1321
	remoteGc->SetClippingRegion(KClippingRegion);
sl@0
  1322
	remoteGc->SetBrushStyle(CFbsBitGc::ESolidBrush);
sl@0
  1323
	remoteGc->SetBrushColor(TRgb(0,150,150));
sl@0
  1324
	remoteGc->DrawRect(TRect(TPoint(0,0), TSize(160,60)));
sl@0
  1325
	remoteGc->SetBrushColor(TRgb(150,100,150));
sl@0
  1326
	remoteGc->DrawRect(TRect(TPoint(0,60), TSize(160,60)));
sl@0
  1327
	remoteGc->SetBrushColor(KRgbGreen);
sl@0
  1328
	remoteGc->SetShadowColor(KRgbDarkRed);
sl@0
  1329
	remoteGc->SetPenColor(KRgbBlack);
sl@0
  1330
	remoteGc->UseFont(font);
sl@0
  1331
	remoteGc->DrawText(KText, TPoint(2,40));
sl@0
  1332
	remoteGc->DiscardFont();
sl@0
  1333
	remoteGc->EndDraw();
sl@0
  1334
sl@0
  1335
	RWsGraphicMsgBuf msgBuf;
sl@0
  1336
	CleanupClosePushL(msgBuf);
sl@0
  1337
	//Externalize the captured commands from remote gc in to a buffer
sl@0
  1338
	remoteGc->ExternalizeL(msgBuf, ETrue);
sl@0
  1339
	
sl@0
  1340
	CCommandBuffer* cmdBuf = CCommandBuffer::NewL();
sl@0
  1341
	CleanupStack::PushL(cmdBuf);
sl@0
  1342
	//Internalize the buffer with captured commands (from CRemoteGC) 
sl@0
  1343
	//in to CCommandBuffer
sl@0
  1344
	cmdBuf->InternalizeL(msgBuf.Pckg());
sl@0
  1345
	
sl@0
  1346
	CDirectGdiDriver* theDGdiDriver = CDirectGdiDriver::Static();
sl@0
  1347
	User::LeaveIfNull(theDGdiDriver);
sl@0
  1348
	
sl@0
  1349
	TSgImageInfo info;
sl@0
  1350
	info.iUsage = ESgUsageDirectGdiTarget | ESgUsageDirectGdiSource | ESgUsageCompositionSource;
sl@0
  1351
	info.iSizeInPixels = TestWin->Size();
sl@0
  1352
	info.iPixelFormat = PixelFormatFromDisplayMode(displayMode);
sl@0
  1353
	
sl@0
  1354
	RSgImageCollection imageCollection;
sl@0
  1355
	CleanupClosePushL(imageCollection);
sl@0
  1356
	TInt res = imageCollection.Create(info, 1);
sl@0
  1357
	User::LeaveIfError(res);
sl@0
  1358
	RSgImage image;
sl@0
  1359
	CleanupClosePushL(image);
sl@0
  1360
	res = imageCollection.OpenImage(0, image);
sl@0
  1361
	User::LeaveIfError(res);
sl@0
  1362
	RDirectGdiImageTarget imageTarget(*theDGdiDriver);
sl@0
  1363
	CleanupClosePushL(imageTarget);
sl@0
  1364
	
sl@0
  1365
	res = imageTarget.Create(image);
sl@0
  1366
	User::LeaveIfError(res);
sl@0
  1367
	
sl@0
  1368
	CDirectGdiGcWrapper* directGdiGcWrapper = CDirectGdiGcWrapper::NewL(imageTarget);
sl@0
  1369
	CleanupStack::PushL(directGdiGcWrapper);
sl@0
  1370
	
sl@0
  1371
	//Dummy class created
sl@0
  1372
	CWSGraphicsRes* wsGrap = new (ELeave) CWSGraphicsRes();
sl@0
  1373
	CleanupStack::PushL(wsGrap);
sl@0
  1374
sl@0
  1375
	//Play the commands on test window using command buffer
sl@0
  1376
	cmdBuf->Play(TPoint(),&KTestRegion,KTestRect,*wsGrap,*directGdiGcWrapper);
sl@0
  1377
sl@0
  1378
	//Set window back to same as test bitmap background
sl@0
  1379
	BaseWin->Win()->SetBackgroundColor(KRgbWhite);
sl@0
  1380
sl@0
  1381
	BaseWin->Win()->Invalidate();
sl@0
  1382
	BaseWin->Win()->BeginRedraw();
sl@0
  1383
	TheGc->Activate(*BaseWin->Win());
sl@0
  1384
	TheGc->Clear();
sl@0
  1385
	TheGc->SetClippingRect(KClippingRect2);
sl@0
  1386
	TheGc->SetClippingRegion(KClippingRegion);
sl@0
  1387
	TheGc->SetBrushStyle(CFbsBitGc::ESolidBrush);
sl@0
  1388
	TheGc->SetBrushColor(TRgb(0,150,150));
sl@0
  1389
	TheGc->DrawRect(TRect(TPoint(0,0), TSize(160,60)));
sl@0
  1390
	TheGc->SetBrushColor(TRgb(150,100,150));
sl@0
  1391
	TheGc->DrawRect(TRect(TPoint(0,60), TSize(160,60)));
sl@0
  1392
	TheGc->SetBrushColor(KRgbGreen);
sl@0
  1393
	TheGc->SetShadowColor(KRgbDarkRed);
sl@0
  1394
	TheGc->SetPenColor(KRgbBlack);
sl@0
  1395
	TheGc->UseFont(font);
sl@0
  1396
	//Draw the text on base window using CWindowGC
sl@0
  1397
	TheGc->DrawText(KText, TPoint(2, 40));
sl@0
  1398
	TheGc->DiscardFont();
sl@0
  1399
	TheGc->Deactivate();
sl@0
  1400
	BaseWin->Win()->EndRedraw();
sl@0
  1401
	TheClient->iWs.Finish();
sl@0
  1402
	TheClient->WaitForRedrawsToFinish();
sl@0
  1403
sl@0
  1404
	//Create a bitmap and then copy the screen to it
sl@0
  1405
	TRect rc(TRect(BaseWin->Win()->AbsPosition(), BaseWin->Win()->Size()));
sl@0
  1406
	CFbsBitmap *screenBitmap = new (ELeave) CFbsBitmap();
sl@0
  1407
	User::LeaveIfError(screenBitmap->Create(rc.Size(), displayMode));
sl@0
  1408
	CleanupStack::PushL(screenBitmap);
sl@0
  1409
	TheClient->iScreen->CopyScreenToBitmap(screenBitmap, rc);
sl@0
  1410
sl@0
  1411
	CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
sl@0
  1412
	CleanupStack::PushL(bitmap);
sl@0
  1413
sl@0
  1414
	image.GetInfo(info);
sl@0
  1415
	bitmap->Create(info.iSizeInPixels, displayMode);
sl@0
  1416
	TRect rect(info.iSizeInPixels);
sl@0
  1417
	CopyImageToBitmapL(bitmap, image, rect);
sl@0
  1418
sl@0
  1419
	//Test to see if the bitmap drawn to using CRemoteGc is the same as the screen copy bitmap
sl@0
  1420
	TInt differentPixels = 0;
sl@0
  1421
	res = LossyCompareBitmapRecord(*bitmap, *screenBitmap, KTestRect, EFalse, differentPixels, Logger());
sl@0
  1422
	if (differentPixels != 0)
sl@0
  1423
		{
sl@0
  1424
		INFO_PRINTF2(_L(" Pixels different %d"), differentPixels);
sl@0
  1425
		}
sl@0
  1426
	TEST(res);
sl@0
  1427
	CleanupStack::PopAndDestroy(10, remoteGc); //screenBitmap, imageCollection, image, imageTarget, directGdiGcWrapper, cmdBuf, wsGrap, msgBuf, remoteGc, bitmap
sl@0
  1428
	CleanupStack::Pop();//font
sl@0
  1429
	TheClient->iScreen->ReleaseFont(font);
sl@0
  1430
	}
sl@0
  1431
sl@0
  1432
/**
sl@0
  1433
@SYMTestCaseID		GRAPHICS-WSERV-0487
sl@0
  1434
@SYMPREQ            PREQ2095
sl@0
  1435
@SYMTestCaseDesc    Draw text using CRemoteGc and DrawText(const TDesC&,const TTextParameters*,const TPoint&)
sl@0
  1436
@SYMTestPriority    High
sl@0
  1437
@SYMTestStatus      Implemented
sl@0
  1438
@SYMTestActions     Create a font.  Draw text to a bitmap with the font using CFbsBitGc::DrawText. Draw text with the font using CFbsBitGc::DrawText.
sl@0
  1439
Record the same DrawText commands using CRemoteGc and play the recorded commands on a 
sl@0
  1440
bitmap using MWsGraphicsContext. Compare the two bitmaps.
sl@0
  1441
@SYMTestExpectedResults Text drawn using CFbsBitGc and CRemoteGc(MWsGraphicsContext) should be the same
sl@0
  1442
*/
sl@0
  1443
void CTGc::TestCRemoteGcDrawTextInContextPointL()
sl@0
  1444
	{
sl@0
  1445
	CDrawTextInContextTestPoint* test = CDrawTextInContextTestPoint::NewL();
sl@0
  1446
	CleanupStack::PushL(test);
sl@0
  1447
	test->Test();
sl@0
  1448
	TEST(test->HasPassedTest());
sl@0
  1449
	CleanupStack::PopAndDestroy(); //test
sl@0
  1450
	}
sl@0
  1451
sl@0
  1452
/**
sl@0
  1453
@SYMTestCaseID		GRAPHICS-WSERV-0488
sl@0
  1454
@SYMPREQ            PREQ2095
sl@0
  1455
@SYMTestCaseDesc    Draw text using CRemoteGc and DrawText(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt)
sl@0
  1456
@SYMTestPriority    High
sl@0
  1457
@SYMTestStatus      Implemented
sl@0
  1458
@SYMTestActions     Create a font.  Draw text to a bitmap with the font using CFbsBitGc::DrawText. Draw text with the font using CFbsBitGc::DrawText.
sl@0
  1459
Record the same DrawText commands using CRemoteGc and play the recorded commands on a 
sl@0
  1460
bitmap using MWsGraphicsContext. Compare the two bitmaps.
sl@0
  1461
@SYMTestExpectedResults Text drawn using CFbsBitGc and CRemoteGc(MWsGraphicsContext) should be the same
sl@0
  1462
*/
sl@0
  1463
void CTGc::TestCRemoteGcDrawTextInContextBoxL()
sl@0
  1464
	{
sl@0
  1465
	CDrawTextInContextTestBox* test = CDrawTextInContextTestBox::NewL();
sl@0
  1466
	CleanupStack::PushL(test);
sl@0
  1467
	test->Test();
sl@0
  1468
	TEST(test->HasPassedTest());
sl@0
  1469
	CleanupStack::PopAndDestroy(); //test
sl@0
  1470
	}
sl@0
  1471
sl@0
  1472
/**
sl@0
  1473
@SYMTestCaseID		GRAPHICS-WSERV-0489
sl@0
  1474
@SYMPREQ            PREQ2095
sl@0
  1475
@SYMTestCaseDesc    Draw text using CRemoteGc and DrawTextVertical(const TDesC&,const TTextParameters*,const TPoint&)
sl@0
  1476
@SYMTestPriority    High
sl@0
  1477
@SYMTestStatus      Implemented
sl@0
  1478
@SYMTestActions     Create a font.  Draw text to a bitmap with the font using CFbsBitGc::DrawTextVertical. Draw text with the font using CFbsBitGc::DrawText.
sl@0
  1479
Record the same DrawText commands using CRemoteGc and play the recorded commands on a 
sl@0
  1480
bitmap using MWsGraphicsContext. Compare the two bitmaps.
sl@0
  1481
@SYMTestExpectedResults Text drawn using CFbsBitGc and CRemoteGc(MWsGraphicsContext) should be the same
sl@0
  1482
*/
sl@0
  1483
void CTGc::TestCRemoteGcDrawTextInContextPointVerticalL()
sl@0
  1484
	{
sl@0
  1485
	CDrawTextInContextTestPointVertical* test = CDrawTextInContextTestPointVertical::NewL();
sl@0
  1486
	CleanupStack::PushL(test);
sl@0
  1487
	test->Test();
sl@0
  1488
	TEST(test->HasPassedTest());
sl@0
  1489
	CleanupStack::PopAndDestroy(); //test
sl@0
  1490
	}
sl@0
  1491
sl@0
  1492
/**
sl@0
  1493
@SYMTestCaseID		GRAPHICS-WSERV-0490
sl@0
  1494
@SYMPREQ            PREQ2095
sl@0
  1495
@SYMTestCaseDesc    Draw text using CRemoteGc and DrawTextVertical(const TDesC&,const TTextParameters*,const TRect&,TInt,TTextAlign,TInt)
sl@0
  1496
@SYMTestPriority    High
sl@0
  1497
@SYMTestStatus      Implemented
sl@0
  1498
@SYMTestActions     Create a font.  Draw text to a bitmap with the font using CFbsBitGc::DrawTextVertical. Draw text with the font using CFbsBitGc::DrawText.
sl@0
  1499
Record the same DrawText commands using CRemoteGc and play the recorded commands on a 
sl@0
  1500
bitmap using MWsGraphicsContext. Compare the two bitmaps.
sl@0
  1501
@SYMTestExpectedResults Text drawn using CFbsBitGc and CRemoteGc(MWsGraphicsContext) should be the same
sl@0
  1502
*/
sl@0
  1503
void CTGc::TestCRemoteGcDrawTextInContextBoxVerticalL()
sl@0
  1504
	{
sl@0
  1505
	CDrawTextInContextTestBoxVertical* test = CDrawTextInContextTestBoxVertical::NewL();
sl@0
  1506
	CleanupStack::PushL(test);
sl@0
  1507
	test->Test();
sl@0
  1508
	TEST(test->HasPassedTest());
sl@0
  1509
	CleanupStack::PopAndDestroy(); //test
sl@0
  1510
	}
sl@0
  1511
#endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
  1512
sl@0
  1513
/**
sl@0
  1514
@SYMTestCaseID		GRAPHICS-WSERV-0494
sl@0
  1515
@SYMDEF				DEF131255
sl@0
  1516
@SYMTestCaseDesc    Negative test to show that using SetBrushStyle() will not panic WServ with different
sl@0
  1517
					brush bitmaps.
sl@0
  1518
@SYMTestPriority    High
sl@0
  1519
@SYMTestStatus      Implemented
sl@0
  1520
@SYMTestActions		Four seperate panic situations are tested:
sl@0
  1521
					1)
sl@0
  1522
                    Create a regular CFbsBitmap, set as brush pattern, and set brush style to EPatternedBrush.
sl@0
  1523
                    Draw a line to force the playback to occur.
sl@0
  1524
                    Call Finish on the GC.
sl@0
  1525
                    Destroy the brush bitmap.
sl@0
  1526
                    2)
sl@0
  1527
                    Create a regular CFbsBitmap, set as brush pattern, and set brush style to EPatternedBrush.
sl@0
  1528
                    Draw a line to force the playback to occur.
sl@0
  1529
                    Destroy the brush bitmap. 
sl@0
  1530
                    Call Finish on the GC.
sl@0
  1531
                    3+4)
sl@0
  1532
                    Create an extended bitmap, set as the brush pattern, and set the brush style to EPatternedBrush.
sl@0
  1533
                    Draw a line to force the playback to occur.
sl@0
  1534
                    Set the brush bitmap and style again.
sl@0
  1535
                    Call Finish on the GC.
sl@0
  1536
                    Destroy the brush bitmap. 
sl@0
  1537
@SYMTestExpectedResults The calls to SetBrushStyle() should not cause WServ to panic when Finish() is called.
sl@0
  1538
*/
sl@0
  1539
void CTGc::TestGcSetBrushPatternL()
sl@0
  1540
	{
sl@0
  1541
	// Extended bitmap test data.
sl@0
  1542
	const TUint8 KTestData[] = "TEST DATA";
sl@0
  1543
	const TInt KTestDataSize = sizeof(KTestData);
sl@0
  1544
	const TUid KTestExtendedBitmapUid = TUid::Uid(0xFFFFFFFF);
sl@0
  1545
	
sl@0
  1546
	// First try using a regular bitmap as the brush pattern.
sl@0
  1547
	BaseWin->Win()->Invalidate();
sl@0
  1548
	BaseWin->Win()->BeginRedraw();
sl@0
  1549
	TheGc->Activate(*BaseWin->Win());	
sl@0
  1550
	CFbsBitmap* bitmapRegular = new (ELeave) CFbsBitmap;
sl@0
  1551
	CleanupStack::PushL(bitmapRegular);
sl@0
  1552
	TInt res = bitmapRegular->Create(TSize(10,10), EColor64K);
sl@0
  1553
	TEST(res == KErrNone);
sl@0
  1554
	//Record the commands using CWindowGc.
sl@0
  1555
	TheGc->UseBrushPattern(bitmapRegular);
sl@0
  1556
	TheGc->SetBrushStyle(CGraphicsContext::EPatternedBrush);
sl@0
  1557
	// DrawLine() is only used here to force playback of the commands.
sl@0
  1558
	TheGc->DrawLine(TPoint(0,0), TPoint(1,1));	
sl@0
  1559
	TheGc->Deactivate();
sl@0
  1560
	BaseWin->Win()->EndRedraw();
sl@0
  1561
	TheClient->iWs.Finish();
sl@0
  1562
	CleanupStack::PopAndDestroy(1, bitmapRegular);
sl@0
  1563
	
sl@0
  1564
	// Secondly, try using a regular bitmap as the brush pattern, but deleting the bitmap
sl@0
  1565
	// before calling Finish().
sl@0
  1566
	BaseWin->Win()->Invalidate();
sl@0
  1567
	BaseWin->Win()->BeginRedraw();
sl@0
  1568
	TheGc->Activate(*BaseWin->Win());		
sl@0
  1569
	bitmapRegular = new (ELeave) CFbsBitmap;
sl@0
  1570
	CleanupStack::PushL(bitmapRegular);
sl@0
  1571
	res = bitmapRegular->Create(TSize(10,10), EColor64K);		
sl@0
  1572
	TEST(res == KErrNone);
sl@0
  1573
	//Record the commands using CWindowGc.
sl@0
  1574
	TheGc->UseBrushPattern(bitmapRegular);
sl@0
  1575
	TheGc->SetBrushStyle(CGraphicsContext::EPatternedBrush);
sl@0
  1576
	TheGc->DrawLine(TPoint(0,0), TPoint(1,1));
sl@0
  1577
	CleanupStack::PopAndDestroy(1, bitmapRegular);	
sl@0
  1578
	TheGc->Deactivate();
sl@0
  1579
	BaseWin->Win()->EndRedraw();
sl@0
  1580
	TheClient->iWs.Finish();
sl@0
  1581
	
sl@0
  1582
	// Thirdly, try using an extended bitmap (which is unsupported by DirectGDI) as 
sl@0
  1583
	// the brush pattern.
sl@0
  1584
	BaseWin->Win()->Invalidate();
sl@0
  1585
	BaseWin->Win()->BeginRedraw();
sl@0
  1586
	TheGc->Activate(*BaseWin->Win());
sl@0
  1587
	// Create a dummy extended bitmap to use as a brush bitmap.
sl@0
  1588
	// This is unsupported by the default implementation of DirectGDI.
sl@0
  1589
	CFbsBitmap* bitmapExtended = new (ELeave) CFbsBitmap;
sl@0
  1590
	CleanupStack::PushL(bitmapExtended);
sl@0
  1591
	res = bitmapExtended->CreateExtendedBitmap(TSize(10,10), EColor64K, KTestExtendedBitmapUid, KTestData, KTestDataSize);
sl@0
  1592
	TEST(res == KErrNone);	
sl@0
  1593
	//Record the commands using CWindowGc.
sl@0
  1594
	TheGc->UseBrushPattern(bitmapExtended);
sl@0
  1595
	TheGc->SetBrushStyle(CGraphicsContext::EPatternedBrush);
sl@0
  1596
	TheGc->DrawLine(TPoint(0,0), TPoint(100,100));
sl@0
  1597
	TheGc->UseBrushPattern(bitmapExtended);
sl@0
  1598
	// Forth, do it twice so that we test the state commands and the drawops commands.
sl@0
  1599
	TheGc->SetBrushStyle(CGraphicsContext::EPatternedBrush);
sl@0
  1600
	TheGc->DrawLine(TPoint(0,0), TPoint(100,100));
sl@0
  1601
	TheGc->Deactivate();
sl@0
  1602
	BaseWin->Win()->EndRedraw();
sl@0
  1603
	TheClient->iWs.Finish();
sl@0
  1604
	CleanupStack::PopAndDestroy(1, bitmapExtended);	
sl@0
  1605
	}
sl@0
  1606
sl@0
  1607
/**
sl@0
  1608
@SYMTestCaseID      GRAPHICS-WSERV-0576
sl@0
  1609
@SYMDEF             
sl@0
  1610
@SYMTestCaseDesc    Checks window server is still able to draw a bitmap, even after the client has released its handle to the bitmap.
sl@0
  1611
@SYMTestPriority    High
sl@0
  1612
@SYMTestStatus      Implemented
sl@0
  1613
@SYMTestActions     - Draw the bitmap to TestWin (keeping the window hidden)
sl@0
  1614
                    - Delete the bitmap
sl@0
  1615
                    - Show TestWin to cause it to be drawn on screen (after the bitmap has been deleted)
sl@0
  1616
                    - Draw the same bitmap (same image, different bitmap object instance) to BaseWin
sl@0
  1617
                    - Compare contents of TestWin with BaseWin
sl@0
  1618
@SYMTestExpectedResults TestWin and BaseWin should both show the bitmap.
sl@0
  1619
*/
sl@0
  1620
void CTGc::TestGcDeleteBitmap1L()
sl@0
  1621
    {
sl@0
  1622
    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
sl@0
  1623
    CleanupStack::PushL(bitmap);
sl@0
  1624
    TInt ret = bitmap->Load(TEST_BITMAP_NAME,0);
sl@0
  1625
    TEST(ret == KErrNone);
sl@0
  1626
sl@0
  1627
    // send drawing to hidden window
sl@0
  1628
    TestWin->SetVisible(EFalse);
sl@0
  1629
    TestWin->Win()->Invalidate();
sl@0
  1630
    TestWin->Win()->BeginRedraw();
sl@0
  1631
    TheGc->Activate(*TestWin->Win());
sl@0
  1632
    TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1633
    TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  1634
    TheGc->SetBrushColor(TRgb(255, 0, 0));
sl@0
  1635
    TheGc->Clear();
sl@0
  1636
    TheGc->BitBlt(TPoint(0,0), bitmap);
sl@0
  1637
    CleanupStack::PopAndDestroy(bitmap); // before the bitmap is actually deleted, WsFbsDestroyCallBack flushes the command buffer to ensure the bitmap is duplicated in the window server thread
sl@0
  1638
    bitmap = NULL;
sl@0
  1639
    TheGc->Deactivate();
sl@0
  1640
    TestWin->Win()->EndRedraw();
sl@0
  1641
    TheClient->iWs.Flush(); // calling Flush rather than Finish, as we don't need to wait for any drawing to happen (as the window is currently hidden)
sl@0
  1642
sl@0
  1643
    // make window visible (forcing it to draw)
sl@0
  1644
    TestWin->SetVisible(ETrue);
sl@0
  1645
    TheClient->iWs.Finish(); // ensure the bitmap has been drawn on test win
sl@0
  1646
sl@0
  1647
    // window server should have duplicated the bitmap when the BitBlt was added to the redraw store, so drawing
sl@0
  1648
    // the window now (by making it visible above) should display the bitmap on screen, even
sl@0
  1649
    // though we've deleted it in this thread
sl@0
  1650
sl@0
  1651
    // now create the bitmap again, and draw it to the base win (for comparison with test win)
sl@0
  1652
    bitmap = new (ELeave) CFbsBitmap;
sl@0
  1653
    CleanupStack::PushL(bitmap);
sl@0
  1654
    ret = bitmap->Load(TEST_BITMAP_NAME,0);
sl@0
  1655
    TEST(ret == KErrNone);
sl@0
  1656
    BaseWin->SetVisible(ETrue);
sl@0
  1657
    BaseWin->Win()->Invalidate();
sl@0
  1658
    BaseWin->Win()->BeginRedraw();
sl@0
  1659
    TheGc->Activate(*BaseWin->Win());   
sl@0
  1660
    TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1661
    TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  1662
    TheGc->SetBrushColor(TRgb(255, 0, 0));
sl@0
  1663
    TheGc->Clear();
sl@0
  1664
    TheGc->BitBlt(TPoint(0,0), bitmap);
sl@0
  1665
    TheGc->Deactivate();
sl@0
  1666
    BaseWin->Win()->EndRedraw();
sl@0
  1667
    TheClient->iWs.Finish(); // ensure the bitmap has been drawn on base win
sl@0
  1668
    
sl@0
  1669
    CleanupStack::PopAndDestroy(bitmap);
sl@0
  1670
sl@0
  1671
    // the test bitmap should be shown in both base win and test win, so we now check that the
sl@0
  1672
    // contents of base win and test win are the same
sl@0
  1673
    CheckRect(BaseWin, TestWin, TRect(0, 0, BaseWin->Size().iWidth, BaseWin->Size().iHeight), _L("CTGc::TestGcDeleteBitmap1L()"));
sl@0
  1674
    }
sl@0
  1675
sl@0
  1676
/**
sl@0
  1677
@SYMTestCaseID      GRAPHICS-WSERV-0577
sl@0
  1678
@SYMDEF             
sl@0
  1679
@SYMTestCaseDesc    Check window server is still able to use a bitmap required by window drawing, even
sl@0
  1680
                    after the client has released its handle to the bitmap. Also check window server 
sl@0
  1681
                    releases the bitmap, when it's no longer used by window drawing.
sl@0
  1682
@SYMTestPriority    High
sl@0
  1683
@SYMTestStatus      Implemented
sl@0
  1684
@SYMTestActions     - Clean BaseWin and TestWin from content that has been left over from previous test
sl@0
  1685
                    - Draw test bitmap to TestWin
sl@0
  1686
                    - Delete the bitmap
sl@0
  1687
                    - Using a different bitmap object instance, duplicate bitmap (the bitmap is still used by window drawing)
sl@0
  1688
                    - Delete the bitmap
sl@0
  1689
                    - Draw new content to TestWin, so that previously drawn bitmap is covered
sl@0
  1690
                    - Duplicate bitmap (the bitmap is no longer used by window drawing)
sl@0
  1691
@SYMTestExpectedResults Bitmap duplication succeeds, when the bitmap used by window drawing, whereas
sl@0
  1692
                        bitmap duplication fails, when the bitmap is no longer used by window drawing.
sl@0
  1693
*/
sl@0
  1694
void CTGc::TestGcDeleteBitmap2L()
sl@0
  1695
    {
sl@0
  1696
    //send new drawing to test and base windows, in order to cover 
sl@0
  1697
    //any content has been left on them (through previous test)
sl@0
  1698
    BaseWin->SetVisible(ETrue);
sl@0
  1699
    BaseWin->Win()->Invalidate();
sl@0
  1700
    BaseWin->Win()->BeginRedraw();
sl@0
  1701
    TheGc->Activate(*BaseWin->Win());   
sl@0
  1702
    TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1703
    TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  1704
    TheGc->SetBrushColor(TRgb(0, 0, 255));
sl@0
  1705
    TheGc->Clear();
sl@0
  1706
    TheGc->Deactivate();
sl@0
  1707
    BaseWin->Win()->EndRedraw();
sl@0
  1708
    
sl@0
  1709
    TestWin->SetVisible(ETrue);
sl@0
  1710
    TestWin->Win()->Invalidate();
sl@0
  1711
    TestWin->Win()->BeginRedraw();
sl@0
  1712
    TheGc->Activate(*TestWin->Win());   
sl@0
  1713
    TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1714
    TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  1715
    TheGc->SetBrushColor(TRgb(0, 0, 255));
sl@0
  1716
    TheGc->Clear();
sl@0
  1717
    TheGc->Deactivate();
sl@0
  1718
    TestWin->Win()->EndRedraw();
sl@0
  1719
    
sl@0
  1720
    TheClient->iWs.Flush(); 
sl@0
  1721
    TheClient->iWs.Finish();
sl@0
  1722
        
sl@0
  1723
    //load test bitmap
sl@0
  1724
    CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
sl@0
  1725
    CleanupStack::PushL(bitmap);
sl@0
  1726
    TInt ret = bitmap->Load(_L("Z:\\WSTEST\\TESTCIRCLES.MBM"),0);
sl@0
  1727
    TEST(ret == KErrNone);
sl@0
  1728
    TInt bitmapHandle = bitmap->Handle();
sl@0
  1729
    
sl@0
  1730
    //send bitmap drawing to test window
sl@0
  1731
    TestWin->Win()->Invalidate();
sl@0
  1732
    TestWin->Win()->BeginRedraw();
sl@0
  1733
    TheGc->Activate(*TestWin->Win());
sl@0
  1734
    TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1735
    TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  1736
    TheGc->SetBrushColor(TRgb(0, 255, 0));
sl@0
  1737
    TheGc->Clear();
sl@0
  1738
    TheGc->BitBlt(TPoint(0,0), bitmap);
sl@0
  1739
    TheGc->Deactivate();
sl@0
  1740
    TestWin->Win()->EndRedraw();
sl@0
  1741
    
sl@0
  1742
    CleanupStack::PopAndDestroy(bitmap);
sl@0
  1743
sl@0
  1744
    TheClient->iWs.Flush(); 
sl@0
  1745
    TheClient->iWs.Finish();
sl@0
  1746
    
sl@0
  1747
    //using a new bitmap object instance check that wserv can still duplicate test bitmap (even though
sl@0
  1748
    //the initial bitmap object is deleted) , since there is a window segment using it
sl@0
  1749
    bitmap = new (ELeave) CFbsBitmap;
sl@0
  1750
    CleanupStack::PushL(bitmap);
sl@0
  1751
    ret = bitmap->Duplicate(bitmapHandle);
sl@0
  1752
    TEST(ret == KErrNone);
sl@0
  1753
    CleanupStack::PopAndDestroy(bitmap);
sl@0
  1754
sl@0
  1755
    //send new drawing to test window, in order to cover the bitmap that was previously drawn
sl@0
  1756
    TestWin->Win()->Invalidate();
sl@0
  1757
    TestWin->Win()->BeginRedraw();
sl@0
  1758
    TheGc->Activate(*TestWin->Win());
sl@0
  1759
    TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  1760
    TheGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  1761
    TheGc->SetBrushColor(TRgb(0, 0, 255));
sl@0
  1762
    TheGc->Clear();
sl@0
  1763
    TheGc->Deactivate();
sl@0
  1764
    TestWin->Win()->EndRedraw();
sl@0
  1765
    
sl@0
  1766
    TheClient->iWs.Flush(); 
sl@0
  1767
    TheClient->iWs.Finish();
sl@0
  1768
    
sl@0
  1769
    //check that wserv can't duplicate test bitmap, since no window segment uses it any more
sl@0
  1770
    bitmap = new (ELeave) CFbsBitmap;
sl@0
  1771
    CleanupStack::PushL(bitmap);
sl@0
  1772
    ret = bitmap->Duplicate(bitmapHandle);
sl@0
  1773
    TEST(ret != KErrNone);
sl@0
  1774
    CleanupStack::PopAndDestroy(bitmap);
sl@0
  1775
    }
sl@0
  1776
sl@0
  1777
void CTGc::RunTestCaseL(TInt /*aCurTestCase*/)
sl@0
  1778
	{
sl@0
  1779
	((CTGcStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
sl@0
  1780
	switch(++iTest->iState)
sl@0
  1781
		{
sl@0
  1782
	case 1:
sl@0
  1783
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0437"));
sl@0
  1784
		iTest->LogSubTest(_L("CRemoteGc&CWindowGc, outline and shadow text"));
sl@0
  1785
		TestOutlineAndShadowL();		
sl@0
  1786
		break;	
sl@0
  1787
	case 2:
sl@0
  1788
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0471"));
sl@0
  1789
		iTest->LogSubTest(_L("Test GC clip rect and origin attributes."));		 
sl@0
  1790
		TestGcClipRectOrigin();
sl@0
  1791
		break;
sl@0
  1792
	case 3:
sl@0
  1793
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0469"));
sl@0
  1794
		iTest->LogSubTest(_L("CRemoteGc&CWindowGc, reset with background colour"));		
sl@0
  1795
		TestResetWithBackgroundColorL();
sl@0
  1796
		break;
sl@0
  1797
	case 4:
sl@0
  1798
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0481"));
sl@0
  1799
		iTest->LogSubTest(_L("CRemoteGc&CCommandBuffer, coverage tests"));
sl@0
  1800
		TestCommandBufferL();
sl@0
  1801
		break;			
sl@0
  1802
	case 5:
sl@0
  1803
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0482"));
sl@0
  1804
		iTest->LogSubTest(_L("CCommandBuffer, coverage tests"));
sl@0
  1805
		TestEmptyCommandBufferL();
sl@0
  1806
		break;
sl@0
  1807
	case 6:
sl@0
  1808
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0494"));
sl@0
  1809
		iTest->LogSubTest(_L("CWindowGc, Brush Pattern test"));
sl@0
  1810
		TestGcSetBrushPatternL();
sl@0
  1811
		break;
sl@0
  1812
    case 7:
sl@0
  1813
        ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0576"));
sl@0
  1814
        iTest->LogSubTest(_L("CWindowGc, delete bitmap 1"));
sl@0
  1815
        TestGcDeleteBitmap1L();
sl@0
  1816
        break;
sl@0
  1817
    case 8:
sl@0
  1818
        ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0577"));
sl@0
  1819
        iTest->LogSubTest(_L("CWindowGc, delete bitmap 2"));
sl@0
  1820
        TestGcDeleteBitmap2L();
sl@0
  1821
        break;
sl@0
  1822
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
  1823
	case 9:
sl@0
  1824
		 ((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0471"));
sl@0
  1825
		 iTest->LogSubTest(_L("Test GC clip rect and origin attributes."));
sl@0
  1826
		 TestGcClipRectOrigin();
sl@0
  1827
		 break;
sl@0
  1828
	case 10:
sl@0
  1829
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0469"));
sl@0
  1830
		iTest->LogSubTest(_L("CRemoteGc&CWindowGc, reset with background colour"));
sl@0
  1831
		TestResetWithBackgroundColorL();
sl@0
  1832
		break;
sl@0
  1833
	case 11:
sl@0
  1834
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0486"));
sl@0
  1835
		iTest->LogSubTest(_L("CRemoteGc&MWsGraphicsContext, clipping rect test"));
sl@0
  1836
		TestCRemoteGcAndMWsGraphicsContextClippingRectL();
sl@0
  1837
		break;
sl@0
  1838
	case 12:
sl@0
  1839
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0487"));
sl@0
  1840
		iTest->LogSubTest(_L("CRemoteGc, DrawTextInContext Position test"));
sl@0
  1841
		TestCRemoteGcDrawTextInContextPointL();
sl@0
  1842
		break;
sl@0
  1843
	case 13:
sl@0
  1844
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0488"));
sl@0
  1845
		iTest->LogSubTest(_L("CRemoteGc, DrawTextInContext ClipRect test"));
sl@0
  1846
		TestCRemoteGcDrawTextInContextBoxL();
sl@0
  1847
		break;
sl@0
  1848
	case 14:
sl@0
  1849
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0489"));
sl@0
  1850
		iTest->LogSubTest(_L("CRemoteGc, DrawTextInContext Pos Vertical  test"));
sl@0
  1851
		TestCRemoteGcDrawTextInContextPointVerticalL();
sl@0
  1852
		break;
sl@0
  1853
	case 15:
sl@0
  1854
		((CTGcStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0490"));
sl@0
  1855
		iTest->LogSubTest(_L("CRemoteGc, DrawTextInContext ClipRect Vert  test"));
sl@0
  1856
		TestCRemoteGcDrawTextInContextBoxVerticalL();
sl@0
  1857
		break;
sl@0
  1858
#endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
sl@0
  1859
	default:
sl@0
  1860
		((CTGcStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
  1861
		((CTGcStep*)iStep)->CloseTMSGraphicsStep();
sl@0
  1862
		TestComplete();
sl@0
  1863
		break;
sl@0
  1864
		}
sl@0
  1865
	((CTGcStep*)iStep)->RecordTestResultL();
sl@0
  1866
	}
sl@0
  1867
sl@0
  1868
__CONSTRUCT_STEP__(Gc)