os/graphics/graphicsdeviceinterface/directgdi/test/tbitbltmasked.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
#include "tbitbltmasked.h"
sl@0
    17
sl@0
    18
CTBitBltMasked::CTBitBltMasked()
sl@0
    19
	{
sl@0
    20
	SetTestStepName(KTDirectGdiBitBltMaskedStep);
sl@0
    21
	}
sl@0
    22
sl@0
    23
CTBitBltMasked::~CTBitBltMasked()
sl@0
    24
	{
sl@0
    25
	}
sl@0
    26
sl@0
    27
/**
sl@0
    28
Override of base class pure virtual
sl@0
    29
Lists the tests to be run
sl@0
    30
*/
sl@0
    31
void CTBitBltMasked::RunTestsL()
sl@0
    32
	{
sl@0
    33
	if(iUseDirectGdi && !iUseSwDirectGdi)
sl@0
    34
		{
sl@0
    35
		// In the event that a test leaves after a BitBlt() or DrawBitmap() has occurred
sl@0
    36
		// the vgimage cache will need to be reset.
sl@0
    37
		// This needs to be the first item on the cleanupstack, 
sl@0
    38
		// as some tests perform pushes and pops of bitmaps.
sl@0
    39
		CleanupStack::PushL(TCleanupItem(ResetCache, iVgImageCache));
sl@0
    40
		}
sl@0
    41
sl@0
    42
	BeginMaskIteration();
sl@0
    43
	// to minimize tests call number these tests are processed only for one mask
sl@0
    44
	if(!iLargeTarget)
sl@0
    45
		{
sl@0
    46
		SetTestStepID(_L("GRAPHICS-DIRECTGDI-BITBLTMASKED-0003"));
sl@0
    47
		TestInvalidParametersL();
sl@0
    48
		RecordTestResultL();
sl@0
    49
		SetTestStepID(_L("GRAPHICS-DIRECTGDI-BITBLTMASKED-0004"));
sl@0
    50
		TestSourceBitmapCloningL();
sl@0
    51
		RecordTestResultL();
sl@0
    52
		SetTestStepID(_L("GRAPHICS-DIRECTGDI-BITBLTMASKED-0005"));
sl@0
    53
		TestMaskCloningL();
sl@0
    54
		RecordTestResultL();
sl@0
    55
		}
sl@0
    56
	do
sl@0
    57
		{
sl@0
    58
		if(!iLargeTarget)
sl@0
    59
			{
sl@0
    60
			iTestParams.iDoCompressed = ETrue;
sl@0
    61
			SetTestStepID(_L("GRAPHICS-DIRECTGDI-BITBLTMASKED-0001"));
sl@0
    62
			TestBasicL();
sl@0
    63
			RecordTestResultL();
sl@0
    64
			iTestParams.iDoCompressed = EFalse;
sl@0
    65
			SetTestStepID(_L("GRAPHICS-DIRECTGDI-BITBLTMASKED-0006"));
sl@0
    66
			TestDrawModeL();			
sl@0
    67
			RecordTestResultL();
sl@0
    68
			SetTestStepID(_L("GRAPHICS-DIRECTGDI-BITBLTMASKED-0007"));
sl@0
    69
			TestWithSameBitmapsL();
sl@0
    70
			RecordTestResultL();
sl@0
    71
			SetTestStepID(_L("GRAPHICS-DIRECTGDI-BITBLTMASKED-0008"));
sl@0
    72
			TestSetOriginL();
sl@0
    73
			RecordTestResultL();
sl@0
    74
			}
sl@0
    75
		else
sl@0
    76
			{
sl@0
    77
			SetTestStepID(_L("GRAPHICS-DIRECTGDI-BITBLTMASKED-0002"));
sl@0
    78
			TestPositioningL();
sl@0
    79
			RecordTestResultL();
sl@0
    80
			}
sl@0
    81
		}
sl@0
    82
	while(NextMaskIteration());
sl@0
    83
sl@0
    84
	if(iUseDirectGdi && !iUseSwDirectGdi)
sl@0
    85
		{
sl@0
    86
		CleanupStack::PopAndDestroy(iVgImageCache);
sl@0
    87
		}
sl@0
    88
	}
