First public contribution.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
22 @internalComponent Internal Symbian test code
29 #include "t_cachedeletion.h"
32 #include <graphics/shapeimpl.h>
34 _LIT(KSecondProcess,"tcachedeletionprocess");
35 _LIT(KThirdProcess,"tcachedeletionprocess");
37 class CTCacheDeletion : public CTGraphicsBase
40 CTCacheDeletion(CTestStep* aStep);
43 // From CTGraphicsStep
44 virtual void RunTestCaseL(TInt aCurTestCase);
49 CTCacheDeletion::CTCacheDeletion(CTestStep* aStep)
50 : CTGraphicsBase(aStep)
55 CTCacheDeletion::~CTCacheDeletion()
60 void TimerCleanup(TAny *aTimer)
62 ((RTimer*)aTimer)->Cancel();
67 GRAPHICS-FNTSTORE-0050
70 Tests font and bitmap server disconnection (when a process finishes)
71 at the same time a process is outputing.
74 This function creates two processes. These processes are called
75 process 3 and process 2. Process 3 is created, and run. There are
76 parameters input to the process. The first is an indicator to the
77 process of the instance (2 or 3) and the second is a timeout.
78 Process3 runs continually, drawing text for the full timeout period.
79 Process2 is created and allowed to finish in a loop in this function for
80 the same timeout period, currently ten seconds.
82 @SYMTestExpectedResults
85 void CTCacheDeletion::RunProcess2L()
87 TInt runForMicroSecs = 1000*1000*10;
92 err = process3.Create(KThirdProcess, KNullDesC);
93 User::LeaveIfError(err);
94 CleanupClosePushL(process3);
97 process3.SetParameter(1,1);
98 process3.SetParameter(2,runForMicroSecs);
99 TRequestStatus completeStatus3;
100 process3.Logon(completeStatus3);
101 TRequestStatus rendezvousStatus3;
102 rendezvousStatus3=KRequestPending;
103 process3.Rendezvous(rendezvousStatus3);
104 process3.Resume(); //start the process
105 User::WaitForRequest(rendezvousStatus3);
110 TRequestStatus timerStatus=KRequestPending;
111 TTimeIntervalMicroSeconds32 timeout(runForMicroSecs);
112 timer.After(timerStatus, runForMicroSecs);
114 TCleanupItem cleanup(TimerCleanup,&timer);
115 CleanupStack::PushL(cleanup);
119 //run process 2 in a loop
123 TInt err = process2.Create(KSecondProcess, KNullDesC);
124 User::LeaveIfError(err);
125 CleanupClosePushL(process2);
128 process2.SetParameter(1,0);
129 process2.SetParameter(2,runForMicroSecs);//not actually used
130 TRequestStatus completeStatus2;
131 process2.Logon(completeStatus2);
132 TRequestStatus rendezvousStatus2;
133 rendezvousStatus2=KRequestPending;
134 process2.Rendezvous(rendezvousStatus2);
135 process2.Resume(); //start the process
138 User::WaitForRequest(rendezvousStatus2);
139 TInt status = rendezvousStatus2.Int();
143 User::WaitForRequest(completeStatus2);
144 TExitType exit = process2.ExitType();
145 TEST(exit == EExitKill);
146 TInt reason = process2.ExitReason();
149 CleanupStack::PopAndDestroy();
151 while (timerStatus==KRequestPending);
153 CleanupStack::Pop();//timer
156 User::WaitForRequest(rendezvousStatus3);
157 TInt status = rendezvousStatus3.Int();
161 User::WaitForRequest(completeStatus3);
162 TExitType exit = process3.ExitType();
163 TEST(exit == EExitKill);
164 TInt reason = process3.ExitReason();
167 CleanupStack::PopAndDestroy();//process 3
170 void CTCacheDeletion::RunTestCaseL( TInt aCurTestCase )
172 #if defined __WINS__ || defined __WINSCW__
173 aCurTestCase = aCurTestCase; //to avoid unused warning
174 TestComplete(); //only run test on hardware, always passes on winscw
177 ((CTCacheDeletionStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
179 switch ( aCurTestCase )
182 ((CTCacheDeletionStep*)iStep)->SetTestStepID(_L("GRAPHICS-FNTSTORE-0050"));
186 ((CTCacheDeletionStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
187 ((CTCacheDeletionStep*)iStep)->CloseTMSGraphicsStep();
191 ((CTCacheDeletionStep*)iStep)->RecordTestResultL();
195 __CONSTRUCT_STEP__(CacheDeletion)