sl@0
|
1 |
// Copyright (c) 2004-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 "../sfbs/UTILS.H"
|
sl@0
|
17 |
#include "TFBSDefect.h"
|
sl@0
|
18 |
#include "fbsmessage.h"
|
sl@0
|
19 |
|
sl@0
|
20 |
CTFbsDefect::CTFbsDefect(CTestStep* aStep) :
|
sl@0
|
21 |
CTGraphicsBase(aStep)
|
sl@0
|
22 |
{
|
sl@0
|
23 |
|
sl@0
|
24 |
}
|
sl@0
|
25 |
|
sl@0
|
26 |
/**
|
sl@0
|
27 |
@SYMTestCaseID
|
sl@0
|
28 |
GRAPHICS-FBSERV-0574
|
sl@0
|
29 |
|
sl@0
|
30 |
@SYMTestCaseDesc
|
sl@0
|
31 |
Checks for leaking thread handles during
|
sl@0
|
32 |
creation of bitmaps
|
sl@0
|
33 |
|
sl@0
|
34 |
@SYMDEF INC041784
|
sl@0
|
35 |
|
sl@0
|
36 |
@SYMTestActions
|
sl@0
|
37 |
Retrieves the process handle count and the
|
sl@0
|
38 |
thread handle count. Creates a bitmap with
|
sl@0
|
39 |
the specified size and display mode. The bitmap
|
sl@0
|
40 |
is created on the font and bitmap server's shared
|
sl@0
|
41 |
heap. The thread handle count is retrieved again
|
sl@0
|
42 |
and compared against the first thread handle count
|
sl@0
|
43 |
and they should match.
|
sl@0
|
44 |
|
sl@0
|
45 |
@SYMTestExpectedResults
|
sl@0
|
46 |
Test should pass
|
sl@0
|
47 |
*/
|
sl@0
|
48 |
void CTFbsDefect::CreateBitmapTestL()
|
sl@0
|
49 |
{
|
sl@0
|
50 |
INFO_PRINTF1(_L("CreateBitmapTestL (INC041784)"));
|
sl@0
|
51 |
|
sl@0
|
52 |
// and leaking thread handles
|
sl@0
|
53 |
TInt startProcessHandleCount;
|
sl@0
|
54 |
TInt startThreadHandleCount;
|
sl@0
|
55 |
TInt endProcessHandleCount;
|
sl@0
|
56 |
TInt endThreadHandleCount;
|
sl@0
|
57 |
|
sl@0
|
58 |
RThread thisThread;
|
sl@0
|
59 |
thisThread.HandleCount(startProcessHandleCount, startThreadHandleCount);
|
sl@0
|
60 |
|
sl@0
|
61 |
// Test Starts...
|
sl@0
|
62 |
//
|
sl@0
|
63 |
|
sl@0
|
64 |
const TSize size(100, 100);
|
sl@0
|
65 |
|
sl@0
|
66 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
|
sl@0
|
67 |
CleanupStack::PushL(bitmap);
|
sl@0
|
68 |
|
sl@0
|
69 |
TEST (bitmap->Create(size, ERgb) == KErrArgument);
|
sl@0
|
70 |
TEST (bitmap->Create(size, ENone) == KErrArgument);
|
sl@0
|
71 |
TEST (bitmap->Create(size, EColor16) == KErrNone);
|
sl@0
|
72 |
|
sl@0
|
73 |
CleanupStack::PopAndDestroy(bitmap);
|
sl@0
|
74 |
|
sl@0
|
75 |
//
|
sl@0
|
76 |
// Test Ends...
|
sl@0
|
77 |
|
sl@0
|
78 |
// Check for open handles
|
sl@0
|
79 |
thisThread.HandleCount(endProcessHandleCount, endThreadHandleCount);
|
sl@0
|
80 |
|
sl@0
|
81 |
TEST(startThreadHandleCount == endThreadHandleCount);
|
sl@0
|
82 |
}
|
sl@0
|
83 |
|
sl@0
|
84 |
/**
|
sl@0
|
85 |
@SYMTestCaseID
|
sl@0
|
86 |
GRAPHICS-FBSERV-0575
|
sl@0
|
87 |
|
sl@0
|
88 |
@SYMDEF DEF042528
|
sl@0
|
89 |
|
sl@0
|
90 |
@SYMTestCaseDesc
|
sl@0
|
91 |
Tests replacing initial display with all the
|
sl@0
|
92 |
possible higher display mode and tests replacing
|
sl@0
|
93 |
initial display with all the possible lower display mode.
|
sl@0
|
94 |
|
sl@0
|
95 |
@SYMTestActions
|
sl@0
|
96 |
Creates a bitmap. Creates an array containing display modes.
|
sl@0
|
97 |
For each display mode it sets the display mode to a higher
|
sl@0
|
98 |
display mode and checks for errors. Then for each display mode
|
sl@0
|
99 |
it sets the display mode to a lower display mode and checks
|
sl@0
|
100 |
for errors.
|
sl@0
|
101 |
|
sl@0
|
102 |
@SYMTestExpectedResults
|
sl@0
|
103 |
Test should pass
|
sl@0
|
104 |
*/
|
sl@0
|
105 |
void CTFbsDefect::TestDisplayModeL()
|
sl@0
|
106 |
{
|
sl@0
|
107 |
INFO_PRINTF1(_L("TestDisplayModeL (DEF042528)"));
|
sl@0
|
108 |
|
sl@0
|
109 |
const TSize size(10,10);
|
sl@0
|
110 |
CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
|
sl@0
|
111 |
//TDisplayMode value= { 1 , 2 , 3 , 4 , 5 6 10 7 8 11 12 13
|
sl@0
|
112 |
TDisplayMode mode[] = {EGray2,EGray4,EGray16,EGray256,EColor16,EColor256,EColor4K,EColor64K,EColor16M,EColor16MU,EColor16MA,EColor16MAP};
|
sl@0
|
113 |
|
sl@0
|
114 |
TInt arraysize=sizeof(mode)/sizeof(mode[0]);
|
sl@0
|
115 |
INFO_PRINTF2(_L("Array size=%d\n"),arraysize);
|
sl@0
|
116 |
TInt ret;
|
sl@0
|
117 |
|
sl@0
|
118 |
//Test for replacing initial display with all the possible higher display mode
|
sl@0
|
119 |
//This should not work and all the values returned by SetDisplayMode()==KErrArgument
|
sl@0
|
120 |
for (TInt i=0;i<arraysize;i++)
|
sl@0
|
121 |
{
|
sl@0
|
122 |
ret=bitmap->Create(size,mode[i]);
|
sl@0
|
123 |
INFO_PRINTF2(_L("Initial mode: %d\n"),mode[i]);
|
sl@0
|
124 |
TEST(ret==KErrNone);
|
sl@0
|
125 |
for (TInt j=i+1;j<arraysize;j++)
|
sl@0
|
126 |
{
|
sl@0
|
127 |
if ((mode[i]==EColor16MU && (mode[j]==EColor16MA || mode[j]==EColor16MAP)) || (mode[i]==EColor16MA && mode[j]==EColor16MAP))
|
sl@0
|
128 |
{
|
sl@0
|
129 |
//special cases where we can change from EColor16MU to either EColor16MA or EColor16MAP and from EColor16MA to EColor16MAP.
|
sl@0
|
130 |
ret=bitmap->SetDisplayMode(mode[j]);
|
sl@0
|
131 |
INFO_PRINTF3(_L("Changing to display mode=%d with ret value=%d\n "),mode[j],ret);
|
sl@0
|
132 |
TEST(ret==KErrNone);
|
sl@0
|
133 |
}
|
sl@0
|
134 |
else
|
sl@0
|
135 |
{
|
sl@0
|
136 |
ret=bitmap->SetDisplayMode(mode[j]);
|
sl@0
|
137 |
INFO_PRINTF3(_L("Changing to display mode %d with ret value %d \n"),mode[j],ret);
|
sl@0
|
138 |
TEST(ret==KErrArgument);
|
sl@0
|
139 |
}
|
sl@0
|
140 |
}
|
sl@0
|
141 |
INFO_PRINTF1(_L("End of mode \n"));
|
sl@0
|
142 |
}
|
sl@0
|
143 |
|
sl@0
|
144 |
//Test for replacing initial display with all the possible lower display mode
|
sl@0
|
145 |
//This should work fine and all the values returned by SetDisplayMode()==KErrNone
|
sl@0
|
146 |
INFO_PRINTF1(_L("\n\n"));
|
sl@0
|
147 |
for (TInt k=arraysize-1;k>=0;k--)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
ret=bitmap->Create(size,mode[k]);
|
sl@0
|
150 |
INFO_PRINTF2(_L("Initial mode=%d\n"),mode[k]);
|
sl@0
|
151 |
TEST(ret==KErrNone);
|
sl@0
|
152 |
for (TInt l=k-1;l>=0;l--)
|
sl@0
|
153 |
{
|
sl@0
|
154 |
|
sl@0
|
155 |
if (mode[k]==EColor16 && mode[l]==EGray256)
|
sl@0
|
156 |
{
|
sl@0
|
157 |
//special case where we cannot change from EColor16 to EGray256
|
sl@0
|
158 |
ret=bitmap->SetDisplayMode(mode[l]);
|
sl@0
|
159 |
INFO_PRINTF3(_L("Changing to display mode=%d with ret value=%d\n "),mode[l],ret);
|
sl@0
|
160 |
TEST(ret==KErrArgument);
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
else
|
sl@0
|
164 |
{
|
sl@0
|
165 |
ret=bitmap->SetDisplayMode(mode[l]);
|
sl@0
|
166 |
INFO_PRINTF3(_L("Changing to display mode=%d with ret value=%d\n "),mode[l],ret);
|
sl@0
|
167 |
TEST(ret==KErrNone);
|
sl@0
|
168 |
}
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
}
|
sl@0
|
172 |
|
sl@0
|
173 |
bitmap->Reset();
|
sl@0
|
174 |
delete bitmap;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
/* Creates and destroys large bitmaps */
|
sl@0
|
178 |
TInt BitmapCreate(TAny* /* aAny */)
|
sl@0
|
179 |
{
|
sl@0
|
180 |
RFbsSession fbs;
|
sl@0
|
181 |
TInt err = fbs.Connect();
|
sl@0
|
182 |
User::LeaveIfError(err);
|
sl@0
|
183 |
RFbsSession* fbs2 = RFbsSession::GetSession();
|
sl@0
|
184 |
|
sl@0
|
185 |
FOREVER
|
sl@0
|
186 |
{
|
sl@0
|
187 |
CFbsBitmap bitmap;
|
sl@0
|
188 |
bitmap.Create(TSize(300,200), EColor16MU);
|
sl@0
|
189 |
bitmap.Reset();
|
sl@0
|
190 |
fbs2->SendCommand(EFbsCompress, 0);
|
sl@0
|
191 |
User::After(1);
|
sl@0
|
192 |
}
|
sl@0
|
193 |
}
|
sl@0
|
194 |
|
sl@0
|
195 |
void CleanupFbsConnection(TAny* aPtr)
|
sl@0
|
196 |
{
|
sl@0
|
197 |
RFbsSession* fbs = static_cast<RFbsSession*>(aPtr);
|
sl@0
|
198 |
fbs->Disconnect();
|
sl@0
|
199 |
}
|
sl@0
|
200 |
|
sl@0
|
201 |
void CleanupLoadedBitmap(TAny* aPtr)
|
sl@0
|
202 |
{
|
sl@0
|
203 |
RPointerArray<CFbsBitmap>* ptrArray = (static_cast<RPointerArray<CFbsBitmap>*>(aPtr));
|
sl@0
|
204 |
ptrArray->ResetAndDestroy();
|
sl@0
|
205 |
ptrArray->Close();
|
sl@0
|
206 |
}
|
sl@0
|
207 |
|
sl@0
|
208 |
void FillBitmapArray(RPointerArray<CFbsBitmap>& aArray)
|
sl@0
|
209 |
{
|
sl@0
|
210 |
for(TInt count=100; count>=0; --count)
|
sl@0
|
211 |
{
|
sl@0
|
212 |
CFbsBitmap* bitmap = new CFbsBitmap;
|
sl@0
|
213 |
if (!bitmap)
|
sl@0
|
214 |
return;
|
sl@0
|
215 |
|
sl@0
|
216 |
TInt err = bitmap->Create(TSize(100,100), EColor16MU);
|
sl@0
|
217 |
|
sl@0
|
218 |
if (err == KErrNone)
|
sl@0
|
219 |
{
|
sl@0
|
220 |
err = aArray.Append(bitmap);
|
sl@0
|
221 |
}
|
sl@0
|
222 |
|
sl@0
|
223 |
if (err != KErrNone)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
delete bitmap;
|
sl@0
|
226 |
return;
|
sl@0
|
227 |
}
|
sl@0
|
228 |
}
|
sl@0
|
229 |
}
|
sl@0
|
230 |
|
sl@0
|
231 |
void DoBitmapUseL()
|
sl@0
|
232 |
{
|
sl@0
|
233 |
RFbsSession fbs;
|
sl@0
|
234 |
TInt err = fbs.Connect();
|
sl@0
|
235 |
User::LeaveIfError(err);
|
sl@0
|
236 |
TCleanupItem fbsConnectionCleanup(CleanupFbsConnection, &fbs);
|
sl@0
|
237 |
CleanupStack::PushL(fbsConnectionCleanup);
|
sl@0
|
238 |
|
sl@0
|
239 |
RPointerArray<CFbsBitmap> stressBitmaps;
|
sl@0
|
240 |
TCleanupItem loadedBitmapCleanup(CleanupLoadedBitmap, &stressBitmaps);
|
sl@0
|
241 |
CleanupStack::PushL(loadedBitmapCleanup);
|
sl@0
|
242 |
FillBitmapArray(stressBitmaps);
|
sl@0
|
243 |
|
sl@0
|
244 |
CFbsBitmap* outputBitmap=new(ELeave) CFbsBitmap;
|
sl@0
|
245 |
CleanupStack::PushL(outputBitmap);
|
sl@0
|
246 |
User::LeaveIfError(outputBitmap->Create(TSize(200,200),EColor16MU));
|
sl@0
|
247 |
CFbsBitmapDevice *bgDevice=CFbsBitmapDevice::NewL(outputBitmap);
|
sl@0
|
248 |
CleanupStack::PushL(bgDevice);
|
sl@0
|
249 |
CFbsBitGc* bgGc=NULL;
|
sl@0
|
250 |
User::LeaveIfError(bgDevice->CreateContext(bgGc));
|
sl@0
|
251 |
CleanupStack::PushL(bgGc);
|
sl@0
|
252 |
|
sl@0
|
253 |
CFbsBitmap* bitmap=new(ELeave) CFbsBitmap;
|
sl@0
|
254 |
CleanupStack::PushL(bitmap);
|
sl@0
|
255 |
User::LeaveIfError(bitmap->Create(TSize(100,100),EColor16MU));
|
sl@0
|
256 |
for (TInt count = 1000; count > 0; count--)
|
sl@0
|
257 |
{
|
sl@0
|
258 |
if ((count % 31)==1)
|
sl@0
|
259 |
{
|
sl@0
|
260 |
bitmap->Reset();
|
sl@0
|
261 |
User::After(1);
|
sl@0
|
262 |
User::LeaveIfError(bitmap->Create(TSize(100,100),EColor16MU));
|
sl@0
|
263 |
}
|
sl@0
|
264 |
if ((count % 11)==1)
|
sl@0
|
265 |
{
|
sl@0
|
266 |
stressBitmaps.ResetAndDestroy();
|
sl@0
|
267 |
}
|
sl@0
|
268 |
if ((count % 11)==5)
|
sl@0
|
269 |
{
|
sl@0
|
270 |
stressBitmaps.ResetAndDestroy();
|
sl@0
|
271 |
FillBitmapArray(stressBitmaps);
|
sl@0
|
272 |
}
|
sl@0
|
273 |
bgGc->DrawBitmap(TPoint(10,10),bitmap);
|
sl@0
|
274 |
User::After(1);
|
sl@0
|
275 |
}
|
sl@0
|
276 |
|
sl@0
|
277 |
CleanupStack::PopAndDestroy(bitmap);
|
sl@0
|
278 |
CleanupStack::PopAndDestroy(bgGc);
|
sl@0
|
279 |
CleanupStack::PopAndDestroy(bgDevice);
|
sl@0
|
280 |
CleanupStack::PopAndDestroy(outputBitmap);
|
sl@0
|
281 |
CleanupStack::PopAndDestroy(/*&loadedBitmapCleanup*/);
|
sl@0
|
282 |
CleanupStack::PopAndDestroy(/*&fbsConnectionCleanup*/);
|
sl@0
|
283 |
}
|
sl@0
|
284 |
|
sl@0
|
285 |
void TestBitmapUseL(CTFbsDefect* aFbsDefect)
|
sl@0
|
286 |
{
|
sl@0
|
287 |
TRAPD(err,DoBitmapUseL());
|
sl@0
|
288 |
aFbsDefect->TEST(err==KErrNone || err==KErrNoMemory); // Out-of-memory doesn't constitute a test failure
|
sl@0
|
289 |
}
|
sl@0
|
290 |
|
sl@0
|
291 |
/* Draws bitmaps */
|
sl@0
|
292 |
TInt BitmapUse(TAny* aAny)
|
sl@0
|
293 |
{
|
sl@0
|
294 |
CTrapCleanup* CleanUpStack=CTrapCleanup::New();
|
sl@0
|
295 |
CTFbsDefect* theTest = static_cast <CTFbsDefect*> (aAny);
|
sl@0
|
296 |
__UHEAP_MARK;
|
sl@0
|
297 |
|
sl@0
|
298 |
TRAP_IGNORE(TestBitmapUseL(theTest));
|
sl@0
|
299 |
|
sl@0
|
300 |
__UHEAP_MARKEND;
|
sl@0
|
301 |
delete CleanUpStack;
|
sl@0
|
302 |
return KErrNone;
|
sl@0
|
303 |
}
|
sl@0
|
304 |
|
sl@0
|
305 |
/**
|
sl@0
|
306 |
@SYMTestCaseID
|
sl@0
|
307 |
GRAPHICS-FBSERV-0576
|
sl@0
|
308 |
|
sl@0
|
309 |
@SYMTestCaseDesc
|
sl@0
|
310 |
Verifies defect DEF079124.
|
sl@0
|
311 |
|
sl@0
|
312 |
@SYMDEF DEF079124
|
sl@0
|
313 |
|
sl@0
|
314 |
@SYMTestActions
|
sl@0
|
315 |
Creates two threads. One threads keeps creating
|
sl@0
|
316 |
and destroying large bitmaps. The second thread
|
sl@0
|
317 |
draws bitmaps. The exit reason of the threads
|
sl@0
|
318 |
are checked. The thread handles are closed.
|
sl@0
|
319 |
|
sl@0
|
320 |
@SYMTestExpectedResults
|
sl@0
|
321 |
Test should pass
|
sl@0
|
322 |
*/
|
sl@0
|
323 |
void CTFbsDefect::TestFbservChunkLockingL()
|
sl@0
|
324 |
{
|
sl@0
|
325 |
INFO_PRINTF1(_L("TestDisplayModeL (DEF079124)"));
|
sl@0
|
326 |
|
sl@0
|
327 |
__UHEAP_MARK;
|
sl@0
|
328 |
TRequestStatus stat;
|
sl@0
|
329 |
RThread bitmapCreate;
|
sl@0
|
330 |
RThread bitmapUse;
|
sl@0
|
331 |
bitmapCreate.Create(_L("BitmapCreate"),BitmapCreate,KDefaultStackSize,0x2200,0x2200,this);
|
sl@0
|
332 |
bitmapUse.Create(_L("BitmapUse"),BitmapUse,KDefaultStackSize,0x2200,0x2200,this);
|
sl@0
|
333 |
|
sl@0
|
334 |
bitmapUse.Logon(stat);
|
sl@0
|
335 |
bitmapCreate.Resume();
|
sl@0
|
336 |
bitmapUse.Resume();
|
sl@0
|
337 |
User::WaitForRequest(stat);
|
sl@0
|
338 |
|
sl@0
|
339 |
INFO_PRINTF2(_L("bitmapCreate ExitReason: %d"),bitmapCreate.ExitReason());
|
sl@0
|
340 |
INFO_PRINTF2(_L("bitmapUse ExitReason: %d"),bitmapUse.ExitReason());
|
sl@0
|
341 |
TEST(bitmapCreate.ExitReason() == KErrNone);
|
sl@0
|
342 |
TEST(bitmapUse.ExitReason() == KErrNone);
|
sl@0
|
343 |
bitmapCreate.Close();
|
sl@0
|
344 |
bitmapUse.Close();
|
sl@0
|
345 |
__UHEAP_MARKEND;
|
sl@0
|
346 |
}
|
sl@0
|
347 |
|
sl@0
|
348 |
/**
|
sl@0
|
349 |
* @SYMTestCaseID GRAPHICS-FBSERV-0621
|
sl@0
|
350 |
*
|
sl@0
|
351 |
* @SYMDEF INC112542, PDEF113158
|
sl@0
|
352 |
*
|
sl@0
|
353 |
* @SYMTestCaseDesc A test to check KErrEof is returned when a bitmap index greater than the
|
sl@0
|
354 |
* number of bitmaps present in the .mbm is requested from a ROM bitamp
|
sl@0
|
355 |
*
|
sl@0
|
356 |
* @SYMTestPriority Normal
|
sl@0
|
357 |
*
|
sl@0
|
358 |
* @SYMTestStatus Implemented
|
sl@0
|
359 |
*
|
sl@0
|
360 |
* @SYMTestActions Loads a bitmap from rom where the index is greater than the numer of bitmaps actually in the mbm
|
sl@0
|
361 |
* Checks that KErrEof is returned when this happens.
|
sl@0
|
362 |
*
|
sl@0
|
363 |
*/
|
sl@0
|
364 |
void CTFbsDefect::TestKErrEof()
|
sl@0
|
365 |
{
|
sl@0
|
366 |
INFO_PRINTF1(_L("TestKErrEof - testing error code returned from CFbsBitmap::Load()"));
|
sl@0
|
367 |
_LIT(KTestBitmapOnZZ,"z:\\system\\data\\tfbs.rbm"); // this contains 2 bitmaps
|
sl@0
|
368 |
|
sl@0
|
369 |
|
sl@0
|
370 |
TUint32* romAddress = NULL;
|
sl@0
|
371 |
if(!CFbsBitmap::IsFileInRom(KTestBitmapOnZZ, romAddress))
|
sl@0
|
372 |
{
|
sl@0
|
373 |
INFO_PRINTF2(_L("Skipping test of ROM bitmaps since file \"%S\" is reported to not be a ROM bitmap."),
|
sl@0
|
374 |
&KTestBitmapOnZZ);
|
sl@0
|
375 |
INFO_PRINTF1(_L("This should only occur on non-XIP ROMs, e.g. NAND ROMs, where ROM bitmaps aren't supported."));
|
sl@0
|
376 |
return;
|
sl@0
|
377 |
}
|
sl@0
|
378 |
|
sl@0
|
379 |
CFbsBitmap rom;
|
sl@0
|
380 |
TInt bitmapIndex = 2; // this bmp index is one greater than the bitmap contains
|
sl@0
|
381 |
TInt errCode = rom.Load(KTestBitmapOnZZ,bitmapIndex,EFalse);
|
sl@0
|
382 |
|
sl@0
|
383 |
if(errCode!=KErrEof)
|
sl@0
|
384 |
{
|
sl@0
|
385 |
TEST(EFalse);
|
sl@0
|
386 |
INFO_PRINTF2(_L("TestKErrEof - Accessing ROM bitmap index greater than # contained returned %d instead of KErrEof"),errCode);
|
sl@0
|
387 |
}
|
sl@0
|
388 |
}
|
sl@0
|
389 |
|
sl@0
|
390 |
/* Creates bitmaps under OOM conditions (PDEF129780)*/
|
sl@0
|
391 |
void CTFbsDefect::CreateBitmapOOMTestL()
|
sl@0
|
392 |
{
|
sl@0
|
393 |
INFO_PRINTF1(_L("CreateBitmapOOMTestL (PDEF129780) - Creating Bitmap under OOM conditions"));
|
sl@0
|
394 |
|
sl@0
|
395 |
RFbsSession* fbs = RFbsSession::GetSession();
|
sl@0
|
396 |
|
sl@0
|
397 |
RPointerArray<CFbsBitmap> bitmaps;
|
sl@0
|
398 |
TCleanupItem bitmapsCleanupItem (CleanupLoadedBitmap, &bitmaps);
|
sl@0
|
399 |
CleanupStack::PushL(bitmapsCleanupItem);
|
sl@0
|
400 |
|
sl@0
|
401 |
// Loop here is to fill CFbTop::iBitmapObjectIndex and force it reallocate memory inside CBitmapObject::ConstructL
|
sl@0
|
402 |
// The upper bound of the loop depends on how CFbTop::iBitmapObjectIndex is expended and how many pointers are in it by the start of this subtest
|
sl@0
|
403 |
// The upper bound may require to be increased if previous subtests are changed
|
sl@0
|
404 |
for(TInt i=0; i<500; i++)
|
sl@0
|
405 |
{
|
sl@0
|
406 |
TSize size(2,2);
|
sl@0
|
407 |
|
sl@0
|
408 |
// Rate starts from 2 to allow allocate memory at least for new CBitmapObject and leave during next attempt to allocate memory
|
sl@0
|
409 |
// The Loop is to make sure that the situation won't be missed if something in code is changed
|
sl@0
|
410 |
// and it is more memory allocations before ConstructL. Currently it is enough 2.
|
sl@0
|
411 |
for(TInt leaveRate = 2; leaveRate<10; leaveRate++)
|
sl@0
|
412 |
{
|
sl@0
|
413 |
CFbsBitmap* testBitmap = new(ELeave) CFbsBitmap;
|
sl@0
|
414 |
|
sl@0
|
415 |
fbs->SendCommand(EFbsMessSetHeapFail, RFbsSession::EHeapFailTypeServerMemory, leaveRate);
|
sl@0
|
416 |
|
sl@0
|
417 |
//Try to create bitmap
|
sl@0
|
418 |
testBitmap->Create(size, EColor16MAP);
|
sl@0
|
419 |
delete testBitmap;
|
sl@0
|
420 |
}
|
sl@0
|
421 |
|
sl@0
|
422 |
fbs->SendCommand(EFbsMessSetHeapReset, RFbsSession::EHeapFailTypeServerMemory, 0);
|
sl@0
|
423 |
|
sl@0
|
424 |
// Create bitmap to fill FbTop::iBitmapObjectIndex
|
sl@0
|
425 |
CFbsBitmap* bitmap = new(ELeave) CFbsBitmap;
|
sl@0
|
426 |
CleanupStack::PushL(bitmap);
|
sl@0
|
427 |
User::LeaveIfError(bitmaps.Append(bitmap));
|
sl@0
|
428 |
CleanupStack::Pop(bitmap);
|
sl@0
|
429 |
User::LeaveIfError(bitmap->Create(size, EColor16MAP));
|
sl@0
|
430 |
}
|
sl@0
|
431 |
INFO_PRINTF2(_L("Created %d bitmaps."), bitmaps.Count());
|
sl@0
|
432 |
CleanupStack::PopAndDestroy(&bitmaps);
|
sl@0
|
433 |
// If it was no Panic in fbserv and we have got here test pass
|
sl@0
|
434 |
}
|
sl@0
|
435 |
|
sl@0
|
436 |
|
sl@0
|
437 |
void CTFbsDefect::RunTestCaseL(TInt aCurTestCase)
|
sl@0
|
438 |
{
|
sl@0
|
439 |
((CTFbsDefectStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
440 |
switch(aCurTestCase)
|
sl@0
|
441 |
{
|
sl@0
|
442 |
case 1:
|
sl@0
|
443 |
((CTFbsDefectStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0574"));
|
sl@0
|
444 |
CreateBitmapTestL();
|
sl@0
|
445 |
break;
|
sl@0
|
446 |
case 2:
|
sl@0
|
447 |
((CTFbsDefectStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0575"));
|
sl@0
|
448 |
TestDisplayModeL();
|
sl@0
|
449 |
break;
|
sl@0
|
450 |
case 3:
|
sl@0
|
451 |
((CTFbsDefectStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0576"));
|
sl@0
|
452 |
TestFbservChunkLockingL();
|
sl@0
|
453 |
break;
|
sl@0
|
454 |
case 4:
|
sl@0
|
455 |
((CTFbsDefectStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0621"));
|
sl@0
|
456 |
TestKErrEof();
|
sl@0
|
457 |
break;
|
sl@0
|
458 |
case 5:
|
sl@0
|
459 |
/**
|
sl@0
|
460 |
@SYMTestCaseID GRAPHICS-FBSERV-0620
|
sl@0
|
461 |
*/
|
sl@0
|
462 |
((CTFbsDefectStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0620"));
|
sl@0
|
463 |
CreateBitmapOOMTestL();
|
sl@0
|
464 |
break;
|
sl@0
|
465 |
case 6:
|
sl@0
|
466 |
((CTFbsDefectStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
467 |
((CTFbsDefectStep*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
468 |
TestComplete();
|
sl@0
|
469 |
break;
|
sl@0
|
470 |
}
|
sl@0
|
471 |
((CTFbsDefectStep*)iStep)->RecordTestResultL();
|
sl@0
|
472 |
}
|
sl@0
|
473 |
|
sl@0
|
474 |
//--------------
|
sl@0
|
475 |
__CONSTRUCT_STEP__(FbsDefect)
|