sl@0
    89
sl@0
    90
/**
sl@0
    91
@SYMTestCaseID  	
sl@0
    92
	GRAPHICS-DIRECTGDI-BITBLTMASKED-0001
sl@0
    93
	
sl@0
    94
@SYMPREQ 			
sl@0
    95
	PREQ39
sl@0
    96
sl@0
    97
@SYMREQ
sl@0
    98
	REQ9198
sl@0
    99
	REQ9204 
sl@0
   100
	REQ9195
sl@0
   101
	REQ9201 
sl@0
   102
	REQ9202 
sl@0
   103
	REQ9222 
sl@0
   104
	REQ9223 
sl@0
   105
	REQ9236 
sl@0
   106
	REQ9237
sl@0
   107
	
sl@0
   108
@SYMTestCaseDesc	
sl@0
   109
	Bit blitting with masking basic functionality.
sl@0
   110
	
sl@0
   111
@SYMTestPriority	
sl@0
   112
	Critical
sl@0
   113
	
sl@0
   114
@SYMTestStatus 		
sl@0
   115
	Implemented
sl@0
   116
	
sl@0
   117
@SYMTestActions 	
sl@0
   118
	Test bit blitting with masking for basic and valid parameters.
sl@0
   119
	
sl@0
   120
@SYMTestExpectedResults 
sl@0
   121
	Source bitmap should be copied into target area. Basic or inverted
sl@0
   122
	masking should be considered. Valid bitmap should be created. This
sl@0
   123
	bitmap should be the same as a reference bitmap.
sl@0
   124
*/
sl@0
   125
void CTBitBltMasked::TestBasicL()
sl@0
   126
	{	
sl@0
   127
	_LIT(KTestName, "BitBltMasked-Basic"); 
sl@0
   128
	_LIT(KTestNameNegative, "BitBltMasked-Basic-NegativeMaskPosition");	
sl@0
   129
	if(!iRunningOomTests)
sl@0
   130
		{
sl@0
   131
		INFO_PRINTF1(KTestName);
sl@0
   132
		}
sl@0
   133
sl@0
   134
	ResetGc();
sl@0
   135
	CFbsBitmap* bitmap;
sl@0
   136
	CFbsBitmap* mask;
sl@0
   137
	if(iTestParams.iDoCompressed)
sl@0
   138
		{
sl@0
   139
		bitmap = iCompressedBitmap;
sl@0
   140
		mask = iCompressedMaskL8;
sl@0
   141
		}
sl@0
   142
	else
sl@0
   143
		{
sl@0
   144
		bitmap = iCheckedBoardBitmap2;
sl@0
   145
		mask = iCurrentMask1;
sl@0
   146
		}
sl@0
   147
	
sl@0
   148
	TRect bmpRect(TPoint(0, 0), bitmap->SizeInPixels());	
sl@0
   149
	if(iMaskPixelFormat == EUidPixelFormatL_1)
sl@0
   150
		{
sl@0
   151
		iGc->BitBltMasked(TPoint(20, 20), *bitmap, bmpRect, *mask, iInvertMask);
sl@0
   152
		iGc->BitBltMasked(TPoint(20, 20), *bitmap, bmpRect, *mask, ETrue);
sl@0
   153
		}
sl@0
   154
	else
sl@0
   155
		{
sl@0
   156
		iGc->BitBltMasked(TPoint(20, 20), *bitmap, bmpRect, *mask, TPoint(0, 0));
sl@0
   157
		}
sl@0
   158
	TESTNOERROR(iGc->GetError());
sl@0
   159
	if(!iTestParams.iDoCompressed)
sl@0
   160
		WriteTargetOutput(KTestName());
sl@0
   161
	
sl@0
   162
	// negative mask position
sl@0
   163
	iGc->BitBltMasked(TPoint(-35, 180), *bitmap, bmpRect, *iMask1L8, TPoint(-1, -1));
sl@0
   164
	TESTNOERROR(iGc->GetError());	
sl@0
   165
	
sl@0
   166
	// mask position greater than mask size
sl@0
   167
	iGc->BitBltMasked(TPoint(-35, 200), *bitmap, bmpRect, *iMask1L8, iMask1L8->SizeInPixels().AsPoint());
sl@0
   168
	CheckErrorsL(KErrNone, KErrArgument, (TText8*)__FILE__, __LINE__);
sl@0
   169
	
sl@0
   170
	if(!iTestParams.iDoCompressed)
sl@0
   171
		TESTNOERRORL(WriteTargetOutput(KTestNameNegative()));
sl@0
   172
	}
sl@0
   173
sl@0
   174
/**
sl@0
   175
@SYMTestCaseID  	
sl@0
   176
	GRAPHICS-DIRECTGDI-BITBLTMASKED-0002
sl@0
   177
	
sl@0
   178
@SYMPREQ 			
sl@0
   179
	PREQ39
sl@0
   180
sl@0
   181
@SYMREQ
sl@0
   182
	REQ9197
sl@0
   183
	REQ9198
sl@0
   184
	REQ9204 
sl@0
   185
	REQ9195
sl@0
   186
	REQ9201 
sl@0
   187
	REQ9202 
sl@0
   188
	REQ9222 
sl@0
   189
	REQ9223 
sl@0
   190
	REQ9236 
sl@0
   191
	REQ9237
sl@0
   192
	
sl@0
   193
@SYMTestCaseDesc	
sl@0
   194
	Various combinations of destination positions, source position and size
sl@0
   195
 	of a bitmap are tested. Test also covers mask alignment, tiling and boundary
sl@0
   196
 	parameters.
sl@0
   197
 	
sl@0
   198
@SYMTestPriority	
sl@0
   199
	Critical
sl@0
   200
	
sl@0
   201
@SYMTestStatus 		
sl@0
   202
	Implemented
sl@0
   203
	
sl@0
   204
@SYMTestActions
sl@0
   205
	Covers the whole target bitmap starting from TPoint(-30,-30) with staggered blits of a small 8x8 bitmap. 	
sl@0
   206
	Test positioning functionality of BitBltMasked() methods. Test boundary
sl@0
   207
 	conditions, tiling and clipping to surface area.
sl@0
   208
 	
sl@0
   209
@SYMTestExpectedResults 
sl@0
   210
*/
sl@0
   211
void CTBitBltMasked::TestPositioningL()
sl@0
   212
	{	
sl@0
   213
	_LIT(KTestName, "BitBltMasked-Positioning"); 
sl@0
   214
	if(!iRunningOomTests)
sl@0
   215
		{
sl@0
   216
		INFO_PRINTF1(KTestName);
sl@0
   217
		}
sl@0
   218
	iTestParams.iDoCompressed = ETrue;
sl@0
   219
	TestPositioningBaseL(KTestName(), EBitBltMasked);
sl@0
   220
	iTestParams.iDoCompressed = EFalse;
sl@0
   221
	TestPositioningBaseL(KTestName(), EBitBltMasked);
sl@0
   222
	}
sl@0
   223
sl@0
   224
