os/graphics/fbs/fontandbitmapserver/tfbs/textendedbitmapnegative.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent - Internal Symbian test code
sl@0
    20
*/
sl@0
    21
sl@0
    22
#include <graphics/bitmapuid.h>
sl@0
    23
#include "textendedbitmapcommon.h"
sl@0
    24
#include "textendedbitmapnegative.h"
sl@0
    25
sl@0
    26
// Values for valid test extended bitmap
sl@0
    27
const TUint8 KTestData[]		= "Extended bitmap test data 123456";
sl@0
    28
const TInt KTestDataSize		= sizeof(KTestData);
sl@0
    29
const TSize KSizeInPixels 		= TSize(50,50);
sl@0
    30
const TDisplayMode KDisplayMode	= EColor64K;
sl@0
    31
sl@0
    32
const TInt KMaxPixelSize = KMaxTInt/4; // Maximum pixel size to avoid some overflow problems
sl@0
    33
const TUint KMaxByteSize = TUint(KMaxTInt/2); // Maximum byte size to avoid other overflow problems
sl@0
    34
sl@0
    35
CTExtendedBitmapNegative::CTExtendedBitmapNegative(CTestStep* aStep):
sl@0
    36
	CTFbsBase(aStep, ETrue)
sl@0
    37
	{
sl@0
    38
	}
sl@0
    39
sl@0
    40
CTExtendedBitmapNegative::~CTExtendedBitmapNegative()
sl@0
    41
	{
sl@0
    42
	((CTExtendedBitmapNegativeStep*)iStep)->CloseTMSGraphicsStep();
sl@0
    43
	}
sl@0
    44
sl@0
    45
void CTExtendedBitmapNegative::RunFbsTestL(TInt aCurTestCase)
sl@0
    46
    {
sl@0
    47
    ((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
sl@0
    48
	switch(aCurTestCase)
sl@0
    49
		{
sl@0
    50
		// CreateExtendedBitmap() tests
sl@0
    51
	case 1:
sl@0
    52
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0010"));
sl@0
    53
		CreateWithoutFbsSessionL();
sl@0
    54
		break;
sl@0
    55
	case 2:
sl@0
    56
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0011"));
sl@0
    57
		CreateBadPixelSizeL();
sl@0
    58
		break;
sl@0
    59
	case 3:
sl@0
    60
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0012"));
sl@0
    61
		CreateBadDisplayModeL();
sl@0
    62
		break;
sl@0
    63
	case 4:
sl@0
    64
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0013"));
sl@0
    65
		CreateRestrictedUidL();
sl@0
    66
		break;
sl@0
    67
	case 5:
sl@0
    68
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0014"));
sl@0
    69
		CreateNullDataL();
sl@0
    70
		break;
sl@0
    71
	case 6:
sl@0
    72
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0015"));
sl@0
    73
		CreateBadDataSizeL();
sl@0
    74
		break;
sl@0
    75
sl@0
    76
		// ExtendedBitmapType() tests
sl@0
    77
	case 7:
sl@0
    78
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0016"));
sl@0
    79
		TypeUninitialisedBitmapL();
sl@0
    80
		break;
sl@0
    81
	case 8:
sl@0
    82
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0017"));
sl@0
    83
		TypeStandardBitmapL();
sl@0
    84
		break;
sl@0
    85
	case 9:
sl@0
    86
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0018"));
sl@0
    87
		TypeHardwareBitmapL();
sl@0
    88
		break;	
sl@0
    89
sl@0
    90
		// DataSize() tests
sl@0
    91
	case 10:
sl@0
    92
		((CTExtendedBitmapNegativeStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0019"));
sl@0
    93
		SizeUninitialisedBitmapL();
sl@0
    94
sl@0
    95
		// Fall through as last test case
sl@0
    96
	default:
sl@0
    97
		SetLastTestCase();
sl@0
    98
		break;
sl@0
    99
		}
sl@0
   100
	((CTExtendedBitmapNegativeStep*)iStep)->RecordTestResultL();
sl@0
   101
    }
sl@0
   102
sl@0
   103
sl@0
   104
// CreateExtendedBitmap() tests
sl@0
   105
sl@0
   106
/**
sl@0
   107
	@SYMTestCaseID
sl@0
   108
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0010
sl@0
   109
sl@0
   110
	@SYMTestCaseDesc
sl@0
   111
	Create an extended bitmap without an FbsSession
sl@0
   112
sl@0
   113
	@SYMPREQ 
sl@0
   114
	PREQ2096
sl@0
   115
	
sl@0
   116
	@SYMREQ
sl@0
   117
	REQ10847
sl@0
   118
	REQ10849
sl@0
   119
sl@0
   120
	@SYMTestPriority  
sl@0
   121
	High
sl@0
   122
sl@0
   123
	@SYMTestStatus 
sl@0
   124
	Implemented
sl@0
   125
sl@0
   126
	@SYMTestActions
sl@0
   127
	Test calls RFbsSession::Disconnect() and then attempts to
sl@0
   128
	create an extended bitmap using test data and test UID.
sl@0
   129
sl@0
   130
	@SYMTestExpectedResults
sl@0
   131
	Extended bitmap creation should fail returning KErrCouldNotConnect.
sl@0
   132
*/
sl@0
   133
void CTExtendedBitmapNegative::CreateWithoutFbsSessionL()
sl@0
   134
	{
sl@0
   135
	INFO_PRINTF1(_L("Create an extended bitmap with no FbsSession"));
sl@0
   136
sl@0
   137
	const TUint KMinTestThreadHeapSize = 0x00000100;
sl@0
   138
	const TUint KMaxTestThreadheapSize = 0x00100000;
sl@0
   139
sl@0
   140
	INFO_PRINTF1(_L("Creating new thread with no FbsSession"));
sl@0
   141
	RThread noFbsThread;
sl@0
   142
	CleanupClosePushL(noFbsThread);
sl@0
   143
	_LIT(KNoFbsThreadName, "CTExtendedBitmapNegative_NoFbsThread");
sl@0
   144
	User::LeaveIfError(noFbsThread.Create(KNoFbsThreadName, CreateWithoutFbsSessionStart, KDefaultStackSize, KMinTestThreadHeapSize, KMaxTestThreadheapSize, NULL));
sl@0
   145
sl@0
   146
	TRequestStatus threadStatus;
sl@0
   147
	noFbsThread.Logon(threadStatus);
sl@0
   148
	noFbsThread.SetPriority(EPriorityLess);
sl@0
   149
	
sl@0
   150
	INFO_PRINTF1(_L("Resuming new thread, which will call CreateExtendedBitmap() with valid parameters"));	
sl@0
   151
	noFbsThread.Resume();
sl@0
   152
sl@0
   153
	User::WaitForRequest(threadStatus);
sl@0
   154
sl@0
   155
	TESTEXPECTEDERRORL(noFbsThread.ExitReason(), KErrCouldNotConnect);
sl@0
   156
	CleanupStack::PopAndDestroy(&noFbsThread);
sl@0
   157
	}
sl@0
   158
sl@0
   159
sl@0
   160
/**
sl@0
   161
Function for testing with no RFbsSession connected, used by CreateWithoutFbsSessionL().
sl@0
   162
@see CreateWithoutFbsSessionL() 
sl@0
   163
@param aInfo Not used
sl@0
   164
@return Error code returned by CreateExtendedBitmap, with KErrCouldNotConnect expected.
sl@0
   165
 */
sl@0
   166
TInt CTExtendedBitmapNegative::CreateWithoutFbsSessionStart(TAny* /*aInfo*/)
sl@0
   167
	{
sl@0
   168
	TInt res = KErrNone;
sl@0
   169
	CFbsBitmap* bmp = new CFbsBitmap;
sl@0
   170
	if (bmp == NULL)
sl@0
   171
		{
sl@0
   172
		res = KErrNoMemory;
sl@0
   173
		}
sl@0
   174
	
sl@0
   175
	if (res == KErrNone)
sl@0
   176
		{
sl@0
   177
		// Call CFbsBitmap::Rasterizer() for coverage of the case where it is called without a valid FbsSession
sl@0
   178
		if (bmp->Rasterizer() != NULL)
sl@0
   179
			{
sl@0
   180
			res = KErrGeneral;
sl@0
   181
			}
sl@0
   182
		}
sl@0
   183
	
sl@0
   184
	if (res == KErrNone)
sl@0
   185
		{
sl@0
   186
		res = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);		
sl@0
   187
		}
sl@0
   188
	
sl@0
   189
	delete bmp;
sl@0
   190
	
sl@0
   191
	return res;
sl@0
   192
	}
sl@0
   193
sl@0
   194
/**
sl@0
   195
	@SYMTestCaseID
sl@0
   196
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0011
sl@0
   197
sl@0
   198
	@SYMTestCaseDesc
sl@0
   199
	Create an extended bitmap with bad pixel size
sl@0
   200
sl@0
   201
	@SYMPREQ 
sl@0
   202
	PREQ2096
sl@0
   203
	
sl@0
   204
	@SYMREQ
sl@0
   205
	REQ10847
sl@0
   206
	REQ10849
sl@0
   207
	REQ10854
sl@0
   208
sl@0
   209
	@SYMTestPriority  
sl@0
   210
	High
sl@0
   211
sl@0
   212
	@SYMTestStatus 
sl@0
   213
	Implemented
sl@0
   214
sl@0
   215
	@SYMTestActions
sl@0
   216
	Creates an extended bitmap using test data and test UID,
sl@0
   217
	passing invalid values of width/height in aSizeInPixels:
sl@0
   218
		- negative values
sl@0
   219
		- exceeding the stated limit KMaxPixelSize
sl@0
   220
sl@0
   221
	@SYMTestExpectedResults
sl@0
   222
	Extended bitmap creation should fail, with KErrArgument
sl@0
   223
	returned for negative values, and KErrTooBig returned for
sl@0
   224
	values exceeding the stated limit.
sl@0
   225
*/
sl@0
   226
void CTExtendedBitmapNegative::CreateBadPixelSizeL()
sl@0
   227
	{
sl@0
   228
	INFO_PRINTF1(_L("Create an extended bitmap with invalid pixel sizes"));
sl@0
   229
	
sl@0
   230
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with negative width"));	
sl@0
   231
	TESTCREATEEXTENDEDBITMAPL(TSize(-1,50), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   232
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(TSize(-1,50), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   233
sl@0
   234
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with negative height"));	
sl@0
   235
	TESTCREATEEXTENDEDBITMAPL(TSize(40,-10), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   236
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(TSize(40,-10), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   237
	
sl@0
   238
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with negative width and height"));	
sl@0
   239
	TESTCREATEEXTENDEDBITMAPL(TSize(-102,-330), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   240
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(TSize(-102,-330), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   241
sl@0
   242
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with width exceeding stated limit KMaxPixelSize"));	
sl@0
   243
	TESTCREATEEXTENDEDBITMAPL(TSize(KMaxPixelSize + 1, 33), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrTooBig);
sl@0
   244
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(TSize(KMaxPixelSize + 1, 33), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrTooBig);
sl@0
   245
sl@0
   246
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with height exceeding stated limit KMaxPixelSize"));	
sl@0
   247
	TESTCREATEEXTENDEDBITMAPL(TSize(43, KMaxPixelSize + 1), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrTooBig);
sl@0
   248
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(TSize(43, KMaxPixelSize + 1), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrTooBig);
sl@0
   249
sl@0
   250
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with width and height exceeding stated limit KMaxPixelSize"));	
sl@0
   251
	TESTCREATEEXTENDEDBITMAPL(TSize(KMaxPixelSize + 50, KMaxPixelSize + 1), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrTooBig);
sl@0
   252
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(TSize(KMaxPixelSize + 50, KMaxPixelSize + 1), KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrTooBig);
sl@0
   253
	}
sl@0
   254
sl@0
   255
sl@0
   256
/**
sl@0
   257
	@SYMTestCaseID
sl@0
   258
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0012
sl@0
   259
sl@0
   260
	@SYMTestCaseDesc
sl@0
   261
	Create an extended bitmap with bad display modes
sl@0
   262
sl@0
   263
	@SYMPREQ 
sl@0
   264
	PREQ2096
sl@0
   265
	
sl@0
   266
	@SYMREQ
sl@0
   267
	REQ10847
sl@0
   268
	REQ10849
sl@0
   269
	REQ10855
sl@0
   270
sl@0
   271
	@SYMTestPriority  
sl@0
   272
	High
sl@0
   273
sl@0
   274
	@SYMTestStatus 
sl@0
   275
	Implemented
sl@0
   276
sl@0
   277
	@SYMTestActions
sl@0
   278
	Creates an extended bitmap using test data and test UID,
sl@0
   279
	passing invalid display modes.
sl@0
   280
sl@0
   281
	@SYMTestExpectedResults
sl@0
   282
	Extended bitmap creation should fail, with KErrArgument
sl@0
   283
	returned.
sl@0
   284
*/
sl@0
   285
void CTExtendedBitmapNegative::CreateBadDisplayModeL()
sl@0
   286
	{
sl@0
   287
	INFO_PRINTF1(_L("Create an extended bitmap with invalid display modes"));
sl@0
   288
sl@0
   289
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with TDisplayMode::ENone"));	
sl@0
   290
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, ENone, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   291
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, ENone, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   292
sl@0
   293
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with TDisplayMode::ERgb"));	
sl@0
   294
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, ERgb, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   295
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, ERgb, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   296
sl@0
   297
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with TDisplayMode::EColorLast"));	
sl@0
   298
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, EColorLast, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   299
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, EColorLast, KUidTestExtendedBitmap, KTestData, KTestDataSize, KErrArgument);
sl@0
   300
	}
sl@0
   301
sl@0
   302
sl@0
   303
/**
sl@0
   304
	@SYMTestCaseID
sl@0
   305
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0013
sl@0
   306
sl@0
   307
	@SYMTestCaseDesc
sl@0
   308
	Create an extended bitmap with a UID reserved for OS-use
sl@0
   309
sl@0
   310
	@SYMPREQ 
sl@0
   311
	PREQ2096
sl@0
   312
	
sl@0
   313
	@SYMREQ
sl@0
   314
	REQ10847
sl@0
   315
	REQ10849
sl@0
   316
	REQ10851
sl@0
   317
sl@0
   318
	@SYMTestPriority  
sl@0
   319
	High
sl@0
   320
sl@0
   321
	@SYMTestStatus 
sl@0
   322
	Implemented
sl@0
   323
sl@0
   324
	@SYMTestActions
sl@0
   325
	Creates an extended bitmap using test data and a UID
sl@0
   326
	reserved for OS-use.
sl@0
   327
sl@0
   328
	@SYMTestExpectedResults
sl@0
   329
	Extended bitmap creation should fail, with KErrArgument 
sl@0
   330
	returned.
sl@0
   331
*/
sl@0
   332
void CTExtendedBitmapNegative::CreateRestrictedUidL()
sl@0
   333
	{
sl@0
   334
	INFO_PRINTF1(_L("Create an extended bitmap with reserved UIDs"));
sl@0
   335
sl@0
   336
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with KCBitwiseBitmapUid"));
sl@0
   337
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, KDisplayMode, KCBitwiseBitmapUid, KTestData, KTestDataSize, KErrArgument);
sl@0
   338
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, KDisplayMode, KCBitwiseBitmapUid, KTestData, KTestDataSize, KErrArgument);
sl@0
   339
sl@0
   340
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with KCBitwiseBitmapHardwareUid"));
sl@0
   341
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, KDisplayMode, KCBitwiseBitmapHardwareUid, KTestData, KTestDataSize, KErrArgument);
sl@0
   342
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, KDisplayMode, KCBitwiseBitmapHardwareUid, KTestData, KTestDataSize, KErrArgument);
sl@0
   343
	}
sl@0
   344
sl@0
   345
sl@0
   346
/**
sl@0
   347
	@SYMTestCaseID
sl@0
   348
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0014
sl@0
   349
sl@0
   350
	@SYMTestCaseDesc
sl@0
   351
	Create an extended bitmap with NULL data
sl@0
   352
sl@0
   353
	@SYMPREQ 
sl@0
   354
	PREQ2096
sl@0
   355
	
sl@0
   356
	@SYMREQ
sl@0
   357
	REQ10847
sl@0
   358
	REQ10849
sl@0
   359
	REQ10850
sl@0
   360
sl@0
   361
	@SYMTestPriority  
sl@0
   362
	High
sl@0
   363
sl@0
   364
	@SYMTestStatus 
sl@0
   365
	Implemented
sl@0
   366
sl@0
   367
	@SYMTestActions
sl@0
   368
	Creates an extended bitmap using a test Uid, with NULL
sl@0
   369
	passed in aData 
sl@0
   370
sl@0
   371
	@SYMTestExpectedResults
sl@0
   372
	Extended bitmap creation should fail, with KErrArgument
sl@0
   373
	returned.
sl@0
   374
*/
sl@0
   375
void CTExtendedBitmapNegative::CreateNullDataL()
sl@0
   376
	{
sl@0
   377
	INFO_PRINTF1(_L("Create an extended bitmap with null data"));
sl@0
   378
sl@0
   379
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with NULL data and aDataSize set to 0"));
sl@0
   380
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, NULL, 0, KErrArgument);
sl@0
   381
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, NULL, 0, KErrArgument);
sl@0
   382
sl@0
   383
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with NULL data and aDataSize set to 100"));
sl@0
   384
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, NULL, 100, KErrArgument);
sl@0
   385
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, NULL, 100, KErrUnderflow);
sl@0
   386
	}
