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 "textendedbitmapcommon.h"
|
sl@0
|
17 |
#include "textendedbitmaplegacy.h"
|
sl@0
|
18 |
#include "tfbs.h"
|
sl@0
|
19 |
#include <s32mem.h>
|
sl@0
|
20 |
#include <bautils.h>
|
sl@0
|
21 |
|
sl@0
|
22 |
const TUint8 KTestData[] = "Extended bitmap test data 123456";
|
sl@0
|
23 |
const TInt KTestDataSize = sizeof(KTestData);
|
sl@0
|
24 |
const TInt KTestWidth = 50;
|
sl@0
|
25 |
const TInt KTestHeight = 50;
|
sl@0
|
26 |
const TSize KSizeInPixels = TSize(KTestWidth,KTestHeight);
|
sl@0
|
27 |
const TDisplayMode KDisplayMode = EColor64K;
|
sl@0
|
28 |
const TInt KBpp = 2; // 2 bpp for EColor64K
|
sl@0
|
29 |
|
sl@0
|
30 |
// Test mbm files used by CTExtendedBitmapLegacy::TestApisThatCallResetL().
|
sl@0
|
31 |
// These are used to check the operation of CFbsBitmap::Load() when used with
|
sl@0
|
32 |
// extended bitmaps.
|
sl@0
|
33 |
_LIT(KRomBmpFilename, "z:\\system\\data\\rf1.mbm");
|
sl@0
|
34 |
_LIT(KRamBitmapFilenameOnZ, "z:\\system\\data\\16RAM2.mbm");
|
sl@0
|
35 |
_LIT(KRamBitmapFilename, "c:\\textendedbitmaplegacy_16RAM2.mbm");
|
sl@0
|
36 |
|
sl@0
|
37 |
LOCAL_D RFs TheFs;
|
sl@0
|
38 |
|
sl@0
|
39 |
CTExtendedBitmapLegacy::CTExtendedBitmapLegacy(CTestStep* aStep):
|
sl@0
|
40 |
CTFbsBase(aStep, ETrue)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
CTExtendedBitmapLegacy::~CTExtendedBitmapLegacy()
|
sl@0
|
45 |
{
|
sl@0
|
46 |
((CTExtendedBitmapLegacyStep*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
47 |
}
|
sl@0
|
48 |
|
sl@0
|
49 |
void CTExtendedBitmapLegacy::RunFbsTestL(TInt aCurTestCase)
|
sl@0
|
50 |
{
|
sl@0
|
51 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
52 |
switch(aCurTestCase)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
case 1:
|
sl@0
|
55 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0030"));
|
sl@0
|
56 |
TestDuplicateL();
|
sl@0
|
57 |
break;
|
sl@0
|
58 |
case 2:
|
sl@0
|
59 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0031"));
|
sl@0
|
60 |
TestAccessDeniedL();
|
sl@0
|
61 |
break;
|
sl@0
|
62 |
case 3:
|
sl@0
|
63 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0032"));
|
sl@0
|
64 |
TestNotSupportedL();
|
sl@0
|
65 |
break;
|
sl@0
|
66 |
case 4:
|
sl@0
|
67 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0033"));
|
sl@0
|
68 |
TestTwipsL();
|
sl@0
|
69 |
break;
|
sl@0
|
70 |
case 5:
|
sl@0
|
71 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0034"));
|
sl@0
|
72 |
TestGettersL();
|
sl@0
|
73 |
break;
|
sl@0
|
74 |
case 6:
|
sl@0
|
75 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0035"));
|
sl@0
|
76 |
TestGetScanLineL();
|
sl@0
|
77 |
break;
|
sl@0
|
78 |
case 7:
|
sl@0
|
79 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0036"));
|
sl@0
|
80 |
TestApisThatCallResetL();
|
sl@0
|
81 |
break;
|
sl@0
|
82 |
case 8:
|
sl@0
|
83 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0037"));
|
sl@0
|
84 |
TestApisThatLeaveL();
|
sl@0
|
85 |
break;
|
sl@0
|
86 |
case 9:
|
sl@0
|
87 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0038"));
|
sl@0
|
88 |
TestNotSupportedNoReturnL();
|
sl@0
|
89 |
break;
|
sl@0
|
90 |
case 10:
|
sl@0
|
91 |
((CTExtendedBitmapLegacyStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-EXTENDEDBITMAP-0039"));
|
sl@0
|
92 |
TestGetPixelL();
|
sl@0
|
93 |
// Fall through as last test case
|
sl@0
|
94 |
default:
|
sl@0
|
95 |
SetLastTestCase();
|
sl@0
|
96 |
break;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
((CTExtendedBitmapLegacyStep*)iStep)->RecordTestResultL();
|
sl@0
|
99 |
}
|
sl@0
|
100 |
|
sl@0
|
101 |
|
sl@0
|
102 |
/**
|
sl@0
|
103 |
@SYMTestCaseID
|
sl@0
|
104 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0030
|
sl@0
|
105 |
|
sl@0
|
106 |
@SYMTestCaseDesc
|
sl@0
|
107 |
Create an extended bitmap then duplicate it by calling CFbsBitmap::Duplicate()
|
sl@0
|
108 |
|
sl@0
|
109 |
@SYMPREQ
|
sl@0
|
110 |
PREQ2096
|
sl@0
|
111 |
|
sl@0
|
112 |
@SYMREQ
|
sl@0
|
113 |
REQ10847
|
sl@0
|
114 |
|
sl@0
|
115 |
@SYMTestPriority
|
sl@0
|
116 |
High
|
sl@0
|
117 |
|
sl@0
|
118 |
@SYMTestStatus
|
sl@0
|
119 |
Implemented
|
sl@0
|
120 |
|
sl@0
|
121 |
@SYMTestActions
|
sl@0
|
122 |
Create an extended bitmap using test data and test Uid.
|
sl@0
|
123 |
Call Duplicate() on the extended bitmap.
|
sl@0
|
124 |
Retrieves and validates the bitmap size, display mode, Uid, data and data size.
|
sl@0
|
125 |
|
sl@0
|
126 |
@SYMTestExpectedResults
|
sl@0
|
127 |
Extended bitmap created and duplicated and information should match exactly.
|
sl@0
|
128 |
*/
|
sl@0
|
129 |
void CTExtendedBitmapLegacy::TestDuplicateL()
|
sl@0
|
130 |
{
|
sl@0
|
131 |
INFO_PRINTF1(_L("Duplicate - create a duplicate of an extended bitmap"));
|
sl@0
|
132 |
|
sl@0
|
133 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
134 |
CleanupStack::PushL(bmp);
|
sl@0
|
135 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
136 |
TESTNOERRORL(err);
|
sl@0
|
137 |
|
sl@0
|
138 |
CFbsBitmap* duplicateBmp = new(ELeave) CFbsBitmap;
|
sl@0
|
139 |
CleanupStack::PushL(duplicateBmp);
|
sl@0
|
140 |
err = duplicateBmp->Duplicate(bmp->Handle());
|
sl@0
|
141 |
TESTNOERRORL(err);
|
sl@0
|
142 |
|
sl@0
|
143 |
// check that the size, display mode etc are all correct
|
sl@0
|
144 |
TESTSIZEEQUALL(duplicateBmp->SizeInPixels(), KSizeInPixels);
|
sl@0
|
145 |
TESTEQUALL(duplicateBmp->DisplayMode(), KDisplayMode);
|
sl@0
|
146 |
TESTEQUALL(duplicateBmp->DisplayMode(), KDisplayMode);
|
sl@0
|
147 |
TESTEQUALL(duplicateBmp->ExtendedBitmapType(), KUidTestExtendedBitmap);
|
sl@0
|
148 |
|
sl@0
|
149 |
duplicateBmp->BeginDataAccess();
|
sl@0
|
150 |
|
sl@0
|
151 |
const TUint8* returnedDataAddress = reinterpret_cast<TUint8*>(duplicateBmp->DataAddress());
|
sl@0
|
152 |
TESTNOTEQUALL(returnedDataAddress, NULL);
|
sl@0
|
153 |
|
sl@0
|
154 |
// compare the size of the data in the duplicate bitmap with the size of the original data, they should be the same
|
sl@0
|
155 |
TInt returnedDataSize = duplicateBmp->DataSize();
|
sl@0
|
156 |
TESTEQUALL(returnedDataSize, KTestDataSize);
|
sl@0
|
157 |
|
sl@0
|
158 |
// compare the data returned from the duplicate bitmap with the original data, they should be the same
|
sl@0
|
159 |
TInt res = Mem::Compare(returnedDataAddress, returnedDataSize, KTestData, KTestDataSize);
|
sl@0
|
160 |
TESTEQUALL(res, 0);
|
sl@0
|
161 |
|
sl@0
|
162 |
duplicateBmp->EndDataAccess(ETrue);
|
sl@0
|
163 |
|
sl@0
|
164 |
CleanupStack::PopAndDestroy(2, bmp);
|
sl@0
|
165 |
}
|
sl@0
|
166 |
|
sl@0
|
167 |
/**
|
sl@0
|
168 |
@SYMTestCaseID
|
sl@0
|
169 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0031
|
sl@0
|
170 |
|
sl@0
|
171 |
@SYMTestCaseDesc
|
sl@0
|
172 |
Test that all the legacy CFbsBitmap APIs (i.e. APIs that existed before PREQ2096)
|
sl@0
|
173 |
that should return KErrAccessDenied for an extended bitmap do so correctly.
|
sl@0
|
174 |
|
sl@0
|
175 |
@SYMPREQ
|
sl@0
|
176 |
PREQ2096
|
sl@0
|
177 |
|
sl@0
|
178 |
@SYMREQ
|
sl@0
|
179 |
REQ10847
|
sl@0
|
180 |
REQ10856
|
sl@0
|
181 |
REQ10857
|
sl@0
|
182 |
|
sl@0
|
183 |
@SYMTestPriority
|
sl@0
|
184 |
High
|
sl@0
|
185 |
|
sl@0
|
186 |
@SYMTestStatus
|
sl@0
|
187 |
Implemented
|
sl@0
|
188 |
|
sl@0
|
189 |
@SYMTestActions
|
sl@0
|
190 |
Create an extended bitmap using test data and test Uid.
|
sl@0
|
191 |
Call all the legacy APIs that should return KErrAccessDenied:
|
sl@0
|
192 |
- Resize()
|
sl@0
|
193 |
- Compress()
|
sl@0
|
194 |
- CompressInBackground()
|
sl@0
|
195 |
- SwapWidthAndHeight()
|
sl@0
|
196 |
|
sl@0
|
197 |
@SYMTestExpectedResults
|
sl@0
|
198 |
The legacy APIs tested should all return KErrAccessDenied.
|
sl@0
|
199 |
*/
|
sl@0
|
200 |
void CTExtendedBitmapLegacy::TestAccessDeniedL()
|
sl@0
|
201 |
{
|
sl@0
|
202 |
INFO_PRINTF1(_L("AccessDenied - test legacy CFbsBitmap APIs that should return KErrAccessDenied when used with an extended bitmap"));
|
sl@0
|
203 |
|
sl@0
|
204 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
205 |
CleanupStack::PushL(bmp);
|
sl@0
|
206 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
207 |
TESTNOERRORL(err);
|
sl@0
|
208 |
|
sl@0
|
209 |
INFO_PRINTF1(_L("Resize()"));
|
sl@0
|
210 |
err = bmp->Resize(TSize(100,100));
|
sl@0
|
211 |
TESTEXPECTEDERRORL(err, KErrAccessDenied);
|
sl@0
|
212 |
|
sl@0
|
213 |
// This covers both versions of Compress() as one calls the other
|
sl@0
|
214 |
INFO_PRINTF1(_L("Compress()"));
|
sl@0
|
215 |
err = bmp->Compress();
|
sl@0
|
216 |
TESTEXPECTEDERRORL(err, KErrAccessDenied);
|
sl@0
|
217 |
|
sl@0
|
218 |
// This covers both synchronous versions of CompressInBackground() as one calls the other
|
sl@0
|
219 |
INFO_PRINTF1(_L("CompressInBackground()"));
|
sl@0
|
220 |
err = bmp->CompressInBackground();
|
sl@0
|
221 |
TESTEXPECTEDERRORL(err, KErrAccessDenied);
|
sl@0
|
222 |
|
sl@0
|
223 |
// This covers both asynchronous versions of CompressInBackground() as one calls the other
|
sl@0
|
224 |
INFO_PRINTF1(_L("CompressInBackground() (asynchronous)"));
|
sl@0
|
225 |
TRequestStatus requestStatus;
|
sl@0
|
226 |
bmp->CompressInBackground(requestStatus);
|
sl@0
|
227 |
User::WaitForRequest(requestStatus);
|
sl@0
|
228 |
TESTEXPECTEDERRORL(requestStatus.Int(), KErrAccessDenied);
|
sl@0
|
229 |
|
sl@0
|
230 |
INFO_PRINTF1(_L("SwapWidthAndHeight()"));
|
sl@0
|
231 |
err = bmp->SwapWidthAndHeight();
|
sl@0
|
232 |
TESTEXPECTEDERRORL(err, KErrAccessDenied);
|
sl@0
|
233 |
|
sl@0
|
234 |
CleanupStack::PopAndDestroy(bmp);
|
sl@0
|
235 |
}
|
sl@0
|
236 |
|
sl@0
|
237 |
/**
|
sl@0
|
238 |
@SYMTestCaseID
|
sl@0
|
239 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0032
|
sl@0
|
240 |
|
sl@0
|
241 |
@SYMTestCaseDesc
|
sl@0
|
242 |
Test that all the legacy CFbsBitmap APIs (i.e. APIs that existted before PREQ2096)
|
sl@0
|
243 |
that should return KErrNotSupported for an extended bitmap do so correctly, or
|
sl@0
|
244 |
if they have no return value and are not supported that they return cleanly.
|
sl@0
|
245 |
|
sl@0
|
246 |
@SYMPREQ
|
sl@0
|
247 |
PREQ2096
|
sl@0
|
248 |
|
sl@0
|
249 |
@SYMREQ
|
sl@0
|
250 |
REQ10847
|
sl@0
|
251 |
REQ10856
|
sl@0
|
252 |
REQ10857
|
sl@0
|
253 |
|
sl@0
|
254 |
@SYMTestPriority
|
sl@0
|
255 |
High
|
sl@0
|
256 |
|
sl@0
|
257 |
@SYMTestStatus
|
sl@0
|
258 |
Implemented
|
sl@0
|
259 |
|
sl@0
|
260 |
@SYMTestActions
|
sl@0
|
261 |
Create an extended bitmap using test data and test Uid.
|
sl@0
|
262 |
Call all the legacy APIs that should return KErrNotSupported:
|
sl@0
|
263 |
- Save()
|
sl@0
|
264 |
- GetPalette()
|
sl@0
|
265 |
- SetDisplayMode()
|
sl@0
|
266 |
|
sl@0
|
267 |
@SYMTestExpectedResults
|
sl@0
|
268 |
The legacy APIs tested should all return KErrNotSupported where they have return
|
sl@0
|
269 |
values, they should not cause errors where they are not supported but don't return
|
sl@0
|
270 |
an error value.
|
sl@0
|
271 |
*/
|
sl@0
|
272 |
void CTExtendedBitmapLegacy::TestNotSupportedL()
|
sl@0
|
273 |
{
|
sl@0
|
274 |
INFO_PRINTF1(_L("NotSupported - test legacy CFbsBitmap APIs that are not supported when used with an extended bitmap"));
|
sl@0
|
275 |
|
sl@0
|
276 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
277 |
CleanupStack::PushL(bmp);
|
sl@0
|
278 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
279 |
TESTNOERRORL(err);
|
sl@0
|
280 |
|
sl@0
|
281 |
// Methods that should return KErrNotSupported
|
sl@0
|
282 |
INFO_PRINTF1(_L("Save() - filename"));
|
sl@0
|
283 |
_LIT(KFilename, "C:\\temp.mbm");
|
sl@0
|
284 |
TESTEXPECTEDERRORL(bmp->Save(KFilename), KErrNotSupported);
|
sl@0
|
285 |
|
sl@0
|
286 |
INFO_PRINTF1(_L("Save() - RFile"));
|
sl@0
|
287 |
RFile file;
|
sl@0
|
288 |
err = file.Open(TheFs, KFilename, EFileWrite);
|
sl@0
|
289 |
TESTNOERRORL(err);
|
sl@0
|
290 |
CleanupClosePushL(file);
|
sl@0
|
291 |
TESTEXPECTEDERRORL(bmp->Save(file), KErrNotSupported);
|
sl@0
|
292 |
CleanupStack::PopAndDestroy(&file);
|
sl@0
|
293 |
|
sl@0
|
294 |
INFO_PRINTF1(_L("GetPalette()"));
|
sl@0
|
295 |
CPalette* palette;
|
sl@0
|
296 |
TESTEXPECTEDERRORL(bmp->GetPalette(palette), KErrNotSupported);
|
sl@0
|
297 |
|
sl@0
|
298 |
INFO_PRINTF1(_L("SetDisplayMode()"));
|
sl@0
|
299 |
err = bmp->SetDisplayMode(EColor16MU);
|
sl@0
|
300 |
TESTEXPECTEDERRORL(err, KErrNotSupported);
|
sl@0
|
301 |
|
sl@0
|
302 |
|
sl@0
|
303 |
CleanupStack::PopAndDestroy(bmp);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
/**
|
sl@0
|
307 |
@SYMTestCaseID
|
sl@0
|
308 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0033
|
sl@0
|
309 |
|
sl@0
|
310 |
@SYMTestCaseDesc
|
sl@0
|
311 |
Test that all CFbsBitmap methods that mention Twips work correctly with extended bitmaps.
|
sl@0
|
312 |
|
sl@0
|
313 |
@SYMPREQ
|
sl@0
|
314 |
PREQ2096
|
sl@0
|
315 |
|
sl@0
|
316 |
@SYMREQ
|
sl@0
|
317 |
REQ10847
|
sl@0
|
318 |
REQ10857
|
sl@0
|
319 |
REQ10858
|
sl@0
|
320 |
|
sl@0
|
321 |
@SYMTestPriority
|
sl@0
|
322 |
High
|
sl@0
|
323 |
|
sl@0
|
324 |
@SYMTestStatus
|
sl@0
|
325 |
Implemented
|
sl@0
|
326 |
|
sl@0
|
327 |
@SYMTestActions
|
sl@0
|
328 |
Create an extended bitmap using test data and test Uid.
|
sl@0
|
329 |
Call all the legacy APIs that mention Twips:
|
sl@0
|
330 |
- SetSizeInTwips()
|
sl@0
|
331 |
- SizeInTwips()
|
sl@0
|
332 |
- HorizontalPixelsToTwips()
|
sl@0
|
333 |
- HorizontalTwipsToPixels()
|
sl@0
|
334 |
- VerticalPixelsToTwips()
|
sl@0
|
335 |
- VerticalTwipsToPixels()
|
sl@0
|
336 |
|
sl@0
|
337 |
@SYMTestExpectedResults
|
sl@0
|
338 |
All methods should work correctly with extended bitmaps.
|
sl@0
|
339 |
*/
|
sl@0
|
340 |
void CTExtendedBitmapLegacy::TestTwipsL()
|
sl@0
|
341 |
{
|
sl@0
|
342 |
INFO_PRINTF1(_L("Twips - test legacy CFbsBitmap Twips APIs work correctly when used with an extended bitmap"));
|
sl@0
|
343 |
const TSize KSizeInTwips(20,30);
|
sl@0
|
344 |
|
sl@0
|
345 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
346 |
CleanupStack::PushL(bmp);
|
sl@0
|
347 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
348 |
TESTNOERRORL(err);
|
sl@0
|
349 |
|
sl@0
|
350 |
INFO_PRINTF1(_L("SetSizeInTwips()"));
|
sl@0
|
351 |
bmp->SetSizeInTwips(KSizeInTwips);
|
sl@0
|
352 |
|
sl@0
|
353 |
INFO_PRINTF1(_L("SizeInTwips()"));
|
sl@0
|
354 |
TESTSIZEEQUALL(bmp->SizeInTwips(), KSizeInTwips);
|
sl@0
|
355 |
|
sl@0
|
356 |
INFO_PRINTF1(_L("HorizontalPixelsToTwips()"));
|
sl@0
|
357 |
TESTEQUALL(bmp->HorizontalPixelsToTwips(KSizeInPixels.iWidth), KSizeInTwips.iWidth);
|
sl@0
|
358 |
|
sl@0
|
359 |
INFO_PRINTF1(_L("HorizontalTwipsToPixels()"));
|
sl@0
|
360 |
TESTEQUALL(bmp->HorizontalTwipsToPixels(KSizeInTwips.iWidth), KSizeInPixels.iWidth);
|
sl@0
|
361 |
|
sl@0
|
362 |
INFO_PRINTF1(_L("VerticalPixelsToTwips()"));
|
sl@0
|
363 |
TESTEQUALL(bmp->VerticalPixelsToTwips(KSizeInPixels.iHeight), KSizeInTwips.iHeight);
|
sl@0
|
364 |
|
sl@0
|
365 |
INFO_PRINTF1(_L("VerticalTwipsToPixels()"));
|
sl@0
|
366 |
TESTEQUALL(bmp->VerticalTwipsToPixels(KSizeInTwips.iHeight), KSizeInPixels.iHeight);
|
sl@0
|
367 |
|
sl@0
|
368 |
const TDisplayMode displayMode[] = {EColor256, EColor4K, EColor16M, EColor16MU, EColor64K,
|
sl@0
|
369 |
EGray256, EGray16, EGray4, EGray2, EColor16, EColor16MA, EColor16MAP};
|
sl@0
|
370 |
TInt ii = 0;
|
sl@0
|
371 |
err = KErrNotSupported;
|
sl@0
|
372 |
CFbsScreenDevice* scd = NULL;
|
sl@0
|
373 |
for(;(ii<TInt(sizeof(displayMode)/sizeof(displayMode[0]))) && (err == KErrNotSupported);++ii)
|
sl@0
|
374 |
{
|
sl@0
|
375 |
TRAP(err, scd = CFbsScreenDevice::NewL(_L("scdv"),displayMode[ii]));
|
sl@0
|
376 |
}
|
sl@0
|
377 |
if (err != KErrNone)
|
sl@0
|
378 |
{
|
sl@0
|
379 |
_LIT(KLog,"Failed to create screen device %S return value %d");
|
sl@0
|
380 |
INFO_PRINTF3(KLog,&ColorModeName(displayMode[ii]),err);
|
sl@0
|
381 |
}
|
sl@0
|
382 |
else
|
sl@0
|
383 |
{
|
sl@0
|
384 |
_LIT(KLog,"Created Screen Device with mode %S");
|
sl@0
|
385 |
INFO_PRINTF2(KLog,&ColorModeName(displayMode[ii]));
|
sl@0
|
386 |
}
|
sl@0
|
387 |
TESTNOERRORL(err);
|
sl@0
|
388 |
// The size of screen that this is tested on will be different depending on where it is
|
sl@0
|
389 |
// tested, so just check that this does not cause an error, don't check the result
|
sl@0
|
390 |
INFO_PRINTF1(_L("SetSizeInTwips() (screen device)"));
|
sl@0
|
391 |
bmp->SetSizeInTwips(scd);
|
sl@0
|
392 |
|
sl@0
|
393 |
delete scd;
|
sl@0
|
394 |
CleanupStack::PopAndDestroy(1, bmp);
|
sl@0
|
395 |
}
|
sl@0
|
396 |
|
sl@0
|
397 |
/**
|
sl@0
|
398 |
@SYMTestCaseID
|
sl@0
|
399 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0034
|
sl@0
|
400 |
|
sl@0
|
401 |
@SYMTestCaseDesc
|
sl@0
|
402 |
Test the simple getter CFbsBitmap APIs such as Handle().
|
sl@0
|
403 |
|
sl@0
|
404 |
@SYMPREQ
|
sl@0
|
405 |
PREQ2096
|
sl@0
|
406 |
|
sl@0
|
407 |
@SYMREQ
|
sl@0
|
408 |
REQ10847
|
sl@0
|
409 |
REQ10857
|
sl@0
|
410 |
REQ10858
|
sl@0
|
411 |
|
sl@0
|
412 |
@SYMTestPriority
|
sl@0
|
413 |
High
|
sl@0
|
414 |
|
sl@0
|
415 |
@SYMTestStatus
|
sl@0
|
416 |
Implemented
|
sl@0
|
417 |
|
sl@0
|
418 |
@SYMTestActions
|
sl@0
|
419 |
Create an extended bitmap using test data and test Uid.
|
sl@0
|
420 |
Call the following simple getter APIs:
|
sl@0
|
421 |
- InitialDisplayMode()
|
sl@0
|
422 |
- IsRomBitmap()
|
sl@0
|
423 |
- Handle()
|
sl@0
|
424 |
- Header()
|
sl@0
|
425 |
- IsLargeBitmap()
|
sl@0
|
426 |
- DataStride()
|
sl@0
|
427 |
- HardwareBitmapHandle()
|
sl@0
|
428 |
- SerialNumber()
|
sl@0
|
429 |
- IsCompressedInRAM()
|
sl@0
|
430 |
- GetAllBitmapHandles()
|
sl@0
|
431 |
|
sl@0
|
432 |
@SYMTestExpectedResults
|
sl@0
|
433 |
No errors should occur.
|
sl@0
|
434 |
*/
|
sl@0
|
435 |
void CTExtendedBitmapLegacy::TestGettersL()
|
sl@0
|
436 |
{
|
sl@0
|
437 |
INFO_PRINTF1(_L("Test simple getter APIs"));
|
sl@0
|
438 |
|
sl@0
|
439 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
440 |
CleanupStack::PushL(bmp);
|
sl@0
|
441 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
442 |
TESTNOERRORL(err);
|
sl@0
|
443 |
|
sl@0
|
444 |
INFO_PRINTF1(_L("InitialDisplayMode()"));
|
sl@0
|
445 |
TESTEQUALL(bmp->InitialDisplayMode(), KDisplayMode);
|
sl@0
|
446 |
|
sl@0
|
447 |
INFO_PRINTF1(_L("IsRomBitmap()"));
|
sl@0
|
448 |
TESTTRUEL(bmp->IsRomBitmap());
|
sl@0
|
449 |
|
sl@0
|
450 |
INFO_PRINTF1(_L("Handle()"));
|
sl@0
|
451 |
TESTNOTEQUALL(bmp->Handle(), 0);
|
sl@0
|
452 |
|
sl@0
|
453 |
INFO_PRINTF1(_L("Header()"));
|
sl@0
|
454 |
SEpocBitmapHeader header = bmp->Header();
|
sl@0
|
455 |
TESTSIZEEQUALL(header.iSizeInPixels, KSizeInPixels);
|
sl@0
|
456 |
TESTSIZEEQUALL(header.iSizeInTwips, TSize(0,0));
|
sl@0
|
457 |
TESTEQUALL(header.iBitsPerPixel, 16);
|
sl@0
|
458 |
TESTEQUALL(header.iColor, 1);
|
sl@0
|
459 |
TESTEQUALL(header.iPaletteEntries, 0);
|
sl@0
|
460 |
TESTEQUALL(header.iCompression, EProprietaryCompression);
|
sl@0
|
461 |
|
sl@0
|
462 |
INFO_PRINTF1(_L("IsLargeBitmap()"));
|
sl@0
|
463 |
TESTTRUEL(bmp->IsLargeBitmap());
|
sl@0
|
464 |
|
sl@0
|
465 |
INFO_PRINTF1(_L("DataStride()"));
|
sl@0
|
466 |
TESTEQUALL(bmp->DataStride(), KSizeInPixels.iWidth*KBpp);
|
sl@0
|
467 |
|
sl@0
|
468 |
INFO_PRINTF1(_L("HardwareBitmapHandle()"));
|
sl@0
|
469 |
TESTEQUALL(bmp->HardwareBitmapHandle(), 0);
|
sl@0
|
470 |
|
sl@0
|
471 |
INFO_PRINTF1(_L("SerialNumber()"));
|
sl@0
|
472 |
TESTNOTEQUALL(bmp->SerialNumber(), 0);
|
sl@0
|
473 |
|
sl@0
|
474 |
INFO_PRINTF1(_L("IsCompressedInRAM()"));
|
sl@0
|
475 |
TESTEQUALL(bmp->IsCompressedInRAM(), EFalse);
|
sl@0
|
476 |
|
sl@0
|
477 |
// The touch count changes for a bitmap (not a ROM bitmap) when it is resized etc, it should not change
|
sl@0
|
478 |
// when Resize() is called on an extended bitmap
|
sl@0
|
479 |
INFO_PRINTF1(_L("TouchCount()"));
|
sl@0
|
480 |
TESTEQUALL(bmp->TouchCount(), 0);
|
sl@0
|
481 |
bmp->Resize(TSize(100,100));
|
sl@0
|
482 |
TESTEQUALL(bmp->TouchCount(), 0);
|
sl@0
|
483 |
|
sl@0
|
484 |
// Bitmaps (not ROM bitmaps) become volatile if DataAddress() is called outside BeginDataAccess() and EndDataAccess(),
|
sl@0
|
485 |
// should never be set for extended bitmaps
|
sl@0
|
486 |
INFO_PRINTF1(_L("IsVolatile()"));
|
sl@0
|
487 |
TESTEQUALL(bmp->IsVolatile(), EFalse);
|
sl@0
|
488 |
bmp->DataAddress();
|
sl@0
|
489 |
TESTEQUALL(bmp->IsVolatile(), EFalse);
|
sl@0
|
490 |
|
sl@0
|
491 |
RArray<TInt> handles;
|
sl@0
|
492 |
CleanupClosePushL(handles);
|
sl@0
|
493 |
INFO_PRINTF1(_L("GetAllBitmapHandles()"));
|
sl@0
|
494 |
TESTNOERRORL(bmp->GetAllBitmapHandles(handles));
|
sl@0
|
495 |
TESTTRUEL(handles.Count() > 0);
|
sl@0
|
496 |
|
sl@0
|
497 |
CleanupStack::PopAndDestroy(2, bmp);
|
sl@0
|
498 |
}
|
sl@0
|
499 |
|
sl@0
|
500 |
/**
|
sl@0
|
501 |
@SYMTestCaseID
|
sl@0
|
502 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0035
|
sl@0
|
503 |
|
sl@0
|
504 |
@SYMTestCaseDesc
|
sl@0
|
505 |
Test GetScanLine with extended bitmaps where no rasterizer is present.
|
sl@0
|
506 |
|
sl@0
|
507 |
@SYMPREQ
|
sl@0
|
508 |
PREQ2096
|
sl@0
|
509 |
|
sl@0
|
510 |
@SYMREQ
|
sl@0
|
511 |
REQ10847
|
sl@0
|
512 |
REQ10857
|
sl@0
|
513 |
REQ10858
|
sl@0
|
514 |
|
sl@0
|
515 |
@SYMTestPriority
|
sl@0
|
516 |
High
|
sl@0
|
517 |
|
sl@0
|
518 |
@SYMTestStatus
|
sl@0
|
519 |
Implemented
|
sl@0
|
520 |
|
sl@0
|
521 |
@SYMTestActions
|
sl@0
|
522 |
Create an extended bitmap using test data and test Uid that is not supported by a rasterizer.
|
sl@0
|
523 |
Call GetScanLine().
|
sl@0
|
524 |
|
sl@0
|
525 |
@SYMTestExpectedResults
|
sl@0
|
526 |
GetScanLine() should return a white scanline of the length requested, no errors should occur.
|
sl@0
|
527 |
*/
|
sl@0
|
528 |
void CTExtendedBitmapLegacy::TestGetScanLineL()
|
sl@0
|
529 |
{
|
sl@0
|
530 |
INFO_PRINTF1(_L("Test CFbsBitmap::GetScanLine() where there is no supported rasterizer for the passed extended bitmap Uid"));
|
sl@0
|
531 |
|
sl@0
|
532 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
533 |
CleanupStack::PushL(bmp);
|
sl@0
|
534 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
535 |
TESTNOERRORL(err);
|
sl@0
|
536 |
|
sl@0
|
537 |
const TInt KScanlineLength = KTestWidth*KBpp;
|
sl@0
|
538 |
TBuf8<KScanlineLength> buf;
|
sl@0
|
539 |
bmp->GetScanLine(buf, TPoint(0,0), KTestWidth, KDisplayMode);
|
sl@0
|
540 |
TESTEQUALL(buf.Size(), KScanlineLength);
|
sl@0
|
541 |
|
sl@0
|
542 |
// Check that the scanline has been set to white
|
sl@0
|
543 |
for (TInt i = 0; i < KScanlineLength; i++)
|
sl@0
|
544 |
{
|
sl@0
|
545 |
TESTEQUALL(buf[i], 255);
|
sl@0
|
546 |
}
|
sl@0
|
547 |
|
sl@0
|
548 |
CleanupStack::PopAndDestroy(bmp);
|
sl@0
|
549 |
}
|
sl@0
|
550 |
|
sl@0
|
551 |
/**
|
sl@0
|
552 |
@SYMTestCaseID
|
sl@0
|
553 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0036
|
sl@0
|
554 |
|
sl@0
|
555 |
@SYMTestCaseDesc
|
sl@0
|
556 |
Test an extended bitmap with all of the CFbsBitmap APIs that call Reset().
|
sl@0
|
557 |
|
sl@0
|
558 |
@SYMPREQ
|
sl@0
|
559 |
PREQ2096
|
sl@0
|
560 |
|
sl@0
|
561 |
@SYMREQ
|
sl@0
|
562 |
REQ10847
|
sl@0
|
563 |
|
sl@0
|
564 |
@SYMTestPriority
|
sl@0
|
565 |
High
|
sl@0
|
566 |
|
sl@0
|
567 |
@SYMTestStatus
|
sl@0
|
568 |
Implemented
|
sl@0
|
569 |
|
sl@0
|
570 |
@SYMTestActions
|
sl@0
|
571 |
For each API:
|
sl@0
|
572 |
- Create an extended bitmap using test data and test Uid that is not supported by a rasterizer.
|
sl@0
|
573 |
- Call the API.
|
sl@0
|
574 |
The following APIs are tested:
|
sl@0
|
575 |
- Load()
|
sl@0
|
576 |
- LoadAndCompress()
|
sl@0
|
577 |
- Internalize()
|
sl@0
|
578 |
- SetRomBitmapL()
|
sl@0
|
579 |
|
sl@0
|
580 |
@SYMTestExpectedResults
|
sl@0
|
581 |
All APIs tested should complete with no errors, the resultant CFbsBitmap
|
sl@0
|
582 |
should not be an extended bitmap as it will have been reset.
|
sl@0
|
583 |
*/
|
sl@0
|
584 |
void CTExtendedBitmapLegacy::TestApisThatCallResetL()
|
sl@0
|
585 |
{
|
sl@0
|
586 |
INFO_PRINTF1(_L("Test CFbsBitmap APIs that Call Reset()"));
|
sl@0
|
587 |
|
sl@0
|
588 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
589 |
CleanupStack::PushL(bmp);
|
sl@0
|
590 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
591 |
TESTNOERRORL(err);
|
sl@0
|
592 |
TESTEQUALL(bmp->ExtendedBitmapType(), KUidTestExtendedBitmap);
|
sl@0
|
593 |
|
sl@0
|
594 |
INFO_PRINTF1(_L("Load()"));
|
sl@0
|
595 |
err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
596 |
TESTNOERRORL(err);
|
sl@0
|
597 |
TESTEQUALL(bmp->ExtendedBitmapType(), KUidTestExtendedBitmap); // should be an extended bitmap again
|
sl@0
|
598 |
TESTNOERRORL(bmp->Load(KRamBitmapFilename));
|
sl@0
|
599 |
TESTNOTEQUALL(bmp->ExtendedBitmapType(), KUidTestExtendedBitmap); // should no longer be an extended bitmap
|
sl@0
|
600 |
|
sl@0
|
601 |
INFO_PRINTF1(_L("LoadAndCompress()"));
|
sl@0
|
602 |
err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
603 |
TESTNOERRORL(err);
|
sl@0
|
604 |
TESTEQUALL(bmp->ExtendedBitmapType(), KUidTestExtendedBitmap); // should be an extended bitmap again
|
sl@0
|
605 |
TESTNOERRORL(bmp->LoadAndCompress(KRamBitmapFilename));
|
sl@0
|
606 |
TESTNOTEQUALL(bmp->ExtendedBitmapType(), KUidTestExtendedBitmap); // should no longer be an extended bitmap
|
sl@0
|
607 |
|
sl@0
|
608 |
INFO_PRINTF1(_L("InternalizeL()"));
|
sl@0
|
609 |
CBufFlat* buf = CBufFlat::NewL(512);
|
sl@0
|
610 |
CleanupStack::PushL(buf);
|
sl@0
|
611 |
RBufWriteStream writeStream(*buf,0);
|
sl@0
|
612 |
bmp->ExternalizeL(writeStream); // externalize a normal bitmap
|
sl@0
|
613 |
writeStream.Close();
|
sl@0
|
614 |
err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
615 |
TESTNOERRORL(err);
|
sl@0
|
616 |
TESTEQUALL(bmp->ExtendedBitmapType(), KUidTestExtendedBitmap); // should be an extended bitmap again
|
sl@0
|
617 |
RBufReadStream readStream(*buf,0);
|
sl@0
|
618 |
bmp->InternalizeL(readStream);
|
sl@0
|
619 |
readStream.Close();
|
sl@0
|
620 |
TESTNOTEQUALL(bmp->ExtendedBitmapType(), KUidTestExtendedBitmap); // should no longer be an extended bitmap
|
sl@0
|
621 |
|
sl@0
|
622 |
TUint32* romAddress = NULL;
|
sl@0
|
623 |
if(!CFbsBitmap::IsFileInRom(KRomBmpFilename, romAddress)) //check any rom bitmap
|
sl@0
|
624 |
{
|
sl@0
|
625 |
INFO_PRINTF2(_L("Skipping tests of ROM bitmaps since file \"%S\" is reported to not be a ROM bitmap."), &KRomBmpFilename);
|
sl@0
|
626 |
INFO_PRINTF1(_L("This should only occur on non-XIP ROMs, e.g. NAND ROMs, where ROM bitmaps aren't supported."));
|
sl@0
|
627 |
}
|
sl@0
|
628 |
else
|
sl@0
|
629 |
{
|
sl@0
|
630 |
INFO_PRINTF1(_L("SetRomBitmapL()"));
|
sl@0
|
631 |
CFbsBitmapEx* romBitmap = new(ELeave) CFbsBitmapEx;
|
sl@0
|
632 |
CleanupStack::PushL(romBitmap);
|
sl@0
|
633 |
INFO_PRINTF2(_L("... attempting to load %S"), &KRomBmpFilename);
|
sl@0
|
634 |
err = romBitmap->Load(KRomBmpFilename);
|
sl@0
|
635 |
TESTNOERRORL(err);
|
sl@0
|
636 |
TInt size = 0;
|
sl@0
|
637 |
INFO_PRINTF1(_L("... calling SetRomBitmapL()"));
|
sl@0
|
638 |
bmp->SetRomBitmapL(romBitmap->BitmapAddress(), size);
|
sl@0
|
639 |
TESTNOTEQUALL(bmp->ExtendedBitmapType(), KUidTestExtendedBitmap); // should no longer be an extended bitmap
|
sl@0
|
640 |
TEST(bmp->SerialNumber() == -TInt64(static_cast<TUint32>(bmp->Handle()))); // A ROM bitmap's handle is its address pointer, its serial number is -ve the address pointer
|
sl@0
|
641 |
|
sl@0
|
642 |
CleanupStack::PopAndDestroy(1, romBitmap);
|
sl@0
|
643 |
}
|
sl@0
|
644 |
|
sl@0
|
645 |
CleanupStack::PopAndDestroy(2, bmp);
|
sl@0
|
646 |
}
|
sl@0
|
647 |
|
sl@0
|
648 |
/**
|
sl@0
|
649 |
@SYMTestCaseID
|
sl@0
|
650 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0037
|
sl@0
|
651 |
|
sl@0
|
652 |
@SYMTestCaseDesc
|
sl@0
|
653 |
Test the CFbsBitmap APIs that should leave when called by an extended bitmap.
|
sl@0
|
654 |
|
sl@0
|
655 |
@SYMPREQ
|
sl@0
|
656 |
PREQ2096
|
sl@0
|
657 |
|
sl@0
|
658 |
@SYMREQ
|
sl@0
|
659 |
REQ10847
|
sl@0
|
660 |
REQ10856
|
sl@0
|
661 |
REQ10857
|
sl@0
|
662 |
|
sl@0
|
663 |
@SYMTestPriority
|
sl@0
|
664 |
High
|
sl@0
|
665 |
|
sl@0
|
666 |
@SYMTestStatus
|
sl@0
|
667 |
Implemented
|
sl@0
|
668 |
|
sl@0
|
669 |
@SYMTestActions
|
sl@0
|
670 |
For each API:
|
sl@0
|
671 |
- Create an extended bitmap using test data and test Uid that is not supported by a rasterizer.
|
sl@0
|
672 |
- Call the API.
|
sl@0
|
673 |
The following APIs are tested:
|
sl@0
|
674 |
- ExternalizeL()
|
sl@0
|
675 |
- ExternalizeRectangleL()
|
sl@0
|
676 |
|
sl@0
|
677 |
@SYMTestExpectedResults
|
sl@0
|
678 |
All APIs tested should leave with the error KErrNotSupported.
|
sl@0
|
679 |
*/
|
sl@0
|
680 |
void CTExtendedBitmapLegacy::TestApisThatLeaveL()
|
sl@0
|
681 |
{
|
sl@0
|
682 |
INFO_PRINTF1(_L("ApisThatLeave - test legacy CFbsBitmap APIs that leave when used with an extended bitmap"));
|
sl@0
|
683 |
|
sl@0
|
684 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
685 |
CleanupStack::PushL(bmp);
|
sl@0
|
686 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
687 |
TESTNOERRORL(err);
|
sl@0
|
688 |
|
sl@0
|
689 |
INFO_PRINTF1(_L("ExternalizeL()"));
|
sl@0
|
690 |
CBufFlat* buf = CBufFlat::NewL(512);
|
sl@0
|
691 |
CleanupStack::PushL(buf);
|
sl@0
|
692 |
RBufWriteStream writeStream(*buf,0);
|
sl@0
|
693 |
CleanupClosePushL(writeStream);
|
sl@0
|
694 |
TRAP(err, bmp->ExternalizeL(writeStream));
|
sl@0
|
695 |
TESTEXPECTEDERRORL(err, KErrNotSupported);
|
sl@0
|
696 |
|
sl@0
|
697 |
INFO_PRINTF1(_L("ExternalizeRectangleL()"));
|
sl@0
|
698 |
RBufWriteStream writeStream2(*buf,0);
|
sl@0
|
699 |
CleanupClosePushL(writeStream2);
|
sl@0
|
700 |
TRAP(err, bmp->ExternalizeRectangleL(writeStream2, TRect(10,10,100,100)));
|
sl@0
|
701 |
TESTEXPECTEDERRORL(err, KErrNotSupported);
|
sl@0
|
702 |
|
sl@0
|
703 |
CleanupStack::PopAndDestroy(4, bmp);
|
sl@0
|
704 |
}
|
sl@0
|
705 |
|
sl@0
|
706 |
/**
|
sl@0
|
707 |
@SYMTestCaseID
|
sl@0
|
708 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0038
|
sl@0
|
709 |
|
sl@0
|
710 |
@SYMTestCaseDesc
|
sl@0
|
711 |
Test that APIs that do not return an error value or leave, yet are not supported
|
sl@0
|
712 |
for extended bitmaps, do not cause an error.
|
sl@0
|
713 |
|
sl@0
|
714 |
@SYMPREQ
|
sl@0
|
715 |
PREQ2096
|
sl@0
|
716 |
|
sl@0
|
717 |
@SYMREQ
|
sl@0
|
718 |
REQ10847
|
sl@0
|
719 |
REQ10856
|
sl@0
|
720 |
REQ10857
|
sl@0
|
721 |
|
sl@0
|
722 |
@SYMTestPriority
|
sl@0
|
723 |
High
|
sl@0
|
724 |
|
sl@0
|
725 |
@SYMTestStatus
|
sl@0
|
726 |
Implemented
|
sl@0
|
727 |
|
sl@0
|
728 |
@SYMTestActions
|
sl@0
|
729 |
For each API:
|
sl@0
|
730 |
- Create an extended bitmap using test data and test Uid that is not supported by a rasterizer.
|
sl@0
|
731 |
- Call the API.
|
sl@0
|
732 |
The following APIs are tested:
|
sl@0
|
733 |
- PaletteAttributes()
|
sl@0
|
734 |
- SetPalette()
|
sl@0
|
735 |
|
sl@0
|
736 |
@SYMTestExpectedResults
|
sl@0
|
737 |
All APIs tested should complete with no errors.
|
sl@0
|
738 |
*/
|
sl@0
|
739 |
void CTExtendedBitmapLegacy::TestNotSupportedNoReturnL()
|
sl@0
|
740 |
{
|
sl@0
|
741 |
INFO_PRINTF1(_L("NotSupportedNoReturn - test legacy CFbsBitmap APIs that are not supported when used with an extended bitmap but do not return errors"));
|
sl@0
|
742 |
|
sl@0
|
743 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
744 |
CleanupStack::PushL(bmp);
|
sl@0
|
745 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
746 |
TESTNOERRORL(err);
|
sl@0
|
747 |
|
sl@0
|
748 |
// Methods that are not supported and do not return errors values
|
sl@0
|
749 |
INFO_PRINTF1(_L("PaletteAttributes()"));
|
sl@0
|
750 |
TBool modifiable;
|
sl@0
|
751 |
TInt numEntries;
|
sl@0
|
752 |
bmp->PaletteAttributes(modifiable, numEntries);
|
sl@0
|
753 |
|
sl@0
|
754 |
INFO_PRINTF1(_L("SetPalette()"));
|
sl@0
|
755 |
bmp->SetPalette(NULL);
|
sl@0
|
756 |
|
sl@0
|
757 |
CleanupStack::PopAndDestroy(bmp);
|
sl@0
|
758 |
}
|
sl@0
|
759 |
|
sl@0
|
760 |
/**
|
sl@0
|
761 |
@SYMTestCaseID
|
sl@0
|
762 |
GRAPHICS-FBSERV-EXTENDEDBITMAP-0039
|
sl@0
|
763 |
|
sl@0
|
764 |
@SYMTestCaseDesc
|
sl@0
|
765 |
Test GetPixel with extended bitmaps where no rasterizer is present
|
sl@0
|
766 |
that supports the extended bitmap type.
|
sl@0
|
767 |
|
sl@0
|
768 |
@SYMCR
|
sl@0
|
769 |
CR1804
|
sl@0
|
770 |
|
sl@0
|
771 |
@SYMREQ
|
sl@0
|
772 |
REQ10858
|
sl@0
|
773 |
|
sl@0
|
774 |
@SYMTestPriority
|
sl@0
|
775 |
High
|
sl@0
|
776 |
|
sl@0
|
777 |
@SYMTestStatus
|
sl@0
|
778 |
Implemented
|
sl@0
|
779 |
|
sl@0
|
780 |
@SYMTestActions
|
sl@0
|
781 |
Create an extended bitmap using test data and test Uid that is not supported by a rasterizer.
|
sl@0
|
782 |
Call GetPixel().
|
sl@0
|
783 |
|
sl@0
|
784 |
@SYMTestExpectedResults
|
sl@0
|
785 |
GetPixel() should return white pixels at the points requested, no errors should occur.
|
sl@0
|
786 |
*/
|
sl@0
|
787 |
void CTExtendedBitmapLegacy::TestGetPixelL()
|
sl@0
|
788 |
{
|
sl@0
|
789 |
INFO_PRINTF1(_L("Test CFbsBitmap::GetPixel() where there is no supported rasterizer for the passed extended bitmap Uid"));
|
sl@0
|
790 |
|
sl@0
|
791 |
CFbsBitmap* bmp = new(ELeave) CFbsBitmap;
|
sl@0
|
792 |
CleanupStack::PushL(bmp);
|
sl@0
|
793 |
TInt err = bmp->CreateExtendedBitmap(KSizeInPixels, KDisplayMode, KUidTestExtendedBitmap, KTestData, KTestDataSize);
|
sl@0
|
794 |
TESTNOERRORL(err);
|
sl@0
|
795 |
|
sl@0
|
796 |
// Check that the absence of a rasteriser causes legacy off-screen rendering to
|
sl@0
|
797 |
// treat the extended bitmap as if all pixels were white.
|
sl@0
|
798 |
TRgb color;
|
sl@0
|
799 |
for (TInt y = 0; y < KTestHeight; ++y)
|
sl@0
|
800 |
{
|
sl@0
|
801 |
for (TInt x = 0; x < KTestWidth; ++x)
|
sl@0
|
802 |
{
|
sl@0
|
803 |
bmp->GetPixel(color, TPoint(x,y));
|
sl@0
|
804 |
TESTTRUEL(color == KRgbWhite);
|
sl@0
|
805 |
}
|
sl@0
|
806 |
}
|
sl@0
|
807 |
|
sl@0
|
808 |
CleanupStack::PopAndDestroy(bmp);
|
sl@0
|
809 |
}
|
sl@0
|
810 |
|
sl@0
|
811 |
__CONSTRUCT_STEP__(ExtendedBitmapLegacy)
|
sl@0
|
812 |
|
sl@0
|
813 |
void CTExtendedBitmapLegacyStep::TestSetupL()
|
sl@0
|
814 |
{
|
sl@0
|
815 |
// Copy files needed by the tests to c:
|
sl@0
|
816 |
TheFs.Connect();
|
sl@0
|
817 |
TInt err = BaflUtils::CopyFile(TheFs, KRamBitmapFilenameOnZ, KRamBitmapFilename);
|
sl@0
|
818 |
if (err != KErrNone)
|
sl@0
|
819 |
{
|
sl@0
|
820 |
ERR_PRINTF2(_L("Error copying test mbm file from rom to ram: %d"), err);
|
sl@0
|
821 |
User::Leave(err);
|
sl@0
|
822 |
}
|
sl@0
|
823 |
}
|
sl@0
|
824 |
|
sl@0
|
825 |
void CTExtendedBitmapLegacyStep::TestClose()
|
sl@0
|
826 |
{
|
sl@0
|
827 |
// Delete files used by the tests from c:
|
sl@0
|
828 |
BaflUtils::DeleteFile(TheFs, KRamBitmapFilename);
|
sl@0
|
829 |
TheFs.Close();
|
sl@0
|
830 |
}
|