/**
sl@0
   225
@SYMTestCaseID  	
sl@0
   226
	GRAPHICS-DIRECTGDI-BITBLTMASKED-0003
sl@0
   227
	
sl@0
   228
@SYMPREQ 			
sl@0
   229
	PREQ39
sl@0
   230
sl@0
   231
@SYMREQ
sl@0
   232
	REQ9197
sl@0
   233
	REQ9198
sl@0
   234
	REQ9204 
sl@0
   235
	REQ9195
sl@0
   236
	REQ9222 
sl@0
   237
	REQ9223 
sl@0
   238
	REQ9236 
sl@0
   239
	REQ9237
sl@0
   240
	
sl@0
   241
@SYMTestCaseDesc	
sl@0
   242
	Calling BitBltMasked() method with invalid parameters
sl@0
   243
	
sl@0
   244
@SYMTestPriority	
sl@0
   245
	Critical
sl@0
   246
	
sl@0
   247
@SYMTestStatus 		
sl@0
   248
	Implemented
sl@0
   249
	
sl@0
   250
@SYMTestActions 	
sl@0
   251
	Invalid source rect:
sl@0
   252
		- TRect(-30, -30, -10, -10);
sl@0
   253
		- TRect(bmpWidth+10, bmpHeight+10, bmpWidth+20, bmpHeight+20);
sl@0
   254
		- TRect(bmpWidth, bmpHeight, 0, 0);
sl@0
   255
		- TRect(-10, -10, -30, -30);
sl@0
   256
		- TRect(0, 0, 0, 0);
sl@0
   257
	Invalid mask (aMaskBitmap):
sl@0
   258
		- zero size mask
sl@0
   259
		- not initialized mask
sl@0
   260
	Mask position greater than mask size: aMaskPt = TPoint(mask_width, mask_height)
sl@0
   261
    Invalid source bitmap:
sl@0
   262
		- zero size bitmap
sl@0
   263
        - not initialised bitmap
sl@0
   264
sl@0
   265
@SYMTestExpectedResults 
sl@0
   266
	Function should detect invalid parameters and return. Nothing should be drawn
sl@0
   267
 	in a target area.
sl@0
   268
*/
sl@0
   269
void CTBitBltMasked::TestInvalidParametersL()
sl@0
   270
	{	
sl@0
   271
	_LIT(KTestName, "BitBltMasked-InvalidParameters"); 
sl@0
   272
	if(!iRunningOomTests)
sl@0
   273
		{
sl@0
   274
		INFO_PRINTF1(KTestName);
sl@0
   275
		}
sl@0
   276
	TestInvalidParametersBaseL(KTestName(), EBitBltMasked);
sl@0
   277
	}
sl@0
   278
sl@0
   279
/**
sl@0
   280
@SYMTestCaseID  	
sl@0
   281
	GRAPHICS-DIRECTGDI-BITBLTMASKED-0004
sl@0
   282
	
sl@0
   283
@SYMPREQ 			
sl@0
   284
	PREQ39
sl@0
   285
sl@0
   286
@SYMREQ
sl@0
   287
	REQ9197
sl@0
   288
	REQ9204 
sl@0
   289
	REQ9195
sl@0
   290
	REQ9201 
sl@0
   291
	REQ9202 
sl@0
   292
	REQ9222 
sl@0
   293
	REQ9223 
sl@0
   294
	REQ9236 
sl@0
   295
	REQ9237
sl@0
   296
	
sl@0
   297
@SYMTestCaseDesc	
sl@0
   298
	Tests that masked bitmaps are drawn correctly if they 
sl@0
   299
	are deleted immediately after BitBltMasked() is called, but before Finish() is called.
sl@0
   300
	
sl@0
   301
@SYMTestPriority	
sl@0
   302
	Critical
sl@0
   303
	
sl@0
   304
@SYMTestStatus 		
sl@0
   305
	Implemented
sl@0
   306
	
sl@0
   307
@SYMTestActions 	
sl@0
   308
	Set valid mask parameters (see BitBltMasked-Basic).
sl@0
   309
	For test description see BitBlt-SourceBitmapCloning.
sl@0
   310
	 
sl@0
   311
@SYMTestExpectedResults 
sl@0
   312
	Source bitmap should be copied into target area. Memory leaks should not
sl@0
   313
 	be created. Valid bitmap should be created. This bitmap should be
sl@0
   314
 	the same as a reference bitmap.
sl@0
   315
*/
sl@0
   316
void CTBitBltMasked::TestSourceBitmapCloningL()
sl@0
   317
	{	
sl@0
   318
	_LIT(KTestName, "BitBltMasked-SourceBitmapCloning"); 
sl@0
   319
	if(!iRunningOomTests)
sl@0
   320
		{
sl@0
   321
		INFO_PRINTF1(KTestName);
sl@0
   322
		}
sl@0
   323
	iTestParams.iDoCompressed = ETrue;
sl@0
   324
	TestSourceBitmapCloningBaseL(KTestName(), EBitBltMasked);
sl@0
   325
	iTestParams.iDoCompressed = EFalse;	
sl@0
   326
	TestSourceBitmapCloningBaseL(KTestName(), EBitBltMasked);
sl@0
   327
	}
