Update contrib.
1 // Copyright (c) 2008-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
17 #include "textendedbitmapcommon.h"
18 #include "textendedbitmappanic.h"
23 #include <test/tefunit.h>
26 const TUint8 KTestData[] = "Extended bitmap test data 123456";
27 const TInt KTestDataSize = sizeof(KTestData);
28 const TSize KSizeInPixels = TSize(50,50);
29 const TDisplayMode KDisplayMode = EColor64K;
31 GLREF_C void Panic(TFbsPanic aPanic);
33 CTExtendedBitmapPanic::CTExtendedBitmapPanic(CTestStep* aStep):
34 CTFbsBase(aStep, EFalse)
36 __ASSERT_DEBUG(CActiveScheduler::Current(), User::Invariant());
39 CTExtendedBitmapPanic::~CTExtendedBitmapPanic()
41 delete iExtendedBitmap;
44 void CTExtendedBitmapPanic::ConstructL()
46 iExtendedBitmap = new(ELeave)CFbsBitmap;
47 TInt err = iExtendedBitmap->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
48 User::LeaveIfError(err);
51 void CTExtendedBitmapPanic::RunFbsTestL(TInt /*aCurTestCase*/)
53 _LIT(KCaseNumber, "CaseNumber");
56 TBool res = iStep->GetIntFromConfig(iStep->ConfigSection(), KCaseNumber, stepNumber);
61 ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
65 ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0020"));
67 ((CTExtendedBitmapPanicStep*)iStep)->RecordTestResultL();
72 ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0041"));
74 ((CTExtendedBitmapPanicStep*)iStep)->RecordTestResultL();
79 ((CTExtendedBitmapPanicStep*)iStep)->CloseTMSGraphicsStep();
87 GRAPHICS-FBSERV-EXTENDEDBITMAP-0020
90 Panic test to check that CFbsBitmap::SetScanLine() panics when used with an extended bitmap
106 Create an extended bitmap using test data and test Uid.
107 Call SetScanLine() on the extended bitmap.
109 @SYMTestExpectedResults
110 CFbsBitmap::SetScanLine() should panic with FBSERV 28 (EFbsPanicBitmapReadOnly) in debug only
112 void CTExtendedBitmapPanic::TestSetScanLine()
114 INFO_PRINTF1(_L("TestSetScanLine - panic test"));
117 iExtendedBitmap->SetScanLine(temp, 0); // This should panic with FBSERV 28 (EFbsPanicBitmapReadOnly) - debug only panic
120 // Force the panic when not in debug mode so that the test still passes
121 INFO_PRINTF1(_L("Forcing a panic in release mode as SetScanLine() only panics in debug"));
122 User::Panic(KFBSERVPanicCategory, EFbsPanicBitmapReadOnly);
129 GRAPHICS-FBSERV-EXTENDEDBITMAP-0041
132 Panic test to check that CFbsBitmap::IsMonochrome() panics when used with an extended bitmap
144 Create an extended bitmap using test data and test Uid.
145 Call IsMonochrome() on the extended bitmap.
147 @SYMTestExpectedResults
148 CFbsBitmap::IsMonochrome() should panic with FBSERV 11 (EFbsBitmapInvalidCompression) in debug only
150 void CTExtendedBitmapPanic::TestIsMonochrome()
152 INFO_PRINTF1(_L("TestIsMonochrome - panic test"));
154 iExtendedBitmap->IsMonochrome(); // This should panic with FBSERV 11 (EFbsBitmapInvalidCompression) - debug only panic
157 // Force the panic when not in debug mode so that the test still passes
158 INFO_PRINTF1(_L("Forcing a panic in release mode as IsMonochrome() only panics in debug"));
159 User::Panic(KFBSERVPanicCategory, EFbsBitmapInvalidCompression);
163 __CONSTRUCT_STEP__(ExtendedBitmapPanic)