sl@0
|
1 |
// Copyright (c) 1995-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 |
// Manual window server tests
|
sl@0
|
15 |
// Note: Wherever possible tests should be put into the TAUTO automatic test
|
sl@0
|
16 |
// code test should only go here when manual operation is essential
|
sl@0
|
17 |
//
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
#include <e32std.h>
|
sl@0
|
21 |
#include "W32STD.H"
|
sl@0
|
22 |
#include <e32svr.h>
|
sl@0
|
23 |
#include "TMAN.H"
|
sl@0
|
24 |
|
sl@0
|
25 |
#define LOG_TESTS
|
sl@0
|
26 |
|
sl@0
|
27 |
class ErrorDialog : public CTDialog
|
sl@0
|
28 |
{
|
sl@0
|
29 |
public:
|
sl@0
|
30 |
ErrorDialog(CTestBase *aTest);
|
sl@0
|
31 |
void ButtonPressL(TInt aButton);
|
sl@0
|
32 |
private:
|
sl@0
|
33 |
CTestBase *iTest;
|
sl@0
|
34 |
};
|
sl@0
|
35 |
|
sl@0
|
36 |
class TestWindowGroup : public CTWindowGroup
|
sl@0
|
37 |
{
|
sl@0
|
38 |
public:
|
sl@0
|
39 |
TestWindowGroup(CTClient *aClient);
|
sl@0
|
40 |
void ConstructL();
|
sl@0
|
41 |
void KeyL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
42 |
void KeyDownL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
43 |
void KeyUpL(const TKeyEvent &aKey,const TTime &aTime);
|
sl@0
|
44 |
};
|
sl@0
|
45 |
|
sl@0
|
46 |
class CTManScheduler : public CActiveScheduler
|
sl@0
|
47 |
{
|
sl@0
|
48 |
public:
|
sl@0
|
49 |
void SetClient(TestClient *aClient);
|
sl@0
|
50 |
void Error(TInt anError) const;
|
sl@0
|
51 |
private:
|
sl@0
|
52 |
void doErrorL(TInt anError) const;
|
sl@0
|
53 |
private:
|
sl@0
|
54 |
TestClient *iClient;
|
sl@0
|
55 |
};
|
sl@0
|
56 |
|
sl@0
|
57 |
typedef CTestBase *(*CTestBaseCreate)();
|
sl@0
|
58 |
|
sl@0
|
59 |
GLREF_C CTestBase *CreateScreenModeTest();
|
sl@0
|
60 |
GLREF_C CTestBase *CreateScaleTest();
|
sl@0
|
61 |
GLREF_C CTestBase *CreateTextTest();
|
sl@0
|
62 |
GLREF_C CTestBase *CreateDummyTest();
|
sl@0
|
63 |
GLREF_C CTestBase *CreateMultiConTest();
|
sl@0
|
64 |
GLREF_C CTestBase *CreateMultiCaptureKeyTest();
|
sl@0
|
65 |
GLREF_C CTestBase *CreateHotKeyTest();
|
sl@0
|
66 |
GLREF_C CTestBase *CreatePointerTest();
|
sl@0
|
67 |
GLREF_C CTestBase *CreatePointerCaptureTest();
|
sl@0
|
68 |
GLREF_C CTestBase *CreatePointerBufferTest();
|
sl@0
|
69 |
GLREF_C CTestBase *CreateModifiersChangedTest();
|
sl@0
|
70 |
GLREF_C CTestBase *CreatePointerKeyTest();
|
sl@0
|
71 |
GLREF_C CTestBase *CreatePasswordTest();
|
sl@0
|
72 |
GLREF_C CTestBase *CreatePointerCursorTest();
|
sl@0
|
73 |
GLREF_C CTestBase *CreateScreenModeTimes();
|
sl@0
|
74 |
|
sl@0
|
75 |
// Tests that have not been converted to tauto yet
|
sl@0
|
76 |
CTestBaseCreate CreateTestClass[]={
|
sl@0
|
77 |
CreateScreenModeTimes,
|
sl@0
|
78 |
CreatePointerCursorTest,
|
sl@0
|
79 |
CreatePointerTest, //Mostly converted
|
sl@0
|
80 |
CreatePointerKeyTest, //Mostly converted
|
sl@0
|
81 |
CreateModifiersChangedTest, //Partially Conerted
|
sl@0
|
82 |
CreatePointerBufferTest,
|
sl@0
|
83 |
CreateTextTest,
|
sl@0
|
84 |
CreateScaleTest,
|
sl@0
|
85 |
CreateDummyTest,
|
sl@0
|
86 |
};
|
sl@0
|
87 |
|
sl@0
|
88 |
LogWindow *LogWin;
|
sl@0
|
89 |
|
sl@0
|
90 |
void TManPanic(TInt aPanic)
|
sl@0
|
91 |
{
|
sl@0
|
92 |
User::Panic(_L("Auto"),aPanic);
|
sl@0
|
93 |
}
|
sl@0
|
94 |
|
sl@0
|
95 |
//
|
sl@0
|
96 |
// Log window, logs testing //
|
sl@0
|
97 |
//
|
sl@0
|
98 |
|
sl@0
|
99 |
LogWindow::LogWindow() : CTWin()
|
sl@0
|
100 |
{
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
void LogWindow::ConstructL(CTWinBase &parent)
|
sl@0
|
104 |
{
|
sl@0
|
105 |
CTWin::ConstructL(parent);
|
sl@0
|
106 |
iTitleHeight=iFont->HeightInPixels()+4;
|
sl@0
|
107 |
}
|
sl@0
|
108 |
|
sl@0
|
109 |
void LogWindow::Draw()
|
sl@0
|
110 |
{
|
sl@0
|
111 |
iGc->SetPenColor(TRgb::Gray16(8));
|
sl@0
|
112 |
iGc->SetPenColor(TRgb::Gray16(0));
|
sl@0
|
113 |
DrawBorder();
|
sl@0
|
114 |
iGc->DrawLine(TPoint(0,iTitleHeight),TPoint(iSize.iWidth,iTitleHeight));
|
sl@0
|
115 |
iGc->DrawText(iTestTitle, TPoint((iSize.iWidth-iFont->TextWidthInPixels(iTestTitle))/2,iFont->AscentInPixels()+2));
|
sl@0
|
116 |
}
|
sl@0
|
117 |
|
sl@0
|
118 |
void LogWindow::LogTest(TDesC &aTitle,TInt aNum)
|
sl@0
|
119 |
{
|
sl@0
|
120 |
iTestTitle.Format(TRefByValue<const TDesC>(_L("Test %d,%S")),aNum,&aTitle);
|
sl@0
|
121 |
iWin.Invalidate();
|
sl@0
|
122 |
Client()->iWs.Flush();
|
sl@0
|
123 |
}
|
sl@0
|
124 |
|
sl@0
|
125 |
//
|
sl@0
|
126 |
// Test window, simple window used to do test graphics in //
|
sl@0
|
127 |
//
|
sl@0
|
128 |
TestWindow::TestWindow() : CTWin()
|
sl@0
|
129 |
{
|
sl@0
|
130 |
}
|
sl@0
|
131 |
|
sl@0
|
132 |
void TestWindow::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc)
|
sl@0
|
133 |
{
|
sl@0
|
134 |
iBorderWin=new(ELeave) BorderWindow();
|
sl@0
|
135 |
iBorderWin->SetUpL(pos,size,parent,aGc);
|
sl@0
|
136 |
CTWin::ConstructExtLD(*iBorderWin,TPoint(2,2),TSize(size.iWidth-4,size.iHeight-4));
|
sl@0
|
137 |
Activate();
|
sl@0
|
138 |
AssignGC(aGc);
|
sl@0
|
139 |
}
|
sl@0
|
140 |
|
sl@0
|
141 |
void TestWindow::Draw()
|
sl@0
|
142 |
{
|
sl@0
|
143 |
iGc->Clear();
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
//
|
sl@0
|
147 |
BorderWindow::BorderWindow() : CTWin()
|
sl@0
|
148 |
{
|
sl@0
|
149 |
}
|
sl@0
|
150 |
|
sl@0
|
151 |
void BorderWindow::ConstructL(CTWinBase &parent)
|
sl@0
|
152 |
{
|
sl@0
|
153 |
CTWin::ConstructL(parent);
|
sl@0
|
154 |
}
|
sl@0
|
155 |
|
sl@0
|
156 |
void BorderWindow::Draw()
|
sl@0
|
157 |
{
|
sl@0
|
158 |
iGc->SetBrushColor(TRgb::Gray16(0));
|
sl@0
|
159 |
iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
sl@0
|
160 |
iGc->SetPenStyle(CGraphicsContext::ENullPen);
|
sl@0
|
161 |
iGc->DrawRect(TRect(Size()));
|
sl@0
|
162 |
}
|
sl@0
|
163 |
|
sl@0
|
164 |
//
|
sl@0
|
165 |
|
sl@0
|
166 |
TestWindowGroup::TestWindowGroup(CTClient *aClient) : CTWindowGroup(aClient)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
}
|
sl@0
|
169 |
|
sl@0
|
170 |
void TestWindowGroup::ConstructL()
|
sl@0
|
171 |
{
|
sl@0
|
172 |
CTWindowGroup::ConstructL();
|
sl@0
|
173 |
GroupWin()->EnableScreenChangeEvents();
|
sl@0
|
174 |
}
|
sl@0
|
175 |
|
sl@0
|
176 |
void TestWindowGroup::KeyDownL(const TKeyEvent &aKey,const TTime &aTime)
|
sl@0
|
177 |
{
|
sl@0
|
178 |
if (iCurWin)
|
sl@0
|
179 |
iCurWin->KeyDownL(aKey,aTime);
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
void TestWindowGroup::KeyUpL(const TKeyEvent &aKey,const TTime &aTime)
|
sl@0
|
183 |
{
|
sl@0
|
184 |
if (iCurWin)
|
sl@0
|
185 |
iCurWin->KeyUpL(aKey,aTime);
|
sl@0
|
186 |
}
|
sl@0
|
187 |
|
sl@0
|
188 |
void TestWindowGroup::KeyL(const TKeyEvent &aKey,const TTime &aTime)
|
sl@0
|
189 |
{
|
sl@0
|
190 |
if (aKey.iModifiers&EModifierFunc)
|
sl@0
|
191 |
{
|
sl@0
|
192 |
switch(aKey.iCode)
|
sl@0
|
193 |
{
|
sl@0
|
194 |
case 'f':
|
sl@0
|
195 |
((TestClient *)Client())->Driver()->iTest->TriggerFail();
|
sl@0
|
196 |
break;
|
sl@0
|
197 |
}
|
sl@0
|
198 |
}
|
sl@0
|
199 |
else if (iCurWin)
|
sl@0
|
200 |
iCurWin->WinKeyL(aKey,aTime);
|
sl@0
|
201 |
}
|
sl@0
|
202 |
|
sl@0
|
203 |
//
|
sl@0
|
204 |
|
sl@0
|
205 |
TestClient::TestClient()
|
sl@0
|
206 |
{
|
sl@0
|
207 |
}
|
sl@0
|
208 |
|
sl@0
|
209 |
void TestClient::ConstructL()
|
sl@0
|
210 |
{
|
sl@0
|
211 |
CTClient::ConstructL();
|
sl@0
|
212 |
|
sl@0
|
213 |
iGroup=new(ELeave) TestWindowGroup(this);
|
sl@0
|
214 |
iGroup->ConstructL();
|
sl@0
|
215 |
|
sl@0
|
216 |
TSize screenSize=iGroup->Size();
|
sl@0
|
217 |
TInt winWidth=(screenSize.iWidth/3)-10;
|
sl@0
|
218 |
TInt winHeight=screenSize.iHeight-10;
|
sl@0
|
219 |
LogWin=new(ELeave) LogWindow();
|
sl@0
|
220 |
LogWin->SetUpL(TPoint(5+winWidth*2,5),TSize(winWidth,winHeight),iGroup,*iGc);
|
sl@0
|
221 |
iDriver=new(ELeave) TestDriver(this);
|
sl@0
|
222 |
}
|
sl@0
|
223 |
|
sl@0
|
224 |
TestClient::~TestClient()
|
sl@0
|
225 |
{
|
sl@0
|
226 |
delete iDriver;
|
sl@0
|
227 |
}
|
sl@0
|
228 |
|
sl@0
|
229 |
TestDriver *TestClient::Driver()
|
sl@0
|
230 |
{
|
sl@0
|
231 |
return(iDriver);
|
sl@0
|
232 |
}
|
sl@0
|
233 |
|
sl@0
|
234 |
//
|
sl@0
|
235 |
// Error dialog //
|
sl@0
|
236 |
//
|
sl@0
|
237 |
|
sl@0
|
238 |
ErrorDialog::ErrorDialog(CTestBase *aTest) : CTDialog(), iTest(aTest)
|
sl@0
|
239 |
{}
|
sl@0
|
240 |
|
sl@0
|
241 |
void ErrorDialog::ButtonPressL(TInt aButton)
|
sl@0
|
242 |
{
|
sl@0
|
243 |
switch(aButton)
|
sl@0
|
244 |
{
|
sl@0
|
245 |
case 0:
|
sl@0
|
246 |
{
|
sl@0
|
247 |
CTestBase *test=iTest;
|
sl@0
|
248 |
CTDialog::Delete(this);
|
sl@0
|
249 |
if (test)
|
sl@0
|
250 |
test->Driver()->DestroyTest();
|
sl@0
|
251 |
CActiveScheduler::Stop();
|
sl@0
|
252 |
User::Leave(0); // Signals RunL not to do another request
|
sl@0
|
253 |
}
|
sl@0
|
254 |
break;
|
sl@0
|
255 |
case 1:
|
sl@0
|
256 |
CTestBase *test=iTest;
|
sl@0
|
257 |
CTDialog::Delete(this);
|
sl@0
|
258 |
if (test)
|
sl@0
|
259 |
{
|
sl@0
|
260 |
test->Driver()->TestComplete();
|
sl@0
|
261 |
test->Driver()->DestroyTest();
|
sl@0
|
262 |
}
|
sl@0
|
263 |
break;
|
sl@0
|
264 |
}
|
sl@0
|
265 |
}
|
sl@0
|
266 |
|
sl@0
|
267 |
//
|
sl@0
|
268 |
// TestDriver, drives the test code //
|
sl@0
|
269 |
//
|
sl@0
|
270 |
|
sl@0
|
271 |
TestDriver::TestDriver(TestClient *aClient) : CActive(-10), iClient(aClient)
|
sl@0
|
272 |
{
|
sl@0
|
273 |
CActiveScheduler::Add(this);
|
sl@0
|
274 |
Request();
|
sl@0
|
275 |
}
|
sl@0
|
276 |
|
sl@0
|
277 |
TestClient *TestDriver::Client()
|
sl@0
|
278 |
{
|
sl@0
|
279 |
return(iClient);
|
sl@0
|
280 |
}
|
sl@0
|
281 |
|
sl@0
|
282 |
TestDriver::~TestDriver()
|
sl@0
|
283 |
{
|
sl@0
|
284 |
Cancel();
|
sl@0
|
285 |
DestroyTest();
|
sl@0
|
286 |
}
|
sl@0
|
287 |
|
sl@0
|
288 |
void TestDriver::DoCancel()
|
sl@0
|
289 |
{
|
sl@0
|
290 |
TRequestStatus *pStat= &iStatus;
|
sl@0
|
291 |
RThread().RequestComplete(pStat,KErrCancel);
|
sl@0
|
292 |
}
|
sl@0
|
293 |
|
sl@0
|
294 |
void TestDriver::Request()
|
sl@0
|
295 |
{
|
sl@0
|
296 |
TRequestStatus *pStat= &iStatus;
|
sl@0
|
297 |
RThread().RequestComplete(pStat,KErrNone);
|
sl@0
|
298 |
SetActive();
|
sl@0
|
299 |
}
|
sl@0
|
300 |
|
sl@0
|
301 |
void TestDriver::RunL()
|
sl@0
|
302 |
{
|
sl@0
|
303 |
iTest=(*CreateTestClass[iTestNum])();
|
sl@0
|
304 |
iTest->StartTest(iTestNum,this);
|
sl@0
|
305 |
iTest->ConstructL();
|
sl@0
|
306 |
}
|
sl@0
|
307 |
|
sl@0
|
308 |
void TestDriver::TestComplete()
|
sl@0
|
309 |
{
|
sl@0
|
310 |
iTestNum++;
|
sl@0
|
311 |
if (iTestNum==sizeof(CreateTestClass)/sizeof(CreateTestClass[0]))
|
sl@0
|
312 |
{
|
sl@0
|
313 |
DisplayDialog(_L("Tests complete"),_L(""),_L(""));
|
sl@0
|
314 |
CActiveScheduler::Stop();
|
sl@0
|
315 |
}
|
sl@0
|
316 |
else
|
sl@0
|
317 |
Request();
|
sl@0
|
318 |
}
|
sl@0
|
319 |
|
sl@0
|
320 |
void TestDriver::DestroyTest()
|
sl@0
|
321 |
{
|
sl@0
|
322 |
delete iTest;
|
sl@0
|
323 |
iTest=NULL;
|
sl@0
|
324 |
}
|
sl@0
|
325 |
|
sl@0
|
326 |
// CTestBase //
|
sl@0
|
327 |
|
sl@0
|
328 |
CTestBase::CTestBase(const TDesC &aTitle) : CActive(-10)
|
sl@0
|
329 |
{
|
sl@0
|
330 |
CActiveScheduler::Add(this);
|
sl@0
|
331 |
iTitle.Copy(aTitle);
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
CTestBase::~CTestBase()
|
sl@0
|
335 |
{
|
sl@0
|
336 |
User::Free(iBuf1);
|
sl@0
|
337 |
User::Free(iBuf2);
|
sl@0
|
338 |
Cancel();
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
void CTestBase::DoCancel()
|
sl@0
|
342 |
{
|
sl@0
|
343 |
TRequestStatus *pStat= &iStatus;
|
sl@0
|
344 |
RThread().RequestComplete(pStat,KErrCancel);
|
sl@0
|
345 |
}
|
sl@0
|
346 |
|
sl@0
|
347 |
void CTestBase::Request()
|
sl@0
|
348 |
{
|
sl@0
|
349 |
TRequestStatus *pStat= &iStatus;
|
sl@0
|
350 |
RThread().RequestComplete(pStat,KErrNone);
|
sl@0
|
351 |
SetActive();
|
sl@0
|
352 |
}
|
sl@0
|
353 |
|
sl@0
|
354 |
void CTestBase::TriggerFail()
|
sl@0
|
355 |
{
|
sl@0
|
356 |
iFail=ETrue;
|
sl@0
|
357 |
}
|
sl@0
|
358 |
|
sl@0
|
359 |
TestClient *CTestBase::Client()
|
sl@0
|
360 |
{
|
sl@0
|
361 |
return(iDriver->Client());
|
sl@0
|
362 |
}
|
sl@0
|
363 |
|
sl@0
|
364 |
void CTestBase::LogLeave(TInt aErr)
|
sl@0
|
365 |
{
|
sl@0
|
366 |
#if defined(LOG_TESTS)
|
sl@0
|
367 |
TLogMessageText buf;
|
sl@0
|
368 |
_LIT(KLeave,"MAN Left with error code %d in sub-test %d: ");
|
sl@0
|
369 |
buf.AppendFormat(KLeave,aErr,iSubTestNum);
|
sl@0
|
370 |
buf.Append(iSubTitle);
|
sl@0
|
371 |
Client()->LogMessage(buf);
|
sl@0
|
372 |
#else
|
sl@0
|
373 |
aErr=KErrNone; //To stop a warning
|
sl@0
|
374 |
#endif
|
sl@0
|
375 |
}
|
sl@0
|
376 |
|
sl@0
|
377 |
void CTestBase::RunL()
|
sl@0
|
378 |
{
|
sl@0
|
379 |
TInt ret=EInvalid;
|
sl@0
|
380 |
TRAPD(err,ret=DoTestL());
|
sl@0
|
381 |
if (err!=KErrNone)
|
sl@0
|
382 |
{
|
sl@0
|
383 |
LogLeave(err);
|
sl@0
|
384 |
if (err!=ETestFailed)
|
sl@0
|
385 |
{
|
sl@0
|
386 |
User::Leave(err);
|
sl@0
|
387 |
}
|
sl@0
|
388 |
}
|
sl@0
|
389 |
else if (ret==EFinished)
|
sl@0
|
390 |
{
|
sl@0
|
391 |
iDriver->TestComplete();
|
sl@0
|
392 |
iDriver->DestroyTest();
|
sl@0
|
393 |
}
|
sl@0
|
394 |
else if (ret==ENext)
|
sl@0
|
395 |
Request();
|
sl@0
|
396 |
}
|
sl@0
|
397 |
|
sl@0
|
398 |
void CTestBase::StartTest(TInt aNum, TestDriver *aDriver)
|
sl@0
|
399 |
{
|
sl@0
|
400 |
iDriver=aDriver;
|
sl@0
|
401 |
iTestNum=aNum;
|
sl@0
|
402 |
LogWin->LogTest(iTitle,aNum);
|
sl@0
|
403 |
#if defined(LOG_TESTS)
|
sl@0
|
404 |
TLogMessageText buf;
|
sl@0
|
405 |
_LIT(ManNewTest,"MAN New Test %d: ");
|
sl@0
|
406 |
buf.AppendFormat(ManNewTest,aNum);
|
sl@0
|
407 |
buf.Append(iTitle);
|
sl@0
|
408 |
Client()->LogMessage(buf);
|
sl@0
|
409 |
#endif
|
sl@0
|
410 |
Request();
|
sl@0
|
411 |
}
|
sl@0
|
412 |
|
sl@0
|
413 |
void CTestBase::LogSubTest(const TDesC &aSubTitle,TInt aNum)
|
sl@0
|
414 |
{
|
sl@0
|
415 |
iSubTestNum=aNum;
|
sl@0
|
416 |
iSubTitle=aSubTitle;
|
sl@0
|
417 |
#if defined(LOG_TESTS)
|
sl@0
|
418 |
TLogMessageText buf;
|
sl@0
|
419 |
_LIT(ManSubTest,"MAN SubTest %d: ");
|
sl@0
|
420 |
buf.AppendFormat(ManSubTest,iSubTestNum);
|
sl@0
|
421 |
buf.Append(iSubTitle);
|
sl@0
|
422 |
Client()->LogMessage(buf);
|
sl@0
|
423 |
#endif
|
sl@0
|
424 |
}
|
sl@0
|
425 |
|
sl@0
|
426 |
void CTestBase::AbortL()
|
sl@0
|
427 |
{
|
sl@0
|
428 |
TestDriver *driver=iDriver;
|
sl@0
|
429 |
iDriver->DestroyTest();
|
sl@0
|
430 |
driver->TestComplete();
|
sl@0
|
431 |
User::Leave(ETestFailed);
|
sl@0
|
432 |
}
|
sl@0
|
433 |
|
sl@0
|
434 |
void CTestBase::TestL(TInt aCondition)
|
sl@0
|
435 |
{
|
sl@0
|
436 |
if (!aCondition || iFail)
|
sl@0
|
437 |
{
|
sl@0
|
438 |
iFail=EFalse;
|
sl@0
|
439 |
ErrorDialog *dialog=new ErrorDialog(this);
|
sl@0
|
440 |
if (dialog)
|
sl@0
|
441 |
{
|
sl@0
|
442 |
dialog->SetTitle(_L("Test failed"));
|
sl@0
|
443 |
dialog->SetNumButtons(2);
|
sl@0
|
444 |
dialog->SetButtonText(0,_L("Abort all tests"));
|
sl@0
|
445 |
dialog->SetButtonText(1,_L("Continue other tests"));
|
sl@0
|
446 |
dialog->ConstructLD(*Client()->iGroup,*Client()->iGc);
|
sl@0
|
447 |
dialog->Display();
|
sl@0
|
448 |
}
|
sl@0
|
449 |
User::Leave(ETestFailed);
|
sl@0
|
450 |
}
|
sl@0
|
451 |
}
|
sl@0
|
452 |
|
sl@0
|
453 |
void CTManScheduler::SetClient(TestClient *aClient)
|
sl@0
|
454 |
{
|
sl@0
|
455 |
iClient=aClient;
|
sl@0
|
456 |
}
|
sl@0
|
457 |
|
sl@0
|
458 |
void CTManScheduler::Error(TInt aError) const
|
sl@0
|
459 |
{
|
sl@0
|
460 |
TRAP_IGNORE(doErrorL(aError));
|
sl@0
|
461 |
CActiveScheduler::Stop();
|
sl@0
|
462 |
}
|
sl@0
|
463 |
|
sl@0
|
464 |
void CTManScheduler::doErrorL(TInt aError) const
|
sl@0
|
465 |
{
|
sl@0
|
466 |
CTDialog *dialog=new(ELeave) CTDialog();
|
sl@0
|
467 |
if (dialog)
|
sl@0
|
468 |
{
|
sl@0
|
469 |
TWindowTitle title;
|
sl@0
|
470 |
title.Format(TRefByValue<const TDesC>(_L("Error %d")),aError);
|
sl@0
|
471 |
dialog->SetTitle(title);
|
sl@0
|
472 |
dialog->SetNumButtons(1);
|
sl@0
|
473 |
dialog->SetButtonText(0,_L("Abort tests"));
|
sl@0
|
474 |
dialog->ConstructLD(*iClient->iGroup,*iClient->iGc);
|
sl@0
|
475 |
dialog->Display();
|
sl@0
|
476 |
}
|
sl@0
|
477 |
}
|
sl@0
|
478 |
|
sl@0
|
479 |
//
|
sl@0
|
480 |
|
sl@0
|
481 |
GLDEF_C CTClient *CreateClientL()
|
sl@0
|
482 |
{
|
sl@0
|
483 |
return(new(ELeave) TestClient());
|
sl@0
|
484 |
}
|
sl@0
|
485 |
|
sl@0
|
486 |
|
sl@0
|
487 |
GLDEF_C TInt E32Main()
|
sl@0
|
488 |
{
|
sl@0
|
489 |
return(TestLibStartUp(CreateClientL));
|
sl@0
|
490 |
}
|