sl@0
   328
sl@0
   329
/**
sl@0
   330
@SYMTestCaseID  	
sl@0
   331
	GRAPHICS-DIRECTGDI-BITBLTMASKED-0005
sl@0
   332
	
sl@0
   333
@SYMPREQ 			
sl@0
   334
	PREQ39
sl@0
   335
sl@0
   336
@SYMREQ
sl@0
   337
	REQ9197
sl@0
   338
	REQ9204 
sl@0
   339
	REQ9195
sl@0
   340
	REQ9201 
sl@0
   341
	REQ9202 
sl@0
   342
	REQ9222 
sl@0
   343
	REQ9223 
sl@0
   344
	REQ9236 
sl@0
   345
	REQ9237
sl@0
   346
	
sl@0
   347
@SYMTestCaseDesc	
sl@0
   348
	Tests that masked bitmaps are drawn correctly if the mask 
sl@0
   349
	is deleted immediately after BitBltMasked() is called, but before Finish() is called.
sl@0
   350
	
sl@0
   351
@SYMTestPriority	
sl@0
   352
	Critical
sl@0
   353
	
sl@0
   354
@SYMTestStatus 		
sl@0
   355
	Implemented
sl@0
   356
sl@0
   357
@SYMTestActions 	
sl@0
   358
	1. Invoke the BitBltMasked() method with valid parameters (see BitBltMasked-Basic). 
sl@0
   359
	2. Right after returning from BitBltMasked() call, destroy the source mask (aMaskBitmap).
sl@0
   360
	3. Call the BitBltMasked() method again with the same mask parameter.
sl@0
   361
	Repeat  p. 1-3 a few times.
sl@0
   362
	
sl@0
   363
@SYMTestExpectedResults 
sl@0
   364
	Source bitmap should be copied into target area and should be correctly masked.
sl@0
   365
 	Memory leaks should not be created. Valid bitmap should be created. This bitmap
sl@0
   366
 	should be the same as a reference bitmap.
sl@0
   367
*/	
sl@0
   368
void CTBitBltMasked::TestMaskCloningL()
sl@0
   369
	{	
sl@0
   370
	_LIT(KTestName, "BitBltMasked-MaskCloning"); 
sl@0
   371
	if(!iRunningOomTests)
sl@0
   372
		{
sl@0
   373
		INFO_PRINTF1(KTestName);
sl@0
   374
		}
sl@0
   375
	iTestParams.iDoCompressed = ETrue;
sl@0
   376
	TestMaskCloningBaseL(KTestName(), EBitBltMasked);
sl@0
   377
	iTestParams.iDoCompressed = EFalse;
sl@0
   378
	TestMaskCloningBaseL(KTestName(), EBitBltMasked);
sl@0
   379
	}
sl@0
   380
sl@0
   381
/**
sl@0
   382
@SYMTestCaseID  	
sl@0
   383
	GRAPHICS-DIRECTGDI-BITBLTMASKED-0006
sl@0
   384
	
sl@0
   385
@SYMPREQ 			
sl@0
   386
	PREQ39
sl@0
   387
sl@0
   388
@SYMREQ
sl@0
   389
	REQ9198
sl@0
   390
	REQ9204 
sl@0
   391
	REQ9195
sl@0
   392
	REQ9201 
sl@0
   393
	REQ9202 
sl@0
   394
	REQ9222 
sl@0
   395
	REQ9223 
sl@0
   396
	REQ9236 
sl@0
   397
	REQ9237
sl@0
   398
	
sl@0
   399
@SYMTestCaseDesc	
sl@0
   400
	Test correctness of bit blitting with mask in all possible draw modes.
sl@0
   401
	
sl@0
   402
@SYMTestPriority	
sl@0
   403
	Critical
sl@0
   404
	
sl@0
   405
@SYMTestStatus 		
sl@0
   406
	Implemented
sl@0
   407
	
sl@0
   408
@SYMTestActions 	
sl@0
   409
	Set valid parameters (see BitBltMasked-Basic).
sl@0
   410
	Use the semi-transparent source bitmap (iCheckedBoardWithAlphaBitmap).
sl@0
   411
	Set drawmode to EDrawModePEN and call the methods.
sl@0
   412
	Set drawmode to EDrawModeWriteAlpha and call the methods.
sl@0
   413
	
sl@0
   414
@SYMTestExpectedResults 
sl@0
   415
	Semi-transparent (for  EDrawModePEN) and opaque (for  EDrawModeWriteAlpha)
sl@0
   416
 	should be copied into rendering target. Valid bitmap should be created.
sl@0
   417
 	This bitmap should be the same as a reference bitmap.
sl@0
   418
*/
sl@0
   419
