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