sl@0
   387
sl@0
   388
sl@0
   389
/**
sl@0
   390
	@SYMTestCaseID
sl@0
   391
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0015
sl@0
   392
sl@0
   393
	@SYMTestCaseDesc
sl@0
   394
	Create an extended bitmap with bad data size
sl@0
   395
sl@0
   396
	@SYMPREQ 
sl@0
   397
	PREQ2096
sl@0
   398
	
sl@0
   399
	@SYMREQ
sl@0
   400
	REQ10847
sl@0
   401
	REQ10849
sl@0
   402
	REQ10850
sl@0
   403
sl@0
   404
	@SYMTestPriority  
sl@0
   405
	High
sl@0
   406
sl@0
   407
	@SYMTestStatus 
sl@0
   408
	Implemented
sl@0
   409
sl@0
   410
	@SYMTestActions
sl@0
   411
	Creates an extended bitmap using test data and test Uid,
sl@0
   412
	passing a negative aDataSize value.
sl@0
   413
sl@0
   414
	@SYMTestExpectedResults
sl@0
   415
	Extended bitmap creation should fail, with KErrArgument
sl@0
   416
	returned for zero data size and a negative data size. 
sl@0
   417
	KErrTooBig should be returned for data size KMaxByteSize+1.
sl@0
   418
*/
sl@0
   419