void CTBitBltMasked::TestDrawModeL()
sl@0
   420
	{
sl@0
   421
	_LIT(KTestName, "BitBltMasked-DrawMode"); 
sl@0
   422
	if(!iRunningOomTests)
sl@0
   423
		{
sl@0
   424
		INFO_PRINTF1(KTestName);
sl@0
   425
		}
sl@0
   426
	ResetGc();
sl@0
   427
sl@0
   428
	TSize bmpSize(iCheckedBoardWithAlphaBitmap->SizeInPixels());
sl@0
   429
sl@0
   430
	TInt halfHeight = (bmpSize.iHeight  >> 1);	
sl@0
   431
	TInt quarterWidth  = (bmpSize.iWidth  >> 2);
sl@0
   432
	TInt y1 = halfHeight - (bmpSize.iHeight >> 2);	
sl@0
   433
	TSize vertRectSize  (quarterWidth, bmpSize.iHeight);
sl@0
   434
	TSize horizRectSize (bmpSize.iWidth, halfHeight);
sl@0
   435
sl@0
   436
	// EDrawModeWriteAlpha is not supported in the following modes
sl@0
   437
	// This is tested under invalid parameter tests.
sl@0
   438
	if (!((iMaskPixelFormat == EUidPixelFormatL_8) && 
sl@0
   439
		  ((iTestParams.iSourcePixelFormat == EUidPixelFormatARGB_8888) ||
sl@0
   440
		   (iTestParams.iSourcePixelFormat == EUidPixelFormatARGB_8888_PRE))))
sl@0
   441
		{
sl@0
   442
		// Render column to left
sl@0
   443
		iGc->SetDrawMode(DirectGdi::EDrawModeWriteAlpha);
sl@0
   444
		iGc->BitBltMasked(
sl@0
   445
			TPoint(0, 0),
sl@0
   446
			*iCheckedBoardWithAlphaBitmap,
sl@0
   447
			TRect(TPoint(0, 0), vertRectSize), 
sl@0
   448
			*iCurrentMask2, 
sl@0
   449
			TPoint(0, 0));
sl@0
   450
		}
sl@0
   451
sl@0
   452
	// Render row in center
sl@0
   453
	iGc->SetDrawMode(DirectGdi::EDrawModePEN);
sl@0
   454
	iGc->BitBltMasked(
sl@0
   455
		TPoint(0, y1), 
sl@0
   456
		*iCheckedBoardWithAlphaBitmap, 
sl@0
   457
		TRect(TPoint(0, 0), horizRectSize),
sl@0
   458
		*iCurrentMask2, 
sl@0
   459
		TPoint(0, 0));
sl@0
   460
	
sl@0
   461
	// EDrawModeWriteAlpha is not supported in the following modes
sl@0
   462
	// This is tested under invalid parameter tests.
sl@0
   463
	if (!((iMaskPixelFormat == EUidPixelFormatL_8) && 
sl@0
   464
		  ((iTestParams.iSourcePixelFormat == EUidPixelFormatARGB_8888) ||
sl@0
   465
		   (iTestParams.iSourcePixelFormat == EUidPixelFormatARGB_8888_PRE))))
sl@0
   466
		{
sl@0
   467
		// Render column to right
sl@0
   468
		iGc->SetDrawMode(DirectGdi::EDrawModeWriteAlpha);
sl@0
   469
		iGc->BitBltMasked(
sl@0
   470
			TPoint(bmpSize.iWidth - quarterWidth, 0),
sl@0
   471
			*iCheckedBoardWithAlphaBitmap,
sl@0
   472
			TRect(TPoint(0, 0), vertRectSize), 
sl@0
   473
			*iCurrentMask2, 
sl@0
   474
			TPoint(0, 0));
sl@0
   475
		}
sl@0
   476
	
sl@0
   477
	TESTNOERRORL(iGc->GetError());
sl@0
   478
sl@0
   479
	TESTNOERRORL(WriteTargetOutput(KTestName()));
sl@0
   480
	}
