graphics/gdi/src/T_DataBitmapDevice.cpp
branchSymbian2
changeset 1 8758140453c0
child 6 c108117318cb
equal deleted inserted replaced
0:e8c1ea2c6496 1:8758140453c0
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Symbian Foundation License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 /**
       
    19 @test
       
    20 @internalComponent
       
    21 
       
    22 This contains CT_DataGraphicsDevice
       
    23 */
       
    24 
       
    25 #include "T_DataBitmapDevice.h"
       
    26 #include "T_GraphicsUtil.h"
       
    27 
       
    28 /*@{*/
       
    29 ///	Commands
       
    30 _LIT(KCmdAddFile,									"AddFile");
       
    31 _LIT(KCmdCreateBitmapContext,						"CreateBitmapContext");
       
    32 _LIT(KCmdFontHeightInPixels,						"FontHeightInPixels");
       
    33 _LIT(KCmdGetNearestFontInPixels,					"GetNearestFontInPixels");
       
    34 _LIT(KCmdGetNearestFontToDesignHeightInPixels,		"GetNearestFontToDesignHeightInPixels");
       
    35 _LIT(KCmdGetNearestFontToMaxHeightInPixels,			"GetNearestFontToMaxHeightInPixels");
       
    36 _LIT(KCmdGetPixel,									"GetPixel");
       
    37 _LIT(KCmdGetScanLine,								"GetScanLine");
       
    38 _LIT(KCmdRemoveFile,								"RemoveFile");
       
    39 
       
    40 ///	Fields
       
    41 _LIT(KFldBitmapContext,								"bitmap_context");
       
    42 _LIT(KFldBuffLength,								"buff_length");
       
    43 _LIT(KFldCheckScanLine,								"checkScanLine");
       
    44 _LIT(KFldScanLineBufferLength,						"scanLineBufferLength");
       
    45 _LIT(KFldDisplayMode,								"displaymode");
       
    46 _LIT(KFldExpected,									"expected");
       
    47 _LIT(KFldFile,										"file");
       
    48 _LIT(KFldFont,										"font");
       
    49 _LIT(KFldHeightIndex,								"height_index");
       
    50 _LIT(KFldId,										"id");
       
    51 _LIT(KFldLength,									"length");
       
    52 _LIT(KFldMaxHeight,									"maxheight");
       
    53 _LIT(KFldPoint,										"point");
       
    54 _LIT(KFldSize,										"size");
       
    55 _LIT(KFldTypefaceIndex,								"typeface_index");
       
    56 _LIT(KFldPointNum,									"checkPointNum");
       
    57 _LIT(KFldPointXN,									"point%d_x");
       
    58 _LIT(KFldPointRGBN,									"expected_point%d");
       
    59 _LIT(KFldScanlineY,									"scanline_y");
       
    60 
       
    61 ///	Logging
       
    62 _LIT(KLogColor,										"Color Red=%d Green=%d Blue=%d Alpha=%d");
       
    63 _LIT(KLogError,										"Error=%d");
       
    64 _LIT(KLogHeight,									"Height=%d");
       
    65 _LIT(KLogMissingFilename,							"File '%S' not found in array");
       
    66 _LIT(KLogMissingParameter,							"Missing parameter '%S'");
       
    67 _LIT(KLogMissingWrapper,							"Missing wrapper for '%S'");
       
    68 _LIT(KLogNotExpectedValue,							"Not expected value");
       
    69 _LIT(KLogDoNotCheckScanLine,						"Will not check scanline.");
       
    70 _LIT(KLogDoCheckScanLine,							"Will check scanline is correct.");
       
    71 _LIT(KLogCheckScanLineResult,						"ScanLine checked, expected length is %d, actual length is %d.");
       
    72 _LIT(KLogColorExpected,								"Expected Color Red=%d Green=%d Blue=%d Alpha=%d");
       
    73 _LIT(KLogColorActual,								"Actual Color Red=%d Green=%d Blue=%d Alpha=%d");
       
    74 _LIT(KLogPoint,										"Point X=%d Y=%d");
       
    75 /*@}*/
       
    76 
       
    77 
       
    78 /**
       
    79 * Constructor. First phase construction
       
    80 */
       
    81 CT_DataBitmapDevice::CT_DataBitmapDevice()
       
    82 :	CT_DataGraphicsDevice()
       
    83 	{
       
    84 	}
       
    85 
       
    86 CT_DataBitmapDevice::~CT_DataBitmapDevice()
       
    87 	{
       
    88 	iFile.Reset();
       
    89 	iFile.Close();
       
    90 	iId.Reset();
       
    91 	iId.Close();
       
    92 	}
       
    93 
       
    94 /**
       
    95 * Process a command read from the ini file
       
    96 *
       
    97 * @param aDataWrapper	test step requiring command to be processed
       
    98 * @param aCommand	the command to process
       
    99 * @param aSection		the entry in the ini file requiring the command to be processed
       
   100 *
       
   101 * @return ETrue if the command is processed
       
   102 */
       
   103 TBool CT_DataBitmapDevice::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
       
   104 	{
       
   105 	TBool	ret=ETrue;
       
   106 	if ( aCommand==KCmdAddFile )
       
   107 		{
       
   108 		DoCmdAddFileL(aSection);
       
   109 		}
       
   110 	else if ( aCommand==KCmdCreateBitmapContext )
       
   111 		{
       
   112 		DoCmdCreateBitmapContextL(aSection);
       
   113 		}
       
   114 	else if ( aCommand==KCmdFontHeightInPixels )
       
   115 		{
       
   116 		DoCmdFontHeightInPixels(aSection);
       
   117 		}
       
   118 	else if ( aCommand==KCmdGetNearestFontInPixels )
       
   119 		{
       
   120 		DoCmdGetNearestFontInPixelsL(aSection);
       
   121 		}
       
   122 	else if ( aCommand==KCmdGetNearestFontToDesignHeightInPixels )
       
   123 		{
       
   124 		DoCmdGetNearestFontToDesignHeightInPixelsL(aSection);
       
   125 		}
       
   126 	else if ( aCommand==KCmdGetNearestFontToMaxHeightInPixels )
       
   127 		{
       
   128 		DoCmdGetNearestFontToMaxHeightInPixelsL(aSection);
       
   129 		}
       
   130 	else if ( aCommand==KCmdGetPixel )
       
   131 		{
       
   132 		DoCmdGetPixel(aSection);
       
   133 		}
       
   134 	else if ( aCommand==KCmdGetScanLine )
       
   135 		{
       
   136 		DoCmdGetScanLineL(aSection);
       
   137 		}
       
   138 	else if ( aCommand==KCmdRemoveFile )
       
   139 		{
       
   140 		DoCmdRemoveFile(aSection);
       
   141 		}
       
   142 	else
       
   143 		{
       
   144 		ret=CT_DataGraphicsDevice::DoCommandL(aCommand, aSection, aAsyncErrorIndex);
       
   145 		}
       
   146 
       
   147 	/* Another work package will implement this */
       
   148 	return ret;
       
   149 	}
       
   150 
       
   151 void CT_DataBitmapDevice::DoCmdAddFileL(const TDesC& aSection)
       
   152 	{
       
   153 	// get typeface index from parameters
       
   154 	TPtrC	file;
       
   155 	if ( !GetStringFromConfig(aSection, KFldFile(), file) )
       
   156 		{
       
   157 		ERR_PRINTF2(KLogMissingParameter, &KFldFile());
       
   158 		SetBlockResult(EFail);
       
   159 		}
       
   160 	else
       
   161 		{
       
   162 		TInt	id;
       
   163 		INFO_PRINTF1(_L("execute AddFile(const TDesC&, TInt&)"));
       
   164 		TInt	err=GetBitmapDevice()->AddFile(file, id);
       
   165 		if ( err!=KErrNone )
       
   166 			{
       
   167 			ERR_PRINTF2(KLogError, err);
       
   168 			SetError(err);
       
   169 			}
       
   170 		else
       
   171 			{
       
   172 			// Append filename and id
       
   173 			iFile.AppendL(file);
       
   174 			iId.AppendL(id);
       
   175 			}
       
   176 		}
       
   177 	}
       
   178 
       
   179 void CT_DataBitmapDevice::DoCmdCreateBitmapContextL(const TDesC& aSection)
       
   180 	{
       
   181 	TPtrC	wrapperName;
       
   182 	if ( !GetStringFromConfig(aSection, KFldBitmapContext, wrapperName) )
       
   183 		{
       
   184 		ERR_PRINTF2(KLogMissingParameter, &KFldBitmapContext());
       
   185 		SetBlockResult(EFail);
       
   186 		}
       
   187 	else
       
   188 		{
       
   189 		CDataWrapper*	wrapper=GetDataWrapperL(wrapperName);
       
   190 		if ( wrapper==NULL )
       
   191 			{
       
   192 			ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
       
   193 			SetBlockResult(EFail);
       
   194 			}
       
   195 		else
       
   196 			{
       
   197 			CBitmapContext*	bitmapContext=NULL;
       
   198 			INFO_PRINTF1(_L("execute CreateBitmapContext(CBitmapContext*&)"));
       
   199 			TInt	err=GetBitmapDevice()->CreateBitmapContext(bitmapContext);
       
   200 			if ( err!=KErrNone )
       
   201 				{
       
   202 				ERR_PRINTF2(KLogError, err);
       
   203 				SetError(err);
       
   204 				}
       
   205 			else
       
   206 				{
       
   207 				wrapper->SetObjectL(bitmapContext);
       
   208 				}
       
   209 			}
       
   210 		}
       
   211 	}
       
   212 
       
   213 void CT_DataBitmapDevice::DoCmdFontHeightInPixels(const TDesC& aSection)
       
   214 	{
       
   215 	TBool	dataOk=ETrue;
       
   216 
       
   217 	// get typeface index from parameters
       
   218 	TInt	typefaceIndex;
       
   219 	if ( !GetIntFromConfig(aSection, KFldTypefaceIndex(), typefaceIndex) )
       
   220 		{
       
   221 		dataOk=EFalse;
       
   222 		ERR_PRINTF2(KLogMissingParameter, &KFldTypefaceIndex());
       
   223 		SetBlockResult(EFail);
       
   224 		}
       
   225 
       
   226 	// get height index from parameters
       
   227 	TInt	heightIndex;
       
   228 	if ( !GetIntFromConfig(aSection, KFldHeightIndex(), heightIndex) )
       
   229 		{
       
   230 		dataOk=EFalse;
       
   231 		ERR_PRINTF2(KLogMissingParameter, &KFldHeightIndex());
       
   232 		SetBlockResult(EFail);
       
   233 		}
       
   234 
       
   235 	if ( dataOk )
       
   236 		{
       
   237 		INFO_PRINTF1(_L("execute FontHeightInPixels(TInt, TInt)"));
       
   238 		TInt	height=GetBitmapDevice()->FontHeightInPixels(typefaceIndex, heightIndex);
       
   239 		INFO_PRINTF2(KLogHeight, height);
       
   240 	
       
   241 		TInt	expected;
       
   242 		if ( GetIntFromConfig(aSection, KFldExpected, expected) )
       
   243 			{
       
   244 			if ( expected!=height )
       
   245 				{
       
   246 				ERR_PRINTF1(KLogNotExpectedValue);
       
   247 				SetBlockResult(EFail);
       
   248 				}
       
   249 			}
       
   250 		}
       
   251 	}
       
   252 
       
   253 void CT_DataBitmapDevice::DoCmdGetNearestFontInPixelsL(const TDesC& aSection)
       
   254 	{
       
   255 	TBool	dataOk=ETrue;
       
   256 
       
   257 	TFontSpec	fontSpec;
       
   258 	if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
       
   259 		{
       
   260 		dataOk=EFalse;
       
   261 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   262 		SetBlockResult(EFail);
       
   263 		}
       
   264 
       
   265 	TPtrC	wrapperName;
       
   266 	if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
       
   267 		{
       
   268 		dataOk=EFalse;
       
   269 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   270 		SetBlockResult(EFail);
       
   271 		}
       
   272 
       
   273 	if ( dataOk )
       
   274 		{
       
   275 		CDataWrapper*	wrapper=GetDataWrapperL(wrapperName);
       
   276 		if ( wrapper==NULL )
       
   277 			{
       
   278 			ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
       
   279 			SetBlockResult(EFail);
       
   280 			}
       
   281 		else
       
   282 			{
       
   283 			CFont*	font=NULL;
       
   284 			INFO_PRINTF1(_L("execute GetNearestFontInPixels(CFont*&, TFontSpec)"));
       
   285 			TInt	err=GetBitmapDevice()->GetNearestFontInPixels(font, fontSpec);
       
   286 			if ( err!=KErrNone )
       
   287 				{
       
   288 				ERR_PRINTF2(KLogError, err);
       
   289 				SetError(err);
       
   290 				}
       
   291 			else
       
   292 				{
       
   293 				wrapper->SetObjectL(font);
       
   294 				}
       
   295 			}
       
   296 		}
       
   297 	}
       
   298 
       
   299 void CT_DataBitmapDevice::DoCmdGetNearestFontToDesignHeightInPixelsL(const TDesC& aSection)
       
   300 	{
       
   301 	TBool	dataOk=ETrue;
       
   302 
       
   303 	TFontSpec	fontSpec;
       
   304 	if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
       
   305 		{
       
   306 		dataOk=EFalse;
       
   307 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   308 		SetBlockResult(EFail);
       
   309 		}
       
   310 
       
   311 	TPtrC		wrapperName;
       
   312 	// get BitmapUtilData object from parameters
       
   313 	if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
       
   314 		{
       
   315 		dataOk=EFalse;
       
   316 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   317 		SetBlockResult(EFail);
       
   318 		}
       
   319 
       
   320 	if ( dataOk )
       
   321 		{
       
   322 		CDataWrapper*	wrapper=GetDataWrapperL(wrapperName);
       
   323 		if ( wrapper==NULL )
       
   324 			{
       
   325 			ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
       
   326 			SetBlockResult(EFail);
       
   327 			}
       
   328 		else
       
   329 			{
       
   330 			CFont*	font=NULL;
       
   331 			INFO_PRINTF1(_L("execute GetNearestFontToDesignHeightInPixels(CFont*&, TFontSpec)"));
       
   332 			TInt	err=GetBitmapDevice()->GetNearestFontToDesignHeightInPixels(font, fontSpec);
       
   333 			if ( err!=KErrNone )
       
   334 				{
       
   335 				ERR_PRINTF2(KLogError, err);
       
   336 				SetError(err);
       
   337 				}
       
   338 			else
       
   339 				{
       
   340 				wrapper->SetObjectL(font);
       
   341 				}
       
   342 			}
       
   343 		}
       
   344 	}
       
   345 
       
   346 void CT_DataBitmapDevice::DoCmdGetNearestFontToMaxHeightInPixelsL(const TDesC& aSection)
       
   347 	{
       
   348 	TBool	dataOk=ETrue;
       
   349 
       
   350 	TFontSpec	fontSpec;
       
   351 	if ( !GetFontSpecFromConfig(aSection, KFldFont, fontSpec) )
       
   352 		{
       
   353 		dataOk=EFalse;
       
   354 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   355 		SetBlockResult(EFail);
       
   356 		}
       
   357 
       
   358 	TInt	maxHeight;
       
   359 	if ( !GetIntFromConfig(aSection, KFldMaxHeight, maxHeight) )
       
   360 		{
       
   361 		dataOk=EFalse;
       
   362 		ERR_PRINTF2(KLogMissingParameter, &KFldMaxHeight());
       
   363 		SetBlockResult(EFail);
       
   364 		}
       
   365 
       
   366 	TPtrC		wrapperName;
       
   367 	// get BitmapUtilData object from parameters
       
   368 	if ( !GetStringFromConfig(aSection, KFldFont, wrapperName) )
       
   369 		{
       
   370 		dataOk=EFalse;
       
   371 		ERR_PRINTF2(KLogMissingParameter, &KFldFont());
       
   372 		SetBlockResult(EFail);
       
   373 		}
       
   374 
       
   375 	if ( dataOk )
       
   376 		{
       
   377 		CDataWrapper*	wrapper=GetDataWrapperL(wrapperName);
       
   378 		if ( wrapper==NULL )
       
   379 			{
       
   380 			ERR_PRINTF2(KLogMissingWrapper, &wrapperName);
       
   381 			SetBlockResult(EFail);
       
   382 			}
       
   383 		else
       
   384 			{
       
   385 			CFont*	font=NULL;
       
   386 			INFO_PRINTF1(_L("execute GetNearestFontToMaxHeightInPixels(CFont*&, TFontSpec, TInt)"));
       
   387 			TInt	err=GetBitmapDevice()->GetNearestFontToMaxHeightInPixels(font, fontSpec, maxHeight);
       
   388 			if ( err!=KErrNone )
       
   389 				{
       
   390 				ERR_PRINTF2(KLogError, err);
       
   391 				SetError(err);
       
   392 				}
       
   393 			else
       
   394 				{
       
   395 				wrapper->SetObjectL(font);
       
   396 				}
       
   397 			}
       
   398 		}
       
   399 	}
       
   400 
       
   401 void CT_DataBitmapDevice::DoCmdGetPixel(const TDesC& aSection)
       
   402 	{
       
   403 	// get typeface index from parameters
       
   404 	TPoint	point;
       
   405 	if ( !GetPointFromConfig(aSection, KFldPoint(), point) )
       
   406 		{
       
   407 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
   408 		SetBlockResult(EFail);
       
   409 		}
       
   410 	else
       
   411 		{
       
   412 		TRgb	color;
       
   413 		INFO_PRINTF1(_L("execute GetPixel(TRgb&, const TPoint&)"));
       
   414 		GetBitmapDevice()->GetPixel(color, point);
       
   415 		INFO_PRINTF5(KLogColor, color.Red(), color.Green(), color.Blue(), color.Alpha());
       
   416 
       
   417 		TRgb	expected;
       
   418 		if ( GetRgbFromConfig(aSection, KFldExpected, expected) )
       
   419 			{
       
   420 			if ( expected!=color )
       
   421 				{
       
   422 				ERR_PRINTF1(KLogNotExpectedValue);
       
   423 				SetBlockResult(EFail);
       
   424 				}
       
   425 			}
       
   426 		}
       
   427 	}
       
   428 
       
   429 void CT_DataBitmapDevice::DoCmdGetScanLineL(const TDesC& aSection)
       
   430 	{
       
   431 	TBool	dataOk=ETrue;
       
   432 
       
   433 	// get point x coordinate from parameters
       
   434 	TPoint	point;
       
   435 	if ( !GetPointFromConfig(aSection, KFldPoint(), point) )
       
   436 		{
       
   437 		dataOk=EFalse;
       
   438 		ERR_PRINTF2(KLogMissingParameter, &KFldPoint());
       
   439 		SetBlockResult(EFail);
       
   440 		}
       
   441 
       
   442 	// get length from parameters
       
   443 	TInt	length = 0;
       
   444 	if ( !GetIntFromConfig(aSection, KFldLength(), length) )
       
   445 		{
       
   446 		dataOk=EFalse;
       
   447 		ERR_PRINTF2(KLogMissingParameter, &KFldLength());
       
   448 		SetBlockResult(EFail);
       
   449 		}
       
   450 
       
   451 	// get buffer length from parameters
       
   452 	TInt	buffLength = 0;
       
   453 	if ( !GetIntFromConfig(aSection, KFldBuffLength(), buffLength) )
       
   454 		{
       
   455 		dataOk=EFalse;
       
   456 		ERR_PRINTF2(KLogMissingParameter, &KFldBuffLength());
       
   457 		SetBlockResult(EFail);
       
   458 		}
       
   459 
       
   460 	// get display mode from parameters
       
   461 	TDisplayMode	displayMode;
       
   462 	if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldDisplayMode(), displayMode) )
       
   463 		{
       
   464 		ERR_PRINTF2(KLogMissingParameter, &KFldDisplayMode());
       
   465 		SetBlockResult(EFail);
       
   466 		dataOk=EFalse;
       
   467 		}
       
   468 
       
   469 	if ( dataOk )
       
   470 		{
       
   471 		// call GetScanLine()
       
   472 		TUint8*	buffer = new (ELeave) TUint8[buffLength];
       
   473 		TPtr8	scanline(buffer, buffLength, buffLength);
       
   474 
       
   475 		INFO_PRINTF1(_L("execute GetScanLine(TDes8&, const TPoint&, TInt, TDisplayMode)"));
       
   476 		GetBitmapDevice()->GetScanLine(scanline, point, length, displayMode);
       
   477 		
       
   478 		// Check ScanLine.
       
   479 		TBool checkScanLine = EFalse;
       
   480 		if ( !GetBoolFromConfig(aSection, KFldCheckScanLine(), checkScanLine)  )
       
   481 			{
       
   482 			INFO_PRINTF1(KLogDoNotCheckScanLine);	
       
   483 			}
       
   484 		else 
       
   485 			{
       
   486 			if(!checkScanLine)
       
   487 				{
       
   488 				INFO_PRINTF1(KLogDoNotCheckScanLine);
       
   489 				}
       
   490 			else
       
   491 				{
       
   492 				INFO_PRINTF1(KLogDoCheckScanLine);				
       
   493 				
       
   494 				// get length of returned scanline
       
   495 				TInt	expectedscanLineBufferLength = 0;
       
   496 				if ( GetIntFromConfig(aSection, KFldScanLineBufferLength, expectedscanLineBufferLength) )
       
   497 					{		
       
   498 					TInt scanlineLen = scanline.Length();
       
   499 					INFO_PRINTF3(KLogCheckScanLineResult,expectedscanLineBufferLength,scanlineLen);
       
   500 					if(expectedscanLineBufferLength != scanlineLen)				
       
   501 						{
       
   502 							ERR_PRINTF3(KLogCheckScanLineResult,expectedscanLineBufferLength,scanlineLen);
       
   503 							SetBlockResult(EFail);
       
   504 						}						
       
   505 					}
       
   506 				else
       
   507 					{
       
   508 					//check the scanline got correctlly.
       
   509 					CheckScanLine(aSection,scanline);
       
   510 					}
       
   511 				
       
   512 				}
       
   513 			}
       
   514 		delete [] buffer;
       
   515 		}
       
   516 	}
       
   517 
       
   518 void CT_DataBitmapDevice::DoCmdRemoveFile(const TDesC& aSection)
       
   519 	{
       
   520 	TBool	dataOk = ETrue;
       
   521 	TInt	id;
       
   522 	if ( !GetIntFromConfig(aSection, KFldId(), id) )
       
   523 		{
       
   524 		TPtrC	file;
       
   525 		if ( !GetStringFromConfig(aSection, KFldFile(), file) )
       
   526 			{
       
   527 			dataOk=EFalse;
       
   528 			ERR_PRINTF2(KLogMissingParameter, &KFldId());
       
   529 			ERR_PRINTF2(KLogMissingParameter, &KFldFile());
       
   530 			SetBlockResult(EFail);
       
   531 			}
       
   532 		else
       
   533 			{
       
   534 			TBool	found=EFalse;	//	Filename found in array
       
   535 			for ( TInt index=iFile.Count(); (index>0) && (!found);  )
       
   536 				{
       
   537 				if ( iFile[--index]==file )
       
   538 					{
       
   539 					id=iId[index];
       
   540 					iFile.Remove(index);
       
   541 					iId.Remove(index);
       
   542 					found=ETrue;
       
   543 					}
       
   544 				}
       
   545 			if ( !found )
       
   546 				{
       
   547 				dataOk=EFalse;
       
   548 				ERR_PRINTF2(KLogMissingFilename, &file);
       
   549 				SetBlockResult(EFail);
       
   550 				}
       
   551 			}
       
   552 		}
       
   553 
       
   554 	if ( dataOk )
       
   555 		{
       
   556 		INFO_PRINTF1(_L("execute RemoveFile(TInt)"));
       
   557 		GetBitmapDevice()->RemoveFile(id);
       
   558 		}
       
   559 	}
       
   560 
       
   561 void CT_DataBitmapDevice::CheckScanLine(const TDesC& aSection,TDes8 &aBuf)
       
   562 	{
       
   563 	INFO_PRINTF1(KLogDoCheckScanLine);	
       
   564 	
       
   565 	TBool appendCheckDataOK = ETrue;
       
   566 	TSize	bitmapSize;
       
   567 	if ( !GetSizeFromConfig(aSection, KFldSize, bitmapSize) )
       
   568 		{
       
   569 		ERR_PRINTF2(KLogMissingParameter, &KFldSize);
       
   570 		SetBlockResult(EFail);
       
   571 		appendCheckDataOK = EFalse;
       
   572 		}
       
   573 	
       
   574 	TDisplayMode displayMode;
       
   575 	if ( !CT_GraphicsUtil::ReadDisplayMode(*this, aSection, KFldDisplayMode(), displayMode) )
       
   576 		{
       
   577 		ERR_PRINTF1(_L("No display mode"));
       
   578 		SetBlockResult(EFail);
       
   579 		appendCheckDataOK = EFalse;
       
   580 		}
       
   581 	
       
   582 	TInt pointNum;
       
   583 	if ( !GetIntFromConfig(aSection, KFldPointNum(), pointNum) )
       
   584 		{
       
   585 		ERR_PRINTF1(_L("No check point num"));
       
   586 		SetBlockResult(EFail);
       
   587 		appendCheckDataOK = EFalse;
       
   588 		}
       
   589 	
       
   590 	TInt scanlineY;
       
   591 	if ( !GetIntFromConfig(aSection, KFldScanlineY, scanlineY) )
       
   592 		{
       
   593 		ERR_PRINTF1(_L("No check scan line Y"));
       
   594 		SetBlockResult(EFail);
       
   595 		appendCheckDataOK = EFalse;
       
   596 		}
       
   597 	
       
   598 	if (appendCheckDataOK)
       
   599 		{
       
   600 		CFbsBitmap* fbsbitmap = new(ELeave) CFbsBitmap();
       
   601 		fbsbitmap->Create(bitmapSize,displayMode); 
       
   602 		fbsbitmap->SetScanLine(aBuf,scanlineY);
       
   603 		
       
   604 		TBuf<KMaxTestExecuteCommandLength>	tempStore;		
       
   605 		
       
   606 		for (TInt i=1;i<=pointNum;i++)
       
   607 			{
       
   608 			TInt x;			
       
   609 			tempStore.Format(KFldPointXN, i);
       
   610 			if ( !GetIntFromConfig(aSection, tempStore, x) )
       
   611 				{
       
   612 				ERR_PRINTF2(KLogMissingParameter, &tempStore);
       
   613 				SetBlockResult(EFail);
       
   614 				appendCheckDataOK=EFalse;
       
   615 				}	
       
   616 			TRgb expected;
       
   617 			tempStore.Format(KFldPointRGBN, i);
       
   618 			if ( !GetRgbFromConfig(aSection, tempStore, expected) )
       
   619 				{
       
   620 				ERR_PRINTF2(KLogMissingParameter, &KFldExpected());
       
   621 				SetBlockResult(EFail);
       
   622 				appendCheckDataOK=EFalse;
       
   623 				}
       
   624 			if(appendCheckDataOK)
       
   625 				{
       
   626 				TRgb actual;
       
   627 				TPoint pixelPoint(x,scanlineY);
       
   628 				fbsbitmap->GetPixel(actual,pixelPoint);
       
   629 				if(actual != expected)
       
   630 					{
       
   631 					ERR_PRINTF3(KLogPoint, x,scanlineY);
       
   632 					ERR_PRINTF5(KLogColorActual, actual.Red(), actual.Green(), actual.Blue(), actual.Alpha());
       
   633 					ERR_PRINTF5(KLogColorExpected, expected.Red(), expected.Green(), expected.Blue(), expected.Alpha());
       
   634 					SetBlockResult(EFail);
       
   635 					}
       
   636 				}
       
   637 			}
       
   638 
       
   639 		delete fbsbitmap;
       
   640 		}
       
   641 	}