void CTExtendedBitmapNegative::CreateBadDataSizeL()
sl@0
   420
	{
sl@0
   421
	INFO_PRINTF1(_L("Create an extended bitmap with invalid data sizes"));
sl@0
   422
sl@0
   423
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with aDataSize set to 0"));
sl@0
   424
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, 0, KErrArgument);
sl@0
   425
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, 0, KErrArgument);
sl@0
   426
	
sl@0
   427
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with aDataSize set to KMaxByteSize+1"));
sl@0
   428
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KMaxByteSize+1, KErrTooBig);
sl@0
   429
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KMaxByteSize+1, KErrTooBig);
sl@0
   430
sl@0
   431
	INFO_PRINTF1(_L("Calling CreateExtendedBitmap() with negative aDataSize"));
sl@0
   432
	TESTCREATEEXTENDEDBITMAPL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, -75, KErrArgument);
sl@0
   433
	TESTCREATEEXTENDEDBITMAPINITIALIZERL(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, -75, KErrArgument);
sl@0
   434
	}
sl@0
   435
sl@0
   436
sl@0
   437
// ExtendedBitmapType() tests
sl@0
   438
sl@0
   439
/**
sl@0
   440
	@SYMTestCaseID
sl@0
   441
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0016
sl@0
   442
sl@0
   443
	@SYMTestCaseDesc
sl@0
   444
	Gets Extended Bitmap Type on an uninitialised bitmap
sl@0
   445
sl@0
   446
	@SYMPREQ 
sl@0
   447
	PREQ2096
sl@0
   448
	
sl@0
   449
	@SYMREQ
sl@0
   450
	REQ10847
sl@0
   451
	REQ10852
sl@0
   452
	REQ10853
sl@0
   453
sl@0
   454
	@SYMTestPriority  
sl@0
   455
	Medium
sl@0
   456
sl@0
   457
	@SYMTestStatus 
sl@0
   458
	Implemented
sl@0
   459
sl@0
   460
	@SYMTestActions
sl@0
   461
	Calls ExtendedBitmapType() on an uninitialised CFbsBitmap.
sl@0
   462
sl@0
   463
	@SYMTestExpectedResults
sl@0
   464
	ExtendedBitmapType() should return KNullUid as an uninitialised CFbsBitmap is not an extended bitmap.
sl@0
   465
*/
sl@0
   466