sl@0
   481
sl@0
   482
/**
sl@0
   483
@SYMTestCaseID  	
sl@0
   484
	GRAPHICS-DIRECTGDI-BITBLTMASKED-0007
sl@0
   485
	
sl@0
   486
@SYMPREQ 			
sl@0
   487
	PREQ39
sl@0
   488
sl@0
   489
@SYMREQ
sl@0
   490
	REQ9198
sl@0
   491
	REQ9204 
sl@0
   492
	REQ9195
sl@0
   493
	REQ9201 
sl@0
   494
	REQ9202 
sl@0
   495
	REQ9222 
sl@0
   496
	REQ9223 
sl@0
   497
	REQ9236 
sl@0
   498
	REQ9237
sl@0
   499
	
sl@0
   500
@SYMTestCaseDesc	
sl@0
   501
	Test the basic functionality of bit blitting with masking.
sl@0
   502
	
sl@0
   503
@SYMTestPriority	
sl@0
   504
	Critical
sl@0
   505
	
sl@0
   506
@SYMTestStatus 		
sl@0
   507
	Implemented
sl@0
   508
	
sl@0
   509
@SYMTestActions 	
sl@0
   510
	Test bit blitting with masking for same source and mask bitmaps.
sl@0
   511
	
sl@0
   512
@SYMTestExpectedResults 
sl@0
   513
	Source bitmap should be copied into target area. Basic or inverted
sl@0
   514
 	masking should be considered. Valid bitmap should be created. This
sl@0
   515
 	bitmap should be the same as a reference bitmap.
sl@0
   516
*/
sl@0
   517
void CTBitBltMasked::TestWithSameBitmapsL()
sl@0
   518
	{	
sl@0
   519
	_LIT(KTestName, "BitBltMasked-SameBitmaps"); 
sl@0
   520
	ResetGc();
sl@0
   521
	TRect bmpRect1(TPoint(0, 0), iBlackWhiteBitmap->SizeInPixels());
sl@0
   522
	iGc->SetOrigin(TPoint(30, 30));
sl@0
   523
	iGc->BitBltMasked(TPoint(0, 0), *iBlackWhiteBitmap, bmpRect1, *iBlackWhiteBitmap, ETrue);
sl@0
   524
	iGc->BitBltMasked(TPoint(0, 0), *iBlackWhiteBitmap, bmpRect1, *iBlackWhiteBitmap, EFalse);
sl@0
   525
	TESTNOERRORL(iGc->GetError());
sl@0
   526
	//Write target only if image is not empty. BitGDI is producing white images when Mask pixel format is EUidPixelFormatL_8 
sl@0
   527
	TBool pass = TestTargetL(KRgbWhite);
sl@0
   528
	if(!pass)
sl@0
   529
		{		
sl@0
   530
		TESTNOERRORL(WriteTargetOutput(KTestName()));
sl@0
   531
		}	
sl@0
   532
	}
sl@0
   533
sl@0
   534
