1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/fbs/fontandbitmapserver/tfbs/textendedbitmappanic.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,164 @@
1.4 +// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#include "UTILS.h"
1.20 +#include "textendedbitmapcommon.h"
1.21 +#include "textendedbitmappanic.h"
1.22 +#include <e32math.h>
1.23 +#include <s32file.h>
1.24 +#include <bautils.h>
1.25 +#include <hal.h>
1.26 +#include <test/tefunit.h>
1.27 +
1.28 +
1.29 +const TUint8 KTestData[] = "Extended bitmap test data 123456";
1.30 +const TInt KTestDataSize = sizeof(KTestData);
1.31 +const TSize KSizeInPixels = TSize(50,50);
1.32 +const TDisplayMode KDisplayMode = EColor64K;
1.33 +
1.34 +GLREF_C void Panic(TFbsPanic aPanic);
1.35 +
1.36 +CTExtendedBitmapPanic::CTExtendedBitmapPanic(CTestStep* aStep):
1.37 +CTFbsBase(aStep, EFalse)
1.38 + {
1.39 + __ASSERT_DEBUG(CActiveScheduler::Current(), User::Invariant());
1.40 + }
1.41 +
1.42 +CTExtendedBitmapPanic::~CTExtendedBitmapPanic()
1.43 + {
1.44 + delete iExtendedBitmap;
1.45 + }
1.46 +
1.47 +void CTExtendedBitmapPanic::ConstructL()
1.48 + {
1.49 + iExtendedBitmap = new(ELeave)CFbsBitmap;
1.50 + TInt err = iExtendedBitmap->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
1.51 + User::LeaveIfError(err);
1.52 + }
1.53 +
1.54 +void CTExtendedBitmapPanic::RunFbsTestL(TInt /*aCurTestCase*/)
1.55 + {
1.56 + _LIT(KCaseNumber, "CaseNumber");
1.57 +
1.58 + TInt stepNumber;
1.59 + TBool res = iStep->GetIntFromConfig(iStep->ConfigSection(), KCaseNumber, stepNumber);
1.60 + if(!res)
1.61 + {
1.62 + return;
1.63 + }
1.64 + ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.65 + switch(stepNumber)
1.66 + {
1.67 + case 1:
1.68 + ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0020"));
1.69 + TestSetScanLine();
1.70 + ((CTExtendedBitmapPanicStep*)iStep)->RecordTestResultL();
1.71 + TEST(EFalse);
1.72 + TestComplete();
1.73 + break;
1.74 + case 2:
1.75 + ((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0041"));
1.76 + TestIsMonochrome();
1.77 + ((CTExtendedBitmapPanicStep*)iStep)->RecordTestResultL();
1.78 + TEST(EFalse);
1.79 + TestComplete();
1.80 + break;
1.81 + default:
1.82 + ((CTExtendedBitmapPanicStep*)iStep)->CloseTMSGraphicsStep();
1.83 + TestComplete();
1.84 + break;
1.85 + }
1.86 + }
1.87 +
1.88 +/**
1.89 +@SYMTestCaseID
1.90 + GRAPHICS-FBSERV-EXTENDEDBITMAP-0020
1.91 +
1.92 +@SYMTestCaseDesc
1.93 + Panic test to check that CFbsBitmap::SetScanLine() panics when used with an extended bitmap
1.94 +
1.95 +@SYMPREQ
1.96 + PREQ2096
1.97 +
1.98 +@SYMREQ
1.99 + REQ10847
1.100 + REQ10857
1.101 +
1.102 +@SYMTestPriority
1.103 + High
1.104 +
1.105 +@SYMTestStatus
1.106 + Implemented
1.107 +
1.108 +@SYMTestActions
1.109 + Create an extended bitmap using test data and test Uid.
1.110 + Call SetScanLine() on the extended bitmap.
1.111 +
1.112 +@SYMTestExpectedResults
1.113 + CFbsBitmap::SetScanLine() should panic with FBSERV 28 (EFbsPanicBitmapReadOnly) in debug only
1.114 +*/
1.115 +void CTExtendedBitmapPanic::TestSetScanLine()
1.116 + {
1.117 + INFO_PRINTF1(_L("TestSetScanLine - panic test"));
1.118 +
1.119 + TBuf8<16> temp;
1.120 + iExtendedBitmap->SetScanLine(temp, 0); // This should panic with FBSERV 28 (EFbsPanicBitmapReadOnly) - debug only panic
1.121 +
1.122 +#ifndef _DEBUG
1.123 + // Force the panic when not in debug mode so that the test still passes
1.124 + INFO_PRINTF1(_L("Forcing a panic in release mode as SetScanLine() only panics in debug"));
1.125 + User::Panic(KFBSERVPanicCategory, EFbsPanicBitmapReadOnly);
1.126 +#endif
1.127 + }
1.128 +
1.129 +
1.130 +/**
1.131 +@SYMTestCaseID
1.132 + GRAPHICS-FBSERV-EXTENDEDBITMAP-0041
1.133 +
1.134 +@SYMTestCaseDesc
1.135 + Panic test to check that CFbsBitmap::IsMonochrome() panics when used with an extended bitmap
1.136 +
1.137 +@SYMPREQ
1.138 + CR1804
1.139 +
1.140 +@SYMTestPriority
1.141 + High
1.142 +
1.143 +@SYMTestStatus
1.144 + Implemented
1.145 +
1.146 +@SYMTestActions
1.147 + Create an extended bitmap using test data and test Uid.
1.148 + Call IsMonochrome() on the extended bitmap.
1.149 +
1.150 +@SYMTestExpectedResults
1.151 + CFbsBitmap::IsMonochrome() should panic with FBSERV 11 (EFbsBitmapInvalidCompression) in debug only
1.152 +*/
1.153 +void CTExtendedBitmapPanic::TestIsMonochrome()
1.154 + {
1.155 + INFO_PRINTF1(_L("TestIsMonochrome - panic test"));
1.156 +
1.157 + iExtendedBitmap->IsMonochrome(); // This should panic with FBSERV 11 (EFbsBitmapInvalidCompression) - debug only panic
1.158 +
1.159 +#ifndef _DEBUG
1.160 + // Force the panic when not in debug mode so that the test still passes
1.161 + INFO_PRINTF1(_L("Forcing a panic in release mode as IsMonochrome() only panics in debug"));
1.162 + User::Panic(KFBSERVPanicCategory, EFbsBitmapInvalidCompression);
1.163 +#endif
1.164 + }
1.165 +
1.166 +__CONSTRUCT_STEP__(ExtendedBitmapPanic)
1.167 +