void CTExtendedBitmapNegative::TypeUninitialisedBitmapL()
sl@0
   467
	{
sl@0
   468
	INFO_PRINTF1(_L("Get extended bitmap type on uninitialised bitmap"));
sl@0
   469
sl@0
   470
	CFbsBitmap* bmp = new(ELeave)CFbsBitmap;
sl@0
   471
	TUid returnedUid = bmp->ExtendedBitmapType();
sl@0
   472
	delete bmp;
sl@0
   473
sl@0
   474
	TESTEQUALL(KNullUid, returnedUid);
sl@0
   475
	}
sl@0
   476
sl@0
   477
sl@0
   478
/**
sl@0
   479
	@SYMTestCaseID
sl@0
   480
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0017
sl@0
   481
sl@0
   482
	@SYMTestCaseDesc
sl@0
   483
	Gets the Extended Bitmap Type on a standard bitmap
sl@0
   484
sl@0
   485
	@SYMPREQ 
sl@0
   486
	PREQ2096
sl@0
   487
	
sl@0
   488
	@SYMREQ
sl@0
   489
	REQ10847
sl@0
   490
	REQ10852
sl@0
   491
	REQ10853
sl@0
   492
sl@0
   493
	@SYMTestPriority  
sl@0
   494
	High
sl@0
   495
sl@0
   496
	@SYMTestStatus 
sl@0
   497
	Implemented
sl@0
   498
sl@0
   499
	@SYMTestActions
sl@0
   500
	Calls ExtendedBitmapType() on a standard (regular)
sl@0
   501
	CFbsBitmap.
sl@0
   502
sl@0
   503
	@SYMTestExpectedResults
sl@0
   504
	ExtendedBitmapType() should return KNullUid as a standard CFbsBitmap is not an extended bitmap.
sl@0
   505
*/
sl@0
   506