/**
sl@0
   535
@SYMTestCaseID  	
sl@0
   536
	GRAPHICS-DIRECTGDI-BITBLTMASKED-0008
sl@0
   537
	
sl@0
   538
@SYMPREQ 			
sl@0
   539
	PREQ39
sl@0
   540
sl@0
   541
@SYMREQ
sl@0
   542
	REQ9198
sl@0
   543
	REQ9204 
sl@0
   544
	REQ9195
sl@0
   545
	REQ9201 
sl@0
   546
	REQ9202 
sl@0
   547
	REQ9222 
sl@0
   548
	REQ9223 
sl@0
   549
	REQ9236 
sl@0
   550
	REQ9237
sl@0
   551
	
sl@0
   552
@SYMTestCaseDesc	
sl@0
   553
	Test that BitBltMasked() performs correctly when it is called after SetOrigin().
sl@0
   554
	
sl@0
   555
@SYMTestPriority	
sl@0
   556
	Critical
sl@0
   557
	
sl@0
   558
@SYMTestStatus 		
sl@0
   559
	Implemented
sl@0
   560
	
sl@0
   561
@SYMTestActions 	
sl@0
   562
	Call SetOrigin().
sl@0
   563
	Call BitBltMasked().
sl@0
   564
	
sl@0
   565
@SYMTestExpectedResults 
sl@0
   566
	Source bitmap should be copied into target area. Basic or inverted
sl@0
   567
	masking should be considered. Valid bitmap should be created. This
sl@0
   568
	bitmap should be the same as a reference bitmap.
sl@0
   569
*/
sl@0
   570
void CTBitBltMasked::TestSetOriginL()
sl@0
   571
	{	
sl@0
   572
	_LIT(KTestName, "BitBltMasked-SetOrigin"); 
sl@0
   573
	_LIT(KTestNameNegative, "BitBltMasked-SetOrigin-NegativeMaskPosition");
sl@0
   574
	
sl@0
   575
	// Only do test for one pixel format to cut down on the number of images produced
sl@0
   576
	// as this is just a positional test and we don't need to test for all pixel formats.
sl@0
   577
	if (!((iTestParams.iTargetPixelFormat == EUidPixelFormatRGB_565) && (iTestParams.iSourcePixelFormat == EUidPixelFormatRGB_565)))
sl@0
   578
		{
sl@0
   579
		return;
sl@0
   580
		}
sl@0
   581
				
sl@0
   582
	if(!iRunningOomTests)
sl@0
   583
		{
sl@0
   584
		INFO_PRINTF1(KTestName);
sl@0
   585
		}
sl@0
   586
sl@0
   587
	ResetGc();
sl@0
   588
	CFbsBitmap* bitmap = iCheckedBoardBitmap2;
sl@0
   589
	CFbsBitmap* mask = iCurrentMask1;	
sl@0
   590
	
sl@0
   591
	TRect bmpRect(TPoint(0, 0), bitmap->SizeInPixels());
sl@0
   592
	iGc->SetOrigin(TPoint(-35, 80));
sl@0
   593
	if(iMaskPixelFormat == EUidPixelFormatL_1)
sl@0
   594
		{
sl@0
   595
		iGc->BitBltMasked(TPoint(55, -60), *bitmap, bmpRect, *mask, iInvertMask);
sl@0
   596
		iGc->BitBltMasked(TPoint(55, -60), *bitmap, bmpRect, *mask, ETrue);
sl@0
   597
		}
sl@0
   598
	else
sl@0
   599
		{
sl@0
   600
		iGc->BitBltMasked(TPoint(55, -60), *bitmap, bmpRect, *mask, TPoint(0, 0));
sl@0
   601
		}
sl@0
   602
	TESTNOERROR(iGc->GetError());	
sl@0
   603
	TESTNOERRORL(WriteTargetOutput(KTestName()));
sl@0
   604
	
sl@0
   605
	// negative mask position
sl@0
   606
	iGc->BitBltMasked(TPoint(0, 100), *bitmap, bmpRect, *iMask1L8, TPoint(-1, -1));
sl@0
   607
	TESTNOERROR(iGc->GetError());	
sl@0
   608
	
sl@0
   609
	// mask position greater than mask size
sl@0
   610
	iGc->BitBltMasked(TPoint(0, 120), *bitmap, bmpRect, *iMask1L8, iMask1L8->SizeInPixels().AsPoint());
sl@0
   611
	CheckErrorsL(KErrNone, KErrArgument, (TText8*)__FILE__, __LINE__);
sl@0
   612
		
sl@0
   613
	TESTNOERRORL(WriteTargetOutput(KTestNameNegative()));
sl@0
   614
	}
sl@0
   615
sl@0
   616