Update contrib.
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.
15 * Cache Deletion for fntstore multi-processed test code
23 @internalComponent - Internal Symbian test code
38 _LIT(KOpenFont, "DejaVu Sans Condensed");
41 //this is used for winscw breakpoints
42 #define BR _asm( int 3);
46 /* it is expected that the main in this file will be called to test multiple
47 process output at the same time a process is being deleted (font and bitmap server
48 disconnection. There are normally two instances of this process. Two virtually
49 identical processes are required to ensure that the session ID is the same.
51 The first is with aThirdProcess set. This sets output to run in a loop until
52 the timeout is completed. These values are input via program arguments.
54 If aThirdProcess is false then only one font creation, draw text,
55 font deletion cycle is completed. The test code will then repeatedly run
56 this process with aThirdProcess set to false.
58 class TRunProc2: public CBase
61 static TRunProc2* NewL();
62 void RunTestL(TInt aThirdProcess, TInt aTimeout);
73 CFbsScreenDevice* iDev;
76 TRunProc2::~TRunProc2()
83 void TRunProc2::ConstructL()
85 TInt err = RFbsSession::Connect();
86 User::LeaveIfError(err);
87 iFbs = RFbsSession::GetSession();
88 User::LeaveIfNull(iFbs);
90 TDisplayMode mode[13];
103 mode[12]=EColor16MAP;
107 for (count=0;count<13;count++)
109 TRAP(err, iDev = CFbsScreenDevice::NewL(KNullDesC, mode[count]));
110 if (err!=KErrNotSupported)
116 User::LeaveIfNull(iDev);
120 iDev->ChangeScreenDevice(NULL);
121 iDev->SetAutoUpdate(ETrue);
122 iDev->CreateContext(iGc);
124 User::LeaveIfNull(iGc);
127 TRunProc2* TRunProc2::NewL()
129 TRunProc2 *ptr = new (ELeave) TRunProc2;
130 CleanupStack::PushL(ptr);
136 void TRunProc2::CreateFont()
138 //make sure that the font is large enough to ensure that the session
142 TOpenFontSpec openFontSpec;
143 openFontSpec.SetName(KOpenFont);
144 openFontSpec.SetHeight(height);
145 openFontSpec.SetItalic(EFalse);
146 openFontSpec.SetBold(EFalse);
149 Typeface.iName = KOpenFont;
151 fs.iTypeface = Typeface;
154 CFbsFont* font = NULL;
155 TInt err = iDev->GetNearestFontToDesignHeightInPixels(font, fs);
157 User::LeaveIfNull(font);
164 void TRunProc2::RunTestL(TInt aThirdProcess, TInt aTimeout)
171 TRequestStatus timerStatus=KRequestPending;
172 TTimeIntervalMicroSeconds32 timeout(aTimeout);
173 timer.After(timerStatus, timeout);
180 while (timerStatus==KRequestPending);
183 RProcess::Rendezvous(10);
190 RProcess::Rendezvous(1);
194 void TRunProc2::DrawText()
198 for (ch[0]='A';ch[0]<='Z';ch[0]++)
201 iGc->DrawText(buf,TPoint(10,100));
203 for (ch[0]='a';ch[0]<='z';ch[0]++)
206 iGc->DrawText(buf,TPoint(10,100));
212 TRunProc2* test= TRunProc2::NewL();
213 CleanupStack::PushL(test);
216 User::LeaveIfError(User::GetTIntParameter(1,param));
217 User::LeaveIfError(User::GetTIntParameter(2,timeoutParam));
218 test->RunTestL(param,timeoutParam);
219 CleanupStack::PopAndDestroy();
222 // Cleanup stack harness
223 GLDEF_C TInt E32Main()
226 CTrapCleanup* cleanupStack = CTrapCleanup::New();
227 TRAPD(error, MainL());
228 _LIT(KTCacheDeletionProcess,"TCacheDeletionProcess");
229 __ASSERT_ALWAYS(!error, User::Panic(KTCacheDeletionProcess, error));