sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2001-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 |
* TCUSTOMWRAP.CPP
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <e32base.h>
|
sl@0
|
21 |
#include <msvapi.h>
|
sl@0
|
22 |
#include <msvids.h>
|
sl@0
|
23 |
#include <mtclreg.h>
|
sl@0
|
24 |
#include <eikstart.h>
|
sl@0
|
25 |
|
sl@0
|
26 |
#include <basched.h>
|
sl@0
|
27 |
#include <banamedplugins.h>
|
sl@0
|
28 |
#include <bautils.h>
|
sl@0
|
29 |
#include <coecntrl.h>
|
sl@0
|
30 |
#include <coeccntx.h>
|
sl@0
|
31 |
#include <coemain.h>
|
sl@0
|
32 |
#include <charconv.h>
|
sl@0
|
33 |
#include <convnames.h>
|
sl@0
|
34 |
#include <e32keys.h>
|
sl@0
|
35 |
#include <techview/eikon.hrh>
|
sl@0
|
36 |
#include <eikappui.h>
|
sl@0
|
37 |
#include <eikapp.h>
|
sl@0
|
38 |
#include <eikdoc.h>
|
sl@0
|
39 |
#include <eikenv.h>
|
sl@0
|
40 |
#include <techview/eikrted.h>
|
sl@0
|
41 |
#include <techview/eikedwin.h>
|
sl@0
|
42 |
#include <eikdef.h>
|
sl@0
|
43 |
#include <techview/eikdialg.h>
|
sl@0
|
44 |
#include <techview/eikdlgtb.h>
|
sl@0
|
45 |
#include <techview/eikrted.h>
|
sl@0
|
46 |
#include <techview/eiksbfrm.h>
|
sl@0
|
47 |
#include <techview/eikconso.h>
|
sl@0
|
48 |
#include <txtrich.h>
|
sl@0
|
49 |
#include <hal.h>
|
sl@0
|
50 |
#include <fbs.h>
|
sl@0
|
51 |
#include "TestNrl.hrh"
|
sl@0
|
52 |
#include <testnrl.rsg>
|
sl@0
|
53 |
#include <techview/eikon.rsg>
|
sl@0
|
54 |
#include <prnsetup.h>
|
sl@0
|
55 |
|
sl@0
|
56 |
#include <biodb.h>
|
sl@0
|
57 |
#include <biouids.h>
|
sl@0
|
58 |
#include <gdi.h>
|
sl@0
|
59 |
|
sl@0
|
60 |
// forward declarations
|
sl@0
|
61 |
class CNRLTestAppUi;
|
sl@0
|
62 |
//class CEikScrollBarFrame;
|
sl@0
|
63 |
|
sl@0
|
64 |
const TInt EGranularity=4;
|
sl@0
|
65 |
|
sl@0
|
66 |
_LIT(KNewLine,"\n");
|
sl@0
|
67 |
_LIT(KLitResourceFileNameAppendage, "_NAME.RSC");
|
sl@0
|
68 |
#ifdef _DEBUG
|
sl@0
|
69 |
_LIT(KPanicText, "NonRom_Test");
|
sl@0
|
70 |
#endif
|
sl@0
|
71 |
|
sl@0
|
72 |
class TDummyObserver: public MMsvSessionObserver
|
sl@0
|
73 |
{
|
sl@0
|
74 |
public:
|
sl@0
|
75 |
virtual void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {};
|
sl@0
|
76 |
};
|
sl@0
|
77 |
|
sl@0
|
78 |
|
sl@0
|
79 |
//
|
sl@0
|
80 |
// class CNRLTestControl
|
sl@0
|
81 |
//
|
sl@0
|
82 |
|
sl@0
|
83 |
class CNRLTestControl : public CCoeControl
|
sl@0
|
84 |
{
|
sl@0
|
85 |
public:
|
sl@0
|
86 |
|
sl@0
|
87 |
void ConstructL(const TRect& aRect);
|
sl@0
|
88 |
void ActivateL();
|
sl@0
|
89 |
~CNRLTestControl();
|
sl@0
|
90 |
TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType);
|
sl@0
|
91 |
void PrintToScreen (TRefByValue<const TDesC> aFmt,...);
|
sl@0
|
92 |
void PrintLineToScreen (TRefByValue<const TDesC> aFmt,...);
|
sl@0
|
93 |
|
sl@0
|
94 |
private: // from CCoeControl
|
sl@0
|
95 |
void Draw(const TRect&) const;
|
sl@0
|
96 |
|
sl@0
|
97 |
private:
|
sl@0
|
98 |
CEikConsoleScreen* iConsole;
|
sl@0
|
99 |
};
|
sl@0
|
100 |
|
sl@0
|
101 |
|
sl@0
|
102 |
CNRLTestControl::~CNRLTestControl ()
|
sl@0
|
103 |
{
|
sl@0
|
104 |
delete iConsole;
|
sl@0
|
105 |
}
|
sl@0
|
106 |
|
sl@0
|
107 |
|
sl@0
|
108 |
void CNRLTestControl::ConstructL (const TRect& aRect)
|
sl@0
|
109 |
{
|
sl@0
|
110 |
CreateWindowL();
|
sl@0
|
111 |
Window().SetShadowDisabled(ETrue);
|
sl@0
|
112 |
Window().SetBackgroundColor(KRgbGray);
|
sl@0
|
113 |
EnableDragEvents();
|
sl@0
|
114 |
SetRect(aRect);
|
sl@0
|
115 |
SetBlank();
|
sl@0
|
116 |
TRect consoleSize = aRect;
|
sl@0
|
117 |
consoleSize.Shrink(1,1);
|
sl@0
|
118 |
iConsole=new(ELeave) CEikConsoleScreen;
|
sl@0
|
119 |
iConsole->ConstructL(_L("TEST"),TPoint(1,1),consoleSize.Size(),CEikConsoleScreen::ENoInitialCursor,EEikConsWinInPixels);
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
void CNRLTestControl::ActivateL ()
|
sl@0
|
123 |
{
|
sl@0
|
124 |
CCoeControl::ActivateL();
|
sl@0
|
125 |
iConsole->SetKeepCursorInSight(ETrue);
|
sl@0
|
126 |
iConsole->SetHistorySizeL(500,5);
|
sl@0
|
127 |
iConsole->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOn);
|
sl@0
|
128 |
iConsole->Write(_L("\nStarting tests for Non-Rom Localisation\nThis test requires some user interaction\n"));
|
sl@0
|
129 |
iConsole->FlushChars();
|
sl@0
|
130 |
iConsole->DrawCursor();
|
sl@0
|
131 |
iConsole->SetAtt(ATT_NORMAL);
|
sl@0
|
132 |
}
|
sl@0
|
133 |
|
sl@0
|
134 |
void CNRLTestControl::Draw(const TRect& /* aRect*/) const
|
sl@0
|
135 |
{
|
sl@0
|
136 |
CWindowGc& gc = SystemGc();
|
sl@0
|
137 |
TRect rect=Rect();
|
sl@0
|
138 |
//rect.Shrink(10,10);
|
sl@0
|
139 |
gc.DrawRect(rect);
|
sl@0
|
140 |
rect.Shrink(1,1);
|
sl@0
|
141 |
}
|
sl@0
|
142 |
|
sl@0
|
143 |
|
sl@0
|
144 |
TKeyResponse CNRLTestControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
|
sl@0
|
145 |
{
|
sl@0
|
146 |
if (aType!=EEventKey)
|
sl@0
|
147 |
return(EKeyWasConsumed);
|
sl@0
|
148 |
TInt modifiers=aKeyEvent.iModifiers;
|
sl@0
|
149 |
TInt code=aKeyEvent.iCode;
|
sl@0
|
150 |
|
sl@0
|
151 |
|
sl@0
|
152 |
|
sl@0
|
153 |
TRect range = iConsole->Selection(); // get current selected range
|
sl@0
|
154 |
switch (code)
|
sl@0
|
155 |
{
|
sl@0
|
156 |
case EKeyUpArrow:
|
sl@0
|
157 |
iConsole->Up();
|
sl@0
|
158 |
if (modifiers & EModifierShift)
|
sl@0
|
159 |
{
|
sl@0
|
160 |
range.iTl = iConsole->CursorPos();
|
sl@0
|
161 |
iConsole->SetSelection(range);
|
sl@0
|
162 |
}
|
sl@0
|
163 |
else
|
sl@0
|
164 |
iConsole->SelectCursor();
|
sl@0
|
165 |
break;
|
sl@0
|
166 |
case EKeyDownArrow:
|
sl@0
|
167 |
iConsole->Down();
|
sl@0
|
168 |
if (modifiers & EModifierShift)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
range.iTl = iConsole->CursorPos();
|
sl@0
|
171 |
iConsole->SetSelection(range);
|
sl@0
|
172 |
}
|
sl@0
|
173 |
else
|
sl@0
|
174 |
iConsole->SelectCursor();
|
sl@0
|
175 |
break;
|
sl@0
|
176 |
case EKeyLeftArrow:
|
sl@0
|
177 |
iConsole->Left();
|
sl@0
|
178 |
if (modifiers & EModifierShift)
|
sl@0
|
179 |
{
|
sl@0
|
180 |
range.iTl = iConsole->CursorPos();
|
sl@0
|
181 |
iConsole->SetSelection(range);
|
sl@0
|
182 |
}
|
sl@0
|
183 |
else
|
sl@0
|
184 |
iConsole->SelectCursor();
|
sl@0
|
185 |
break;
|
sl@0
|
186 |
case EKeyRightArrow:
|
sl@0
|
187 |
iConsole->Right();
|
sl@0
|
188 |
if (modifiers & EModifierShift)
|
sl@0
|
189 |
{
|
sl@0
|
190 |
range.iTl = iConsole->CursorPos();
|
sl@0
|
191 |
iConsole->SetSelection(range);
|
sl@0
|
192 |
}
|
sl@0
|
193 |
else
|
sl@0
|
194 |
iConsole->SelectCursor();
|
sl@0
|
195 |
break;
|
sl@0
|
196 |
case EKeyEnter:
|
sl@0
|
197 |
iConsole->Cr();
|
sl@0
|
198 |
iConsole->Lf();
|
sl@0
|
199 |
break;
|
sl@0
|
200 |
default:
|
sl@0
|
201 |
{
|
sl@0
|
202 |
iConsole->SelectCursor(); // forget previous selection
|
sl@0
|
203 |
TBuf<1> chr;
|
sl@0
|
204 |
chr.Format(_L("%c"),code);
|
sl@0
|
205 |
iConsole->Write(chr);
|
sl@0
|
206 |
iConsole->FlushChars();
|
sl@0
|
207 |
}
|
sl@0
|
208 |
break;
|
sl@0
|
209 |
}
|
sl@0
|
210 |
return(EKeyWasConsumed);
|
sl@0
|
211 |
}
|
sl@0
|
212 |
|
sl@0
|
213 |
|
sl@0
|
214 |
void CNRLTestControl::PrintToScreen(TRefByValue<const TDesC> aFmt,...)
|
sl@0
|
215 |
{
|
sl@0
|
216 |
VA_LIST list;
|
sl@0
|
217 |
VA_START(list,aFmt);
|
sl@0
|
218 |
TBuf<128> buf;
|
sl@0
|
219 |
buf.FormatList(aFmt,list);
|
sl@0
|
220 |
iConsole->Write(buf);
|
sl@0
|
221 |
}
|
sl@0
|
222 |
|
sl@0
|
223 |
void CNRLTestControl::PrintLineToScreen(TRefByValue<const TDesC> aFmt,...)
|
sl@0
|
224 |
{
|
sl@0
|
225 |
VA_LIST list;
|
sl@0
|
226 |
VA_START(list,aFmt);
|
sl@0
|
227 |
TBuf<128> buf;
|
sl@0
|
228 |
buf.FormatList(aFmt,list);
|
sl@0
|
229 |
iConsole->Write(buf);
|
sl@0
|
230 |
iConsole->Write(KNewLine);
|
sl@0
|
231 |
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
|
sl@0
|
235 |
|
sl@0
|
236 |
//
|
sl@0
|
237 |
// ---------------------- CNRLTestAppView definition ----------------
|
sl@0
|
238 |
//
|
sl@0
|
239 |
|
sl@0
|
240 |
|
sl@0
|
241 |
class CNRLTestAppUi : public CEikAppUi ,private CBaNamedPlugins::MFallBackName
|
sl@0
|
242 |
{
|
sl@0
|
243 |
public:
|
sl@0
|
244 |
void ConstructL();
|
sl@0
|
245 |
void CreateControlL();
|
sl@0
|
246 |
~CNRLTestAppUi();
|
sl@0
|
247 |
|
sl@0
|
248 |
void StartTestsL();
|
sl@0
|
249 |
void TestLocaleL(const TDesC& aTestHeader);
|
sl@0
|
250 |
void TestCollation(const TDesC& aTestHeader);
|
sl@0
|
251 |
void TestResourcesL(const TDesC& aTestHeader);
|
sl@0
|
252 |
void TestCharSetNamesL(const TDesC& aTestHeader);
|
sl@0
|
253 |
void TestFEPNamesL(const TDesC& aTestHeader);
|
sl@0
|
254 |
void TestDisplayMessagingL(const TDesC& aTestHeader);
|
sl@0
|
255 |
void TestBIFL(const TDesC& aTestHeader);
|
sl@0
|
256 |
void TestPrinterNameL(const TDesC& aTestHeader);
|
sl@0
|
257 |
void TestLocalisableBitmapL(const TDesC& aTestHeader);
|
sl@0
|
258 |
|
sl@0
|
259 |
|
sl@0
|
260 |
private: // from CEikAppUi -- framework
|
sl@0
|
261 |
void HandleCommandL(TInt aCommand);
|
sl@0
|
262 |
|
sl@0
|
263 |
virtual HBufC* FallBackNameL(const TDesC& aFullResourceFileName) const;
|
sl@0
|
264 |
|
sl@0
|
265 |
void WriteTestHeader(const TDesC& aTestHeader) const;
|
sl@0
|
266 |
void Pass(const TDesC& aTestHeader);
|
sl@0
|
267 |
void FailL(const TDesC& aTestHeader);
|
sl@0
|
268 |
void ReportEndResult() const;
|
sl@0
|
269 |
private:
|
sl@0
|
270 |
CNRLTestControl* iNRLTestControl;
|
sl@0
|
271 |
CDesCArray* iFailedTests;
|
sl@0
|
272 |
};
|
sl@0
|
273 |
|
sl@0
|
274 |
void CNRLTestAppUi::ConstructL()
|
sl@0
|
275 |
{
|
sl@0
|
276 |
BaseConstructL();
|
sl@0
|
277 |
CreateControlL();
|
sl@0
|
278 |
|
sl@0
|
279 |
}
|
sl@0
|
280 |
|
sl@0
|
281 |
// The cleanup operation of the TCleanupItem
|
sl@0
|
282 |
|
sl@0
|
283 |
LOCAL_C void DestroyResourceFileArray(TAny* aArrayOfResourceFiles)
|
sl@0
|
284 |
{
|
sl@0
|
285 |
RArray<CBaNamedPlugins::TResourceFile>& arrayOfResourceFiles=*STATIC_CAST(RArray<CBaNamedPlugins::TResourceFile>*, aArrayOfResourceFiles);
|
sl@0
|
286 |
for (TInt i=arrayOfResourceFiles.Count()-1; i>=0; --i)
|
sl@0
|
287 |
{
|
sl@0
|
288 |
const CBaNamedPlugins::TResourceFile& resourceFile=arrayOfResourceFiles[i];
|
sl@0
|
289 |
delete resourceFile.iFullFileName;
|
sl@0
|
290 |
delete resourceFile.iIdentifier;
|
sl@0
|
291 |
}
|
sl@0
|
292 |
arrayOfResourceFiles.Close();
|
sl@0
|
293 |
}
|
sl@0
|
294 |
|
sl@0
|
295 |
|
sl@0
|
296 |
|
sl@0
|
297 |
void CNRLTestAppUi::CreateControlL()
|
sl@0
|
298 |
{
|
sl@0
|
299 |
iNRLTestControl=new(ELeave) CNRLTestControl;
|
sl@0
|
300 |
iNRLTestControl->ConstructL(ClientRect());
|
sl@0
|
301 |
AddToStackL(iNRLTestControl);
|
sl@0
|
302 |
iNRLTestControl->ActivateL();
|
sl@0
|
303 |
iFailedTests=new(ELeave) CDesCArrayFlat(3);
|
sl@0
|
304 |
}
|
sl@0
|
305 |
|
sl@0
|
306 |
CNRLTestAppUi::~CNRLTestAppUi()
|
sl@0
|
307 |
{
|
sl@0
|
308 |
RemoveFromStack(iNRLTestControl);
|
sl@0
|
309 |
delete iNRLTestControl;
|
sl@0
|
310 |
for (TInt i=0; i<iFailedTests->Count();i++)
|
sl@0
|
311 |
iFailedTests->Delete(i);
|
sl@0
|
312 |
delete iFailedTests;
|
sl@0
|
313 |
}
|
sl@0
|
314 |
|
sl@0
|
315 |
void CNRLTestAppUi::HandleCommandL(TInt aCommand)
|
sl@0
|
316 |
{
|
sl@0
|
317 |
switch(aCommand)
|
sl@0
|
318 |
{
|
sl@0
|
319 |
case EAppCmdExit:
|
sl@0
|
320 |
Exit();
|
sl@0
|
321 |
break;
|
sl@0
|
322 |
case EAppCmdTest:
|
sl@0
|
323 |
StartTestsL ();
|
sl@0
|
324 |
break;
|
sl@0
|
325 |
default:
|
sl@0
|
326 |
break;
|
sl@0
|
327 |
}
|
sl@0
|
328 |
}
|
sl@0
|
329 |
|
sl@0
|
330 |
|
sl@0
|
331 |
_LIT(KTestAnnouncer,"----------------");
|
sl@0
|
332 |
_LIT(KLocaleTestTitle,"Locale ");
|
sl@0
|
333 |
_LIT(KResourceTestTitle,"Application Resource ");
|
sl@0
|
334 |
_LIT(KCharSetNamesTest,"Charset Names ");
|
sl@0
|
335 |
_LIT(KFEPNameTestTitle,"FEP Names ");
|
sl@0
|
336 |
_LIT(KCollationTestTitle, "Collation Table ");
|
sl@0
|
337 |
_LIT(KTDisplayMessaging,"Messaging Resources ");
|
sl@0
|
338 |
_LIT(KBIFTestTitle,"BIF Files ");
|
sl@0
|
339 |
_LIT(KPrinterNameTestTitle,"Printer Names ");
|
sl@0
|
340 |
_LIT(KLocalisableBimap,"Bitmap Files ");
|
sl@0
|
341 |
_LIT(KOriginalBitmapPath,"z:\\resource\\apps\\testnrl.mbm");
|
sl@0
|
342 |
_LIT(KNonROM,"Non-ROM");
|
sl@0
|
343 |
|
sl@0
|
344 |
void CNRLTestAppUi::WriteTestHeader(const TDesC& aTestHeader) const
|
sl@0
|
345 |
{
|
sl@0
|
346 |
iNRLTestControl->PrintToScreen(KNewLine);
|
sl@0
|
347 |
iNRLTestControl->PrintToScreen(aTestHeader);
|
sl@0
|
348 |
iNRLTestControl->PrintLineToScreen (_L("Test"));
|
sl@0
|
349 |
iNRLTestControl->PrintToScreen(KNewLine);
|
sl@0
|
350 |
|
sl@0
|
351 |
}
|
sl@0
|
352 |
|
sl@0
|
353 |
|
sl@0
|
354 |
void CNRLTestAppUi::StartTestsL ()
|
sl@0
|
355 |
{
|
sl@0
|
356 |
TestLocaleL(KLocaleTestTitle);
|
sl@0
|
357 |
TestResourcesL (KResourceTestTitle);
|
sl@0
|
358 |
TestCharSetNamesL(KCharSetNamesTest);
|
sl@0
|
359 |
TestCollation(KCollationTestTitle);
|
sl@0
|
360 |
TestFEPNamesL(KFEPNameTestTitle);
|
sl@0
|
361 |
TestDisplayMessagingL(KTDisplayMessaging);
|
sl@0
|
362 |
TestBIFL(KBIFTestTitle);
|
sl@0
|
363 |
TestPrinterNameL (KPrinterNameTestTitle);
|
sl@0
|
364 |
TestLocalisableBitmapL (KLocalisableBimap);
|
sl@0
|
365 |
ReportEndResult();
|
sl@0
|
366 |
|
sl@0
|
367 |
}
|
sl@0
|
368 |
|
sl@0
|
369 |
|
sl@0
|
370 |
void CNRLTestAppUi::TestLocaleL (const TDesC& aTestHeader)
|
sl@0
|
371 |
{
|
sl@0
|
372 |
|
sl@0
|
373 |
// print on console that we are starting the Locale Testing
|
sl@0
|
374 |
// just checking it is not enough, need to display as well that
|
sl@0
|
375 |
// the result is as expected.
|
sl@0
|
376 |
//Test a few other things besides the
|
sl@0
|
377 |
// locale number, some thing like a currency symbol. == $$$
|
sl@0
|
378 |
|
sl@0
|
379 |
WriteTestHeader(aTestHeader);
|
sl@0
|
380 |
iNRLTestControl->PrintLineToScreen(_L("Have to ensure that the correct locale is picked up"));
|
sl@0
|
381 |
iNRLTestControl->PrintLineToScreen(_L("Expected Locale with language extension"));
|
sl@0
|
382 |
|
sl@0
|
383 |
TInt language;
|
sl@0
|
384 |
(void)HAL::Get(HAL::ELanguageIndex,language);
|
sl@0
|
385 |
iNRLTestControl->PrintLineToScreen(_L("%d"),language);
|
sl@0
|
386 |
iNRLTestControl->PrintToScreen(_L("Current Locales language extension: "));
|
sl@0
|
387 |
|
sl@0
|
388 |
TInt currentLangId;
|
sl@0
|
389 |
currentLangId = TInt(User::Language());
|
sl@0
|
390 |
iNRLTestControl->PrintLineToScreen(_L("%d"),currentLangId);
|
sl@0
|
391 |
|
sl@0
|
392 |
if (currentLangId == 95 )
|
sl@0
|
393 |
{
|
sl@0
|
394 |
TCurrencySymbol theCurrencySymbol;
|
sl@0
|
395 |
_LIT(KExpectedCurrencySymbol,"$$$");
|
sl@0
|
396 |
if(theCurrencySymbol==KExpectedCurrencySymbol)
|
sl@0
|
397 |
{
|
sl@0
|
398 |
iNRLTestControl->PrintLineToScreen(_L("The correct locale was loaded"));
|
sl@0
|
399 |
Pass(aTestHeader);
|
sl@0
|
400 |
}
|
sl@0
|
401 |
}
|
sl@0
|
402 |
else
|
sl@0
|
403 |
{
|
sl@0
|
404 |
iNRLTestControl->PrintToScreen(_L("The correct locale was not loaded"));
|
sl@0
|
405 |
FailL(aTestHeader);
|
sl@0
|
406 |
}
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
void CNRLTestAppUi::TestResourcesL(const TDesC& aTestHeader)
|
sl@0
|
410 |
{
|
sl@0
|
411 |
WriteTestHeader(aTestHeader);
|
sl@0
|
412 |
iNRLTestControl->PrintLineToScreen (_L("Reading information from resource file..."));
|
sl@0
|
413 |
|
sl@0
|
414 |
TResourceReader resourceReader;
|
sl@0
|
415 |
CCoeEnv::Static()->CreateResourceReaderLC(resourceReader,R_NRL_COLLATE);
|
sl@0
|
416 |
CDesCArray* collation=new(ELeave) CDesCArrayFlat(3);
|
sl@0
|
417 |
CleanupStack::PushL(collation);
|
sl@0
|
418 |
TInt n=resourceReader.ReadUint16();
|
sl@0
|
419 |
|
sl@0
|
420 |
for (TInt i=0;i<n;i++)
|
sl@0
|
421 |
collation->AppendL(resourceReader.ReadTPtrC());
|
sl@0
|
422 |
|
sl@0
|
423 |
for (TInt j=0;j<n;j++)
|
sl@0
|
424 |
{
|
sl@0
|
425 |
iNRLTestControl->PrintLineToScreen((*collation)[j]);
|
sl@0
|
426 |
}
|
sl@0
|
427 |
|
sl@0
|
428 |
_LIT(KResourceData,"David");
|
sl@0
|
429 |
TInt resourceTest;
|
sl@0
|
430 |
collation->Find(KResourceData,resourceTest,ECmpCollated);
|
sl@0
|
431 |
if(resourceTest!=collation->MdcaCount())
|
sl@0
|
432 |
{
|
sl@0
|
433 |
Pass(aTestHeader);
|
sl@0
|
434 |
}
|
sl@0
|
435 |
else
|
sl@0
|
436 |
{
|
sl@0
|
437 |
FailL(aTestHeader);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
CleanupStack::PopAndDestroy(2);//resourceReader,collation
|
sl@0
|
440 |
}
|
sl@0
|
441 |
|
sl@0
|
442 |
void CNRLTestAppUi::TestCharSetNamesL(const TDesC& aTestHeader)
|
sl@0
|
443 |
{
|
sl@0
|
444 |
WriteTestHeader(aTestHeader);
|
sl@0
|
445 |
RFs& aSession = iCoeEnv->FsSession();
|
sl@0
|
446 |
CArrayFix<CCnvCharacterSetConverter::SCharacterSet>* charsetArray=CCnvCharacterSetConverter::CreateArrayOfCharacterSetsAvailableLC(aSession);
|
sl@0
|
447 |
MDesCArray* nameArry=CCnvCharacterSetNames::NewL(aSession,charsetArray->Array());
|
sl@0
|
448 |
TInt index=((CCnvCharacterSetNames*)nameArry)->IndexOfIdentifier(KCharacterSetIdentifierAscii);
|
sl@0
|
449 |
TInt testResult;
|
sl@0
|
450 |
testResult=0;
|
sl@0
|
451 |
TPtrC bigFive=nameArry->MdcaPoint(index);
|
sl@0
|
452 |
TInt findNonROM;
|
sl@0
|
453 |
findNonROM=bigFive.Find(KNonROM);
|
sl@0
|
454 |
if(findNonROM!=KErrNotFound)
|
sl@0
|
455 |
{
|
sl@0
|
456 |
iNRLTestControl->PrintToScreen(KNewLine);
|
sl@0
|
457 |
iNRLTestControl->PrintLineToScreen(bigFive);
|
sl@0
|
458 |
testResult=1;
|
sl@0
|
459 |
}
|
sl@0
|
460 |
if(testResult)
|
sl@0
|
461 |
Pass(aTestHeader);
|
sl@0
|
462 |
else
|
sl@0
|
463 |
FailL(aTestHeader);
|
sl@0
|
464 |
delete nameArry;
|
sl@0
|
465 |
CleanupStack::PopAndDestroy();//charsetArray
|
sl@0
|
466 |
}
|
sl@0
|
467 |
|
sl@0
|
468 |
|
sl@0
|
469 |
|
sl@0
|
470 |
void CNRLTestAppUi::TestCollation(const TDesC& aTestHeader)
|
sl@0
|
471 |
{
|
sl@0
|
472 |
WriteTestHeader(aTestHeader);
|
sl@0
|
473 |
iNRLTestControl->PrintToScreen(_L("This test locale has it's own collation table\n"));
|
sl@0
|
474 |
iNRLTestControl->PrintToScreen(_L("Set Collation values in the order E-D-C-B-A\n"));
|
sl@0
|
475 |
iNRLTestControl->PrintToScreen(_L("Loading a few names which have been sorted using collation\n"));
|
sl@0
|
476 |
iNRLTestControl->PrintToScreen(_L("David should appear before BeiBei\n\n"));
|
sl@0
|
477 |
TResourceReader resourceReader;
|
sl@0
|
478 |
CCoeEnv::Static()->CreateResourceReaderLC(resourceReader,R_NRL_COLLATE);
|
sl@0
|
479 |
CDesCArray* collation=new(ELeave) CDesCArrayFlat(3);
|
sl@0
|
480 |
CleanupStack::PushL(collation);
|
sl@0
|
481 |
TInt n=resourceReader.ReadUint16();
|
sl@0
|
482 |
|
sl@0
|
483 |
for (TInt i=0;i<n;i++)
|
sl@0
|
484 |
collation->AppendL(resourceReader.ReadTPtrC());
|
sl@0
|
485 |
//David is the first name stored in the array before the array is sorted.
|
sl@0
|
486 |
//When the array is sorted, David should still be the first name
|
sl@0
|
487 |
// because this locales collation table reverses the ordering between A & E
|
sl@0
|
488 |
TPtrC david = (*collation)[0];
|
sl@0
|
489 |
collation->Sort(ECmpCollated);
|
sl@0
|
490 |
for (TInt j=0;j<n;j++)
|
sl@0
|
491 |
{
|
sl@0
|
492 |
iNRLTestControl->PrintLineToScreen((*collation)[j]);
|
sl@0
|
493 |
}
|
sl@0
|
494 |
|
sl@0
|
495 |
TInt coltest;
|
sl@0
|
496 |
|
sl@0
|
497 |
// searching for Davids name in the array,
|
sl@0
|
498 |
// according to the new collation rules David's name should be
|
sl@0
|
499 |
// the first itm in the array.
|
sl@0
|
500 |
|
sl@0
|
501 |
collation->Find(david,coltest,ECmpCollated);
|
sl@0
|
502 |
// if coltest=0 then Davids is the first item,
|
sl@0
|
503 |
// the new collation table was used.
|
sl@0
|
504 |
if (!coltest)
|
sl@0
|
505 |
{
|
sl@0
|
506 |
Pass(aTestHeader);
|
sl@0
|
507 |
}
|
sl@0
|
508 |
else
|
sl@0
|
509 |
{
|
sl@0
|
510 |
FailL(aTestHeader);
|
sl@0
|
511 |
}
|
sl@0
|
512 |
|
sl@0
|
513 |
CleanupStack::PopAndDestroy(2);//resourceReader,collation
|
sl@0
|
514 |
}
|
sl@0
|
515 |
|
sl@0
|
516 |
|
sl@0
|
517 |
void CNRLTestAppUi::TestFEPNamesL(const TDesC& aTestHeader)
|
sl@0
|
518 |
{
|
sl@0
|
519 |
WriteTestHeader(aTestHeader);
|
sl@0
|
520 |
iNRLTestControl->PrintLineToScreen (_L("Fep Names are stored in resource files in the fep directory in system"));
|
sl@0
|
521 |
iNRLTestControl->PrintLineToScreen (_L("Compiled new resources with the word Non-ROM added into a few test fep names"));
|
sl@0
|
522 |
|
sl@0
|
523 |
RArray<CBaNamedPlugins::TResourceFile> arrayOfResourceFiles;
|
sl@0
|
524 |
CleanupStack::PushL(TCleanupItem(DestroyResourceFileArray, &arrayOfResourceFiles));//arrayOfResourceFiles
|
sl@0
|
525 |
RFs& fileServerSession=iCoeEnv->FsSession();
|
sl@0
|
526 |
TInt numberofsession=fileServerSession.ResourceCount();
|
sl@0
|
527 |
TInt i;
|
sl@0
|
528 |
TParse* parser=new(ELeave) TParse;
|
sl@0
|
529 |
CleanupStack::PushL(parser);//parser
|
sl@0
|
530 |
TFileName* fileName=new(ELeave) TFileName;
|
sl@0
|
531 |
CleanupStack::PushL(fileName);//fileName
|
sl@0
|
532 |
|
sl@0
|
533 |
|
sl@0
|
534 |
RArray<TUid> uidsOfAvailableFeps;
|
sl@0
|
535 |
CleanupClosePushL(uidsOfAvailableFeps);
|
sl@0
|
536 |
CDesCArray* fileNamesOfAvailableFeps = new(ELeave) CDesCArrayFlat(EGranularity);
|
sl@0
|
537 |
CleanupDeletePushL(fileNamesOfAvailableFeps);//fileNamesOfAvailableFeps
|
sl@0
|
538 |
iCoeEnv->AvailableFepsL(uidsOfAvailableFeps,fileNamesOfAvailableFeps);//it is allocated some memory here!!!
|
sl@0
|
539 |
|
sl@0
|
540 |
|
sl@0
|
541 |
|
sl@0
|
542 |
for (i=fileNamesOfAvailableFeps->MdcaCount()-1; i>=0; --i)
|
sl@0
|
543 |
{
|
sl@0
|
544 |
const TPtrC fullFileNameOfDll(fileNamesOfAvailableFeps->MdcaPoint(i));
|
sl@0
|
545 |
*fileName=TParsePtrC(fullFileNameOfDll).Name();
|
sl@0
|
546 |
fileName->Append(KLitResourceFileNameAppendage);
|
sl@0
|
547 |
User::LeaveIfError(parser->SetNoWild(*fileName, &fullFileNameOfDll, NULL));
|
sl@0
|
548 |
CBaNamedPlugins::TResourceFile resourceFile;
|
sl@0
|
549 |
resourceFile.iFullFileName=parser->FullName().AllocLC();
|
sl@0
|
550 |
resourceFile.iIdentifier=fullFileNameOfDll.AllocLC();
|
sl@0
|
551 |
resourceFile.iUid=uidsOfAvailableFeps[i];
|
sl@0
|
552 |
resourceFile.iFormat=CBaNamedPlugins::TResourceFile::EFormatTbuf;
|
sl@0
|
553 |
User::LeaveIfError(arrayOfResourceFiles.Append(resourceFile));
|
sl@0
|
554 |
CleanupStack::Pop(2, resourceFile.iFullFileName);//iFullFileName,iIdentifier
|
sl@0
|
555 |
}
|
sl@0
|
556 |
CleanupStack::PopAndDestroy(4, parser);//parser,fileName,uidsOfAvailableFeps,fileNamesOfAvailableFeps
|
sl@0
|
557 |
|
sl@0
|
558 |
CBaNamedPlugins::CParameters* parameters=CBaNamedPlugins::CParameters::NewLC(fileServerSession, arrayOfResourceFiles.Array());
|
sl@0
|
559 |
parameters->SetFallBackName(*this);
|
sl@0
|
560 |
CBaNamedPlugins* namedPlugins=CBaNamedPlugins::NewL(*parameters);//numberofsession increased after this
|
sl@0
|
561 |
numberofsession=fileServerSession.ResourceCount();
|
sl@0
|
562 |
const TInt numberOfAvailableFeps=namedPlugins->MdcaCount();
|
sl@0
|
563 |
TInt testResult;
|
sl@0
|
564 |
testResult=0;
|
sl@0
|
565 |
for (i=0; i<numberOfAvailableFeps; ++i)
|
sl@0
|
566 |
{
|
sl@0
|
567 |
TPtrC fepNames = namedPlugins->MdcaPoint(i);
|
sl@0
|
568 |
RDebug::Print(fepNames);
|
sl@0
|
569 |
TInt findNonROM;
|
sl@0
|
570 |
findNonROM=fepNames.Find(KNonROM);
|
sl@0
|
571 |
if (findNonROM!=KErrNotFound)
|
sl@0
|
572 |
{
|
sl@0
|
573 |
iNRLTestControl->PrintLineToScreen(fepNames);
|
sl@0
|
574 |
testResult =1;
|
sl@0
|
575 |
}
|
sl@0
|
576 |
}
|
sl@0
|
577 |
if (testResult)
|
sl@0
|
578 |
{
|
sl@0
|
579 |
Pass(aTestHeader);
|
sl@0
|
580 |
}
|
sl@0
|
581 |
else
|
sl@0
|
582 |
{
|
sl@0
|
583 |
FailL(aTestHeader);
|
sl@0
|
584 |
}
|
sl@0
|
585 |
delete namedPlugins;
|
sl@0
|
586 |
CleanupStack::PopAndDestroy(2, &arrayOfResourceFiles);//arrayOfResourceFiles,parameters
|
sl@0
|
587 |
}
|
sl@0
|
588 |
|
sl@0
|
589 |
HBufC* CNRLTestAppUi::FallBackNameL(const TDesC& aFullResourceFileName) const
|
sl@0
|
590 |
{
|
sl@0
|
591 |
const TPtrC nameAndExtension(TParsePtrC(aFullResourceFileName).NameAndExt());
|
sl@0
|
592 |
__ASSERT_DEBUG(nameAndExtension.Right(KLitResourceFileNameAppendage().Length())==KLitResourceFileNameAppendage, User::Panic(KPanicText,-1));
|
sl@0
|
593 |
return nameAndExtension.Left(nameAndExtension.Length()-KLitResourceFileNameAppendage().Length()).AllocL();
|
sl@0
|
594 |
}
|
sl@0
|
595 |
|
sl@0
|
596 |
void CNRLTestAppUi::TestDisplayMessagingL(const TDesC& aTestHeader)
|
sl@0
|
597 |
{
|
sl@0
|
598 |
WriteTestHeader(aTestHeader);
|
sl@0
|
599 |
iNRLTestControl->PrintLineToScreen (_L("MTM are stored in resource files in the MTM directory in System"));
|
sl@0
|
600 |
iNRLTestControl->PrintLineToScreen (_L("Compiled new resources with the word Non-ROM added into the MTM resources"));
|
sl@0
|
601 |
|
sl@0
|
602 |
TDummyObserver obs;
|
sl@0
|
603 |
CMsvSession *session=CMsvSession::OpenSyncL(obs);
|
sl@0
|
604 |
CleanupStack::PushL(session);
|
sl@0
|
605 |
CClientMtmRegistry *reg=CClientMtmRegistry::NewL(*session);
|
sl@0
|
606 |
CleanupStack::PushL(reg);
|
sl@0
|
607 |
TInt count=reg->NumRegisteredMtmDlls();
|
sl@0
|
608 |
|
sl@0
|
609 |
TInt testResult;
|
sl@0
|
610 |
testResult=0;
|
sl@0
|
611 |
while(count--)
|
sl@0
|
612 |
{
|
sl@0
|
613 |
const CMtmDllInfo& info=reg->RegisteredMtmDllInfo(reg->MtmTypeUid(count));
|
sl@0
|
614 |
TPtrC mtmNames = info.HumanReadableName();
|
sl@0
|
615 |
TInt findNonROM;
|
sl@0
|
616 |
findNonROM=mtmNames.Find(KNonROM);
|
sl@0
|
617 |
if (findNonROM!=KErrNotFound)
|
sl@0
|
618 |
{
|
sl@0
|
619 |
iNRLTestControl->PrintLineToScreen (mtmNames);
|
sl@0
|
620 |
testResult =1;
|
sl@0
|
621 |
}
|
sl@0
|
622 |
|
sl@0
|
623 |
}
|
sl@0
|
624 |
|
sl@0
|
625 |
CleanupStack::PopAndDestroy(reg);
|
sl@0
|
626 |
|
sl@0
|
627 |
CMsvEntry *entry=session->GetEntryL(KMsvRootIndexEntryId);
|
sl@0
|
628 |
CleanupStack::PushL(entry);
|
sl@0
|
629 |
|
sl@0
|
630 |
entry->SetEntryL(KMsvDraftEntryId);
|
sl@0
|
631 |
iNRLTestControl->PrintLineToScreen (entry->Entry().iDetails);
|
sl@0
|
632 |
|
sl@0
|
633 |
|
sl@0
|
634 |
entry->SetEntryL(KMsvGlobalInBoxIndexEntryId);
|
sl@0
|
635 |
iNRLTestControl->PrintLineToScreen (entry->Entry().iDetails);
|
sl@0
|
636 |
|
sl@0
|
637 |
entry->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
|
sl@0
|
638 |
iNRLTestControl->PrintLineToScreen (entry->Entry().iDetails);
|
sl@0
|
639 |
|
sl@0
|
640 |
entry->SetEntryL(KMsvSentEntryId);
|
sl@0
|
641 |
iNRLTestControl->PrintLineToScreen (entry->Entry().iDetails);
|
sl@0
|
642 |
|
sl@0
|
643 |
CleanupStack::PopAndDestroy(entry);
|
sl@0
|
644 |
CleanupStack::PopAndDestroy(session);
|
sl@0
|
645 |
|
sl@0
|
646 |
if (testResult)
|
sl@0
|
647 |
{
|
sl@0
|
648 |
Pass(aTestHeader);
|
sl@0
|
649 |
}
|
sl@0
|
650 |
else
|
sl@0
|
651 |
{
|
sl@0
|
652 |
FailL(aTestHeader);
|
sl@0
|
653 |
}
|
sl@0
|
654 |
}
|
sl@0
|
655 |
|
sl@0
|
656 |
|
sl@0
|
657 |
|
sl@0
|
658 |
void CNRLTestAppUi::TestBIFL (const TDesC& aTestHeader)
|
sl@0
|
659 |
{
|
sl@0
|
660 |
WriteTestHeader(aTestHeader);
|
sl@0
|
661 |
iNRLTestControl->PrintLineToScreen(_L("BIF files are now stored as resources in System\\BIf directory"));
|
sl@0
|
662 |
iNRLTestControl->PrintLineToScreen(_L("Compiled new BIF resources with the phrase Non-ROM added ... "));
|
sl@0
|
663 |
|
sl@0
|
664 |
RFs& gFs=iCoeEnv->FsSession();
|
sl@0
|
665 |
|
sl@0
|
666 |
iNRLTestControl->PrintLineToScreen(_L("Opening & Searching DB"));
|
sl@0
|
667 |
|
sl@0
|
668 |
CBIODatabase* bioDB = CBIODatabase::NewL(gFs);
|
sl@0
|
669 |
CleanupStack::PushL( bioDB );
|
sl@0
|
670 |
iNRLTestControl->PrintLineToScreen(_L("Opened DB Successfully!"));
|
sl@0
|
671 |
|
sl@0
|
672 |
TInt testResult;
|
sl@0
|
673 |
testResult=0;
|
sl@0
|
674 |
for (TInt i=0; i < bioDB->BIOCount(); i++)
|
sl@0
|
675 |
{
|
sl@0
|
676 |
const CBioInfoFileReader& bifReader = bioDB->BifReader(i);
|
sl@0
|
677 |
|
sl@0
|
678 |
TPtrC desc;
|
sl@0
|
679 |
desc.Set(bifReader.Description());
|
sl@0
|
680 |
TInt findNonROM;
|
sl@0
|
681 |
findNonROM=desc.Find((KNonROM));
|
sl@0
|
682 |
if (findNonROM!=KErrNotFound)
|
sl@0
|
683 |
{
|
sl@0
|
684 |
iNRLTestControl->PrintLineToScreen(desc);
|
sl@0
|
685 |
testResult =1;
|
sl@0
|
686 |
}
|
sl@0
|
687 |
}
|
sl@0
|
688 |
|
sl@0
|
689 |
if (testResult)
|
sl@0
|
690 |
{
|
sl@0
|
691 |
Pass(aTestHeader);
|
sl@0
|
692 |
}
|
sl@0
|
693 |
else
|
sl@0
|
694 |
{
|
sl@0
|
695 |
FailL(aTestHeader);
|
sl@0
|
696 |
}
|
sl@0
|
697 |
CleanupStack::PopAndDestroy(); // bioDB
|
sl@0
|
698 |
|
sl@0
|
699 |
}
|
sl@0
|
700 |
|
sl@0
|
701 |
void CNRLTestAppUi::TestPrinterNameL (const TDesC& aTestHeader)
|
sl@0
|
702 |
{
|
sl@0
|
703 |
|
sl@0
|
704 |
WriteTestHeader(aTestHeader);
|
sl@0
|
705 |
|
sl@0
|
706 |
CDesCArray* list=new(ELeave) CDesCArrayFlat(EGranularity);
|
sl@0
|
707 |
CleanupStack::PushL(list);
|
sl@0
|
708 |
|
sl@0
|
709 |
CPrintSetup* aPrintSetup = CPrintSetup::NewL();
|
sl@0
|
710 |
CleanupStack::PushL(aPrintSetup);
|
sl@0
|
711 |
aPrintSetup->AddPrinterDriverDirL( KDefaultPrinterDriverPath );
|
sl@0
|
712 |
RFs& filesession = iCoeEnv->FsSession();
|
sl@0
|
713 |
CPrinterModelList* aModelList;
|
sl@0
|
714 |
aModelList = aPrintSetup->ModelNameListL(filesession);
|
sl@0
|
715 |
CEikonEnv::GetPrinterNamesL(aModelList,*list);
|
sl@0
|
716 |
|
sl@0
|
717 |
aPrintSetup->FreeModelList();
|
sl@0
|
718 |
|
sl@0
|
719 |
TInt foundNonRomResource=0;
|
sl@0
|
720 |
|
sl@0
|
721 |
for (TInt i=0; i < list->Count(); ++i)
|
sl@0
|
722 |
{
|
sl@0
|
723 |
TPtrC desc;
|
sl@0
|
724 |
desc.Set((*list)[i]);
|
sl@0
|
725 |
TInt findNonROM;
|
sl@0
|
726 |
findNonROM = desc.Find((KNonROM));
|
sl@0
|
727 |
if (findNonROM!=KErrNotFound)
|
sl@0
|
728 |
{
|
sl@0
|
729 |
iNRLTestControl->PrintLineToScreen (desc);
|
sl@0
|
730 |
foundNonRomResource=1;
|
sl@0
|
731 |
}
|
sl@0
|
732 |
}
|
sl@0
|
733 |
if (foundNonRomResource)
|
sl@0
|
734 |
Pass(aTestHeader);
|
sl@0
|
735 |
else
|
sl@0
|
736 |
FailL(aTestHeader);
|
sl@0
|
737 |
|
sl@0
|
738 |
|
sl@0
|
739 |
CleanupStack::PopAndDestroy(2); // list, aPrintSetup, aModelList
|
sl@0
|
740 |
|
sl@0
|
741 |
}
|
sl@0
|
742 |
|
sl@0
|
743 |
void CNRLTestAppUi::TestLocalisableBitmapL(const TDesC& aTestHeader)
|
sl@0
|
744 |
{
|
sl@0
|
745 |
WriteTestHeader(aTestHeader);
|
sl@0
|
746 |
|
sl@0
|
747 |
TFileName filename(KOriginalBitmapPath);
|
sl@0
|
748 |
CWsBitmap* aBitmap;
|
sl@0
|
749 |
aBitmap=iEikonEnv->CreateBitmapL(filename,1);
|
sl@0
|
750 |
TBool nonROM;
|
sl@0
|
751 |
nonROM=aBitmap->IsRomBitmap();
|
sl@0
|
752 |
if(nonROM)
|
sl@0
|
753 |
{
|
sl@0
|
754 |
FailL(aTestHeader);
|
sl@0
|
755 |
}
|
sl@0
|
756 |
else
|
sl@0
|
757 |
{
|
sl@0
|
758 |
iNRLTestControl->PrintLineToScreen(_L("Right, the bitmap loaded should not be in ROM"));
|
sl@0
|
759 |
Pass(aTestHeader);
|
sl@0
|
760 |
}
|
sl@0
|
761 |
|
sl@0
|
762 |
delete aBitmap;
|
sl@0
|
763 |
}
|
sl@0
|
764 |
|
sl@0
|
765 |
|
sl@0
|
766 |
void CNRLTestAppUi::Pass(const TDesC& aTestHeader)
|
sl@0
|
767 |
{
|
sl@0
|
768 |
iNRLTestControl->PrintToScreen(KNewLine);
|
sl@0
|
769 |
iNRLTestControl->PrintLineToScreen(KTestAnnouncer);
|
sl@0
|
770 |
iNRLTestControl->PrintLineToScreen(_L("Expected new %S loaded"),&aTestHeader);
|
sl@0
|
771 |
iNRLTestControl->PrintLineToScreen(KTestAnnouncer);
|
sl@0
|
772 |
}
|
sl@0
|
773 |
|
sl@0
|
774 |
void CNRLTestAppUi::FailL(const TDesC& aTestHeader)
|
sl@0
|
775 |
{
|
sl@0
|
776 |
iNRLTestControl->PrintToScreen(KNewLine);
|
sl@0
|
777 |
iNRLTestControl->PrintLineToScreen(KTestAnnouncer);
|
sl@0
|
778 |
iNRLTestControl->PrintLineToScreen(_L("Unexpected old %S loaded"),&aTestHeader);
|
sl@0
|
779 |
iNRLTestControl->PrintLineToScreen(KTestAnnouncer);
|
sl@0
|
780 |
iFailedTests->AppendL(aTestHeader);
|
sl@0
|
781 |
|
sl@0
|
782 |
}
|
sl@0
|
783 |
|
sl@0
|
784 |
void CNRLTestAppUi::ReportEndResult() const
|
sl@0
|
785 |
{
|
sl@0
|
786 |
TInt failedTestsCount = iFailedTests->Count();
|
sl@0
|
787 |
if (failedTestsCount)
|
sl@0
|
788 |
{
|
sl@0
|
789 |
// Print a list of the Tests Failed
|
sl@0
|
790 |
iNRLTestControl->PrintLineToScreen(_L("The following tests failed\n"));
|
sl@0
|
791 |
for (TInt i=0; i<failedTestsCount; ++i)
|
sl@0
|
792 |
{
|
sl@0
|
793 |
iNRLTestControl->PrintLineToScreen ((*iFailedTests)[i]);
|
sl@0
|
794 |
}
|
sl@0
|
795 |
}
|
sl@0
|
796 |
else
|
sl@0
|
797 |
{
|
sl@0
|
798 |
// No Tests Failed, say that new resources were loaded where expected to
|
sl@0
|
799 |
}
|
sl@0
|
800 |
}
|
sl@0
|
801 |
|
sl@0
|
802 |
|
sl@0
|
803 |
//
|
sl@0
|
804 |
// --------------------- CNRLTestAppDoc class Definition ------------
|
sl@0
|
805 |
//
|
sl@0
|
806 |
|
sl@0
|
807 |
class CNRLTestAppDoc : public CEikDocument
|
sl@0
|
808 |
{
|
sl@0
|
809 |
public:
|
sl@0
|
810 |
CNRLTestAppDoc(CEikApplication& aApp);
|
sl@0
|
811 |
private:
|
sl@0
|
812 |
CEikAppUi* CreateAppUiL();
|
sl@0
|
813 |
};
|
sl@0
|
814 |
|
sl@0
|
815 |
|
sl@0
|
816 |
CNRLTestAppDoc::CNRLTestAppDoc(CEikApplication& aApp):CEikDocument(aApp)
|
sl@0
|
817 |
{
|
sl@0
|
818 |
// Nothing else to do, just call the base class constructor
|
sl@0
|
819 |
//
|
sl@0
|
820 |
}
|
sl@0
|
821 |
|
sl@0
|
822 |
CEikAppUi* CNRLTestAppDoc::CreateAppUiL()
|
sl@0
|
823 |
{
|
sl@0
|
824 |
return new (ELeave) CNRLTestAppUi;
|
sl@0
|
825 |
}
|
sl@0
|
826 |
//
|
sl@0
|
827 |
// ------------------------------ CNRLTestApp -----------------------
|
sl@0
|
828 |
//
|
sl@0
|
829 |
|
sl@0
|
830 |
|
sl@0
|
831 |
const TUid KTestNRLid = {0x1000AC5D};
|
sl@0
|
832 |
|
sl@0
|
833 |
class CNRLTestApp : public CEikApplication
|
sl@0
|
834 |
{
|
sl@0
|
835 |
private:
|
sl@0
|
836 |
CApaDocument* CreateDocumentL();
|
sl@0
|
837 |
TUid AppDllUid() const;
|
sl@0
|
838 |
|
sl@0
|
839 |
};
|
sl@0
|
840 |
|
sl@0
|
841 |
TUid CNRLTestApp::AppDllUid() const
|
sl@0
|
842 |
{
|
sl@0
|
843 |
return KTestNRLid;
|
sl@0
|
844 |
}
|
sl@0
|
845 |
|
sl@0
|
846 |
CApaDocument* CNRLTestApp::CreateDocumentL()
|
sl@0
|
847 |
{
|
sl@0
|
848 |
return new (ELeave) CNRLTestAppDoc(*this);
|
sl@0
|
849 |
}
|
sl@0
|
850 |
|
sl@0
|
851 |
////////////////////////////////////////////////////////////////////////////////////////////
|
sl@0
|
852 |
//
|
sl@0
|
853 |
|
sl@0
|
854 |
static CApaApplication* NewApplication()
|
sl@0
|
855 |
{
|
sl@0
|
856 |
return new CNRLTestApp;
|
sl@0
|
857 |
}
|
sl@0
|
858 |
|
sl@0
|
859 |
TInt E32Main()
|
sl@0
|
860 |
{
|
sl@0
|
861 |
return EikStart::RunApplication(&NewApplication);
|
sl@0
|
862 |
}
|
sl@0
|
863 |
|
sl@0
|
864 |
|