void CTExtendedBitmapNegative::TypeStandardBitmapL()
sl@0
   507
	{
sl@0
   508
	INFO_PRINTF1(_L("Get extended bitmap type on a standard bitmap"));
sl@0
   509
sl@0
   510
	CFbsBitmap* bmp = new(ELeave)CFbsBitmap;
sl@0
   511
	CleanupStack::PushL(bmp);
sl@0
   512
	TESTNOERRORL(bmp->Create(KSizeInPixels, KDisplayMode));
sl@0
   513
sl@0
   514
	TUid returnedUid = bmp->ExtendedBitmapType();
sl@0
   515
	CleanupStack::PopAndDestroy(bmp);
sl@0
   516
sl@0
   517
	TESTEQUALL(KNullUid, returnedUid);
sl@0
   518
	}
sl@0
   519
sl@0
   520
/**
sl@0
   521
	@SYMTestCaseID
sl@0
   522
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0018
sl@0
   523
sl@0
   524
	@SYMTestCaseDesc
sl@0
   525
	Gets the Extended Bitmap Type on a hardware bitmap
sl@0
   526
sl@0
   527
	@SYMPREQ 
sl@0
   528
	PREQ2096
sl@0
   529
	
sl@0
   530
	@SYMREQ
sl@0
   531
	REQ10847
sl@0
   532
	REQ10852
sl@0
   533
	REQ10853
sl@0
   534
sl@0
   535
	@SYMTestPriority  
sl@0
   536
	High
sl@0
   537
sl@0
   538
	@SYMTestStatus 
sl@0
   539
	Implemented
sl@0
   540
sl@0
   541
	@SYMTestActions
sl@0
   542
	Calls ExtendedBitmapType() on a hardware CFbsBitmap.
sl@0
   543
sl@0
   544
	@SYMTestExpectedResults
sl@0
   545
	ExtendedBitmapType() should return KNullUid as a hardware CFbsBitmap is not an extended bitmap.
sl@0
   546
*/
sl@0
   547
