sl@0: // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #include "UTILS.h" sl@0: #include "textendedbitmapcommon.h" sl@0: #include "textendedbitmappanic.h" sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: sl@0: const TUint8 KTestData[] = "Extended bitmap test data 123456"; sl@0: const TInt KTestDataSize = sizeof(KTestData); sl@0: const TSize KSizeInPixels = TSize(50,50); sl@0: const TDisplayMode KDisplayMode = EColor64K; sl@0: sl@0: GLREF_C void Panic(TFbsPanic aPanic); sl@0: sl@0: CTExtendedBitmapPanic::CTExtendedBitmapPanic(CTestStep* aStep): sl@0: CTFbsBase(aStep, EFalse) sl@0: { sl@0: __ASSERT_DEBUG(CActiveScheduler::Current(), User::Invariant()); sl@0: } sl@0: sl@0: CTExtendedBitmapPanic::~CTExtendedBitmapPanic() sl@0: { sl@0: delete iExtendedBitmap; sl@0: } sl@0: sl@0: void CTExtendedBitmapPanic::ConstructL() sl@0: { sl@0: iExtendedBitmap = new(ELeave)CFbsBitmap; sl@0: TInt err = iExtendedBitmap->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize); sl@0: User::LeaveIfError(err); sl@0: } sl@0: sl@0: void CTExtendedBitmapPanic::RunFbsTestL(TInt /*aCurTestCase*/) sl@0: { sl@0: _LIT(KCaseNumber, "CaseNumber"); sl@0: sl@0: TInt stepNumber; sl@0: TBool res = iStep->GetIntFromConfig(iStep->ConfigSection(), KCaseNumber, stepNumber); sl@0: if(!res) sl@0: { sl@0: return; sl@0: } sl@0: ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch(stepNumber) sl@0: { sl@0: case 1: sl@0: ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0020")); sl@0: TestSetScanLine(); sl@0: ((CTExtendedBitmapPanicStep*)iStep)->RecordTestResultL(); sl@0: TEST(EFalse); sl@0: TestComplete(); sl@0: break; sl@0: case 2: sl@0: ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0041")); sl@0: TestIsMonochrome(); sl@0: ((CTExtendedBitmapPanicStep*)iStep)->RecordTestResultL(); sl@0: TEST(EFalse); sl@0: TestComplete(); sl@0: break; sl@0: default: sl@0: ((CTExtendedBitmapPanicStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID sl@0: GRAPHICS-FBSERV-EXTENDEDBITMAP-0020 sl@0: sl@0: @SYMTestCaseDesc sl@0: Panic test to check that CFbsBitmap::SetScanLine() panics when used with an extended bitmap sl@0: sl@0: @SYMPREQ sl@0: PREQ2096 sl@0: sl@0: @SYMREQ sl@0: REQ10847 sl@0: REQ10857 sl@0: sl@0: @SYMTestPriority sl@0: High sl@0: sl@0: @SYMTestStatus sl@0: Implemented sl@0: sl@0: @SYMTestActions sl@0: Create an extended bitmap using test data and test Uid. sl@0: Call SetScanLine() on the extended bitmap. sl@0: sl@0: @SYMTestExpectedResults sl@0: CFbsBitmap::SetScanLine() should panic with FBSERV 28 (EFbsPanicBitmapReadOnly) in debug only sl@0: */ sl@0: void CTExtendedBitmapPanic::TestSetScanLine() sl@0: { sl@0: INFO_PRINTF1(_L("TestSetScanLine - panic test")); sl@0: sl@0: TBuf8<16> temp; sl@0: iExtendedBitmap->SetScanLine(temp, 0); // This should panic with FBSERV 28 (EFbsPanicBitmapReadOnly) - debug only panic sl@0: sl@0: #ifndef _DEBUG sl@0: // Force the panic when not in debug mode so that the test still passes sl@0: INFO_PRINTF1(_L("Forcing a panic in release mode as SetScanLine() only panics in debug")); sl@0: User::Panic(KFBSERVPanicCategory, EFbsPanicBitmapReadOnly); sl@0: #endif sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID sl@0: GRAPHICS-FBSERV-EXTENDEDBITMAP-0041 sl@0: sl@0: @SYMTestCaseDesc sl@0: Panic test to check that CFbsBitmap::IsMonochrome() panics when used with an extended bitmap sl@0: sl@0: @SYMPREQ sl@0: CR1804 sl@0: sl@0: @SYMTestPriority sl@0: High sl@0: sl@0: @SYMTestStatus sl@0: Implemented sl@0: sl@0: @SYMTestActions sl@0: Create an extended bitmap using test data and test Uid. sl@0: Call IsMonochrome() on the extended bitmap. sl@0: sl@0: @SYMTestExpectedResults sl@0: CFbsBitmap::IsMonochrome() should panic with FBSERV 11 (EFbsBitmapInvalidCompression) in debug only sl@0: */ sl@0: void CTExtendedBitmapPanic::TestIsMonochrome() sl@0: { sl@0: INFO_PRINTF1(_L("TestIsMonochrome - panic test")); sl@0: sl@0: iExtendedBitmap->IsMonochrome(); // This should panic with FBSERV 11 (EFbsBitmapInvalidCompression) - debug only panic sl@0: sl@0: #ifndef _DEBUG sl@0: // Force the panic when not in debug mode so that the test still passes sl@0: INFO_PRINTF1(_L("Forcing a panic in release mode as IsMonochrome() only panics in debug")); sl@0: User::Panic(KFBSERVPanicCategory, EFbsBitmapInvalidCompression); sl@0: #endif sl@0: } sl@0: sl@0: __CONSTRUCT_STEP__(ExtendedBitmapPanic) sl@0: