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 |
#include "UTILS.h"
|
sl@0
|
17 |
#include "textendedbitmapcommon.h"
|
sl@0
|
18 |
#include "textendedbitmappanic.h"
|
sl@0
|
19 |
#include <e32math.h>
|
sl@0
|
20 |
#include <s32file.h>
|
sl@0
|
21 |
#include <bautils.h>
|
sl@0
|
22 |
#include <hal.h>
|
sl@0
|
23 |
#include <test/tefunit.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
|
sl@0
|
26 |
const TUint8 KTestData[] = "Extended bitmap test data 123456";
|
sl@0
|
27 |
const TInt KTestDataSize = sizeof(KTestData);
|
sl@0
|
28 |
const TSize KSizeInPixels = TSize(50,50);
|
sl@0
|
29 |
const TDisplayMode KDisplayMode = EColor64K;
|
sl@0
|
30 |
|
sl@0
|
31 |
GLREF_C void Panic(TFbsPanic aPanic);
|
sl@0
|
32 |
|
sl@0
|
33 |
CTExtendedBitmapPanic::CTExtendedBitmapPanic(CTestStep* aStep):
|
sl@0
|
34 |
CTFbsBase(aStep, EFalse)
|
sl@0
|
35 |
{
|
sl@0
|
36 |
__ASSERT_DEBUG(CActiveScheduler::Current(), User::Invariant());
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
CTExtendedBitmapPanic::~CTExtendedBitmapPanic()
|
sl@0
|
40 |
{
|
sl@0
|
41 |
delete iExtendedBitmap;
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
void CTExtendedBitmapPanic::ConstructL()
|
sl@0
|
45 |
{
|
sl@0
|
46 |
iExtendedBitmap = new(ELeave)CFbsBitmap;
|
sl@0
|
47 |
TInt err = iExtendedBitmap->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
48 |
User::LeaveIfError(err);
|
sl@0
|
49 |
}
|
sl@0
|
50 |
|
sl@0
|
51 |
void CTExtendedBitmapPanic::RunFbsTestL(TInt /*aCurTestCase*/)
|
sl@0
|
52 |
{
|
sl@0
|
53 |
_LIT(KCaseNumber, "CaseNumber");
|
sl@0
|
54 |
|
sl@0
|
55 |
TInt stepNumber;
|
sl@0
|
56 |
TBool res = iStep->GetIntFromConfig(iStep->ConfigSection(), KCaseNumber, stepNumber);
|
sl@0
|
57 |
if(!res)
|
sl@0
|
58 |
{
|
sl@0
|
59 |
return;
|
sl@0
|
60 |
}
|
sl@0
|
61 |
((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
62 |
switch(stepNumber)
|
sl@0
|
63 |
{
|
sl@0
|
64 |
case 1:
|
sl@0
|
65 |
((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0020"));
|
sl@0
|
66 |
TestSetScanLine();
|
sl@0
|
67 |
((CTExtendedBitmapPanicStep*)iStep)->RecordTestResultL();
|
sl@0
|
68 |
TEST(EFalse);
|
sl@0
|
69 |
TestComplete();
|
sl@0
|
70 |
break;
|
sl@0
|
71 |
case 2:
|
sl@0
|
72 |
((CTExtendedBitmapPanicStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0041"));
|
sl@0
|
73 |
TestIsMonochrome();
|
sl@0
|
74 |
((CTExtendedBitmapPanicStep*)iStep)->RecordTestResultL();
|
sl@0
|
75 |
TEST(EFalse);
|
sl@0
|
76 |
TestComplete();
|
sl@0
|
77 |
break;
|
sl@0
|
78 |
default:
|
sl@0
|
79 |
((CTExtendedBitmapPanicStep*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
80 |
TestComplete();
|
sl@0
|
81 |
break;
|
sl@0
|
82 |
}
|
sl@0
|
83 |
}
|
sl@0
|
84 |
|
sl@0
|
85 |
/**
|
sl@0
|
86 |
@SYMTestCaseID
|
sl@0
|
87 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0020
|
sl@0
|
88 |
|
sl@0
|
89 |
@SYMTestCaseDesc
|
sl@0
|
90 |
Panic test to check that CFbsBitmap::SetScanLine() panics when used with an extended bitmap
|
sl@0
|
91 |
|
sl@0
|
92 |
@SYMPREQ
|
sl@0
|
93 |
PREQ2096
|
sl@0
|
94 |
|
sl@0
|
95 |
@SYMREQ
|
sl@0
|
96 |
REQ10847
|
sl@0
|
97 |
REQ10857
|
sl@0
|
98 |
|
sl@0
|
99 |
@SYMTestPriority
|
sl@0
|
100 |
High
|
sl@0
|
101 |
|
sl@0
|
102 |
@SYMTestStatus
|
sl@0
|
103 |
Implemented
|
sl@0
|
104 |
|
sl@0
|
105 |
@SYMTestActions
|
sl@0
|
106 |
Create an extended bitmap using test data and test Uid.
|
sl@0
|
107 |
Call SetScanLine() on the extended bitmap.
|
sl@0
|
108 |
|
sl@0
|
109 |
@SYMTestExpectedResults
|
sl@0
|
110 |
CFbsBitmap::SetScanLine() should panic with FBSERV 28 (EFbsPanicBitmapReadOnly) in debug only
|
sl@0
|
111 |
*/
|
sl@0
|
112 |
void CTExtendedBitmapPanic::TestSetScanLine()
|
sl@0
|
113 |
{
|
sl@0
|
114 |
INFO_PRINTF1(_L("TestSetScanLine - panic test"));
|
sl@0
|
115 |
|
sl@0
|
116 |
TBuf8<16> temp;
|
sl@0
|
117 |
iExtendedBitmap->SetScanLine(temp, 0); // This should panic with FBSERV 28 (EFbsPanicBitmapReadOnly) - debug only panic
|
sl@0
|
118 |
|
sl@0
|
119 |
#ifndef _DEBUG
|
sl@0
|
120 |
// Force the panic when not in debug mode so that the test still passes
|
sl@0
|
121 |
INFO_PRINTF1(_L("Forcing a panic in release mode as SetScanLine() only panics in debug"));
|
sl@0
|
122 |
User::Panic(KFBSERVPanicCategory, EFbsPanicBitmapReadOnly);
|
sl@0
|
123 |
#endif
|
sl@0
|
124 |
}
|
sl@0
|
125 |
|
sl@0
|
126 |
|
sl@0
|
127 |
/**
|
sl@0
|
128 |
@SYMTestCaseID
|
sl@0
|
129 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0041
|
sl@0
|
130 |
|
sl@0
|
131 |
@SYMTestCaseDesc
|
sl@0
|
132 |
Panic test to check that CFbsBitmap::IsMonochrome() panics when used with an extended bitmap
|
sl@0
|
133 |
|
sl@0
|
134 |
@SYMPREQ
|
sl@0
|
135 |
CR1804
|
sl@0
|
136 |
|
sl@0
|
137 |
@SYMTestPriority
|
sl@0
|
138 |
High
|
sl@0
|
139 |
|
sl@0
|
140 |
@SYMTestStatus
|
sl@0
|
141 |
Implemented
|
sl@0
|
142 |
|
sl@0
|
143 |
@SYMTestActions
|
sl@0
|
144 |
Create an extended bitmap using test data and test Uid.
|
sl@0
|
145 |
Call IsMonochrome() on the extended bitmap.
|
sl@0
|
146 |
|
sl@0
|
147 |
@SYMTestExpectedResults
|
sl@0
|
148 |
CFbsBitmap::IsMonochrome() should panic with FBSERV 11 (EFbsBitmapInvalidCompression) in debug only
|
sl@0
|
149 |
*/
|
sl@0
|
150 |
void CTExtendedBitmapPanic::TestIsMonochrome()
|
sl@0
|
151 |
{
|
sl@0
|
152 |
INFO_PRINTF1(_L("TestIsMonochrome - panic test"));
|
sl@0
|
153 |
|
sl@0
|
154 |
iExtendedBitmap->IsMonochrome(); // This should panic with FBSERV 11 (EFbsBitmapInvalidCompression) - debug only panic
|
sl@0
|
155 |
|
sl@0
|
156 |
#ifndef _DEBUG
|
sl@0
|
157 |
// Force the panic when not in debug mode so that the test still passes
|
sl@0
|
158 |
INFO_PRINTF1(_L("Forcing a panic in release mode as IsMonochrome() only panics in debug"));
|
sl@0
|
159 |
User::Panic(KFBSERVPanicCategory, EFbsBitmapInvalidCompression);
|
sl@0
|
160 |
#endif
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
__CONSTRUCT_STEP__(ExtendedBitmapPanic)
|
sl@0
|
164 |
|