void CTExtendedBitmapNegative::TypeHardwareBitmapL()
sl@0
   548
	{
sl@0
   549
	INFO_PRINTF1(_L("Get extended bitmap type on a hardware bitmap"));
sl@0
   550
sl@0
   551
	CFbsBitmap* bmp = new(ELeave)CFbsBitmap;
sl@0
   552
	CleanupStack::PushL(bmp);
sl@0
   553
	
sl@0
   554
	TInt err = bmp->CreateHardwareBitmap(KSizeInPixels, KDisplayMode, KNullUid);		
sl@0
   555
	if (err == KErrNotSupported)
sl@0
   556
		{
sl@0
   557
		// Hardware bitmaps not supported with the current test configuration
sl@0
   558
		WARN_PRINTF1(_L("... Hardware bitmaps not supported"));
sl@0
   559
		}
sl@0
   560
	else
sl@0
   561
		{		
sl@0
   562
		TESTNOERRORL(err);
sl@0
   563
		TUid returnedUid = bmp->ExtendedBitmapType();
sl@0
   564
		TESTEQUALL(KNullUid, returnedUid);
sl@0
   565
		}		
sl@0
   566
	
sl@0
   567
	CleanupStack::PopAndDestroy(bmp);	
sl@0
   568
	}
sl@0
   569
sl@0
   570
// DataSize() tests
sl@0
   571
sl@0
   572
/**
sl@0
   573
	@SYMTestCaseID
sl@0
   574
	GRAPHICS-FBSERV-EXTENDEDBITMAP-0019
sl@0
   575
sl@0
   576
	@SYMTestCaseDesc
sl@0
   577
	Gets Data Size on an uninitialised bitmap
sl@0
   578
sl@0
   579
	@SYMPREQ 
sl@0
   580
	PREQ2096
sl@0
   581
	
sl@0
   582
	@SYMREQ
sl@0
   583
	REQ10847
sl@0
   584
	REQ10852	
sl@0
   585
sl@0
   586
	@SYMTestPriority  
sl@0
   587
	Medium
sl@0
   588
sl@0
   589
	@SYMTestStatus 
sl@0
   590
	Implemented
sl@0
   591
sl@0
   592
	@SYMTestActions
sl@0
   593
	Creates an extended bitmap using test data and test Uid,
sl@0
   594
	calls RFbsSession::Disconnect() and then attempts to
sl@0
   595
	call DataSize().
sl@0
   596
sl@0
   597
	@SYMTestExpectedResults
sl@0
   598
	Call should fail, with zero returned.
sl@0
   599
*/
sl@0
   600
void CTExtendedBitmapNegative::SizeUninitialisedBitmapL()
sl@0
   601
	{
sl@0
   602
	INFO_PRINTF1(_L("Get data size on uninitialised bitmap"));
sl@0
   603
sl@0
   604
	CFbsBitmap* bmp = new(ELeave)CFbsBitmap;
sl@0
   605
	TInt returnedDataSize = bmp->DataSize();
sl@0
   606
	delete bmp;
sl@0
   607
sl@0
   608
	TESTEQUALL(0, returnedDataSize);
sl@0
   609
	}
sl@0
   610
sl@0
   611
sl@0
   612
//--------------
sl@0
   613
__CONSTRUCT_STEP__(ExtendedBitmapNegative)