graphicsdeviceinterface/directgdi/test/tdrawbitmapmasked.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 "tdrawbitmapmasked.h"
       
    17 
       
    18 CTDrawBitmapMasked::CTDrawBitmapMasked()
       
    19 	{
       
    20 	SetTestStepName(KTDirectGdiDrawBitmapMaskedStep);
       
    21 	}
       
    22 
       
    23 CTDrawBitmapMasked::~CTDrawBitmapMasked()
       
    24 	{
       
    25 	}
       
    26 
       
    27 /**
       
    28 Override of base class pure virtual
       
    29 Lists the tests to be run
       
    30 */
       
    31 void CTDrawBitmapMasked::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-DRAWBITMAPMASKED-0003"));
       
    47 		TestInvalidParametersL();
       
    48 		RecordTestResultL();
       
    49 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0005"));
       
    50 		TestSourceBitmapCloningL();
       
    51 		RecordTestResultL();
       
    52 		SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0006"));
       
    53 		TestMaskCloningL();
       
    54 		RecordTestResultL();
       
    55 		}
       
    56 	do
       
    57 		{
       
    58 		if(!iLargeTarget)
       
    59 			{
       
    60 			iTestParams.iDoCompressed = ETrue;
       
    61 			SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0001"));
       
    62 			TestBasicL();
       
    63 			RecordTestResultL();
       
    64 			iTestParams.iDoCompressed = EFalse;
       
    65 			SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0007"));
       
    66 			TestDrawModeL();
       
    67 			RecordTestResultL();
       
    68 			SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0008"));
       
    69 			TestWithSameBitmapsL();
       
    70 			RecordTestResultL();
       
    71 			SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0009"));	
       
    72 			TestSetOriginL();
       
    73 			RecordTestResultL();
       
    74 			}
       
    75 		else
       
    76 			{
       
    77 			SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0002"));
       
    78 			TestPositioningL();
       
    79 			RecordTestResultL();
       
    80 			SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0004"));
       
    81 			TestScalingL();
       
    82 			RecordTestResultL();
       
    83 			
       
    84 			if (iMaskType == EMaskL8)
       
    85 				{
       
    86 				iTestParams.iDoCompressed = ETrue;
       
    87 				SetTestStepID(_L("GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0004"));
       
    88 				TestScalingL();
       
    89 				RecordTestResultL();
       
    90 				iTestParams.iDoCompressed = EFalse;
       
    91 				}
       
    92 			}
       
    93 		}
       
    94 	while(NextMaskIteration());
       
    95 	if (iUseDirectGdi && !iUseSwDirectGdi)
       
    96 		{
       
    97 		CleanupStack::PopAndDestroy(iVgImageCache);
       
    98 		}
       
    99 	}
       
   100 
       
   101 /**
       
   102 @SYMTestCaseID  	
       
   103 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0001
       
   104 	
       
   105 @SYMPREQ 			
       
   106 	PREQ39
       
   107 
       
   108 @SYMREQ
       
   109 	REQ9199 
       
   110 	REQ9204 
       
   111 	REQ9195
       
   112 	REQ9201 
       
   113 	REQ9202 
       
   114 	REQ9222 
       
   115 	REQ9223 
       
   116 	REQ9236 
       
   117 	REQ9237
       
   118 	
       
   119 @SYMTestCaseDesc	
       
   120 	Bitmap drawing with masking basic functionality test.
       
   121 	
       
   122 @SYMTestPriority	
       
   123 	Critical
       
   124 	
       
   125 @SYMTestStatus 		
       
   126 	Implemented
       
   127 	
       
   128 @SYMTestActions 	
       
   129 	Test bitmap drawing with masking for simple and valid parameters.
       
   130 	
       
   131 @SYMTestExpectedResults 
       
   132 	Source bitmap should be drawn masked in the target area. Valid bitmap 
       
   133 	should be created. This bitmap shall be compared to a reference bitmap.
       
   134 */
       
   135 void CTDrawBitmapMasked::TestBasicL()
       
   136 	{	
       
   137 	_LIT(KTestName, "DrawBitmapMasked-Basic");		
       
   138 	if(!iRunningOomTests)
       
   139 		{
       
   140 		INFO_PRINTF1(KTestName);
       
   141 		}
       
   142 	
       
   143 	ResetGc();
       
   144 
       
   145 	CFbsBitmap* bitmap;
       
   146 	CFbsBitmap* mask;
       
   147 	if(iTestParams.iDoCompressed)
       
   148 		{
       
   149 		bitmap = iCompressedBitmap;
       
   150 		mask = iCompressedMaskL8;
       
   151 		}
       
   152 	else
       
   153 		{
       
   154 		bitmap = iCheckedBoardBitmap2;
       
   155 		mask = iCurrentMask1;
       
   156 		}
       
   157 	
       
   158 	TSize bmpSize(bitmap->SizeInPixels());
       
   159 	
       
   160 	iGc->DrawBitmapMasked(TRect(TPoint(20, 20), bmpSize), *bitmap, TRect(TPoint(0, 0), bmpSize), *mask, iInvertMask);
       
   161 
       
   162 	TESTNOERRORL(iGc->GetError());
       
   163 	if(!iTestParams.iDoCompressed)
       
   164 		WriteTargetOutput(KTestName());
       
   165 	}
       
   166 
       
   167 /**
       
   168 @SYMTestCaseID  	
       
   169 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0002
       
   170 	
       
   171 @SYMPREQ 			
       
   172 	PREQ39
       
   173 
       
   174 @SYMREQ
       
   175 	REQ9199 
       
   176 	REQ9204 
       
   177 	REQ9195
       
   178 	REQ9201 
       
   179 	REQ9202 
       
   180 	REQ9222 
       
   181 	REQ9223 
       
   182 	REQ9236 
       
   183 	REQ9237
       
   184 	
       
   185 @SYMTestCaseDesc	
       
   186 	Test regularity of bitmap with masking positioning.
       
   187 	
       
   188 @SYMTestPriority	
       
   189 	Critical
       
   190 	
       
   191 @SYMTestStatus 		
       
   192 	Implemented
       
   193 	
       
   194 @SYMTestActions 	
       
   195 	Test positioning functionality of DrawBitmapMasked() methods.
       
   196  	Test boundary conditions and clipping to surface area.
       
   197  	
       
   198 @SYMTestExpectedResults 
       
   199 */
       
   200 void CTDrawBitmapMasked::TestPositioningL()
       
   201 	{	
       
   202 	_LIT(KTestName, "DrawBitmapMasked-Positioning"); 
       
   203 	if(!iRunningOomTests)
       
   204 		{
       
   205 		INFO_PRINTF1(KTestName);
       
   206 		}
       
   207 	
       
   208 	iTestParams.iDoCompressed = ETrue;
       
   209 	TestPositioningBaseL(KTestName(), EDrawBitmapMasked);
       
   210 	iTestParams.iDoCompressed = EFalse;
       
   211 	TestPositioningBaseL(KTestName(), EDrawBitmapMasked);
       
   212 	}
       
   213 
       
   214 /**
       
   215 @SYMTestCaseID  	
       
   216 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0003
       
   217 	
       
   218 @SYMPREQ 			
       
   219 	PREQ39
       
   220 
       
   221 @SYMREQ
       
   222 	REQ9199 
       
   223 	REQ9204 
       
   224 	REQ9195
       
   225 	REQ9222 
       
   226 	REQ9223 
       
   227 	REQ9236 
       
   228 	REQ9237
       
   229 	
       
   230 @SYMTestCaseDesc	
       
   231 	Test functions behaviour after calling with invalid parameters.
       
   232 	
       
   233 @SYMTestPriority	
       
   234 	Critical
       
   235 	
       
   236 @SYMTestStatus 		
       
   237 	Implemented
       
   238 	
       
   239 @SYMTestActions 	
       
   240 	Replace valid parameters with invalid ones:
       
   241 		Invalid mask
       
   242 			zero size mask
       
   243 			not initialized mask
       
   244 		see DrawBitmap-InvalidParameters for rest of invalid parameters.
       
   245 		
       
   246 @SYMTestExpectedResults 
       
   247 	Function should detect invalid parameters and return. Nothing should be
       
   248  	drawn in  target area.
       
   249 */
       
   250 void CTDrawBitmapMasked::TestInvalidParametersL()
       
   251 	{	
       
   252 	_LIT(KTestName, "DrawBitmapMasked-InvalidParameters"); 
       
   253 	if(!iRunningOomTests)
       
   254 		{
       
   255 		INFO_PRINTF1(KTestName);
       
   256 		}
       
   257 	
       
   258 	TestInvalidParametersBaseL(KTestName(), EDrawBitmapMasked);
       
   259 	}
       
   260 
       
   261 /**
       
   262 @SYMTestCaseID 
       
   263 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0004
       
   264 
       
   265 @SYMPREQ 
       
   266 	PREQ39
       
   267 
       
   268 @SYMREQ
       
   269 	REQ9199 
       
   270 	REQ9204 
       
   271 	REQ9195 
       
   272 	REQ9201 
       
   273 	REQ9202 
       
   274 	REQ9222 
       
   275 	REQ9223 
       
   276 	REQ9236 
       
   277 	REQ9237
       
   278 
       
   279 @SYMTestCaseDesc
       
   280 	Test regularity of bitmap scaling.
       
   281 
       
   282 @SYMTestPriority	
       
   283 	Critical
       
   284 
       
   285 @SYMTestStatus 
       
   286 	Implemented
       
   287 
       
   288 @SYMTestActions 
       
   289 	Test scaling down and up of a source bitmap. Test scaling down and tiling of a mask.
       
   290 
       
   291 @SYMTestExpectedResults 
       
   292 	Scaled bitmap should be drawn in a target area. Masking should be proceeded
       
   293 	correctly. Valid bitmap should be created. The bitmap should be properly
       
   294 	scaled. This bitmap shall be compared to a reference bitmap.
       
   295 */
       
   296 void CTDrawBitmapMasked::TestScalingL()
       
   297 	{
       
   298 	_LIT(KTestName, "DrawBitmapMasked-Scaling"); 
       
   299 	if(!iRunningOomTests)
       
   300 		{
       
   301 		INFO_PRINTF1(KTestName);
       
   302 		}
       
   303 
       
   304 	TInt width = iGdiTarget->SizeInPixels().iWidth;
       
   305 	TInt height = iGdiTarget->SizeInPixels().iHeight;
       
   306 
       
   307 	CFbsBitmap* bitmap1 = NULL;
       
   308 	CFbsBitmap* bitmap2 = NULL;
       
   309 	CFbsBitmap* mask = NULL;
       
   310 	if(iTestParams.iDoCompressed)
       
   311 		{
       
   312 		bitmap1 = iCompressedBitmapSmall;
       
   313 		bitmap2 = iCompressedBitmap;
       
   314 		mask = iCompressedMaskL8;
       
   315 		}
       
   316 	else
       
   317 		{
       
   318 		bitmap1 = iCheckedBoardBitmap1;
       
   319 		bitmap2 = iCheckedBoardBitmap2;
       
   320 		mask = iCurrentMask1;
       
   321 		}
       
   322 	TInt bmp1Width = bitmap1->SizeInPixels().iWidth;
       
   323 	TInt bmp1Height = bitmap1->SizeInPixels().iHeight;
       
   324 	
       
   325 	TInt bmp2Width = bitmap2->SizeInPixels().iWidth;
       
   326 	TInt bmp2Height = bitmap2->SizeInPixels().iHeight;
       
   327 
       
   328 	ResetGc();
       
   329 
       
   330 	// small bitmap - extreme magnification
       
   331 	TReal32 scale = 1.0f;
       
   332 	TReal32 scaleFactor = 1.55f;
       
   333 	TInt posX = 1;
       
   334 	for(TInt jj=0; jj<6; jj++)
       
   335 		{
       
   336 		TSize size(static_cast<TInt>(bmp1Width*scale), static_cast<TInt>(bmp1Height*scale));
       
   337 		TPoint pos(posX, height/4-size.iHeight/2);
       
   338 
       
   339 		iGc->DrawBitmapMasked(TRect(pos, size), *bitmap1,
       
   340 				TRect(TPoint(0, 0), TSize(bmp1Width, bmp1Height)), *mask, iInvertMask);
       
   341 
       
   342 		posX += size.iWidth+2;
       
   343 		scale *= scaleFactor;
       
   344 		}
       
   345 
       
   346 	// large bitmap - extreme minification
       
   347 	scale /= scaleFactor;
       
   348 	posX = 1;
       
   349 	for(TInt jj=5; jj>=0; jj--)
       
   350 		{
       
   351 		TSize size(static_cast<TInt>(bmp1Width*scale), static_cast<TInt>(bmp1Height*scale));
       
   352 		TPoint pos(posX, 3*height/4-size.iHeight/2);
       
   353 
       
   354 		iGc->DrawBitmapMasked(TRect(pos, size), *bitmap2,
       
   355 				TRect(TPoint(0, 0), bitmap2->SizeInPixels()), *mask, iInvertMask);
       
   356 
       
   357 		posX += size.iWidth+2;
       
   358 		scale /= scaleFactor;
       
   359 		}
       
   360 
       
   361 	TESTNOERRORL(iGc->GetError());
       
   362 
       
   363 	WriteTargetOutput(KTestName());
       
   364 	}
       
   365 
       
   366 /**
       
   367 @SYMTestCaseID  	
       
   368 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0005
       
   369 	
       
   370 @SYMPREQ 			
       
   371 	PREQ39
       
   372 
       
   373 @SYMREQ
       
   374 	REQ9199 
       
   375 	REQ9204 
       
   376 	REQ9195
       
   377 	REQ9201 
       
   378 	REQ9202 
       
   379 	REQ9222 
       
   380 	REQ9223 
       
   381 	REQ9236 
       
   382 	REQ9237
       
   383 	
       
   384 @SYMTestCaseDesc	
       
   385 	Deleting source bitmap object after issuing draw bitmap  with masking requests.
       
   386 	
       
   387 @SYMTestPriority	
       
   388 	Critical
       
   389 	
       
   390 @SYMTestStatus 		
       
   391 	Implemented
       
   392 	
       
   393 @SYMTestActions 	
       
   394 	1. Call method with valid parameters (see  DrawBitmapMasked-Basic). 
       
   395 	2. Right after returning from method call, destroy the source bitmap.
       
   396 	3. Call the method again with the same bitmap parameter.
       
   397 	Repeat  p. 1-3 a few times.
       
   398 	
       
   399 @SYMTestExpectedResults 
       
   400 	Source bitmap should be copied into target area. Memory leaks should not
       
   401 	be created. Valid bitmap should be created. This bitmap should be the same
       
   402 	as a reference bitmap.
       
   403 */
       
   404 void CTDrawBitmapMasked::TestSourceBitmapCloningL()
       
   405 	{	
       
   406 	_LIT(KTestName, "DrawBitmapMasked-SourceBitmapCloning"); 
       
   407 	if(!iRunningOomTests)
       
   408 		{
       
   409 		INFO_PRINTF1(KTestName);
       
   410 		}
       
   411 	
       
   412 	iTestParams.iDoCompressed = ETrue;
       
   413 	TestSourceBitmapCloningBaseL(KTestName(), EDrawBitmapMasked);
       
   414 	iTestParams.iDoCompressed = EFalse;
       
   415 	TestSourceBitmapCloningBaseL(KTestName(), EDrawBitmapMasked);
       
   416 	}
       
   417 
       
   418 /**
       
   419 @SYMTestCaseID  	
       
   420 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0006
       
   421 	
       
   422 @SYMPREQ 			
       
   423 	PREQ39
       
   424 
       
   425 @SYMREQ
       
   426 	REQ9199 
       
   427 	REQ9204 
       
   428 	REQ9195
       
   429 	REQ9201 
       
   430 	REQ9202 
       
   431 	REQ9222 
       
   432 	REQ9223 
       
   433 	REQ9236 
       
   434 	REQ9237
       
   435 	
       
   436 @SYMTestCaseDesc	
       
   437 	Deleting mask objects after issuing draw bitmap with masking  request.
       
   438 	
       
   439 @SYMTestPriority	
       
   440 	Critical
       
   441 	
       
   442 @SYMTestStatus 		
       
   443 	Implemented
       
   444 	
       
   445 @SYMTestActions 	
       
   446 	1. Call DrawBitmapMasked() method with valid parameters (see DrawBitmapMasked-Basic). 
       
   447 	2. Right after returning from DrawBitmapMasked() call, destroy the source mask (aMaskBitmap).
       
   448 	3. Call the DrawBitmapMasked() method again with the same mask parameter.
       
   449 	Repeat  p. 1-3 a few times.
       
   450 	
       
   451 @SYMTestExpectedResults 
       
   452 	Source bitmap should be copied into target area based on a mask data.
       
   453 	Memory leaks should not be created. Valid bitmap should be created. This bitmap
       
   454 	should be the same as a reference bitmap.
       
   455 */
       
   456 void CTDrawBitmapMasked::TestMaskCloningL()
       
   457 	{	
       
   458 	_LIT(KTestName, "DrawBitmapMasked-MaskCloning"); 
       
   459 	if(!iRunningOomTests)
       
   460 		{
       
   461 		INFO_PRINTF1(KTestName);
       
   462 		}
       
   463 	
       
   464 	iTestParams.iDoCompressed = ETrue;
       
   465 	TestMaskCloningBaseL(KTestName(), EDrawBitmapMasked);
       
   466 	iTestParams.iDoCompressed = EFalse;
       
   467 	TestMaskCloningBaseL(KTestName(), EDrawBitmapMasked);
       
   468 	}
       
   469 
       
   470 /**
       
   471 @SYMTestCaseID  	
       
   472 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0007
       
   473 	
       
   474 @SYMPREQ 			
       
   475 	PREQ39
       
   476 
       
   477 @SYMREQ
       
   478 	REQ9199 
       
   479 	REQ9204 
       
   480 	REQ9195
       
   481 	REQ9201 
       
   482 	REQ9202 
       
   483 	REQ9222 
       
   484 	REQ9223 
       
   485 	REQ9236 
       
   486 	REQ9237
       
   487 	
       
   488 @SYMTestCaseDesc	
       
   489 	Test correctness of bitmap drawing with mask in all possible draw modes.
       
   490 	
       
   491 @SYMTestPriority	
       
   492 	Critical
       
   493 	
       
   494 @SYMTestStatus 		
       
   495 	Implemented
       
   496 	
       
   497 @SYMTestActions 	
       
   498 	Set valid parameters (see DrawBitmapMasked-Basic).
       
   499 	Use the semi-transparent source bitmap (aBitmap).
       
   500 	Set drawmode to EDrawModeWriteAlpha and call the methods.
       
   501 	Set drawmode to EDrawModePEN and call the methods.
       
   502 	Set drawmode to EDrawModeWriteAlpha and call the methods.
       
   503 	
       
   504 @SYMTestExpectedResults 
       
   505 	The image drawn in the center should be drawn masked and blended 
       
   506 	(EDrawModePEN) and the images at the right and left should be drawn masked and 
       
   507 	opaque (EDrawModeWriteAlpha). Valid bitmap should be created.
       
   508 	This bitmap should be the same as a reference bitmap.
       
   509 */
       
   510 void CTDrawBitmapMasked::TestDrawModeL()
       
   511 	{
       
   512 	_LIT(KTestName, "DrawBitmapMasked-DrawMode"); 
       
   513 	if(!iRunningOomTests)
       
   514 		{
       
   515 		INFO_PRINTF1(KTestName);
       
   516 		}
       
   517 	
       
   518 	ResetGc();
       
   519 	
       
   520 	TSize bmpSize(iCheckedBoardWithAlphaBitmap->SizeInPixels());
       
   521 
       
   522 	TInt halfHeight = (bmpSize.iHeight  >> 1);	
       
   523 	TInt quaterWidth  = (bmpSize.iWidth  >> 2);
       
   524 	TInt y1 = halfHeight - (bmpSize.iHeight >> 2);	
       
   525 	TSize vertRectSize  (quaterWidth, bmpSize.iHeight);
       
   526 	TSize horizRectSize (bmpSize.iWidth, halfHeight);
       
   527 	
       
   528 	// EDrawModeWriteAlpha is not supported in the following modes
       
   529 	// This is tested under invalid parameter tests.
       
   530 	if (!((iMaskPixelFormat == EUidPixelFormatL_8) && 
       
   531 		  ((iTestParams.iSourcePixelFormat == EUidPixelFormatARGB_8888) ||
       
   532 		   (iTestParams.iSourcePixelFormat == EUidPixelFormatARGB_8888_PRE))))
       
   533 		{
       
   534 		// Render column to left
       
   535 		iGc->SetDrawMode(DirectGdi::EDrawModeWriteAlpha);
       
   536 		iGc->DrawBitmapMasked(
       
   537 			TRect (TPoint(0, 0), vertRectSize), 
       
   538 			*iCheckedBoardWithAlphaBitmap, 
       
   539 			TRect(TPoint(0, 0), vertRectSize), *iCurrentMask2, iInvertMask);
       
   540 		}
       
   541 	
       
   542 	// Render row in center
       
   543 	iGc->SetDrawMode(DirectGdi::EDrawModePEN);
       
   544 	iGc->DrawBitmapMasked(
       
   545 		TRect (TPoint(0, y1), horizRectSize),
       
   546 		*iCheckedBoardWithAlphaBitmap,
       
   547 		TRect(TPoint(0, 0), horizRectSize), *iCurrentMask2, iInvertMask);
       
   548 
       
   549 	// EDrawModeWriteAlpha is not supported in the following modes
       
   550 	// This is tested under invalid parameter tests.
       
   551 	if (!((iMaskPixelFormat == EUidPixelFormatL_8) && 
       
   552 		  ((iTestParams.iSourcePixelFormat == EUidPixelFormatARGB_8888) ||
       
   553 		   (iTestParams.iSourcePixelFormat == EUidPixelFormatARGB_8888_PRE))))
       
   554 		{
       
   555 		// Render column to right
       
   556 		iGc->SetDrawMode(DirectGdi::EDrawModeWriteAlpha);
       
   557 		iGc->DrawBitmapMasked(
       
   558 			TRect (TPoint(bmpSize.iWidth - quaterWidth, 0), vertRectSize), 
       
   559 			*iCheckedBoardWithAlphaBitmap, 
       
   560 			TRect(TPoint(0, 0), vertRectSize), *iCurrentMask2, iInvertMask);
       
   561 		}
       
   562 	
       
   563 	TESTNOERRORL(iGc->GetError());
       
   564 	WriteTargetOutput(KTestName());
       
   565 	}
       
   566 
       
   567 /**
       
   568 @SYMTestCaseID  	
       
   569 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0008
       
   570 	
       
   571 @SYMPREQ 			
       
   572 	PREQ39
       
   573 
       
   574 @SYMREQ
       
   575 	REQ9199 
       
   576 	REQ9204 
       
   577 	REQ9195
       
   578 	REQ9201 
       
   579 	REQ9202 
       
   580 	REQ9222 
       
   581 	REQ9223 
       
   582 	REQ9236 
       
   583 	REQ9237
       
   584 	
       
   585 @SYMTestCaseDesc	
       
   586 	Test the basic functionality of bit blitting with masking.
       
   587 	
       
   588 @SYMTestPriority	
       
   589 	Critical
       
   590 	
       
   591 @SYMTestStatus 		
       
   592 	Implemented
       
   593 	
       
   594 @SYMTestActions 	
       
   595 	Test bitmap drawing with masking for same source and mask bitmaps.
       
   596 	
       
   597 @SYMTestExpectedResults 
       
   598 	Source bitmap should be copied into target area. A mask should be
       
   599 	considered during coping. Valid bitmap should be created. This bitmap
       
   600 	shall be compared to a reference bitmap.
       
   601 */
       
   602 void CTDrawBitmapMasked::TestWithSameBitmapsL()
       
   603 	{	
       
   604 	_LIT(KTestName, "DrawBitmapMasked-SameBitmaps"); 
       
   605 	ResetGc();
       
   606 	TSize bmpSize1(iBlackWhiteBitmap->SizeInPixels());
       
   607 	iGc->DrawBitmapMasked(TRect(TPoint(0, 0), bmpSize1), *iBlackWhiteBitmap, TRect(TPoint(0, 0), bmpSize1), *iBlackWhiteBitmap, ETrue);
       
   608 	iGc->DrawBitmapMasked(TRect(TPoint(0, 0), bmpSize1), *iBlackWhiteBitmap, TRect(TPoint(0, 0), bmpSize1), *iBlackWhiteBitmap, EFalse);
       
   609 	TESTNOERROR(iGc->GetError());
       
   610 	//Write target only if image is not empty. BitGDI is producing white images when Mask pixel format is EUidPixelFormatL_8 
       
   611 	TBool pass = TestTargetL(KRgbWhite);
       
   612 	if(!pass)
       
   613 		{		
       
   614 		WriteTargetOutput(KTestName());
       
   615 		}	
       
   616 	}
       
   617 
       
   618 /**
       
   619 @SYMTestCaseID  	
       
   620 	GRAPHICS-DIRECTGDI-DRAWBITMAPMASKED-0009
       
   621 	
       
   622 @SYMPREQ 			
       
   623 	PREQ39
       
   624 
       
   625 @SYMREQ
       
   626 	REQ9199 
       
   627 	REQ9204 
       
   628 	REQ9195
       
   629 	REQ9201 
       
   630 	REQ9202 
       
   631 	REQ9222 
       
   632 	REQ9223 
       
   633 	REQ9236 
       
   634 	REQ9237
       
   635 	
       
   636 @SYMTestCaseDesc	
       
   637 	Test that DrawBitmapMasked() performs correctly if it is called after SetOrigin().
       
   638 	
       
   639 @SYMTestPriority	
       
   640 	Critical
       
   641 	
       
   642 @SYMTestStatus 		
       
   643 	Implemented
       
   644 	
       
   645 @SYMTestActions 	
       
   646 	Call SetOrigin().
       
   647 	Call DrawBitmapMasked().
       
   648 	
       
   649 @SYMTestExpectedResults 
       
   650 	Source bitmap should be drawn masked in the target area. Valid bitmap 
       
   651 	should be created. This bitmap shall be compared to a reference bitmap.
       
   652 */
       
   653 void CTDrawBitmapMasked::TestSetOriginL()
       
   654 	{	
       
   655 	_LIT(KTestName, "DrawBitmapMasked-SetOrigin");
       
   656 	
       
   657 	// Only do test for one pixel format to cut down on the number of images produced
       
   658 	// as this is just a positional test and we don't need to test for all pixel formats.
       
   659 	if (!((iTestParams.iTargetPixelFormat == EUidPixelFormatRGB_565) && (iTestParams.iSourcePixelFormat == EUidPixelFormatRGB_565)))
       
   660 		{
       
   661 		return;
       
   662 		}
       
   663 	
       
   664 	if(!iRunningOomTests)
       
   665 		{
       
   666 		INFO_PRINTF1(KTestName);
       
   667 		}
       
   668 	
       
   669 	ResetGc();
       
   670 
       
   671 	CFbsBitmap* bitmap = iCheckedBoardBitmap2;
       
   672 	CFbsBitmap* mask = iCurrentMask1;		
       
   673 	TSize bmpSize(bitmap->SizeInPixels());
       
   674 
       
   675 	iGc->SetOrigin(TPoint(-35, 80));
       
   676 	iGc->DrawBitmapMasked(TRect(TPoint(55, -60), bmpSize), *bitmap, TRect(TPoint(0, 0), bmpSize), *mask, iInvertMask);
       
   677 
       
   678 	TESTNOERRORL(iGc->GetError());	
       
   679 	WriteTargetOutput(KTestName());
       
   680 	}