sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@file
|
sl@0
|
21 |
@test
|
sl@0
|
22 |
@internalComponent Internal Symbian test code
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
|
sl@0
|
25 |
#include "FNTSTORE.H"
|
sl@0
|
26 |
#include "OPENFONT.H"
|
sl@0
|
27 |
#include "FNTBODY.H"
|
sl@0
|
28 |
#include "FNTSTD.H"
|
sl@0
|
29 |
#include "t_cachedeletion.h"
|
sl@0
|
30 |
#include <hal.h>
|
sl@0
|
31 |
#include <s32file.h>
|
sl@0
|
32 |
#include <graphics/shapeimpl.h>
|
sl@0
|
33 |
|
sl@0
|
34 |
_LIT(KSecondProcess,"tcachedeletionprocess");
|
sl@0
|
35 |
_LIT(KThirdProcess,"tcachedeletionprocess");
|
sl@0
|
36 |
|
sl@0
|
37 |
class CTCacheDeletion : public CTGraphicsBase
|
sl@0
|
38 |
{
|
sl@0
|
39 |
public:
|
sl@0
|
40 |
CTCacheDeletion(CTestStep* aStep);
|
sl@0
|
41 |
~CTCacheDeletion();
|
sl@0
|
42 |
protected:
|
sl@0
|
43 |
// From CTGraphicsStep
|
sl@0
|
44 |
virtual void RunTestCaseL(TInt aCurTestCase);
|
sl@0
|
45 |
private:
|
sl@0
|
46 |
void RunProcess2L();
|
sl@0
|
47 |
};
|
sl@0
|
48 |
|
sl@0
|
49 |
CTCacheDeletion::CTCacheDeletion(CTestStep* aStep)
|
sl@0
|
50 |
: CTGraphicsBase(aStep)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
|
sl@0
|
53 |
}
|
sl@0
|
54 |
|
sl@0
|
55 |
CTCacheDeletion::~CTCacheDeletion()
|
sl@0
|
56 |
{
|
sl@0
|
57 |
// no action needed
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
void TimerCleanup(TAny *aTimer)
|
sl@0
|
61 |
{
|
sl@0
|
62 |
((RTimer*)aTimer)->Cancel();
|
sl@0
|
63 |
}
|
sl@0
|
64 |
|
sl@0
|
65 |
/**
|
sl@0
|
66 |
@SYMTestCaseID
|
sl@0
|
67 |
GRAPHICS-FNTSTORE-0050
|
sl@0
|
68 |
|
sl@0
|
69 |
@SYMTestCaseDesc
|
sl@0
|
70 |
Tests font and bitmap server disconnection (when a process finishes)
|
sl@0
|
71 |
at the same time a process is outputing.
|
sl@0
|
72 |
|
sl@0
|
73 |
@SYMTestActions
|
sl@0
|
74 |
This function creates two processes. These processes are called
|
sl@0
|
75 |
process 3 and process 2. Process 3 is created, and run. There are
|
sl@0
|
76 |
parameters input to the process. The first is an indicator to the
|
sl@0
|
77 |
process of the instance (2 or 3) and the second is a timeout.
|
sl@0
|
78 |
Process3 runs continually, drawing text for the full timeout period.
|
sl@0
|
79 |
Process2 is created and allowed to finish in a loop in this function for
|
sl@0
|
80 |
the same timeout period, currently ten seconds.
|
sl@0
|
81 |
|
sl@0
|
82 |
@SYMTestExpectedResults
|
sl@0
|
83 |
Test should pass
|
sl@0
|
84 |
*/
|
sl@0
|
85 |
void CTCacheDeletion::RunProcess2L()
|
sl@0
|
86 |
{
|
sl@0
|
87 |
TInt runForMicroSecs = 1000*1000*10;
|
sl@0
|
88 |
|
sl@0
|
89 |
//create process 3
|
sl@0
|
90 |
RProcess process3;
|
sl@0
|
91 |
TInt err;
|
sl@0
|
92 |
err = process3.Create(KThirdProcess, KNullDesC);
|
sl@0
|
93 |
User::LeaveIfError(err);
|
sl@0
|
94 |
CleanupClosePushL(process3);
|
sl@0
|
95 |
|
sl@0
|
96 |
//run process 3
|
sl@0
|
97 |
process3.SetParameter(1,1);
|
sl@0
|
98 |
process3.SetParameter(2,runForMicroSecs);
|
sl@0
|
99 |
TRequestStatus completeStatus3;
|
sl@0
|
100 |
process3.Logon(completeStatus3);
|
sl@0
|
101 |
TRequestStatus rendezvousStatus3;
|
sl@0
|
102 |
rendezvousStatus3=KRequestPending;
|
sl@0
|
103 |
process3.Rendezvous(rendezvousStatus3);
|
sl@0
|
104 |
process3.Resume(); //start the process
|
sl@0
|
105 |
User::WaitForRequest(rendezvousStatus3);
|
sl@0
|
106 |
|
sl@0
|
107 |
//create a timer
|
sl@0
|
108 |
RTimer timer;
|
sl@0
|
109 |
timer.CreateLocal();
|
sl@0
|
110 |
TRequestStatus timerStatus=KRequestPending;
|
sl@0
|
111 |
TTimeIntervalMicroSeconds32 timeout(runForMicroSecs);
|
sl@0
|
112 |
timer.After(timerStatus, runForMicroSecs);
|
sl@0
|
113 |
|
sl@0
|
114 |
TCleanupItem cleanup(TimerCleanup,&timer);
|
sl@0
|
115 |
CleanupStack::PushL(cleanup);
|
sl@0
|
116 |
|
sl@0
|
117 |
do
|
sl@0
|
118 |
{
|
sl@0
|
119 |
//run process 2 in a loop
|
sl@0
|
120 |
|
sl@0
|
121 |
//create process 2
|
sl@0
|
122 |
RProcess process2;
|
sl@0
|
123 |
TInt err = process2.Create(KSecondProcess, KNullDesC);
|
sl@0
|
124 |
User::LeaveIfError(err);
|
sl@0
|
125 |
CleanupClosePushL(process2);
|
sl@0
|
126 |
|
sl@0
|
127 |
//start process 2
|
sl@0
|
128 |
process2.SetParameter(1,0);
|
sl@0
|
129 |
process2.SetParameter(2,runForMicroSecs);//not actually used
|
sl@0
|
130 |
TRequestStatus completeStatus2;
|
sl@0
|
131 |
process2.Logon(completeStatus2);
|
sl@0
|
132 |
TRequestStatus rendezvousStatus2;
|
sl@0
|
133 |
rendezvousStatus2=KRequestPending;
|
sl@0
|
134 |
process2.Rendezvous(rendezvousStatus2);
|
sl@0
|
135 |
process2.Resume(); //start the process
|
sl@0
|
136 |
|
sl@0
|
137 |
//rendezvous with 2
|
sl@0
|
138 |
User::WaitForRequest(rendezvousStatus2);
|
sl@0
|
139 |
TInt status = rendezvousStatus2.Int();
|
sl@0
|
140 |
TEST(status ==1);
|
sl@0
|
141 |
|
sl@0
|
142 |
//now let 2 finish
|
sl@0
|
143 |
User::WaitForRequest(completeStatus2);
|
sl@0
|
144 |
TExitType exit = process2.ExitType();
|
sl@0
|
145 |
TEST(exit == EExitKill);
|
sl@0
|
146 |
TInt reason = process2.ExitReason();
|
sl@0
|
147 |
TEST (reason == 0);
|
sl@0
|
148 |
|
sl@0
|
149 |
CleanupStack::PopAndDestroy();
|
sl@0
|
150 |
}
|
sl@0
|
151 |
while (timerStatus==KRequestPending);
|
sl@0
|
152 |
timer.Cancel();
|
sl@0
|
153 |
CleanupStack::Pop();//timer
|
sl@0
|
154 |
|
sl@0
|
155 |
//rendezvous with 3
|
sl@0
|
156 |
User::WaitForRequest(rendezvousStatus3);
|
sl@0
|
157 |
TInt status = rendezvousStatus3.Int();
|
sl@0
|
158 |
TEST(status ==10);
|
sl@0
|
159 |
|
sl@0
|
160 |
//now let 3 finish
|
sl@0
|
161 |
User::WaitForRequest(completeStatus3);
|
sl@0
|
162 |
TExitType exit = process3.ExitType();
|
sl@0
|
163 |
TEST(exit == EExitKill);
|
sl@0
|
164 |
TInt reason = process3.ExitReason();
|
sl@0
|
165 |
TEST (reason == 0);
|
sl@0
|
166 |
|
sl@0
|
167 |
CleanupStack::PopAndDestroy();//process 3
|
sl@0
|
168 |
}
|
sl@0
|
169 |
|
sl@0
|
170 |
void CTCacheDeletion::RunTestCaseL( TInt aCurTestCase )
|
sl@0
|
171 |
{
|
sl@0
|
172 |
#if defined __WINS__ || defined __WINSCW__
|
sl@0
|
173 |
aCurTestCase = aCurTestCase; //to avoid unused warning
|
sl@0
|
174 |
TestComplete(); //only run test on hardware, always passes on winscw
|
sl@0
|
175 |
return;
|
sl@0
|
176 |
#endif
|
sl@0
|
177 |
((CTCacheDeletionStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
|
sl@0
|
178 |
|
sl@0
|
179 |
switch ( aCurTestCase )
|
sl@0
|
180 |
{
|
sl@0
|
181 |
case 1:
|
sl@0
|
182 |
((CTCacheDeletionStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0050"));
|
sl@0
|
183 |
RunProcess2L();
|
sl@0
|
184 |
break;
|
sl@0
|
185 |
case 2:
|
sl@0
|
186 |
((CTCacheDeletionStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
sl@0
|
187 |
((CTCacheDeletionStep*)iStep)->CloseTMSGraphicsStep();
|
sl@0
|
188 |
TestComplete();
|
sl@0
|
189 |
break;
|
sl@0
|
190 |
}
|
sl@0
|
191 |
((CTCacheDeletionStep*)iStep)->RecordTestResultL();
|
sl@0
|
192 |
}
|
sl@0
|
193 |
|
sl@0
|
194 |
// --------------
|
sl@0
|
195 |
__CONSTRUCT_STEP__(CacheDeletion)
|