sl@0
|
1 |
// Copyright (c) 1996-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 "TFBS.H"
|
sl@0
|
18 |
#include "TCLEAN.H"
|
sl@0
|
19 |
#include "fbsmessage.h"
|
sl@0
|
20 |
#include "fbsdefs.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
void CTClean::DeleteScanLineBuffer()
|
sl@0
|
23 |
{
|
sl@0
|
24 |
delete iFbs->iScanLineBuffer;
|
sl@0
|
25 |
iFbs->iScanLineBuffer = NULL;
|
sl@0
|
26 |
}
|
sl@0
|
27 |
|
sl@0
|
28 |
CTClean::CTClean(CTestStep* aStep):
|
sl@0
|
29 |
CTGraphicsBase(aStep),
|
sl@0
|
30 |
iFbs(NULL),
|
sl@0
|
31 |
iStore(NULL),
|
sl@0
|
32 |
iBitmap(NULL),
|
sl@0
|
33 |
iTc(NULL)
|
sl@0
|
34 |
{}
|
sl@0
|
35 |
|
sl@0
|
36 |
CTClean::~CTClean()
|
sl@0
|
37 |
{
|
sl@0
|
38 |
delete iStore;
|
sl@0
|
39 |
if(iShutdownFbs)
|
sl@0
|
40 |
RFbsSession::GetSession()->SendCommand(EFbsMessShutdown);
|
sl@0
|
41 |
RFbsSession::Disconnect();
|
sl@0
|
42 |
}
|
sl@0
|
43 |
|
sl@0
|
44 |
void CTClean::ConstructL()
|
sl@0
|
45 |
{
|
sl@0
|
46 |
INFO_PRINTF1(_L("Font/Bitmap Server Thread Death Cleanup Testing"));
|
sl@0
|
47 |
|
sl@0
|
48 |
if(RFbsSession::Connect()==KErrNone)
|
sl@0
|
49 |
{
|
sl@0
|
50 |
RFbsSession::Disconnect();
|
sl@0
|
51 |
iShutdownFbs = EFalse;
|
sl@0
|
52 |
}
|
sl@0
|
53 |
else
|
sl@0
|
54 |
{
|
sl@0
|
55 |
FbsStartup();
|
sl@0
|
56 |
iShutdownFbs = ETrue;
|
sl@0
|
57 |
}
|
sl@0
|
58 |
RFbsSession::Connect();
|
sl@0
|
59 |
iFbs=RFbsSession::GetSession();
|
sl@0
|
60 |
iStore=CFbsTypefaceStore::NewL(NULL);
|
sl@0
|
61 |
}
|
sl@0
|
62 |
|
sl@0
|
63 |
void CTClean::RunTestCaseL(TInt aCurTestCase)
|
sl@0
|
64 |
{
|
sl@0
|
65 |
((CTCleanStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
66 |
switch(aCurTestCase)
|
sl@0
|
67 |
{
|
sl@0
|
68 |
case 1:
|
sl@0
|
69 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0593"));
|
sl@0
|
70 |
INFO_PRINTF1(_L("Thread Cleanup\r\n"));
|
sl@0
|
71 |
DeadThread();
|
sl@0
|
72 |
break;
|
sl@0
|
73 |
case 2:
|
sl@0
|
74 |
#if defined(_DEBUG)
|
sl@0
|
75 |
INFO_PRINTF1(_L("Font\r\n"));
|
sl@0
|
76 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0594"));
|
sl@0
|
77 |
LaunchThread(EFont1);
|
sl@0
|
78 |
((CTCleanStep*)iStep)->RecordTestResultL();
|
sl@0
|
79 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0595"));
|
sl@0
|
80 |
LaunchThread(EFont2);
|
sl@0
|
81 |
#else
|
sl@0
|
82 |
((CTCleanStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
83 |
#endif
|
sl@0
|
84 |
break;
|
sl@0
|
85 |
case 3:
|
sl@0
|
86 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0596"));
|
sl@0
|
87 |
INFO_PRINTF1(_L("Bitmap\r\n"));
|
sl@0
|
88 |
LaunchThread(EBitmap1);
|
sl@0
|
89 |
break;
|
sl@0
|
90 |
case 4:
|
sl@0
|
91 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0597"));
|
sl@0
|
92 |
INFO_PRINTF1(_L("Pile\r\n"));
|
sl@0
|
93 |
LaunchThread(EPile1);
|
sl@0
|
94 |
break;
|
sl@0
|
95 |
case 5:
|
sl@0
|
96 |
INFO_PRINTF1(_L("Session\r\n"));
|
sl@0
|
97 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0598"));
|
sl@0
|
98 |
LaunchThread(ESession1);
|
sl@0
|
99 |
((CTCleanStep*)iStep)->RecordTestResultL();
|
sl@0
|
100 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0599"));
|
sl@0
|
101 |
LaunchThread(ESession2);
|
sl@0
|
102 |
break;
|
sl@0
|
103 |
case 6:
|
sl@0
|
104 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0600"));
|
sl@0
|
105 |
INFO_PRINTF1(_L("TypefaceStore\r\n"));
|
sl@0
|
106 |
LaunchThread(ETypefaceStore1);
|
sl@0
|
107 |
break;
|
sl@0
|
108 |
case 7:
|
sl@0
|
109 |
((CTCleanStep*)iStep)->SetTestStepID(_L("GRAPHICS-FBSERV-0601"));
|
sl@0
|
110 |
INFO_PRINTF1(_L("Bad Message\r\n"));
|
sl@0
|
111 |
LaunchThread(EBadMessage);
|
sl@0
|
112 |
case 8:
|
sl@0
|
113 |
((CTCleanStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
114 |
((CTCleanStep*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
115 |
TestComplete();
|
sl@0
|
116 |
break;
|
sl@0
|
117 |
}
|
sl@0
|
118 |
((CTCleanStep*)iStep)->RecordTestResultL();
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
TInt CleanupTestThread(TAny* aAny)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
CTClean* theTest = (CTClean*) aAny;
|
sl@0
|
124 |
CTrapCleanup::New();
|
sl@0
|
125 |
RFbsSession::Connect();
|
sl@0
|
126 |
CFbsBitmapEx bmp1;
|
sl@0
|
127 |
CFbsBitmapEx bmp2;
|
sl@0
|
128 |
CFbsBitmapEx bmp3;
|
sl@0
|
129 |
TInt ret=bmp1.Create(TSize(10,10),EGray2);
|
sl@0
|
130 |
theTest->TEST(ret==KErrNone);
|
sl@0
|
131 |
ret=bmp2.Create(TSize(100,100),EGray16);
|
sl@0
|
132 |
theTest->TEST(ret==KErrNone);
|
sl@0
|
133 |
ret=bmp3.Duplicate(bmp2.Handle());
|
sl@0
|
134 |
theTest->TEST(ret==KErrNone);
|
sl@0
|
135 |
CFbsFontEx* fon1;
|
sl@0
|
136 |
CFbsFontEx* fon2;
|
sl@0
|
137 |
CFbsTypefaceStore* tfs=NULL;
|
sl@0
|
138 |
TRAP(ret,tfs=CFbsTypefaceStore::NewL(NULL));
|
sl@0
|
139 |
theTest->TEST(ret==KErrNone);
|
sl@0
|
140 |
ret=tfs->GetNearestFontToDesignHeightInPixels((CFont*&)fon1,TFontSpec(_L("Swiss"),12));
|
sl@0
|
141 |
theTest->TEST(ret==KErrNone);
|
sl@0
|
142 |
fon2=(CFbsFontEx*)User::Alloc(sizeof(CFbsFontEx));
|
sl@0
|
143 |
theTest->TEST(fon2!=NULL);
|
sl@0
|
144 |
new(fon2) CFbsFontEx;
|
sl@0
|
145 |
ret=fon2->Duplicate(fon1->Handle());
|
sl@0
|
146 |
theTest->TEST(ret==KErrNone);
|
sl@0
|
147 |
TInt rc=RFbsSession::GetSession()->ResourceCount();
|
sl@0
|
148 |
theTest->TEST(rc==5);
|
sl@0
|
149 |
TInt id;
|
sl@0
|
150 |
#ifdef __WINS__
|
sl@0
|
151 |
ret=tfs->AddFile(_L("z:\\resource\\fonts\\eon14.gdr"),id);
|
sl@0
|
152 |
#else
|
sl@0
|
153 |
ret=tfs->AddFile(_L("z:\\resource\\fonts\\eon.gdr"),id);
|
sl@0
|
154 |
#endif
|
sl@0
|
155 |
theTest->TEST(ret==KErrNone);
|
sl@0
|
156 |
bmp2.LockHeap();
|
sl@0
|
157 |
RFbsSession::Disconnect();
|
sl@0
|
158 |
User::Panic(_L("CleanupTest"),KErrNone);
|
sl@0
|
159 |
return(KErrNone);
|
sl@0
|
160 |
}
|
sl@0
|
161 |
|
sl@0
|
162 |
/**
|
sl@0
|
163 |
@SYMTestCaseID
|
sl@0
|
164 |
GRAPHICS-FBSERV-0593
|
sl@0
|
165 |
|
sl@0
|
166 |
@SYMTestCaseDesc
|
sl@0
|
167 |
Tests the cleaning when a thead is panicing.
|
sl@0
|
168 |
|
sl@0
|
169 |
@SYMTestActions
|
sl@0
|
170 |
Creates a bitmap. Checks the resource count. Creates
|
sl@0
|
171 |
a thread with high priority. Unlocks the heap and locks
|
sl@0
|
172 |
it back again. Disables just-in-time debugging. Waits for
|
sl@0
|
173 |
he thead to complete its execution. The created thread creates
|
sl@0
|
174 |
its own cleanup stack and connects to a FbsSession. It creates
|
sl@0
|
175 |
three bitmaps and duplicates one of them to the other.
|
sl@0
|
176 |
A FbsTypefaceStore object is created on the heap an
|
sl@0
|
177 |
GetNearestFontToDesignHeightInPixel is called on it. Disconnect
|
sl@0
|
178 |
from the FbsSession. The thread is paniced and terminated. The
|
sl@0
|
179 |
function that created the thread now continues its execution by
|
sl@0
|
180 |
checking the exit reason for the thread. Closes the thead. Enables
|
sl@0
|
181 |
just-in-time again. Locks the heap and unlocks it again.
|
sl@0
|
182 |
Checks the resource count. Deletes scan line buffer. The
|
sl@0
|
183 |
heap is checked for memory leaks.
|
sl@0
|
184 |
|
sl@0
|
185 |
@SYMTestExpectedResults
|
sl@0
|
186 |
Test should pass
|
sl@0
|
187 |
*/
|
sl@0
|
188 |
void CTClean::DeadThread()
|
sl@0
|
189 |
{
|
sl@0
|
190 |
__UHEAP_MARK;
|
sl@0
|
191 |
CFbsBitmapEx bmp;
|
sl@0
|
192 |
TInt ret=bmp.Create(TSize(100,100),EGray16);
|
sl@0
|
193 |
TEST(ret==KErrNone);
|
sl@0
|
194 |
TInt rc=iFbs->ResourceCount();
|
sl@0
|
195 |
TEST(rc==1);
|
sl@0
|
196 |
RThread thrd;
|
sl@0
|
197 |
TRequestStatus stat;
|
sl@0
|
198 |
thrd.Create(_L("ctt"),CleanupTestThread,KDefaultStackSize,0x8000,0x8000,this);
|
sl@0
|
199 |
thrd.SetPriority(EPriorityMuchMore);
|
sl@0
|
200 |
thrd.Logon(stat);
|
sl@0
|
201 |
User::SetJustInTime(EFalse);
|
sl@0
|
202 |
bmp.LockHeap();
|
sl@0
|
203 |
bmp.UnlockHeap();
|
sl@0
|
204 |
thrd.Resume();
|
sl@0
|
205 |
User::WaitForRequest(stat);
|
sl@0
|
206 |
ret = thrd.ExitReason();
|
sl@0
|
207 |
thrd.Close();
|
sl@0
|
208 |
User::SetJustInTime(ETrue);
|
sl@0
|
209 |
TEST(ret == KErrNone);
|
sl@0
|
210 |
INFO_PRINTF1(_L("About to lock heap\r\n"));
|
sl@0
|
211 |
bmp.LockHeap();
|
sl@0
|
212 |
bmp.UnlockHeap();
|
sl@0
|
213 |
rc=iFbs->ResourceCount();
|
sl@0
|
214 |
TEST(rc==1);
|
sl@0
|
215 |
DeleteScanLineBuffer();
|
sl@0
|
216 |
__UHEAP_MARKEND;
|
sl@0
|
217 |
}
|
sl@0
|
218 |
|
sl@0
|
219 |
/**
|
sl@0
|
220 |
@SYMTestCaseID
|
sl@0
|
221 |
GRAPHICS-FBSERV-0594
|
sl@0
|
222 |
|
sl@0
|
223 |
@SYMTestCaseDesc
|
sl@0
|
224 |
Tests a CFbsFontEx object in a thead function.
|
sl@0
|
225 |
|
sl@0
|
226 |
@SYMTestActions
|
sl@0
|
227 |
Connects to an FbsSession, creates a CFbsFontEx
|
sl@0
|
228 |
object and gets the font address.
|
sl@0
|
229 |
Thread returns with error code KErrNone.
|
sl@0
|
230 |
|
sl@0
|
231 |
@SYMTestExpectedResults
|
sl@0
|
232 |
Test should pass
|
sl@0
|
233 |
*/
|
sl@0
|
234 |
TInt Font1(TAny* aAny)
|
sl@0
|
235 |
{
|
sl@0
|
236 |
CTClean* theTest = static_cast <CTClean*> (aAny);
|
sl@0
|
237 |
theTest->INFO_PRINTF1(_L("Font1"));
|
sl@0
|
238 |
RFbsSession::Connect();
|
sl@0
|
239 |
CFbsFontEx font;
|
sl@0
|
240 |
(void)font.Address();
|
sl@0
|
241 |
theTest->ERR_PRINTF1(_L("ERROR - NO PANIC"));
|
sl@0
|
242 |
return(KErrNone);
|
sl@0
|
243 |
}
|
sl@0
|
244 |
|
sl@0
|
245 |
/**
|
sl@0
|
246 |
@SYMTestCaseID
|
sl@0
|
247 |
GRAPHICS-FBSERV-0595
|
sl@0
|
248 |
|
sl@0
|
249 |
@SYMTestCaseDesc
|
sl@0
|
250 |
Tests a CFbsFontEx object in a thead function.
|
sl@0
|
251 |
|
sl@0
|
252 |
@SYMTestActions
|
sl@0
|
253 |
Connects to an FbsSession, creates a CFbsFontEx object,
|
sl@0
|
254 |
sets the fonts handle, gets the fonts address.
|
sl@0
|
255 |
Thread returns with error code KErrNone.
|
sl@0
|
256 |
|
sl@0
|
257 |
@SYMTestExpectedResults
|
sl@0
|
258 |
Test should pass
|
sl@0
|
259 |
*/
|
sl@0
|
260 |
TInt Font2(TAny* aAny)
|
sl@0
|
261 |
{
|
sl@0
|
262 |
CTClean* theTest = static_cast <CTClean*> (aAny);
|
sl@0
|
263 |
theTest->INFO_PRINTF1(_L("Font2"));
|
sl@0
|
264 |
RFbsSession::Connect();
|
sl@0
|
265 |
CFbsFontEx font;
|
sl@0
|
266 |
font.SetHandle();
|
sl@0
|
267 |
(void)font.Address();
|
sl@0
|
268 |
theTest->ERR_PRINTF1(_L("ERROR - NO PANIC"));
|
sl@0
|
269 |
return(KErrNone);
|
sl@0
|
270 |
}
|
sl@0
|
271 |
|
sl@0
|
272 |
/**
|
sl@0
|
273 |
@SYMTestCaseID
|
sl@0
|
274 |
GRAPHICS-FBSERV-0596
|
sl@0
|
275 |
|
sl@0
|
276 |
@SYMTestCaseDesc
|
sl@0
|
277 |
Creates a bitmap in a thread function, locks the heap
|
sl@0
|
278 |
and panics the thread.
|
sl@0
|
279 |
|
sl@0
|
280 |
@SYMTestActions
|
sl@0
|
281 |
Connects to an FbsSession, creates a CFbsBitmapEx object,
|
sl@0
|
282 |
creates a bitmap on the stack. Creation is checked for errors
|
sl@0
|
283 |
and thenb locks the heap. The thread is paniced.
|
sl@0
|
284 |
|
sl@0
|
285 |
@SYMTestExpectedResults
|
sl@0
|
286 |
Test should pass
|
sl@0
|
287 |
*/
|
sl@0
|
288 |
TInt Bitmap1(TAny* aAny)
|
sl@0
|
289 |
{
|
sl@0
|
290 |
CTClean* theTest = static_cast <CTClean*> (aAny);
|
sl@0
|
291 |
theTest->INFO_PRINTF1(_L("Bitmap1"));
|
sl@0
|
292 |
RFbsSession::Connect();
|
sl@0
|
293 |
CFbsBitmapEx bitmap;
|
sl@0
|
294 |
TInt ret=bitmap.Create(TSize(200,200),EGray16);
|
sl@0
|
295 |
if(ret!=KErrNone)
|
sl@0
|
296 |
{
|
sl@0
|
297 |
theTest->ERR_PRINTF1(_L("ERROR - BITMAP NOT CREATED"));
|
sl@0
|
298 |
}
|
sl@0
|
299 |
bitmap.LockHeap();
|
sl@0
|
300 |
User::Panic(_L(""),KErrNone);
|
sl@0
|
301 |
return(KErrNone);
|
sl@0
|
302 |
}
|
sl@0
|
303 |
|
sl@0
|
304 |
/**
|
sl@0
|
305 |
@SYMTestCaseID
|
sl@0
|
306 |
GRAPHICS-FBSERV-0597
|
sl@0
|
307 |
|
sl@0
|
308 |
@SYMTestCaseDesc
|
sl@0
|
309 |
Tests creation of a chunk in a thread function.
|
sl@0
|
310 |
|
sl@0
|
311 |
@SYMTestActions
|
sl@0
|
312 |
Creates a chunk. The thread returns with error code KErrNone.
|
sl@0
|
313 |
|
sl@0
|
314 |
@SYMTestExpectedResults
|
sl@0
|
315 |
Test should pass
|
sl@0
|
316 |
*/
|
sl@0
|
317 |
TInt Pile1(TAny* aAny)
|
sl@0
|
318 |
{
|
sl@0
|
319 |
CTClean* theTest = static_cast <CTClean*> (aAny);
|
sl@0
|
320 |
theTest->INFO_PRINTF1(_L("Pile1"));
|
sl@0
|
321 |
RChunk chunk;
|
sl@0
|
322 |
CChunkPile::NewL(chunk);
|
sl@0
|
323 |
theTest->ERR_PRINTF1(_L("ERROR - NO PANIC"));
|
sl@0
|
324 |
return(KErrNone);
|
sl@0
|
325 |
}
|
sl@0
|
326 |
|
sl@0
|
327 |
/**
|
sl@0
|
328 |
@SYMTestCaseID
|
sl@0
|
329 |
GRAPHICS-FBSERV-0598
|
sl@0
|
330 |
|
sl@0
|
331 |
@SYMTestCaseDesc
|
sl@0
|
332 |
Tests sending a close command to a connected
|
sl@0
|
333 |
server from a thread function.
|
sl@0
|
334 |
|
sl@0
|
335 |
@SYMTestActions
|
sl@0
|
336 |
Connects to a FbsSession and sends a
|
sl@0
|
337 |
EFbsMessClose-command to the server. The thread
|
sl@0
|
338 |
returns with error code KErrNone.
|
sl@0
|
339 |
|
sl@0
|
340 |
@SYMTestExpectedResults
|
sl@0
|
341 |
Test should pass
|
sl@0
|
342 |
*/
|
sl@0
|
343 |
TInt Session1(TAny* aAny)
|
sl@0
|
344 |
{
|
sl@0
|
345 |
CTClean* theTest = static_cast <CTClean*> (aAny);
|
sl@0
|
346 |
RFbsSession::Connect();
|
sl@0
|
347 |
RFbsSession::GetSession()->SendCommand(EFbsMessClose);
|
sl@0
|
348 |
theTest->INFO_PRINTF1(_L("Session1"));
|
sl@0
|
349 |
theTest->ERR_PRINTF1(_L("ERROR - NO PANIC"));
|
sl@0
|
350 |
return(KErrNone);
|
sl@0
|
351 |
}
|
sl@0
|
352 |
|
sl@0
|
353 |
/**
|
sl@0
|
354 |
@SYMTestCaseID
|
sl@0
|
355 |
GRAPHICS-FBSERV-0599
|
sl@0
|
356 |
|
sl@0
|
357 |
@SYMTestCaseDesc
|
sl@0
|
358 |
Tests sending an init command to a connected
|
sl@0
|
359 |
server from a thread function.
|
sl@0
|
360 |
|
sl@0
|
361 |
@SYMTestActions
|
sl@0
|
362 |
Connects to a FbsSession and sends a
|
sl@0
|
363 |
EFbsMessInit-command to the server. The thread
|
sl@0
|
364 |
returns with error code KErrNone.
|
sl@0
|
365 |
|
sl@0
|
366 |
@SYMTestExpectedResults
|
sl@0
|
367 |
Test should pass
|
sl@0
|
368 |
*/
|
sl@0
|
369 |
TInt Session2(TAny* aAny)
|
sl@0
|
370 |
{
|
sl@0
|
371 |
CTClean* theTest = static_cast <CTClean*> (aAny);
|
sl@0
|
372 |
RFbsSession session;
|
sl@0
|
373 |
session.SendCommand(EFbsMessInit);
|
sl@0
|
374 |
theTest->INFO_PRINTF1(_L("Session2"));
|
sl@0
|
375 |
theTest->ERR_PRINTF1(_L("ERROR - NO PANIC"));
|
sl@0
|
376 |
return(KErrNone);
|
sl@0
|
377 |
}
|
sl@0
|
378 |
|
sl@0
|
379 |
/**
|
sl@0
|
380 |
@SYMTestCaseID
|
sl@0
|
381 |
GRAPHICS-FBSERV-0600
|
sl@0
|
382 |
|
sl@0
|
383 |
@SYMTestCaseDesc
|
sl@0
|
384 |
Tests the creation of a CFbsTypefaceStore
|
sl@0
|
385 |
object on the heap in a thread function.
|
sl@0
|
386 |
|
sl@0
|
387 |
@SYMTestActions
|
sl@0
|
388 |
Creates a CFbsTypefaceStore object on the heap
|
sl@0
|
389 |
in a thread function and returns with error code
|
sl@0
|
390 |
KErrNone.
|
sl@0
|
391 |
|
sl@0
|
392 |
@SYMTestExpectedResults
|
sl@0
|
393 |
Test should pass
|
sl@0
|
394 |
*/
|
sl@0
|
395 |
TInt TypefaceStore1(TAny* aAny)
|
sl@0
|
396 |
{
|
sl@0
|
397 |
CTClean* theTest = static_cast <CTClean*> (aAny);
|
sl@0
|
398 |
CFbsTypefaceStore::NewL(NULL);
|
sl@0
|
399 |
theTest->INFO_PRINTF1(_L("TypefaceStore1"));
|
sl@0
|
400 |
theTest->ERR_PRINTF1(_L("ERROR - NO PANIC"));
|
sl@0
|
401 |
return(KErrNone);
|
sl@0
|
402 |
}
|
sl@0
|
403 |
|
sl@0
|
404 |
/**
|
sl@0
|
405 |
@SYMTestCaseID
|
sl@0
|
406 |
GRAPHICS-FBSERV-0601
|
sl@0
|
407 |
|
sl@0
|
408 |
@SYMTestCaseDesc
|
sl@0
|
409 |
Tests sending an invalid message from a thread function
|
sl@0
|
410 |
to a connected FbsSession.
|
sl@0
|
411 |
|
sl@0
|
412 |
@SYMTestActions
|
sl@0
|
413 |
Connects to a FbsSession. Gets a pointer to the session
|
sl@0
|
414 |
object. Sends an invalid command to the server. The thread
|
sl@0
|
415 |
returns with error code KErrNone.
|
sl@0
|
416 |
|
sl@0
|
417 |
@SYMTestExpectedResults
|
sl@0
|
418 |
Test should pass
|
sl@0
|
419 |
*/
|
sl@0
|
420 |
TInt BadMessage(TAny* aAny)
|
sl@0
|
421 |
{
|
sl@0
|
422 |
CTClean* theTest = static_cast <CTClean*> (aAny);
|
sl@0
|
423 |
CTrapCleanup::New();
|
sl@0
|
424 |
RFbsSession::Connect();
|
sl@0
|
425 |
RFbsSession* sess=RFbsSession::GetSession();
|
sl@0
|
426 |
sess->SendCommand(TFbsMessage(0x0fffffff));
|
sl@0
|
427 |
theTest->INFO_PRINTF1(_L("Bad Message Test Thread"));
|
sl@0
|
428 |
theTest->ERR_PRINTF1(_L("ERROR - BAD MESSAGE DID NOT PANIC THREAD"));
|
sl@0
|
429 |
return(KErrNone);
|
sl@0
|
430 |
}
|
sl@0
|
431 |
|
sl@0
|
432 |
/**
|
sl@0
|
433 |
@SYMTestCaseID
|
sl@0
|
434 |
GRAPHICS-FBSERV-0602
|
sl@0
|
435 |
|
sl@0
|
436 |
@SYMTestCaseDesc
|
sl@0
|
437 |
Launches different threads for testing.
|
sl@0
|
438 |
|
sl@0
|
439 |
@SYMTestActions
|
sl@0
|
440 |
Creates a thread and gives it higher priority.
|
sl@0
|
441 |
Disables just-in-time and starts the thread and
|
sl@0
|
442 |
waits for the it to finish. Closes the thead,
|
sl@0
|
443 |
enables just-in-time and checks the heap for
|
sl@0
|
444 |
memory leaks.
|
sl@0
|
445 |
|
sl@0
|
446 |
@SYMTestExpectedResults
|
sl@0
|
447 |
Test should pass
|
sl@0
|
448 |
*/
|
sl@0
|
449 |
void CTClean::LaunchThread(TTestType aType)
|
sl@0
|
450 |
{
|
sl@0
|
451 |
__UHEAP_MARK;
|
sl@0
|
452 |
RThread thrd;
|
sl@0
|
453 |
TRequestStatus stat;
|
sl@0
|
454 |
switch(aType)
|
sl@0
|
455 |
{
|
sl@0
|
456 |
case EFont1:
|
sl@0
|
457 |
thrd.Create(_L("Font1"),Font1,KDefaultStackSize,0x2000,0x2000,this);
|
sl@0
|
458 |
break;
|
sl@0
|
459 |
case EFont2:
|
sl@0
|
460 |
thrd.Create(_L("Font2"),Font2,KDefaultStackSize,0x2000,0x2000,this);
|
sl@0
|
461 |
break;
|
sl@0
|
462 |
case EBitmap1:
|
sl@0
|
463 |
thrd.Create(_L("Bitmap1"),Bitmap1,KDefaultStackSize,0x2000,0x2000,this);
|
sl@0
|
464 |
break;
|
sl@0
|
465 |
case EPile1:
|
sl@0
|
466 |
thrd.Create(_L("Pile1"),Pile1,KDefaultStackSize,0x2000,0x2000,this);
|
sl@0
|
467 |
break;
|
sl@0
|
468 |
case ESession1:
|
sl@0
|
469 |
thrd.Create(_L("Session1"),Session1,KDefaultStackSize,0x2000,0x2000,this);
|
sl@0
|
470 |
break;
|
sl@0
|
471 |
case ESession2:
|
sl@0
|
472 |
thrd.Create(_L("Session2"),Session2,KDefaultStackSize,0x2000,0x2000,this);
|
sl@0
|
473 |
break;
|
sl@0
|
474 |
case ETypefaceStore1:
|
sl@0
|
475 |
thrd.Create(_L("TypefaceStore1"),TypefaceStore1,KDefaultStackSize,0x2000,0x2000,this);
|
sl@0
|
476 |
break;
|
sl@0
|
477 |
case EBadMessage:
|
sl@0
|
478 |
thrd.Create(_L("BadMessage"),BadMessage,KDefaultStackSize,0x2000,0x2000,this);
|
sl@0
|
479 |
break;
|
sl@0
|
480 |
default:
|
sl@0
|
481 |
User::Panic(_L("TCLEAN"),KErrArgument);
|
sl@0
|
482 |
}
|
sl@0
|
483 |
thrd.SetPriority(EPriorityMuchMore);
|
sl@0
|
484 |
thrd.Logon(stat);
|
sl@0
|
485 |
User::SetJustInTime(EFalse);
|
sl@0
|
486 |
thrd.Resume();
|
sl@0
|
487 |
User::WaitForRequest(stat);
|
sl@0
|
488 |
thrd.Close();
|
sl@0
|
489 |
User::SetJustInTime(ETrue);
|
sl@0
|
490 |
__UHEAP_MARKEND;
|
sl@0
|
491 |
}
|
sl@0
|
492 |
|
sl@0
|
493 |
//--------------
|
sl@0
|
494 |
__CONSTRUCT_STEP__(Clean)
|
sl@0
|
495 |
|