103
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// General window tests
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
@test
|
|
21 |
@internalComponent - Internal Symbian test code
|
|
22 |
*/
|
|
23 |
|
|
24 |
#include "TWINDOW.H"
|
|
25 |
|
|
26 |
const TInt ENumCornerInsets=6;
|
|
27 |
const TInt corner0[ENumCornerInsets]={0,0,0,0,0,0};
|
|
28 |
const TInt corner1[ENumCornerInsets]={1,0,0,0,0,0};
|
|
29 |
const TInt corner2[ENumCornerInsets]={2,1,0,0,0,0};
|
|
30 |
const TInt corner3[ENumCornerInsets]={3,1,1,0,0,0};
|
|
31 |
const TInt corner5[ENumCornerInsets]={5,3,2,1,1,0};
|
|
32 |
const TInt KBaseUserEvent=61750; //0xF136 - a random number that is unlikely to be used by other applicaions for user event sending
|
|
33 |
|
|
34 |
//
|
|
35 |
|
|
36 |
CWinTestWindow::CWinTestWindow(TRgb aCol) : CBlankWindow(aCol)
|
|
37 |
{
|
|
38 |
}
|
|
39 |
|
|
40 |
CWinTestWindow::~CWinTestWindow()
|
|
41 |
{
|
|
42 |
delete iChild;
|
|
43 |
}
|
|
44 |
|
|
45 |
void CWinTestWindow::ConstructL(TPoint pos,TSize size,CTWinBase *aParent, CWindowGc &aGc, TInt aDepth)
|
|
46 |
{
|
|
47 |
iWin=RWindow(TheClient->iWs);
|
|
48 |
User::LeaveIfError(iWin.Construct(*(aParent->WinTreeNode()),ENullWsHandle));
|
|
49 |
SetExt(pos,size);
|
|
50 |
if (aDepth<3)
|
|
51 |
{
|
|
52 |
iChild=new(ELeave) CWinTestWindow(TRgb::Gray256(iCol.Gray256()+34));
|
|
53 |
size.iWidth-=8;
|
|
54 |
size.iHeight-=8;
|
|
55 |
iChild->ConstructL(TPoint(4,4),size,this,aGc,aDepth+1);
|
|
56 |
}
|
|
57 |
Activate();
|
|
58 |
AssignGC(aGc);
|
|
59 |
}
|
|
60 |
|
|
61 |
//
|
|
62 |
|
|
63 |
CEvWindowGroup* CEvWindowGroup::NewLC(CTClient* aClient,CTWsGraphicsBase* aTest)
|
|
64 |
{
|
|
65 |
CEvWindowGroup* self=new(ELeave) CEvWindowGroup(aClient,aTest);
|
|
66 |
CleanupStack::PushL(self);
|
|
67 |
self->ConstructL();
|
|
68 |
return self;
|
|
69 |
}
|
|
70 |
|
|
71 |
CEvWindowGroup::CEvWindowGroup(CTClient* aClient,CTWsGraphicsBase* aTest) : CTWindowGroup(aClient), iTest(aTest)
|
|
72 |
{}
|
|
73 |
|
|
74 |
void CEvWindowGroup::ConstructL()
|
|
75 |
{
|
|
76 |
CTWindowGroup::ConstructL();
|
|
77 |
iGroupWin.EnableReceiptOfFocus(EFalse);
|
|
78 |
}
|
|
79 |
|
|
80 |
void CEvWindowGroup::SetExpectedEvent(TInt aType)
|
|
81 |
{
|
|
82 |
iTest->TEST(!iExpectingEvent);
|
|
83 |
if (iExpectingEvent)
|
|
84 |
{
|
|
85 |
_LIT(KLog,"Setting expected event of type %d, when previouse event of type %d has not arrived (GpWinId=%d).");
|
|
86 |
iTest->LOG_MESSAGE4(KLog,aType,iExpectedEvent,iGroupWin.Identifier());
|
|
87 |
}
|
|
88 |
iExpectedEvent=aType;
|
|
89 |
iExpectingEvent=ETrue;
|
|
90 |
}
|
|
91 |
|
|
92 |
void CEvWindowGroup::SendEvent(TInt aType)
|
|
93 |
{
|
|
94 |
TWsEvent event;
|
|
95 |
event.SetType(aType);
|
|
96 |
iClient->iWs.SendEventToWindowGroup(iGroupWin.Identifier(),event);
|
|
97 |
SetExpectedEvent(aType);
|
|
98 |
iClient->Flush();
|
|
99 |
}
|
|
100 |
|
|
101 |
void CEvWindowGroup::UserEvent(TInt aEventType)
|
|
102 |
{
|
|
103 |
iTest->TEST(iExpectingEvent && iExpectedEvent==aEventType);
|
|
104 |
if (!iExpectingEvent || iExpectedEvent!=aEventType)
|
|
105 |
{
|
|
106 |
TInt id=iGroupWin.Identifier();
|
|
107 |
if (!iExpectingEvent)
|
|
108 |
{
|
|
109 |
_LIT(KLog,"Event of type %d recieved when not expecting an event (GpWinId=%d).");
|
|
110 |
iTest->LOG_MESSAGE3(KLog,aEventType,id);
|
|
111 |
}
|
|
112 |
else
|
|
113 |
{
|
|
114 |
_LIT(KLog,"Event of type %d when expecting an event of type %d (GpWinId=%d).");
|
|
115 |
iTest->LOG_MESSAGE4(KLog,aEventType,iExpectingEvent,id);
|
|
116 |
}
|
|
117 |
}
|
|
118 |
iExpectingEvent=EFalse;
|
|
119 |
}
|
|
120 |
|
|
121 |
//
|
|
122 |
|
|
123 |
CTWindowTest::CTWindowTest(CTestStep* aStep) : CTWsGraphicsBase(aStep)
|
|
124 |
{}
|
|
125 |
|
|
126 |
CTWindowTest::~CTWindowTest()
|
|
127 |
{
|
|
128 |
delete iWin;
|
|
129 |
}
|
|
130 |
|
|
131 |
void CTWindowTest::ConstructL()
|
|
132 |
{}
|
|
133 |
|
|
134 |
TInt CTWindowTest::MoveGroup(TAny* aParam)
|
|
135 |
{
|
|
136 |
RWsSession ws;
|
|
137 |
TInt err=ws.Connect();
|
|
138 |
if (err==KErrNone)
|
|
139 |
{
|
|
140 |
TInt command=static_cast<TWindowThreadParam*>(aParam)->iCommand;
|
|
141 |
err=ws.SetWindowGroupOrdinalPosition(command&EIdMask,(command&EPosMask)>>EPosShift);
|
|
142 |
ws.Finish();
|
|
143 |
ws.Close();
|
|
144 |
}
|
|
145 |
return err;
|
|
146 |
}
|
|
147 |
|
|
148 |
void CTWindowTest::CreateTestWindowL()
|
|
149 |
{
|
|
150 |
iWin=new(ELeave) CWinTestWindow(TRgb(0,0,0));
|
|
151 |
iWin->ConstructL(TPoint(1,1),TSize(TestWin->Size().iWidth/2,TestWin->Size().iHeight/2),TheClient->iGroup,*TheClient->iGc,0);
|
|
152 |
}
|
|
153 |
|
|
154 |
void CTWindowTest::DrawWindows(CWinTestWindow *aWin)
|
|
155 |
{
|
|
156 |
if (aWin->iChild)
|
|
157 |
DrawWindows(aWin->iChild);
|
|
158 |
aWin->Win()->BeginRedraw();
|
|
159 |
TheGc->Activate(*aWin->Win());
|
|
160 |
TheGc->DrawRect(TRect(aWin->Win()->Size()));
|
|
161 |
TheGc->Deactivate();
|
|
162 |
aWin->Win()->EndRedraw();
|
|
163 |
TheClient->iWs.Flush();
|
|
164 |
}
|
|
165 |
|
|
166 |
void CTWindowTest::CheckAndDestroyWindows()
|
|
167 |
{
|
|
168 |
DrawWindows(iWin);
|
|
169 |
delete iWin;
|
|
170 |
iWin=NULL;
|
|
171 |
}
|
|
172 |
|
|
173 |
void CTWindowTest::DestroyWindowWithActiveGc()
|
|
174 |
{
|
|
175 |
iWin->Win()->BeginRedraw();
|
|
176 |
TheGc->Activate(*iWin->Win());
|
|
177 |
delete iWin;
|
|
178 |
TheGc->Deactivate();
|
|
179 |
iWin=NULL;
|
|
180 |
}
|
|
181 |
|
|
182 |
void CTWindowTest::DestroyWindowWithActiveGc2L()
|
|
183 |
{
|
|
184 |
iWin->Win()->BeginRedraw();
|
|
185 |
TheGc->Activate(*iWin->Win());
|
|
186 |
CWindowGc *gc1=new(ELeave) CWindowGc(TheClient->iScreen);
|
|
187 |
CWindowGc *gc2=new(ELeave) CWindowGc(TheClient->iScreen);
|
|
188 |
CWindowGc *gc3=new(ELeave) CWindowGc(TheClient->iScreen);
|
|
189 |
gc1->Construct();
|
|
190 |
gc2->Construct();
|
|
191 |
gc3->Construct();
|
|
192 |
gc1->Activate(*iWin->Win());
|
|
193 |
gc2->Activate(*iWin->Win());
|
|
194 |
gc3->Activate(*iWin->Win());
|
|
195 |
delete iWin;
|
|
196 |
TheGc->Deactivate();
|
|
197 |
delete gc1;
|
|
198 |
delete gc2;
|
|
199 |
delete gc3;
|
|
200 |
iWin=NULL;
|
|
201 |
}
|
|
202 |
|
|
203 |
LOCAL_C TInt DoPanicTest(TInt aInt, TAny *aScreenNumber)
|
|
204 |
{
|
|
205 |
RWsSession ws;
|
|
206 |
User::LeaveIfError(ws.Connect());
|
|
207 |
// use correct screen
|
|
208 |
//
|
|
209 |
CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
|
|
210 |
User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
|
|
211 |
|
|
212 |
RWindowGroup group(ws);
|
|
213 |
group.Construct(888);
|
|
214 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
215 |
|
|
216 |
RWindow redraw(ws);
|
|
217 |
redraw.Construct(group,88);
|
|
218 |
|
|
219 |
RBackedUpWindow backedUp(ws);
|
|
220 |
backedUp.Construct(group,EGray16,99);
|
|
221 |
|
|
222 |
RBlankWindow blank(ws);
|
|
223 |
blank.Construct(group,111);
|
|
224 |
|
|
225 |
RWindowBase *base=NULL;
|
|
226 |
TInt source=aInt/10000;
|
|
227 |
TInt target=(aInt%10000)/100;
|
|
228 |
TInt panic=aInt%100;
|
|
229 |
switch(source)
|
|
230 |
{
|
|
231 |
case 0:
|
|
232 |
base= &redraw;
|
|
233 |
break;
|
|
234 |
case 1:
|
|
235 |
base= &backedUp;
|
|
236 |
break;
|
|
237 |
case 2:
|
|
238 |
base= ␣
|
|
239 |
break;
|
|
240 |
}
|
|
241 |
switch(target)
|
|
242 |
{
|
|
243 |
case 0:
|
|
244 |
{
|
|
245 |
RWindow *win=(RWindow *)base;
|
|
246 |
switch(panic)
|
|
247 |
{
|
|
248 |
case 0:
|
|
249 |
win->BeginRedraw();
|
|
250 |
break;
|
|
251 |
case 1:
|
|
252 |
ws.SetAutoFlush(ETrue);
|
|
253 |
win->BeginRedraw(TRect(0,0,1,1));
|
|
254 |
ws.SetAutoFlush(EFalse);
|
|
255 |
break;
|
|
256 |
case 2:
|
|
257 |
ws.SetAutoFlush(ETrue);
|
|
258 |
win->EndRedraw();
|
|
259 |
ws.SetAutoFlush(EFalse);
|
|
260 |
break;
|
|
261 |
case 3:
|
|
262 |
win->Invalidate();
|
|
263 |
break;
|
|
264 |
case 4:
|
|
265 |
win->Invalidate(TRect(0,0,1,1));
|
|
266 |
break;
|
|
267 |
case 5:
|
|
268 |
{
|
|
269 |
RRegion region;
|
|
270 |
win->GetInvalidRegion(region);
|
|
271 |
}
|
|
272 |
break;
|
|
273 |
case 6:
|
|
274 |
win->SetBackgroundColor(TRgb(0,0,0));
|
|
275 |
break;
|
|
276 |
case 7:
|
|
277 |
return(EWsExitReasonFinished);
|
|
278 |
}
|
|
279 |
break;
|
|
280 |
}
|
|
281 |
case 1:
|
|
282 |
{
|
|
283 |
RBackedUpWindow *win=(RBackedUpWindow *)base;
|
|
284 |
switch(panic)
|
|
285 |
{
|
|
286 |
case 0:
|
|
287 |
win->BitmapHandle();
|
|
288 |
break;
|
|
289 |
case 1:
|
|
290 |
win->UpdateScreen();
|
|
291 |
break;
|
|
292 |
case 2:
|
|
293 |
win->UpdateScreen(TRegionFix<1>(TRect(10,10,20,20)));
|
|
294 |
break;
|
|
295 |
case 3:
|
|
296 |
win->UpdateBackupBitmap();
|
|
297 |
break;
|
|
298 |
case 4:
|
|
299 |
win->MaintainBackup();
|
|
300 |
break;
|
|
301 |
case 5:
|
|
302 |
return(EWsExitReasonFinished);
|
|
303 |
}
|
|
304 |
break;
|
|
305 |
}
|
|
306 |
case 2:
|
|
307 |
{
|
|
308 |
RBlankWindow *win=(RBlankWindow *)base;
|
|
309 |
switch(panic)
|
|
310 |
{
|
|
311 |
case 0:
|
|
312 |
win->SetColor(TRgb(0));
|
|
313 |
break;
|
|
314 |
case 1:
|
|
315 |
return(EWsExitReasonFinished);
|
|
316 |
}
|
|
317 |
break;
|
|
318 |
}
|
|
319 |
}
|
|
320 |
ws.Flush();
|
|
321 |
return(EWsExitReasonBad); // Should never get here, but it's baaddd if it does
|
|
322 |
}
|
|
323 |
|
|
324 |
struct TWsLocalStructure
|
|
325 |
{
|
|
326 |
TInt xPos;
|
|
327 |
TInt yPos;
|
|
328 |
TInt Length;
|
|
329 |
TAny *ptr;
|
|
330 |
};
|
|
331 |
|
|
332 |
LOCAL_C TInt DoPanicTest2(TInt aInt, TAny *aScreenNumber)
|
|
333 |
{
|
|
334 |
RWsSession ws;
|
|
335 |
User::LeaveIfError(ws.Connect());
|
|
336 |
//
|
|
337 |
CWsScreenDevice *screen=new(ELeave) CWsScreenDevice(ws);
|
|
338 |
screen->Construct((TInt)aScreenNumber);
|
|
339 |
//
|
|
340 |
RWindowGroup group(ws);
|
|
341 |
group.Construct(999);
|
|
342 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
343 |
|
|
344 |
RWindow win(ws);
|
|
345 |
win.Construct(group,122);
|
|
346 |
win.Activate();
|
|
347 |
|
|
348 |
switch(aInt)
|
|
349 |
{
|
|
350 |
case 0:
|
|
351 |
{
|
|
352 |
win.BeginRedraw();
|
|
353 |
CWindowGc *gc;
|
|
354 |
screen->CreateContext(gc);
|
|
355 |
gc->Activate(win);
|
|
356 |
CFbsFont *font;
|
|
357 |
screen->GetNearestFontToDesignHeightInTwips((CFont *&)font,TFontSpec());
|
|
358 |
gc->UseFont(font);
|
|
359 |
TWsLocalStructure params;
|
|
360 |
params.xPos=0;
|
|
361 |
params.yPos=0;
|
|
362 |
params.Length=1;
|
|
363 |
TPckgC<TWsLocalStructure> pkg(params);
|
|
364 |
TPtr8 ptr(NULL,10,10);
|
|
365 |
ws.TestWriteReplyByProvidingRemoteReadAccess(gc->WsHandle(),EWsGcOpDrawTextPtr,pkg,ptr); // Bad source descriptor
|
|
366 |
}
|
|
367 |
break;
|
|
368 |
case 1:
|
|
369 |
{
|
|
370 |
TPtr8 bad(NULL,0); // Bad descriptor
|
|
371 |
ws.TestWriteReplyP(win.WsHandle(),EWsWinOpSize,NULL,0,&bad); // Bad descriptor
|
|
372 |
}
|
|
373 |
break;
|
|
374 |
case 2:
|
|
375 |
{
|
|
376 |
TSize size;
|
|
377 |
TPtr8 bad((TUint8 *)&size,4,4); // Short descriptor
|
|
378 |
ws.TestWriteReplyP(win.WsHandle(),EWsWinOpSize,NULL,0,&bad); // Short descriptor
|
|
379 |
}
|
|
380 |
break;
|
|
381 |
case 3:
|
|
382 |
win.EnablePointerMoveBuffer();
|
|
383 |
break;
|
|
384 |
case 4:
|
|
385 |
{
|
|
386 |
RBackedUpWindow backup(ws);
|
|
387 |
backup.Construct(group,EGray16,123);
|
|
388 |
backup.Activate();
|
|
389 |
backup.SetRequiredDisplayMode(EGray16);
|
|
390 |
}
|
|
391 |
break;
|
|
392 |
default:
|
|
393 |
return(EWsExitReasonFinished);
|
|
394 |
}
|
|
395 |
ws.Flush();
|
|
396 |
return(EWsExitReasonBad); // Should never get here, but it's baaddd if it does
|
|
397 |
}
|
|
398 |
|
|
399 |
LOCAL_C TInt CallWindowFuction(RWindowTreeNode* aWin,TInt aWinType,TInt aFunc,RWsSession aWs)
|
|
400 |
{
|
|
401 |
switch(aWinType)
|
|
402 |
{
|
|
403 |
case 0: //Call functions from RWindowTreeNode
|
|
404 |
{
|
|
405 |
RWindowTreeNode* win=aWin;
|
|
406 |
switch(aFunc)
|
|
407 |
{
|
|
408 |
case 0:
|
|
409 |
win->OrdinalPosition();
|
|
410 |
break;
|
|
411 |
case 1:
|
|
412 |
win->SetOrdinalPosition(1);
|
|
413 |
break;
|
|
414 |
case 2:
|
|
415 |
win->SetOrdinalPosition(1,2);
|
|
416 |
break;
|
|
417 |
case 3:
|
|
418 |
win->FullOrdinalPosition();
|
|
419 |
break;
|
|
420 |
case 4:
|
|
421 |
win->Parent();
|
|
422 |
break;
|
|
423 |
case 5:
|
|
424 |
win->PrevSibling();
|
|
425 |
break;
|
|
426 |
case 6:
|
|
427 |
win->SetFaded(0,RWindowTreeNode::EFadeIncludeChildren);
|
|
428 |
break;
|
|
429 |
case 7:
|
|
430 |
win->WindowGroupId();
|
|
431 |
break;
|
|
432 |
//The following can be called on a window with no parent without panicking
|
|
433 |
case 8:
|
|
434 |
win->ClearPointerCursor();
|
|
435 |
break;
|
|
436 |
case 9:
|
|
437 |
win->ClientHandle();
|
|
438 |
break;
|
|
439 |
case 10:
|
|
440 |
win->DisableErrorMessages();
|
|
441 |
break;
|
|
442 |
case 11:
|
|
443 |
win->DisableFocusChangeEvents();
|
|
444 |
break;
|
|
445 |
case 12:
|
|
446 |
win->DisableGroupChangeEvents();
|
|
447 |
break;
|
|
448 |
case 13:
|
|
449 |
win->DisableGroupListChangeEvents();
|
|
450 |
break;
|
|
451 |
case 14:
|
|
452 |
win->DisableModifierChangedEvents();
|
|
453 |
break;
|
|
454 |
case 15:
|
|
455 |
win->DisableOnEvents();
|
|
456 |
break;
|
|
457 |
case 16:
|
|
458 |
win->DisableVisibilityChangeEvents();
|
|
459 |
break;
|
|
460 |
case 17:
|
|
461 |
win->EnableErrorMessages(EEventControlAlways);
|
|
462 |
break;
|
|
463 |
case 18:
|
|
464 |
win->EnableFocusChangeEvents();
|
|
465 |
break;
|
|
466 |
case 19:
|
|
467 |
win->EnableGroupChangeEvents();
|
|
468 |
break;
|
|
469 |
case 20:
|
|
470 |
win->EnableGroupListChangeEvents();
|
|
471 |
break;
|
|
472 |
case 21:
|
|
473 |
win->EnableModifierChangedEvents(0,EEventControlAlways);
|
|
474 |
break;
|
|
475 |
case 22:
|
|
476 |
win->EnableVisibilityChangeEvents();
|
|
477 |
break;
|
|
478 |
case 23:
|
|
479 |
win->NextSibling();
|
|
480 |
break;
|
|
481 |
case 24:
|
|
482 |
win->OrdinalPriority();
|
|
483 |
break;
|
|
484 |
case 25:
|
|
485 |
win->SetNonFading(0);
|
|
486 |
break;
|
|
487 |
case 26:
|
|
488 |
win->SetPointerCursor(0);
|
|
489 |
break;
|
|
490 |
case 27:
|
|
491 |
win->Child();
|
|
492 |
break;
|
|
493 |
case 28:
|
|
494 |
return(EWsExitReasonFinished);
|
|
495 |
default:;
|
|
496 |
}
|
|
497 |
}
|
|
498 |
break;
|
|
499 |
case 1: //Call functions from RWindowGroup
|
|
500 |
{
|
|
501 |
RWindowGroup* win=(RWindowGroup*)aWin;
|
|
502 |
switch(aFunc)
|
|
503 |
{
|
|
504 |
case 0:
|
|
505 |
win->EnableReceiptOfFocus(ETrue);
|
|
506 |
break;
|
|
507 |
case 1:
|
|
508 |
win->AutoForeground(ETrue);
|
|
509 |
break;
|
|
510 |
case 2:
|
|
511 |
win->SetOrdinalPriorityAdjust(5);
|
|
512 |
break;
|
|
513 |
case 3:
|
|
514 |
win->CaptureKey(20,0,0);
|
|
515 |
break;
|
|
516 |
case 4:
|
|
517 |
win->CaptureKeyUpAndDowns(20,0,0);
|
|
518 |
break;
|
|
519 |
case 5:
|
|
520 |
case 6:
|
|
521 |
{
|
|
522 |
RWindowGroup group(aWs);
|
|
523 |
group.Construct(876);
|
|
524 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
525 |
if (aFunc==5)
|
|
526 |
win->CancelCaptureKey(group.CaptureKey(20,0,0));
|
|
527 |
else
|
|
528 |
win->CancelCaptureKeyUpAndDowns(group.CaptureKeyUpAndDowns(20,0,0));
|
|
529 |
}
|
|
530 |
break;
|
|
531 |
case 7:
|
|
532 |
win->AddPriorityKey(20,0,0);
|
|
533 |
break;
|
|
534 |
case 8:
|
|
535 |
win->RemovePriorityKey(20,0,0);
|
|
536 |
break;
|
|
537 |
case 9:
|
|
538 |
case 10:
|
|
539 |
{
|
|
540 |
RWindowGroup group(aWs);
|
|
541 |
group.Construct(765);
|
|
542 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
543 |
RWindow window(aWs);
|
|
544 |
window.Construct(group,79);
|
|
545 |
if (aFunc==9)
|
|
546 |
win->SetTextCursor(window,TPoint(45,46),TTextCursor());
|
|
547 |
else
|
|
548 |
win->SetTextCursor(window,TPoint(55,66),TTextCursor(),TRect(TSize(5,8)));
|
|
549 |
}
|
|
550 |
break;
|
|
551 |
case 11:
|
|
552 |
win->CancelTextCursor();
|
|
553 |
break;
|
|
554 |
case 12:
|
|
555 |
win->SetOwningWindowGroup(456);
|
|
556 |
break;
|
|
557 |
case 13:
|
|
558 |
win->DefaultOwningWindow();
|
|
559 |
break;
|
|
560 |
case 14:
|
|
561 |
{
|
|
562 |
TBufC<8> text(_L("abcdef"));
|
|
563 |
win->SetName(text);
|
|
564 |
}
|
|
565 |
break;
|
|
566 |
case 15:
|
|
567 |
{
|
|
568 |
TBuf<16> text;
|
|
569 |
User::LeaveIfError(win->Name(text));
|
|
570 |
}
|
|
571 |
break;
|
|
572 |
case 16:
|
|
573 |
win->Identifier();
|
|
574 |
break;
|
|
575 |
case 17:
|
|
576 |
win->DisableKeyClick(ETrue);
|
|
577 |
break;
|
|
578 |
case 18:
|
|
579 |
/*{
|
|
580 |
TPtr8 text(NULL,0);
|
|
581 |
TUid uid;
|
|
582 |
User::LeaveIfError(win->FetchMessage(uid,text));
|
|
583 |
}*/
|
|
584 |
win->Identifier();
|
|
585 |
break;
|
|
586 |
case 19:
|
|
587 |
User::LeaveIfError(win->EnableScreenChangeEvents());
|
|
588 |
break;
|
|
589 |
case 20:
|
|
590 |
win->EnableScreenChangeEvents();
|
|
591 |
break;
|
|
592 |
case 21:
|
|
593 |
win->DisableScreenChangeEvents();
|
|
594 |
break;
|
|
595 |
case 22:
|
|
596 |
win->SimulatePointerEvent(TRawEvent());
|
|
597 |
break;
|
|
598 |
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
|
|
599 |
case 23:
|
|
600 |
win->SimulateAdvancedPointerEvent(TRawEvent());
|
|
601 |
break;
|
|
602 |
case 24:
|
|
603 |
return(EWsExitReasonFinished);
|
|
604 |
#else
|
|
605 |
case 23:
|
|
606 |
return(EWsExitReasonFinished);
|
|
607 |
#endif
|
|
608 |
default:;
|
|
609 |
}
|
|
610 |
}
|
|
611 |
break;
|
|
612 |
case 2: //Call functions from RWindowBase
|
|
613 |
{
|
|
614 |
RWindowBase* win=(RWindowBase*)aWin;
|
|
615 |
switch(aFunc)
|
|
616 |
{
|
|
617 |
case 0:
|
|
618 |
win->SetPosition(TPoint(7,8));
|
|
619 |
break;
|
|
620 |
case 1:
|
|
621 |
User::LeaveIfError(win->SetSizeErr(TSize(21,22)));
|
|
622 |
break;
|
|
623 |
case 2:
|
|
624 |
User::LeaveIfError(win->SetExtentErr(TPoint(8,9),TSize(21,22)));
|
|
625 |
break;
|
|
626 |
case 3:
|
|
627 |
win->ClaimPointerGrab();
|
|
628 |
break;
|
|
629 |
case 4:
|
|
630 |
win->SetVisible(ETrue);
|
|
631 |
break;
|
|
632 |
case 5:
|
|
633 |
win->EnableBackup();
|
|
634 |
break;
|
|
635 |
case 6:
|
|
636 |
win->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect());
|
|
637 |
break;
|
|
638 |
case 7:
|
|
639 |
win->PasswordWindow(EPasswordCancel);
|
|
640 |
break;
|
|
641 |
case 8:
|
|
642 |
win->FadeBehind(ETrue);
|
|
643 |
break;
|
|
644 |
//These can all be called on a window with no parent without panicking
|
|
645 |
case 9:
|
|
646 |
win->SetVisible(EFalse);
|
|
647 |
break;
|
|
648 |
case 10:
|
|
649 |
{
|
|
650 |
RWindowGroup group(aWs);
|
|
651 |
group.Construct(567);
|
|
652 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
653 |
RWindow window(aWs);
|
|
654 |
window.Construct(group,97);
|
|
655 |
win->InquireOffset(window);
|
|
656 |
}
|
|
657 |
break;
|
|
658 |
case 11:
|
|
659 |
win->PointerFilter(0,0);
|
|
660 |
break;
|
|
661 |
case 12:
|
|
662 |
win->SetPointerGrab(ETrue);
|
|
663 |
break;
|
|
664 |
case 13:
|
|
665 |
win->SetPointerCapture(0);
|
|
666 |
break;
|
|
667 |
case 14:
|
|
668 |
win->Size();
|
|
669 |
break;
|
|
670 |
case 15:
|
|
671 |
win->Position();
|
|
672 |
break;
|
|
673 |
case 16:
|
|
674 |
User::LeaveIfError(win->SetCornerType(EWindowCorner5,0));
|
|
675 |
break;
|
|
676 |
case 17:
|
|
677 |
{
|
|
678 |
TRegionFix<3> region;
|
|
679 |
User::LeaveIfError(win->SetShape(region));
|
|
680 |
}
|
|
681 |
break;
|
|
682 |
case 18:
|
|
683 |
User::LeaveIfError(win->SetRequiredDisplayMode(EColor16));
|
|
684 |
break;
|
|
685 |
case 19:
|
|
686 |
win->DisplayMode();
|
|
687 |
break;
|
|
688 |
case 20:
|
|
689 |
win->CancelPointerRepeatEventRequest();
|
|
690 |
break;
|
|
691 |
case 21:
|
|
692 |
win->AllocPointerMoveBuffer(10,0);
|
|
693 |
break;
|
|
694 |
case 22:
|
|
695 |
win->FreePointerMoveBuffer();
|
|
696 |
break;
|
|
697 |
case 23:
|
|
698 |
win->DisablePointerMoveBuffer();
|
|
699 |
break;
|
|
700 |
case 24:
|
|
701 |
{
|
|
702 |
TBuf8<16> buf;
|
|
703 |
win->RetrievePointerMoveBuffer(buf);
|
|
704 |
}
|
|
705 |
break;
|
|
706 |
case 25:
|
|
707 |
win->DiscardPointerMoveBuffer();
|
|
708 |
break;
|
|
709 |
case 26:
|
|
710 |
User::LeaveIfError(win->AddKeyRect(TRect(TSize(10,10)),20,ETrue));
|
|
711 |
break;
|
|
712 |
case 27:
|
|
713 |
win->RemoveAllKeyRects();
|
|
714 |
break;
|
|
715 |
case 28:
|
|
716 |
win->EnablePointerMoveBuffer();
|
|
717 |
break;
|
|
718 |
case 29:
|
|
719 |
return(EWsExitReasonFinished);
|
|
720 |
default:;
|
|
721 |
}
|
|
722 |
}
|
|
723 |
break;
|
|
724 |
case 3: //Call functions from RDrawableWindow
|
|
725 |
{
|
|
726 |
RDrawableWindow* win=(RDrawableWindow*)aWin;
|
|
727 |
switch(aFunc)
|
|
728 |
{
|
|
729 |
//The following can be called on a window with no parent without panicking
|
|
730 |
case 0:
|
|
731 |
win->Scroll(TPoint(7,8));
|
|
732 |
break;
|
|
733 |
case 1:
|
|
734 |
win->Scroll(TRect(9,10,11,12),TPoint(13,14));
|
|
735 |
break;
|
|
736 |
case 2:
|
|
737 |
win->Scroll(TPoint(15,16),TRect(17,18,19,20));
|
|
738 |
break;
|
|
739 |
case 3:
|
|
740 |
win->Scroll(TRect(21,22,23,24),TPoint(25,26),TRect(27,28,29,30));
|
|
741 |
break;
|
|
742 |
case 4:
|
|
743 |
return(EWsExitReasonFinished);
|
|
744 |
default:;
|
|
745 |
}
|
|
746 |
}
|
|
747 |
break;
|
|
748 |
case 4: //Call functions from RBlankWindow
|
|
749 |
{
|
|
750 |
RBlankWindow* win=(RBlankWindow*)aWin;
|
|
751 |
switch(aFunc)
|
|
752 |
{
|
|
753 |
case 0:
|
|
754 |
win->SetSize(TSize(7,8));
|
|
755 |
break;
|
|
756 |
case 1:
|
|
757 |
win->SetExtent(TPoint(27,28),TSize(17,18));
|
|
758 |
break;
|
|
759 |
//The following function can be called on a window with no parent without panicking
|
|
760 |
case 2:
|
|
761 |
win->SetColor(TRgb::Gray4(2));
|
|
762 |
break;
|
|
763 |
case 3:
|
|
764 |
return(EWsExitReasonFinished);
|
|
765 |
default:;
|
|
766 |
}
|
|
767 |
}
|
|
768 |
break;
|
|
769 |
case 5: //Call functions from RWindow
|
|
770 |
{
|
|
771 |
RWindow* win=(RWindow*)aWin;
|
|
772 |
switch(aFunc)
|
|
773 |
{
|
|
774 |
case 0:
|
|
775 |
win->BeginRedraw();
|
|
776 |
break;
|
|
777 |
case 1:
|
|
778 |
aWs.SetAutoFlush(ETrue);
|
|
779 |
win->BeginRedraw(TRect(31,32,43,44));
|
|
780 |
aWs.SetAutoFlush(EFalse);
|
|
781 |
break;
|
|
782 |
case 2:
|
|
783 |
win->SetSize(TSize(5,6));
|
|
784 |
break;
|
|
785 |
case 3:
|
|
786 |
win->SetExtent(TPoint(25,26),TSize(15,16));
|
|
787 |
break;
|
|
788 |
//The following can be called on a window with no parent without panicking
|
|
789 |
case 4:
|
|
790 |
win->Invalidate();
|
|
791 |
break;
|
|
792 |
case 5:
|
|
793 |
win->Invalidate(TRect(51,52,63,64));
|
|
794 |
break;
|
|
795 |
case 6: //These ones don't panic
|
|
796 |
aWs.SetAutoFlush(ETrue);
|
|
797 |
win->EndRedraw();
|
|
798 |
aWs.SetAutoFlush(EFalse);
|
|
799 |
break;
|
|
800 |
case 7:
|
|
801 |
{
|
|
802 |
RRegion region;
|
|
803 |
win->GetInvalidRegion(region);
|
|
804 |
}
|
|
805 |
break;
|
|
806 |
case 8:
|
|
807 |
win->SetBackgroundColor(TRgb::Gray4(1));
|
|
808 |
break;
|
|
809 |
case 9:
|
|
810 |
win->SetBackgroundColor();
|
|
811 |
break;
|
|
812 |
case 10:
|
|
813 |
return(EWsExitReasonFinished);
|
|
814 |
default:;
|
|
815 |
}
|
|
816 |
}
|
|
817 |
break;
|
|
818 |
case 6: //Call functions from RBackedUpWindow
|
|
819 |
{
|
|
820 |
RBackedUpWindow* win=(RBackedUpWindow*)aWin;
|
|
821 |
switch(aFunc) //None of these functions panic
|
|
822 |
{
|
|
823 |
//The following can be called on a window with no parent without panicking
|
|
824 |
case 0:
|
|
825 |
win->BitmapHandle();
|
|
826 |
break;
|
|
827 |
case 1:
|
|
828 |
win->UpdateBackupBitmap();
|
|
829 |
break;
|
|
830 |
case 2:
|
|
831 |
win->MaintainBackup();
|
|
832 |
break;
|
|
833 |
case 3:
|
|
834 |
win->UpdateScreen();
|
|
835 |
break;
|
|
836 |
case 4:
|
|
837 |
win->UpdateScreen(TRegionFix<1>(TRect(1,1,22,22)));
|
|
838 |
break;
|
|
839 |
case 5:
|
|
840 |
return(EWsExitReasonFinished);
|
|
841 |
default:;
|
|
842 |
}
|
|
843 |
}
|
|
844 |
break;
|
|
845 |
}
|
|
846 |
aWs.Flush();
|
|
847 |
return(EWsExitReasonBad); // Should never get here, but it's baaddd if it does
|
|
848 |
}
|
|
849 |
|
|
850 |
LOCAL_C TInt DoPanicTest3(TInt aInt, TAny *aScreenNumber)
|
|
851 |
{
|
|
852 |
TInt winType=aInt/CTWindowTest::EWinTypeFactor;
|
|
853 |
TInt func=aInt%CTWindowTest::EWinTypeFactor;
|
|
854 |
RWsSession ws;
|
|
855 |
User::LeaveIfError(ws.Connect());
|
|
856 |
// use correct screen
|
|
857 |
//
|
|
858 |
CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
|
|
859 |
User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
|
|
860 |
|
|
861 |
RWindowGroup group(ws);
|
|
862 |
group.Construct(888);
|
|
863 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
864 |
RWindow window(ws);
|
|
865 |
window.Construct(group,789);
|
|
866 |
RWindowTreeNode* win;
|
|
867 |
if (winType==1)
|
|
868 |
win=&window;
|
|
869 |
else
|
|
870 |
win=&group;
|
|
871 |
|
|
872 |
return CallWindowFuction(win,winType,func,ws);
|
|
873 |
}
|
|
874 |
|
|
875 |
//PanicTestNoPanic
|
|
876 |
//This function is called from DoPanicTest4 for window functions that should run without
|
|
877 |
//panicking the user thread if its parent has been deleted.
|
|
878 |
TInt PanicTestNoPanic(RWindowTreeNode* aWin,TInt aWinType,TInt aFunc,RWsSession aWs,const TInt* const aFuncToSkip)
|
|
879 |
{
|
|
880 |
TInt funcReturn;
|
|
881 |
for(;;)
|
|
882 |
{
|
|
883 |
if (aFuncToSkip && *aFuncToSkip == aFunc)
|
|
884 |
{
|
|
885 |
aFunc++;
|
|
886 |
}
|
|
887 |
funcReturn = CallWindowFuction(aWin,aWinType,aFunc,aWs);
|
|
888 |
if (funcReturn==EWsExitReasonBad)
|
|
889 |
{
|
|
890 |
aFunc++;
|
|
891 |
}
|
|
892 |
else if (funcReturn==EWsExitReasonFinished)
|
|
893 |
{
|
|
894 |
return EWsExitReasonFinished;
|
|
895 |
}
|
|
896 |
else
|
|
897 |
{
|
|
898 |
return EWsExitReasonBad;
|
|
899 |
}
|
|
900 |
}
|
|
901 |
}
|
|
902 |
|
|
903 |
LOCAL_C TInt DoPanicTest4(TInt aInt, TAny *aScreenNumber)
|
|
904 |
{
|
|
905 |
TInt winType=aInt/CTWindowTest::EWinTypeFactor;
|
|
906 |
TInt func=aInt%CTWindowTest::EWinTypeFactor;
|
|
907 |
RWsSession ws;
|
|
908 |
User::LeaveIfError(ws.Connect());
|
|
909 |
// use correct screen
|
|
910 |
//
|
|
911 |
CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
|
|
912 |
User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
|
|
913 |
|
|
914 |
RWindowGroup group(ws);
|
|
915 |
group.Construct(234);
|
|
916 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
917 |
RWindow window(ws);
|
|
918 |
window.Construct(group,897);
|
|
919 |
RBackedUpWindow backedUp(ws);
|
|
920 |
backedUp.Construct(group,EGray16,98);
|
|
921 |
RBlankWindow blank(ws);
|
|
922 |
blank.Construct(group,169);
|
|
923 |
RWindowTreeNode* win=&window;
|
|
924 |
switch (winType)
|
|
925 |
{
|
|
926 |
case 0:
|
|
927 |
{
|
|
928 |
if (func > 8) //if a func 8+ had panicked, fail the test
|
|
929 |
{
|
|
930 |
return EWsExitReasonBad;
|
|
931 |
}
|
|
932 |
else if (func==8)
|
|
933 |
{
|
|
934 |
group.Close();
|
|
935 |
return PanicTestNoPanic(win,winType,func,ws,NULL);
|
|
936 |
}
|
|
937 |
}
|
|
938 |
break;
|
|
939 |
case 2:
|
|
940 |
{
|
|
941 |
if (func>9) //if a func 9+ had panicked, fail the test
|
|
942 |
{
|
|
943 |
return EWsExitReasonBad;
|
|
944 |
}
|
|
945 |
else if (func==9) //set window visible so that SetVisible(EFalse) (func 9) would crash before fix
|
|
946 |
{
|
|
947 |
window.SetVisible(ETrue);
|
|
948 |
ws.Flush();
|
|
949 |
group.Close();
|
|
950 |
TInt funcToSkip = 28; //this call needs to have already successfully allocated a pointer cursor
|
|
951 |
return PanicTestNoPanic(win,winType,func,ws,&funcToSkip);
|
|
952 |
}
|
|
953 |
}
|
|
954 |
break;
|
|
955 |
case 4:
|
|
956 |
{
|
|
957 |
win=␣
|
|
958 |
if (func>2) //if a func 2+ had panicked, fail the test
|
|
959 |
{
|
|
960 |
return EWsExitReasonBad;
|
|
961 |
}
|
|
962 |
else if (func==2)
|
|
963 |
{
|
|
964 |
group.Close();
|
|
965 |
return PanicTestNoPanic(win,winType,func,ws,NULL);
|
|
966 |
}
|
|
967 |
}
|
|
968 |
break;
|
|
969 |
case 5:
|
|
970 |
{
|
|
971 |
if (func>6) //if a func 4+ had panicked, fail the test
|
|
972 |
{
|
|
973 |
return EWsExitReasonBad;
|
|
974 |
}
|
|
975 |
else if (func==4 || func==5)
|
|
976 |
{
|
|
977 |
if (CallWindowFuction(win,winType,func,ws)==EWsExitReasonBad)
|
|
978 |
{
|
|
979 |
func = 1;
|
|
980 |
}
|
|
981 |
else
|
|
982 |
{
|
|
983 |
return EWsExitReasonBad;
|
|
984 |
}
|
|
985 |
}
|
|
986 |
else if (func==6)
|
|
987 |
{
|
|
988 |
group.Close();
|
|
989 |
TInt funcToSkip = 6; //Skip the call to EndRedraw in CallWindowFunction, it is not safe to call it on Window casts.
|
|
990 |
return PanicTestNoPanic(win,winType,func,ws,&funcToSkip);
|
|
991 |
}
|
|
992 |
}
|
|
993 |
break;
|
|
994 |
case 6:
|
|
995 |
{
|
|
996 |
win=&backedUp;
|
|
997 |
if (func>0)
|
|
998 |
return EWsExitReasonBad;
|
|
999 |
else //if (func==0)
|
|
1000 |
{
|
|
1001 |
TInt end=2;
|
|
1002 |
while (func==0)
|
|
1003 |
{
|
|
1004 |
group.Close();
|
|
1005 |
while (CallWindowFuction(win,winType,func,ws)==EWsExitReasonBad && ++func<end)
|
|
1006 |
{}
|
|
1007 |
if (func==end && end==2)
|
|
1008 |
{
|
|
1009 |
func=0;
|
|
1010 |
end=4;
|
|
1011 |
}
|
|
1012 |
}
|
|
1013 |
if (func==end)
|
|
1014 |
return EWsExitReasonFinished;
|
|
1015 |
else
|
|
1016 |
return EWsExitReasonBad;
|
|
1017 |
}
|
|
1018 |
}
|
|
1019 |
/*break;*/
|
|
1020 |
default:;
|
|
1021 |
}
|
|
1022 |
group.Close();
|
|
1023 |
return CallWindowFuction(win,winType,func,ws);
|
|
1024 |
}
|
|
1025 |
|
|
1026 |
LOCAL_C TInt DoPanicTest5(TInt aTest, TAny *aScreenNumber)
|
|
1027 |
{
|
|
1028 |
RWsSession ws;
|
|
1029 |
User::LeaveIfError(ws.Connect());
|
|
1030 |
|
|
1031 |
CWsScreenDevice *scrDev=new(ELeave) CWsScreenDevice(ws);
|
|
1032 |
scrDev->Construct((TInt)aScreenNumber);
|
|
1033 |
|
|
1034 |
RWindowGroup group(ws);
|
|
1035 |
group.Construct(235);
|
|
1036 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
1037 |
RWindow window(ws);
|
|
1038 |
window.Construct(group,896);
|
|
1039 |
CWindowGc *gc=new(ELeave) CWindowGc(scrDev);
|
|
1040 |
gc->Construct();
|
|
1041 |
gc->Activate(window);
|
|
1042 |
group.Close();
|
|
1043 |
switch (aTest)
|
|
1044 |
{
|
|
1045 |
case 0:
|
|
1046 |
gc->Deactivate();
|
|
1047 |
gc->Activate(window);
|
|
1048 |
break;
|
|
1049 |
case 1:
|
|
1050 |
gc->DrawLine(TPoint(0,0),TPoint(10,10));
|
|
1051 |
break;
|
|
1052 |
default:
|
|
1053 |
return(EWsExitReasonFinished);
|
|
1054 |
}
|
|
1055 |
ws.Flush();
|
|
1056 |
return(EWsExitReasonBad); // Should never get here, but it's baaddd if it does
|
|
1057 |
}
|
|
1058 |
|
|
1059 |
#if defined(_DEBUG)
|
|
1060 |
LOCAL_C TInt DoPanicTest6(TInt /*aInt*/, TAny *aScreenNumber)
|
|
1061 |
{
|
|
1062 |
RWsSession ws;
|
|
1063 |
User::LeaveIfError(ws.Connect());
|
|
1064 |
RWindowGroup group1(ws);
|
|
1065 |
CWsScreenDevice* screen=new(ELeave) CWsScreenDevice(ws);
|
|
1066 |
User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
|
|
1067 |
group1.Construct(123456,ETrue,screen);
|
|
1068 |
RWindowGroup group2(ws);
|
|
1069 |
group2.Construct(123456,ETrue,screen); // Should panic client here
|
|
1070 |
return(EWsExitReasonBad); // Should never get here
|
|
1071 |
}
|
|
1072 |
#endif
|
|
1073 |
|
|
1074 |
void CTWindowTest::TestInvalidFunctionsL()
|
|
1075 |
//
|
|
1076 |
// This code casts windows to be different types and then sends messages for the 'cast' that
|
|
1077 |
// should not be sent to the original type of window. These should all result in panics
|
|
1078 |
//
|
|
1079 |
{
|
|
1080 |
static TClientPanic PanicCode[]={EWservPanicDescriptor,EWservPanicDescriptor,EWservPanicDescriptor,
|
|
1081 |
EWservPanicNoPointerBuffer,EWservPanicBackupDisplayMode,
|
|
1082 |
EWservPanicNoFont}; // Dummy end value to catch out overflowing the array
|
|
1083 |
INFO_PRINTF1(_L("AUTO Test Invalid Functions "));
|
|
1084 |
INFO_PRINTF1(_L(" Opcode Panics"));
|
|
1085 |
|
|
1086 |
for (TInt source=0;source<3;source++)
|
|
1087 |
for (TInt target=0;target<3;target++)
|
|
1088 |
if (source!=target)
|
|
1089 |
for (TInt panic=0;;panic++)
|
|
1090 |
{
|
|
1091 |
TBool testFinished=EFalse;
|
|
1092 |
TEST(iTest->TestWsPanicL(DoPanicTest,EWservPanicOpcode,source*10000+target*100+panic,(TAny*)iTest->iScreenNumber,&testFinished));
|
|
1093 |
if (testFinished)
|
|
1094 |
break;
|
|
1095 |
}
|
|
1096 |
_LIT(KSet,"Various Different Panics");
|
|
1097 |
INFO_PRINTF1(KSet);
|
|
1098 |
RDebug::Print(KPlatsecBegin);
|
|
1099 |
for(TInt index=0;;index++)
|
|
1100 |
{
|
|
1101 |
TBool testFinished=EFalse;
|
|
1102 |
TEST(iTest->TestWsPanicL(DoPanicTest2,PanicCode[index],index,(TAny*)iTest->iScreenNumber,&testFinished));
|
|
1103 |
if (testFinished)
|
|
1104 |
break;
|
|
1105 |
}
|
|
1106 |
RDebug::Print(KPlatsecEnd);
|
|
1107 |
iTest->CloseAllPanicWindows();
|
|
1108 |
}
|
|
1109 |
|
|
1110 |
void CTWindowTest::ShadowAutoClearTest()
|
|
1111 |
{
|
|
1112 |
RWindowGroup group(TheClient->iWs);
|
|
1113 |
group.Construct(1111);
|
|
1114 |
group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close
|
|
1115 |
|
|
1116 |
RWindow background(TheClient->iWs);
|
|
1117 |
background.Construct(group,133);
|
|
1118 |
background.SetBackgroundColor();
|
|
1119 |
background.Activate();
|
|
1120 |
|
|
1121 |
background.BeginRedraw();
|
|
1122 |
TheClient->iGc->Activate(background);
|
|
1123 |
TheClient->iGc->SetBrushColor(TRgb::Gray4(1));
|
|
1124 |
TheClient->iGc->Clear();
|
|
1125 |
background.EndRedraw();
|
|
1126 |
//
|
|
1127 |
RBlankWindow tab2(TheClient->iWs);
|
|
1128 |
tab2.Construct(group,144);
|
|
1129 |
tab2.SetExtent(TPoint(10,00),TSize(200,10));
|
|
1130 |
tab2.SetColor(TRgb::Gray256(170));
|
|
1131 |
tab2.SetShadowHeight(1);
|
|
1132 |
tab2.Activate();
|
|
1133 |
RBlankWindow tab1(TheClient->iWs);
|
|
1134 |
tab1.Construct(group,155);
|
|
1135 |
tab1.SetExtent(TPoint(70,00),TSize(10,10));
|
|
1136 |
tab1.SetColor(TRgb::Gray256(170));
|
|
1137 |
tab1.SetShadowHeight(1);
|
|
1138 |
tab1.Activate();
|
|
1139 |
RBlankWindow blank(TheClient->iWs);
|
|
1140 |
blank.Construct(group,156);
|
|
1141 |
blank.SetExtent(TPoint(50,10),TSize(100,100));
|
|
1142 |
blank.SetColor(TRgb::Gray256(170));
|
|
1143 |
blank.SetShadowHeight(0);
|
|
1144 |
blank.Activate();
|
|
1145 |
//
|
|
1146 |
tab1.Close();
|
|
1147 |
tab1.Construct(group,166);
|
|
1148 |
tab1.SetExtent(TPoint(50,00),TSize(10,10));
|
|
1149 |
tab1.SetColor(TRgb::Gray256(170));
|
|
1150 |
tab1.SetShadowHeight(1);
|
|
1151 |
tab1.Activate();
|
|
1152 |
blank.Close();
|
|
1153 |
RBlankWindow blank2(TheClient->iWs);
|
|
1154 |
blank2.Construct(group,177);
|
|
1155 |
blank2.SetColor(TRgb::Gray256(255));
|
|
1156 |
blank2.SetExtent(TPoint(10,10),TSize(100,120));
|
|
1157 |
blank2.SetShadowHeight(2);
|
|
1158 |
blank2.Activate();
|
|
1159 |
TheClient->iWs.Flush();
|
|
1160 |
//
|
|
1161 |
background.BeginRedraw();
|
|
1162 |
TheClient->iGc->SetBrushColor(TRgb::Gray4(1));
|
|
1163 |
TheClient->iGc->Clear();
|
|
1164 |
background.EndRedraw();
|
|
1165 |
//
|
|
1166 |
tab1.Close();
|
|
1167 |
tab2.Close();
|
|
1168 |
blank2.Close();
|
|
1169 |
background.BeginRedraw();
|
|
1170 |
TheClient->iGc->Clear();
|
|
1171 |
TheClient->iGc->Deactivate();
|
|
1172 |
background.EndRedraw();
|
|
1173 |
TheClient->iWs.Finish();
|
|
1174 |
TSize size=TheClient->iScreen->SizeInPixels();
|
|
1175 |
TBool rectCompare = TheClient->iScreen->RectCompare(TRect(0,0,size.iWidth>>1,size.iHeight),TRect(size.iWidth>>1,0,(size.iWidth>>1)<<1,size.iHeight));
|
|
1176 |
TEST(rectCompare);
|
|
1177 |
if(!rectCompare)
|
|
1178 |
INFO_PRINTF3(_L("TheClient->iScreen->RectCompare return value - Expected: %d, Actual: %d"), ETrue, rectCompare);
|
|
1179 |
background.Close();
|
|
1180 |
group.Close();
|
|
1181 |
}
|
|
1182 |
|
|
1183 |
void CTWindowTest::ClearRedraw(RWindow &aWindow, TRgb aRgb)
|
|
1184 |
{
|
|
1185 |
aWindow.BeginRedraw();
|
|
1186 |
TheClient->iGc->Activate(aWindow);
|
|
1187 |
TheClient->iGc->SetBrushColor(aRgb);
|
|
1188 |
TheClient->iGc->Clear();
|
|
1189 |
TheClient->iGc->Deactivate();
|
|
1190 |
aWindow.EndRedraw();
|
|
1191 |
}
|
|
1192 |
|
|
1193 |
void CTWindowTest::CheckCorner(TCorner aCorner, const TInt *aInsetList)
|
|
1194 |
{
|
|
1195 |
TRect rect(TPoint(1,1),iBlankWin2->Size());
|
|
1196 |
TPoint pos;
|
|
1197 |
TInt direction;
|
|
1198 |
if (aCorner==ECornerTL || aCorner==ECornerTR)
|
|
1199 |
{
|
|
1200 |
pos.iY=rect.iTl.iY;
|
|
1201 |
direction=1;
|
|
1202 |
}
|
|
1203 |
else
|
|
1204 |
{
|
|
1205 |
pos.iY=rect.iBr.iY-1;
|
|
1206 |
direction= -1;
|
|
1207 |
}
|
|
1208 |
if (aCorner==ECornerTL || aCorner==ECornerBL)
|
|
1209 |
pos.iX=rect.iTl.iX;
|
|
1210 |
else
|
|
1211 |
pos.iX=rect.iBr.iX-8;
|
|
1212 |
TRgb rgbBuf[8];
|
|
1213 |
TPtr8 desc((TUint8 *)rgbBuf,sizeof(rgbBuf));
|
|
1214 |
for(TInt count=0;count<ENumCornerInsets;count++,pos.iY+=direction)
|
|
1215 |
{
|
|
1216 |
iScreenDev->GetScanLine(desc,pos,8,EColor16MA);
|
|
1217 |
if (aCorner==ECornerTR || aCorner==ECornerBR)
|
|
1218 |
{
|
|
1219 |
for(TInt loop=0;loop<4;loop++)
|
|
1220 |
{
|
|
1221 |
TRgb tmp=rgbBuf[loop];
|
|
1222 |
rgbBuf[loop]=rgbBuf[8-1-loop];
|
|
1223 |
rgbBuf[8-1-loop]=tmp;
|
|
1224 |
}
|
|
1225 |
}
|
|
1226 |
// We can't compare rgb value from original source against screen value in EColor64K mode as
|
|
1227 |
// the color component might be truncated (EColor64K is 16-bit using format RGB565),
|
|
1228 |
// ie R or B components might be reduced from 8-bit to 5-bit and G from 8-bit to 6-bit
|
|
1229 |
//
|
|
1230 |
// For example: RGB value of Gray4(1) is 0x555555, it is drawn to screen in RGB565 as 0x52AA,
|
|
1231 |
// when it's converted back to RGB for comparison, the value becomes 0x525552
|
|
1232 |
TRgb col1=TRgb::Gray4(1);
|
|
1233 |
TRgb col2=TRgb::Gray4(3);
|
|
1234 |
if (iScreenDev->DisplayMode()==EColor64K)
|
|
1235 |
{
|
|
1236 |
col1=TRgb::Color64K(col1.Color64K());
|
|
1237 |
col2=TRgb::Color64K(col2.Color64K());
|
|
1238 |
}
|
|
1239 |
TInt loop2=0;
|
|
1240 |
for(;loop2<aInsetList[count];loop2++)
|
|
1241 |
{
|
|
1242 |
TEST(rgbBuf[loop2]==col1);
|
|
1243 |
}
|
|
1244 |
for(;loop2<8;loop2++)
|
|
1245 |
{
|
|
1246 |
TEST(rgbBuf[loop2]==col2);
|
|
1247 |
}
|
|
1248 |
}
|
|
1249 |
}
|
|
1250 |
|
|
1251 |
void CTWindowTest::doCornerTest(TCornerType aCornerType, TInt aFlags)
|
|
1252 |
{
|
|
1253 |
const TInt *corners=corner0;
|
|
1254 |
switch(aCornerType)
|
|
1255 |
{
|
|
1256 |
case EWindowCorner1:
|
|
1257 |
corners=corner1;
|
|
1258 |
break;
|
|
1259 |
case EWindowCorner2:
|
|
1260 |
corners=corner2;
|
|
1261 |
break;
|
|
1262 |
case EWindowCorner3:
|
|
1263 |
corners=corner3;
|
|
1264 |
break;
|
|
1265 |
case EWindowCorner5:
|
|
1266 |
corners=corner5;
|
|
1267 |
break;
|
|
1268 |
default:
|
|
1269 |
break;
|
|
1270 |
}
|
|
1271 |
iBlankWin2->BaseWin()->SetCornerType(aCornerType,aFlags);
|
|
1272 |
if (!(aFlags&EWindowCornerNotTL))
|
|
1273 |
CheckCorner(ECornerTL, corners);
|
|
1274 |
if (!(aFlags&EWindowCornerNotTR))
|
|
1275 |
CheckCorner(ECornerTR, corners);
|
|
1276 |
if (!(aFlags&EWindowCornerNotBL))
|
|
1277 |
CheckCorner(ECornerBL, corners);
|
|
1278 |
if (!(aFlags&EWindowCornerNotBR))
|
|
1279 |
CheckCorner(ECornerBR, corners);
|
|
1280 |
//
|
|
1281 |
if (aFlags&EWindowCornerNotTL)
|
|
1282 |
CheckCorner(ECornerTL, corner0);
|
|
1283 |
if (aFlags&EWindowCornerNotTR)
|
|
1284 |
CheckCorner(ECornerTR, corner0);
|
|
1285 |
if (aFlags&EWindowCornerNotBL)
|
|
1286 |
CheckCorner(ECornerBL, corner0);
|
|
1287 |
if (aFlags&EWindowCornerNotBR)
|
|
1288 |
CheckCorner(ECornerBR, corner0);
|
|
1289 |
}
|
|
1290 |
|
|
1291 |
void CTWindowTest::doCornerTestsL()
|
|
1292 |
{
|
|
1293 |
iScreenDev=new(ELeave) CWsScreenDevice(TheClient->iWs);
|
|
1294 |
User::LeaveIfError(iScreenDev->Construct(iTest->iScreenNumber));
|
|
1295 |
iBlankWin1=new(ELeave) CTBlankWindow();
|
|
1296 |
iBlankWin1->SetUpL(TPoint(1,1),TSize(100,50),TheClient->iGroup,*TheClient->iGc);
|
|
1297 |
iBlankWin1->SetColor(TRgb::Gray4(1));
|
|
1298 |
iBlankWin2=new(ELeave) CTBlankWindow();
|
|
1299 |
iBlankWin2->SetUpL(TPoint(1,1),iBlankWin1->Size(),TheClient->iGroup,*TheClient->iGc);
|
|
1300 |
iBlankWin2->SetColor(TRgb::Gray4(3));
|
|
1301 |
iBlankWin2->BaseWin()->SetShadowHeight(0);
|
|
1302 |
doCornerTest(EWindowCornerSquare,0);
|
|
1303 |
doCornerTest(EWindowCornerSquare,EWindowCornerNotBL);
|
|
1304 |
doCornerTest(EWindowCorner1,0); // 0 + all corners missing
|
|
1305 |
doCornerTest(EWindowCorner1,EWindowCornerNotTL|EWindowCornerNotTR|EWindowCornerNotBL|EWindowCornerNotBR);
|
|
1306 |
doCornerTest(EWindowCorner2,0); // 0 + all sets of 3 corners missing
|
|
1307 |
doCornerTest(EWindowCorner2,EWindowCornerNotTR|EWindowCornerNotBL|EWindowCornerNotBR);
|
|
1308 |
doCornerTest(EWindowCorner2,EWindowCornerNotTL|EWindowCornerNotBL|EWindowCornerNotBR);
|
|
1309 |
doCornerTest(EWindowCorner2,EWindowCornerNotTL|EWindowCornerNotTR|EWindowCornerNotBR);
|
|
1310 |
doCornerTest(EWindowCorner2,EWindowCornerNotTL|EWindowCornerNotTR|EWindowCornerNotBL);
|
|
1311 |
doCornerTest(EWindowCorner3,0); // 0 + all 4 individual corners missing
|
|
1312 |
doCornerTest(EWindowCorner3,EWindowCornerNotTL);
|
|
1313 |
doCornerTest(EWindowCorner3,EWindowCornerNotTR);
|
|
1314 |
doCornerTest(EWindowCorner3,EWindowCornerNotBL);
|
|
1315 |
doCornerTest(EWindowCorner3,EWindowCornerNotBR);
|
|
1316 |
doCornerTest(EWindowCorner5,0); // 0 + all pairs of corners missing
|
|
1317 |
doCornerTest(EWindowCorner5,EWindowCornerNotTL|EWindowCornerNotTR);
|
|
1318 |
doCornerTest(EWindowCorner5,EWindowCornerNotTL|EWindowCornerNotBL);
|
|
1319 |
doCornerTest(EWindowCorner5,EWindowCornerNotTL|EWindowCornerNotBR);
|
|
1320 |
doCornerTest(EWindowCorner5,EWindowCornerNotTR|EWindowCornerNotBL);
|
|
1321 |
doCornerTest(EWindowCorner5,EWindowCornerNotTR|EWindowCornerNotBR);
|
|
1322 |
doCornerTest(EWindowCorner5,EWindowCornerNotBL|EWindowCornerNotBR);
|
|
1323 |
}
|
|
1324 |
|
|
1325 |
void CTWindowTest::CornerTests()
|
|
1326 |
{
|
|
1327 |
TRAP_IGNORE(doCornerTestsL());
|
|
1328 |
delete iBlankWin2;
|
|
1329 |
delete iBlankWin1;
|
|
1330 |
delete iScreenDev;
|
|
1331 |
}
|
|
1332 |
|
|
1333 |
LOCAL_C void doMegaTreeThread(TInt aScreenNumber)
|
|
1334 |
{
|
|
1335 |
CTrapCleanup::New();
|
|
1336 |
RWsSession ws;
|
|
1337 |
ws.Connect();
|
|
1338 |
CWsScreenDevice *scrDev=new(ELeave) CWsScreenDevice(ws);
|
|
1339 |
scrDev->Construct(aScreenNumber);
|
|
1340 |
RWindowGroup group(ws);
|
|
1341 |
group.Construct(1);
|
|
1342 |
group.EnableReceiptOfFocus(EFalse);
|
|
1343 |
RWindow parent(ws);
|
|
1344 |
parent.Construct(group,123);
|
|
1345 |
parent.Activate();
|
|
1346 |
CWindowGc *gc=new(ELeave) CWindowGc(scrDev);
|
|
1347 |
gc->Construct();
|
|
1348 |
TSize max(parent.Size());
|
|
1349 |
RWindow prev=parent;
|
|
1350 |
TBool horiz=EFalse;
|
|
1351 |
TInt color=0;
|
|
1352 |
for(TInt count=0;count<100;count++)
|
|
1353 |
{
|
|
1354 |
RWindow win(ws);
|
|
1355 |
if (win.Construct(prev,ENullWsHandle)!=KErrNone)
|
|
1356 |
break;
|
|
1357 |
win.SetExtent(horiz?TPoint(1,0):TPoint(0,1),max);
|
|
1358 |
win.SetBackgroundColor(TRgb::Gray4(color));
|
|
1359 |
color=(color+1)%4;
|
|
1360 |
win.Activate();
|
|
1361 |
win.BeginRedraw();
|
|
1362 |
gc->Activate(win);
|
|
1363 |
gc->Clear();
|
|
1364 |
gc->Deactivate();
|
|
1365 |
win.EndRedraw();
|
|
1366 |
prev=win;
|
|
1367 |
horiz=!horiz;
|
|
1368 |
}
|
|
1369 |
parent.SetVisible(EFalse);
|
|
1370 |
parent.SetVisible(ETrue);
|
|
1371 |
parent.SetPosition(TPoint(-1,-1));
|
|
1372 |
parent.SetPosition(TPoint(0,0));
|
|
1373 |
parent.Close();
|
|
1374 |
ws.Close();
|
|
1375 |
}
|
|
1376 |
|
|
1377 |
LOCAL_C TInt MegaTreeThread(TAny *aScreenNumber)
|
|
1378 |
{
|
|
1379 |
TRAPD(err,doMegaTreeThread((TInt)aScreenNumber));
|
|
1380 |
return(err);
|
|
1381 |
}
|
|
1382 |
|
|
1383 |
void CTWindowTest::CreateMegaTree()
|
|
1384 |
{
|
|
1385 |
const TUint KThreadHeapSize=0x2000;
|
|
1386 |
RThread thread;
|
|
1387 |
if (thread.Create(_L("MegaTree"),MegaTreeThread,KDefaultStackSize,KThreadHeapSize,KThreadHeapSize,(TAny*)iTest->iScreenNumber,EOwnerThread)==KErrNone)
|
|
1388 |
{
|
|
1389 |
TRequestStatus stat;
|
|
1390 |
thread.Logon(stat);
|
|
1391 |
thread.Resume();
|
|
1392 |
User::WaitForRequest(stat);
|
|
1393 |
TEST(stat==KErrNone);
|
|
1394 |
}
|
|
1395 |
thread.Close();
|
|
1396 |
}
|
|
1397 |
|
|
1398 |
void CTWindowTest::TiledWindowTestL()
|
|
1399 |
{
|
|
1400 |
RWindow parent(TheClient->iWs);
|
|
1401 |
User::LeaveIfError(parent.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
|
|
1402 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&parent));
|
|
1403 |
parent.SetExtent(TPoint(10,10),TSize(50,50));
|
|
1404 |
parent.Activate();
|
|
1405 |
//
|
|
1406 |
RWindow child1(TheClient->iWs);
|
|
1407 |
User::LeaveIfError(child1.Construct(parent,ENullWsHandle));
|
|
1408 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child1));
|
|
1409 |
child1.SetExtent(TPoint(0,0),TSize(50,20));
|
|
1410 |
child1.Activate();
|
|
1411 |
//
|
|
1412 |
RWindow child2(TheClient->iWs);
|
|
1413 |
User::LeaveIfError(child2.Construct(parent,ENullWsHandle));
|
|
1414 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child2));
|
|
1415 |
child2.SetExtent(TPoint(0,20),TSize(50,30));
|
|
1416 |
child2.Activate();
|
|
1417 |
//
|
|
1418 |
child1.BeginRedraw();
|
|
1419 |
TSize rect1Size(25,20);
|
|
1420 |
TheGc->Activate(child1);
|
|
1421 |
TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
1422 |
TheGc->DrawRect(TRect(rect1Size));
|
|
1423 |
TheGc->DrawRect(TRect(TPoint(rect1Size.iWidth,0),rect1Size));
|
|
1424 |
TheGc->Deactivate();
|
|
1425 |
child1.EndRedraw();
|
|
1426 |
//
|
|
1427 |
child2.BeginRedraw();
|
|
1428 |
TSize rect2Size(25,30);
|
|
1429 |
TheGc->Activate(child2);
|
|
1430 |
TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
|
|
1431 |
TheGc->DrawRect(TRect(rect2Size));
|
|
1432 |
TheGc->DrawRect(TRect(TPoint(rect2Size.iWidth,0),rect2Size));
|
|
1433 |
TheGc->Deactivate();
|
|
1434 |
child2.EndRedraw();
|
|
1435 |
//
|
|
1436 |
// Left and right halves should be identical
|
|
1437 |
//
|
|
1438 |
TBool rectCompare = !TheClient->iScreen->RectCompare(TRect(10,10,35,60),TRect(35,10,70,60));
|
|
1439 |
TEST(rectCompare);
|
|
1440 |
if(!rectCompare)
|
|
1441 |
INFO_PRINTF3(_L("TheClient->iScreen->RectCompare return value - Expected: %d, Actual: %d"), ETrue, rectCompare);
|
|
1442 |
//
|
|
1443 |
CleanupStack::PopAndDestroy(3);
|
|
1444 |
}
|
|
1445 |
|
|
1446 |
void CTWindowTest::TiledWindowTest2L()
|
|
1447 |
{
|
|
1448 |
TSize size(200,240); //Parent Windows
|
|
1449 |
TSize childSize(TSize(size.iWidth/2,size.iHeight/2)); //Child Windows
|
|
1450 |
TSize dialogueSize(50,50);
|
|
1451 |
|
|
1452 |
TheClient->iWs.SetAutoFlush(ETrue);
|
|
1453 |
RBlankWindow parent1(TheClient->iWs);
|
|
1454 |
User::LeaveIfError(parent1.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
|
|
1455 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&parent1));
|
|
1456 |
parent1.SetExtent(TPoint(240,0),size);
|
|
1457 |
parent1.SetColor(TRgb::Gray4(2));
|
|
1458 |
parent1.Activate();
|
|
1459 |
|
|
1460 |
TheClient->iWs.SetAutoFlush(ETrue);
|
|
1461 |
RBlankWindow parent2(TheClient->iWs);
|
|
1462 |
User::LeaveIfError(parent2.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
|
|
1463 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&parent2));
|
|
1464 |
parent2.SetExtent(TPoint(440,0),size);
|
|
1465 |
parent2.SetColor(TRgb::Gray4(2));
|
|
1466 |
parent2.Activate();
|
|
1467 |
|
|
1468 |
TheClient->iWs.SetAutoFlush(ETrue);
|
|
1469 |
RBlankWindow child1(TheClient->iWs);
|
|
1470 |
User::LeaveIfError(child1.Construct(parent1,ENullWsHandle));
|
|
1471 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child1));
|
|
1472 |
child1.SetExtent(TPoint(0,0),childSize);
|
|
1473 |
child1.SetColor(TRgb::Gray4(2));
|
|
1474 |
child1.Activate();
|
|
1475 |
|
|
1476 |
TheClient->iWs.SetAutoFlush(ETrue);
|
|
1477 |
RBlankWindow child2(TheClient->iWs);
|
|
1478 |
User::LeaveIfError(child2.Construct(parent1,ENullWsHandle));
|
|
1479 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child2));
|
|
1480 |
child2.SetExtent(TPoint(0,childSize.iHeight),childSize);
|
|
1481 |
child2.SetColor(TRgb::Gray4(2));
|
|
1482 |
child2.Activate();
|
|
1483 |
|
|
1484 |
TheClient->iWs.SetAutoFlush(ETrue);
|
|
1485 |
RBlankWindow child3(TheClient->iWs);
|
|
1486 |
User::LeaveIfError(child3.Construct(parent1,ENullWsHandle));
|
|
1487 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child3));
|
|
1488 |
child3.SetExtent(TPoint(childSize.iWidth,0),TSize(childSize.iWidth,size.iHeight));
|
|
1489 |
child3.SetColor(TRgb::Gray4(2));
|
|
1490 |
child3.Activate();
|
|
1491 |
|
|
1492 |
TPoint dialoguePos(375,93);
|
|
1493 |
TheClient->iWs.SetAutoFlush(ETrue);
|
|
1494 |
RBlankWindow dialog1(TheClient->iWs);
|
|
1495 |
User::LeaveIfError(dialog1.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
|
|
1496 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&dialog1));
|
|
1497 |
dialog1.SetExtent(dialoguePos,dialogueSize);
|
|
1498 |
dialog1.SetColor(TRgb::Gray4(3));
|
|
1499 |
dialog1.SetShadowHeight(4);
|
|
1500 |
dialog1.Activate();
|
|
1501 |
|
|
1502 |
TheClient->iWs.SetAutoFlush(ETrue);
|
|
1503 |
RBlankWindow dialog2(TheClient->iWs);
|
|
1504 |
User::LeaveIfError(dialog2.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
|
|
1505 |
CleanupStack::PushL(TCleanupItem(CleanUpWindow,&dialog2));
|
|
1506 |
dialog2.SetExtent(TPoint(dialoguePos.iX+size.iWidth,dialoguePos.iY),dialogueSize);
|
|
1507 |
dialog2.SetColor(TRgb::Gray4(3));
|
|
1508 |
dialog2.SetShadowHeight(0);
|
|
1509 |
dialog2.Activate();
|
|
1510 |
|
|
1511 |
TInt ii;
|
|
1512 |
for (ii=400;ii>374;ii-=25)
|
|
1513 |
dialog1.SetPosition(TPoint(ii,93));
|
|
1514 |
TheClient->iWs.SetAutoFlush(EFalse);
|
|
1515 |
CleanupStack::PopAndDestroy(7);
|
|
1516 |
}
|
|
1517 |
|
|
1518 |
void CTWindowTest::ColorTestL()
|
|
1519 |
{
|
|
1520 |
if (iTest->MaxGrays() == 0)
|
|
1521 |
return;
|
|
1522 |
|
|
1523 |
_LIT(KSet,"AUTO Color Test ");
|
|
1524 |
INFO_PRINTF1(KSet);
|
|
1525 |
RWindow window(TheClient->iWs);
|
|
1526 |
User::LeaveIfError(window.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
|
|
1527 |
PushWindowL(&window);
|
|
1528 |
window.SetExtent(TPoint(10,10),TSize(50,50));
|
|
1529 |
window.Activate();
|
|
1530 |
TInt colorMode,mode;
|
|
1531 |
TInt currentMode=TheClient->iScreen->DisplayMode();
|
|
1532 |
TEST(currentMode==EGray4 || currentMode==EColor16 || currentMode==EColor256 || currentMode == EColor64K);
|
|
1533 |
if(currentMode!=EGray4 && currentMode!=EColor16 && currentMode!=EColor256 && currentMode != EColor64K)
|
|
1534 |
INFO_PRINTF5(_L("TheClient->iScreen->DisplayMode() return value - Expected: %d or %d or %d, Actual: %d"), EGray4, EColor16, EColor256, currentMode);
|
|
1535 |
INFO_PRINTF1(_L(" Done Setup"));
|
|
1536 |
for(colorMode=EGray4;colorMode<EColorLast;colorMode++)
|
|
1537 |
{
|
|
1538 |
INFO_PRINTF1(_L(" Loop 1"));
|
|
1539 |
if (colorMode==ERgb || (colorMode==EGray256 && TDisplayModeUtils::IsDisplayModeColor(REINTERPRET_CAST(TDisplayMode&,currentMode))) || (colorMode==EGray256 && TDisplayModeUtils::IsDisplayModeColor(REINTERPRET_CAST(TDisplayMode&,currentMode))) )
|
|
1540 |
continue;
|
|
1541 |
User::LeaveIfError(window.SetRequiredDisplayMode((TDisplayMode&)colorMode));
|
|
1542 |
mode=window.DisplayMode();
|
|
1543 |
if (!(mode==currentMode || mode==colorMode))
|
|
1544 |
{
|
|
1545 |
_LIT(KModes," Failed in Loop1 SetTo=%d, Actual=%d, Current=%d");
|
|
1546 |
TBuf<64> log;
|
|
1547 |
log.Format(KModes,colorMode,mode,currentMode);
|
|
1548 |
INFO_PRINTF1(log);
|
|
1549 |
}
|
|
1550 |
if (mode>ERgb && colorMode==EColor64K)
|
|
1551 |
break;
|
|
1552 |
TEST(mode==currentMode || mode==colorMode );
|
|
1553 |
if (mode!=currentMode && mode!=colorMode)
|
|
1554 |
INFO_PRINTF4(_L("window.DisplayMode() return value - Expected: %d or %d, Actual: %d"), currentMode, colorMode, mode);
|
|
1555 |
INFO_PRINTF1(_L(" Loop 2"));
|
|
1556 |
if (mode>currentMode)
|
|
1557 |
currentMode=mode;
|
|
1558 |
if (colorMode==EColor16)
|
|
1559 |
window.SetSize(TSize(40,60));
|
|
1560 |
else if (colorMode==EColor4K)
|
|
1561 |
window.SetSize(TSize(60,40));
|
|
1562 |
mode=TheClient->iScreen->DisplayMode();
|
|
1563 |
if(TDisplayModeUtils::NumDisplayModeColors(STATIC_CAST(TDisplayMode,currentMode))==16777216)
|
|
1564 |
{
|
|
1565 |
TEST(mode==CFbsDevice::DisplayMode16M());
|
|
1566 |
if (mode!=CFbsDevice::DisplayMode16M())
|
|
1567 |
INFO_PRINTF3(_L("window.DisplayMode() return value - Expected: %d, Actual: %d"), CFbsDevice::DisplayMode16M(), mode);
|
|
1568 |
}
|
|
1569 |
else
|
|
1570 |
{
|
|
1571 |
TEST(currentMode==mode || currentMode==colorMode);
|
|
1572 |
if (currentMode!=mode && currentMode!=colorMode)
|
|
1573 |
INFO_PRINTF3(_L("TheClient->iScreen->DisplayMode() return value return value - Expected: %d , Actual: %d"), currentMode, mode);
|
|
1574 |
}
|
|
1575 |
}
|
|
1576 |
INFO_PRINTF1(_L(" Done First Loop"));
|
|
1577 |
TInt color,gray;
|
|
1578 |
TDisplayMode defMode=TheClient->iWs.GetDefModeMaxNumColors(color,gray);
|
|
1579 |
TInt screenNo =TheClient->iScreen->GetScreenNumber();
|
|
1580 |
TDisplayMode defModeForScreen=TheClient->iWs.GetDefModeMaxNumColors(screenNo,color,gray);
|
|
1581 |
TEST(defMode==defModeForScreen);
|
|
1582 |
if (defMode!=defModeForScreen)
|
|
1583 |
INFO_PRINTF3(_L("TheClient->iScreen->DisplayMode() return value return value - Expected: %d , Actual: %d"), defMode, defModeForScreen);
|
|
1584 |
if (color==16777216 && gray==256)
|
|
1585 |
{
|
|
1586 |
TEST(defMode==EGray4 || defMode==EColor256 || defMode==EColor64K); //WINS
|
|
1587 |
if (defMode!=EGray4 && defMode!=EColor256 && defMode != EColor64K)
|
|
1588 |
INFO_PRINTF4(_L("TheClient->iWs.GetDefModeMaxNumColors(color,gray) return value return value - Expected: %d or %d, Actual: %d"), EGray4, EColor256, defMode);
|
|
1589 |
}
|
|
1590 |
else
|
|
1591 |
{
|
|
1592 |
if (color==0 && gray==16)
|
|
1593 |
{
|
|
1594 |
TEST(defMode==EGray4); //S5 family
|
|
1595 |
if (defMode!=EGray4)
|
|
1596 |
INFO_PRINTF3(_L("TheClient->iScreen->DisplayMode() return value return value - Expected: %d , Actual: %d"), EGray4, defMode);
|
|
1597 |
}
|
|
1598 |
else
|
|
1599 |
{
|
|
1600 |
TLogMessageText buf;
|
|
1601 |
_LIT(KColorSettings,"##Data Most Colors=%d, Most Greys=%d, DefMode=%d");
|
|
1602 |
buf.Format(KColorSettings,color,gray,defMode);
|
|
1603 |
TheClient->iWs.LogMessage(buf);
|
|
1604 |
TheClient->iWs.Flush();
|
|
1605 |
TEST(defMode==EGray4 || defMode==EColor256);
|
|
1606 |
if (defMode!=EGray4 && defMode!=EColor256)
|
|
1607 |
INFO_PRINTF4(_L("TheClient->iWs.GetDefModeMaxNumColors(color,gray) return value return value - Expected: %d or %d, Actual: %d"), EGray4, EColor256, defMode);
|
|
1608 |
}
|
|
1609 |
}
|
|
1610 |
CArrayFixFlat<TInt> *colorModes=new(ELeave) CArrayFixFlat<TInt>(1);
|
|
1611 |
CleanupStack::PushL(colorModes);
|
|
1612 |
User::LeaveIfError(TheClient->iWs.GetColorModeList(screenNo,colorModes));
|
|
1613 |
TDisplayMode mostColor=ENone;
|
|
1614 |
TDisplayMode lastGray=ENone;
|
|
1615 |
TDisplayMode dispMode;
|
|
1616 |
TInt ii;
|
|
1617 |
TInt colorModes16M = 0;
|
|
1618 |
INFO_PRINTF1(_L(" Done Setup 2"));
|
|
1619 |
for (ii=0;ii<colorModes->Count();ii++)
|
|
1620 |
{
|
|
1621 |
dispMode=(TDisplayMode)(*colorModes)[ii];
|
|
1622 |
TEST(dispMode!=ERgb);
|
|
1623 |
if (dispMode==ERgb)
|
|
1624 |
INFO_PRINTF3(_L("(TDisplayMode)(*colorModes)[i] return value - Not Expected: %d , Actual: %d"), ERgb, dispMode);
|
|
1625 |
TEST(dispMode!=ENone);
|
|
1626 |
if (dispMode==ENone)
|
|
1627 |
INFO_PRINTF3(_L("(TDisplayMode)(*colorModes)[i] return value - Not Expected: %d , Actual: %d"), ENone, dispMode);
|
|
1628 |
if (dispMode<=EGray256)
|
|
1629 |
lastGray=dispMode;
|
|
1630 |
else
|
|
1631 |
mostColor=dispMode;
|
|
1632 |
if(dispMode == EColor16M || dispMode == EColor16MU || dispMode == EColor16MA)
|
|
1633 |
colorModes16M++;
|
|
1634 |
}
|
|
1635 |
TEST(mostColor!=ERgb);
|
|
1636 |
if (mostColor==ERgb)
|
|
1637 |
INFO_PRINTF3(_L("mostColor - Not Expected: %d , Actual: %d"), ERgb, mostColor);
|
|
1638 |
TEST(colorModes16M <= 1);
|
|
1639 |
if (colorModes16M > 1)
|
|
1640 |
INFO_PRINTF3(_L("Number of times color Modes 16M - less than or equal to: %d , Actual: %d"), 1, colorModes16M);
|
|
1641 |
#if defined(__WINS__)
|
|
1642 |
TEST(colorModes16M == 1);
|
|
1643 |
if (colorModes16M != 1)
|
|
1644 |
INFO_PRINTF3(_L("Number of times color Modes 16M on wins - equal to: %d , Actual: %d"), 1, colorModes16M);
|
|
1645 |
#endif
|
|
1646 |
TInt retVal;
|
|
1647 |
if (color==0)
|
|
1648 |
{
|
|
1649 |
TEST(mostColor==ENone);
|
|
1650 |
if (mostColor!=ENone)
|
|
1651 |
INFO_PRINTF3(_L("Most color - equal to: %d , Actual: %d"), ENone ,mostColor);
|
|
1652 |
}
|
|
1653 |
else
|
|
1654 |
{
|
|
1655 |
retVal = TDisplayModeUtils::NumDisplayModeColors(mostColor);
|
|
1656 |
TEST(color==retVal);
|
|
1657 |
if (color!=retVal)
|
|
1658 |
INFO_PRINTF3(_L("TDisplayModeUtils::NumDisplayModeColors(mostColor) return value - equal to: %d , Actual: %d"), TDisplayModeUtils::NumDisplayModeColors(mostColor), retVal);
|
|
1659 |
}
|
|
1660 |
if (gray==0)
|
|
1661 |
{
|
|
1662 |
TEST(lastGray==ENone);
|
|
1663 |
if (lastGray!=ENone)
|
|
1664 |
INFO_PRINTF3(_L("LastGray - equal to: %d , Actual: %d"), ENone, lastGray);
|
|
1665 |
}
|
|
1666 |
else
|
|
1667 |
{
|
|
1668 |
retVal = TDisplayModeUtils::NumDisplayModeColors(lastGray);
|
|
1669 |
TEST(gray==retVal);
|
|
1670 |
if(gray!=retVal)
|
|
1671 |
INFO_PRINTF3(_L("Gray - equal to: %d , Actual: %d"), retVal, gray);
|
|
1672 |
}
|
|
1673 |
retVal = TDisplayModeUtils::NumDisplayModeColors(ENone);
|
|
1674 |
TEST(retVal==0);
|
|
1675 |
if (retVal!=0)
|
|
1676 |
INFO_PRINTF3(_L("TDisplayModeUtils::NumDisplayModeColors(ENone) return value - equal to: %d , Actual: %d"), 0, retVal);
|
|
1677 |
CleanupStack::PopAndDestroy(2); //window and mode-array
|
|
1678 |
}
|
|
1679 |
|
|
1680 |
void CTWindowTest::TestInvalidFunctions2L()
|
|
1681 |
//
|
|
1682 |
// This code casts windows to group windows and vice-versa and then sends messages for the 'cast' that
|
|
1683 |
// should not be sent to the original type of window. These should all result in panics
|
|
1684 |
//
|
|
1685 |
{
|
|
1686 |
for (TInt winType=1;winType<7;++winType) //Skip type 0 (RWindowTreeNode)
|
|
1687 |
for (TInt panic=0;;panic++)
|
|
1688 |
{
|
|
1689 |
TBool testFinished=EFalse;
|
|
1690 |
TEST(iTest->TestWsPanicL(DoPanicTest3,EWservPanicOpcode,EWinTypeFactor*winType+panic,(TAny*)iTest->iScreenNumber,&testFinished));
|
|
1691 |
if (testFinished)
|
|
1692 |
break;
|
|
1693 |
}
|
|
1694 |
iTest->CloseAllPanicWindows();
|
|
1695 |
}
|
|
1696 |
|
|
1697 |
void CTWindowTest::TestDeletedParentPanics1L()
|
|
1698 |
{
|
|
1699 |
for (TInt winType=0;winType<7;++winType)
|
|
1700 |
{
|
|
1701 |
if (winType==1) //Skip type 1 (RWindowGroup)
|
|
1702 |
++winType;
|
|
1703 |
for (TInt panic=0;;panic++)
|
|
1704 |
{
|
|
1705 |
TBool testFinished=EFalse;
|
|
1706 |
TEST(iTest->TestWsPanicL(DoPanicTest4,EWservPanicParentDeleted,EWinTypeFactor*winType+panic,(TAny*)iTest->iScreenNumber,&testFinished));
|
|
1707 |
if (testFinished)
|
|
1708 |
break;
|
|
1709 |
}
|
|
1710 |
}
|
|
1711 |
iTest->CloseAllPanicWindows();
|
|
1712 |
}
|
|
1713 |
|
|
1714 |
void CTWindowTest::TestDeletedParentPanics2L()
|
|
1715 |
{
|
|
1716 |
for (TInt panic=0;;panic++)
|
|
1717 |
{
|
|
1718 |
TBool testFinished=EFalse;
|
|
1719 |
TEST(iTest->TestWsPanicL(DoPanicTest5,EWservPanicParentDeleted,panic,(TAny*)iTest->iScreenNumber,&testFinished));
|
|
1720 |
if (testFinished)
|
|
1721 |
break;
|
|
1722 |
}
|
|
1723 |
iTest->CloseAllPanicWindows();
|
|
1724 |
}
|
|
1725 |
|
|
1726 |
void CTWindowTest::Bug1L()
|
|
1727 |
//
|
|
1728 |
// Test a defect found with WSERV 099 that caused a full Eikon ROM to crash before even the splach screen appeared
|
|
1729 |
//
|
|
1730 |
{
|
|
1731 |
RWsSession ws;
|
|
1732 |
User::LeaveIfError(ws.Connect());
|
|
1733 |
// use correct screen
|
|
1734 |
CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
|
|
1735 |
CleanupStack::PushL(screen);
|
|
1736 |
User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
|
|
1737 |
|
|
1738 |
RWindowGroup group(ws);
|
|
1739 |
group.Construct(344);
|
|
1740 |
group.EnableReceiptOfFocus(EFalse); //Not done by Eikon, but needed to stop shell window comming to front.
|
|
1741 |
RBlankWindow blank(ws);
|
|
1742 |
blank.Construct(group,345);
|
|
1743 |
blank.SetOrdinalPosition(0,1000);
|
|
1744 |
blank.Activate();
|
|
1745 |
RWindow window(ws);
|
|
1746 |
window.Construct(group,346);
|
|
1747 |
|
|
1748 |
//Must delete this window to tidy up
|
|
1749 |
window.Close();
|
|
1750 |
blank.Close();
|
|
1751 |
group.Close();
|
|
1752 |
|
|
1753 |
CleanupStack::PopAndDestroy(screen);
|
|
1754 |
ws.Close();
|
|
1755 |
}
|
|
1756 |
|
|
1757 |
void CTWindowTest::TestWindowDelete()
|
|
1758 |
{
|
|
1759 |
TInt handles = 344;
|
|
1760 |
TInt err = KErrNone;
|
|
1761 |
TInt loop = 0;
|
|
1762 |
TInt allocFailRate = 0;
|
|
1763 |
|
|
1764 |
RWindowGroup group(TheClient->iWs);
|
|
1765 |
RWindow parent1(TheClient->iWs);
|
|
1766 |
RWindow child1(TheClient->iWs);
|
|
1767 |
RWindow testWindow(TheClient->iWs);
|
|
1768 |
|
|
1769 |
while (loop < 5)
|
|
1770 |
{
|
|
1771 |
err = group.Construct(++handles, EFalse);
|
|
1772 |
if (err == KErrNone)
|
|
1773 |
{
|
|
1774 |
TheClient->iWs.HeapSetFail(RHeap::EDeterministic, allocFailRate);
|
|
1775 |
|
|
1776 |
//Create parent 1
|
|
1777 |
err = parent1.Construct(group,++handles);
|
|
1778 |
if (err == KErrNone)
|
|
1779 |
{
|
|
1780 |
parent1.SetExtent(TPoint(10,10),TSize(50,50));
|
|
1781 |
parent1.Activate();
|
|
1782 |
}
|
|
1783 |
}
|
|
1784 |
//Create child 1
|
|
1785 |
if (err == KErrNone)
|
|
1786 |
{
|
|
1787 |
err = child1.Construct(parent1,++handles);
|
|
1788 |
if (err == KErrNone)
|
|
1789 |
{
|
|
1790 |
child1.SetExtent(TPoint(),TSize(50,20));
|
|
1791 |
child1.Activate();
|
|
1792 |
}
|
|
1793 |
//Only delete the parent 1, but not the child 1
|
|
1794 |
parent1.Close();
|
|
1795 |
}
|
|
1796 |
|
|
1797 |
if (err == KErrNone)
|
|
1798 |
{
|
|
1799 |
//Create testWindow
|
|
1800 |
err = testWindow.Construct(group,++handles);
|
|
1801 |
if (err == KErrNone)
|
|
1802 |
{
|
|
1803 |
testWindow.SetExtent(TPoint(0,20),TSize(50,30));
|
|
1804 |
testWindow.Activate();
|
|
1805 |
}
|
|
1806 |
}
|
|
1807 |
TheClient->iWs.HeapSetFail(RAllocator::ENone, 0);
|
|
1808 |
|
|
1809 |
child1.Close();
|
|
1810 |
testWindow.Close();
|
|
1811 |
group.Close();
|
|
1812 |
++allocFailRate;
|
|
1813 |
loop = (err == KErrNone) ? loop + 1 : 0;
|
|
1814 |
}
|
|
1815 |
}
|
|
1816 |
void CTWindowTest::Bug2L()
|
|
1817 |
//
|
|
1818 |
// Test a defect ...
|
|
1819 |
//
|
|
1820 |
{
|
|
1821 |
TSize offset(20,20);
|
|
1822 |
TRect screen(TheClient->iScreen->SizeInPixels()-offset);
|
|
1823 |
TRgb color;
|
|
1824 |
RWsSession ws1;
|
|
1825 |
User::LeaveIfError(ws1.Connect());
|
|
1826 |
ws1.SetAutoFlush(ETrue);
|
|
1827 |
|
|
1828 |
// use correct screen
|
|
1829 |
//
|
|
1830 |
CWsScreenDevice* scr1 = new (ELeave) CWsScreenDevice(ws1);
|
|
1831 |
CleanupStack::PushL(scr1);
|
|
1832 |
User::LeaveIfError(scr1->Construct(iTest->iScreenNumber));
|
|
1833 |
|
|
1834 |
RWsSession ws2;
|
|
1835 |
User::LeaveIfError(ws2.Connect());
|
|
1836 |
ws2.SetAutoFlush(ETrue);
|
|
1837 |
|
|
1838 |
// use correct screen
|
|
1839 |
//
|
|
1840 |
CWsScreenDevice* scr2 = new (ELeave) CWsScreenDevice(ws2);
|
|
1841 |
CleanupStack::PushL(scr2);
|
|
1842 |
User::LeaveIfError(scr2->Construct(iTest->iScreenNumber));
|
|
1843 |
|
|
1844 |
RWindowGroup group1a(ws1);
|
|
1845 |
group1a.Construct(344);
|
|
1846 |
group1a.EnableReceiptOfFocus(EFalse);
|
|
1847 |
group1a.SetOrdinalPosition(0,5);
|
|
1848 |
RBlankWindow blank1a(ws1);
|
|
1849 |
blank1a.Construct(group1a,345);
|
|
1850 |
color=TRgb::Gray4(0);
|
|
1851 |
blank1a.SetColor(color);
|
|
1852 |
blank1a.SetExtent(screen.iTl,screen.Size());
|
|
1853 |
blank1a.EnableBackup();
|
|
1854 |
blank1a.Activate();
|
|
1855 |
|
|
1856 |
RWindowGroup group2(ws2);
|
|
1857 |
group2.Construct(342);
|
|
1858 |
group2.EnableReceiptOfFocus(EFalse);
|
|
1859 |
group2.SetOrdinalPosition(0,5);
|
|
1860 |
RBlankWindow blank2(ws2);
|
|
1861 |
blank2.Construct(group2,347);
|
|
1862 |
color=TRgb::Gray4(1);
|
|
1863 |
blank2.SetColor(color);
|
|
1864 |
blank2.SetExtent(screen.iTl+TSize(20,0),screen.Size());
|
|
1865 |
blank2.EnableBackup();
|
|
1866 |
blank2.Activate();
|
|
1867 |
|
|
1868 |
RWindowGroup group1b(ws1);
|
|
1869 |
group1b.Construct(343);
|
|
1870 |
//group1b.EnableReceiptOfFocus(EFalse);
|
|
1871 |
group1b.SetOrdinalPosition(0,5);
|
|
1872 |
RBlankWindow blank1b(ws1);
|
|
1873 |
blank1b.Construct(group1b,346);
|
|
1874 |
color=TRgb::Gray4(2);
|
|
1875 |
blank1b.SetColor(color);
|
|
1876 |
blank1b.SetExtent(screen.iTl+offset,screen.Size());
|
|
1877 |
blank1b.EnableBackup();
|
|
1878 |
blank1b.Activate();
|
|
1879 |
|
|
1880 |
group1b.Close();
|
|
1881 |
blank1a.Close();
|
|
1882 |
blank1b.Close();
|
|
1883 |
blank2.Close();
|
|
1884 |
group1a.Close();
|
|
1885 |
group2.Close();
|
|
1886 |
|
|
1887 |
CleanupStack::PopAndDestroy(2,scr1);
|
|
1888 |
ws1.Close();
|
|
1889 |
ws2.Close();
|
|
1890 |
}
|
|
1891 |
|
|
1892 |
void CTWindowTest::Bug3L()
|
|
1893 |
//
|
|
1894 |
// Actiate then make visible and backup behind window caused panic.
|
|
1895 |
//
|
|
1896 |
{
|
|
1897 |
TSize offset(20,20);
|
|
1898 |
TRect screen(TheClient->iScreen->SizeInPixels()-offset);
|
|
1899 |
TRgb color;
|
|
1900 |
RWsSession ws;
|
|
1901 |
User::LeaveIfError(ws.Connect());
|
|
1902 |
ws.SetAutoFlush(ETrue);
|
|
1903 |
|
|
1904 |
// use correct screen
|
|
1905 |
//
|
|
1906 |
CWsScreenDevice* scr = new (ELeave) CWsScreenDevice(ws);
|
|
1907 |
CleanupStack::PushL(scr);
|
|
1908 |
User::LeaveIfError(scr->Construct(iTest->iScreenNumber));
|
|
1909 |
|
|
1910 |
RWindowGroup group(ws);
|
|
1911 |
group.Construct(348);
|
|
1912 |
group.EnableReceiptOfFocus(EFalse);
|
|
1913 |
RBlankWindow blank1(ws);
|
|
1914 |
blank1.Construct(group,341);
|
|
1915 |
color=TRgb::Gray4(1);
|
|
1916 |
blank1.SetColor(color);
|
|
1917 |
blank1.SetExtent(screen.iTl,screen.Size());
|
|
1918 |
blank1.EnableBackup();
|
|
1919 |
blank1.SetVisible(EFalse);
|
|
1920 |
blank1.Activate();
|
|
1921 |
blank1.SetVisible(ETrue);
|
|
1922 |
RBlankWindow blank2(ws);
|
|
1923 |
blank2.Construct(group,342);
|
|
1924 |
color=TRgb::Gray4(2);
|
|
1925 |
blank2.SetColor(color);
|
|
1926 |
blank2.SetExtent(screen.iTl,screen.Size());
|
|
1927 |
blank2.EnableBackup();
|
|
1928 |
blank2.SetVisible(EFalse);
|
|
1929 |
blank2.SetVisible(ETrue);
|
|
1930 |
blank2.Activate();
|
|
1931 |
group.Close();
|
|
1932 |
blank1.Close();
|
|
1933 |
blank2.Close();
|
|
1934 |
|
|
1935 |
CleanupStack::PopAndDestroy(scr);
|
|
1936 |
ws.Close();
|
|
1937 |
}
|
|
1938 |
|
|
1939 |
void CTWindowTest::ErrorCodesL()
|
|
1940 |
{
|
|
1941 |
RWsSession ws;
|
|
1942 |
User::LeaveIfError(ws.Connect());
|
|
1943 |
// use correct screen
|
|
1944 |
//
|
|
1945 |
CWsScreenDevice* scr = new (ELeave) CWsScreenDevice(ws);
|
|
1946 |
CleanupStack::PushL(scr);
|
|
1947 |
User::LeaveIfError(scr->Construct(iTest->iScreenNumber));
|
|
1948 |
|
|
1949 |
|
|
1950 |
RWindowGroup group(ws);
|
|
1951 |
group.Construct(349);
|
|
1952 |
group.EnableReceiptOfFocus(EFalse);
|
|
1953 |
RWindow window(TheClient->iWs);
|
|
1954 |
User::LeaveIfError(window.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
|
|
1955 |
TInt retVal = window.MoveToGroup(22222);
|
|
1956 |
TEST(retVal==KErrNotFound);
|
|
1957 |
if (retVal!=KErrNotFound)
|
|
1958 |
INFO_PRINTF3(_L("window.MoveToGroup(22222) return value - equal to: %d , Actual: %d"), KErrNotFound, retVal);
|
|
1959 |
retVal = window.MoveToGroup(group.Identifier());
|
|
1960 |
TEST(retVal==KErrNotFound);
|
|
1961 |
if (retVal!=KErrNotFound)
|
|
1962 |
INFO_PRINTF3(_L("window.MoveToGroup(group.Identifier()) return value - equal to: %d , Actual: %d"), KErrNotFound, retVal);
|
|
1963 |
window.Close();
|
|
1964 |
group.Close();
|
|
1965 |
|
|
1966 |
CleanupStack::PopAndDestroy(scr);
|
|
1967 |
ws.Close();
|
|
1968 |
}
|
|
1969 |
|
|
1970 |
void CTWindowTest::BackColorBugL()
|
|
1971 |
//
|
|
1972 |
// Test a defect with window being drawn with the wrong background color when they are moved on the screen
|
|
1973 |
//
|
|
1974 |
{
|
|
1975 |
TSize scrSize(TheClient->iScreen->SizeInPixels());
|
|
1976 |
TSize checkSize(12,10); //X-Size needs to be multiple of 4 due to BITGDI change/defect
|
|
1977 |
CBlankWindow* win;
|
|
1978 |
win=new(ELeave) CBlankWindow(TRgb(16,16,240));
|
|
1979 |
CleanupStack::PushL(win);
|
|
1980 |
win->SetUpL(TPoint(5,5),scrSize-TSize(10,10),TheClient->iGroup,*TheClient->iGc);
|
|
1981 |
TInt mode=win->BaseWin()->SetRequiredDisplayMode(EColor256);
|
|
1982 |
const TDisplayMode actualMode=reinterpret_cast<TDisplayMode&>(mode);
|
|
1983 |
if (!TDisplayModeUtils::IsDisplayModeColor(actualMode) || TDisplayModeUtils::NumDisplayModeColors(actualMode)<256)
|
|
1984 |
{
|
|
1985 |
CleanupStack::PopAndDestroy(win);
|
|
1986 |
return;
|
|
1987 |
}
|
|
1988 |
win->RealDraw(ETrue);
|
|
1989 |
win->Win()->SetBackgroundColor(TRgb(64,224,64));
|
|
1990 |
CBlankWindow* win3;
|
|
1991 |
win3=new(ELeave) CBlankWindow(TRgb::Gray16(8));
|
|
1992 |
CleanupStack::PushL(win3);
|
|
1993 |
win3->SetUpL(TPoint(12,12),checkSize,TheClient->iGroup,*TheClient->iGc);
|
|
1994 |
win3->BaseWin()->SetRequiredDisplayMode(EColor256);
|
|
1995 |
CBlankWindow* win2;
|
|
1996 |
win2=new(ELeave) CBlankWindow(TRgb(240,16,16));
|
|
1997 |
CleanupStack::PushL(win2);
|
|
1998 |
win2->SetUpL(TPoint(10,scrSize.iHeight/2),TSize(scrSize.iWidth/3,scrSize.iHeight/2-10),TheClient->iGroup,*TheClient->iGc);
|
|
1999 |
win2->BaseWin()->SetRequiredDisplayMode(EColor256);
|
|
2000 |
win2->RealDraw(EFalse);
|
|
2001 |
|
|
2002 |
win2->Win()->SetBackgroundColor(TRgb::Gray16(8));
|
|
2003 |
win2->SetExt(TPoint(scrSize.iWidth/4,30),TSize(scrSize.iWidth/2,2*scrSize.iHeight/3));
|
|
2004 |
TheClient->iWs.Finish();
|
|
2005 |
TheClient->WaitForRedrawsToFinish();
|
|
2006 |
if (!CheckRect(win2,win3,TRect(checkSize)))
|
|
2007 |
{
|
|
2008 |
_LIT(KLog,"After window is moved and resizes it doesn't matches the other window");
|
|
2009 |
LOG_MESSAGE(KLog);
|
|
2010 |
//Code to save a screen shot useful if this test fails
|
|
2011 |
/*_LIT(KTest,"E:\\logs\\testexecute\\Window%d");
|
|
2012 |
TBuf<64> buf;
|
|
2013 |
buf.Format(KTest,iTest->iState);
|
|
2014 |
TInt err=iTest->SaveScreen(buf);
|
|
2015 |
_LIT(KLogSave,"Saved screenshot to file %S, (err=%d)");
|
|
2016 |
LOG_MESSAGE3(KLogSave,&buf,err);*/
|
|
2017 |
}
|
|
2018 |
TheClient->WaitForRedrawsToFinish();
|
|
2019 |
CleanupStack::PopAndDestroy(3,win);
|
|
2020 |
}
|
|
2021 |
|
|
2022 |
void CTWindowTest::FocusChangedL()
|
|
2023 |
//
|
|
2024 |
// Test that the focus change is available when the redraw is
|
|
2025 |
// it should be available before, but it isn't always possible to test that
|
|
2026 |
//
|
|
2027 |
{
|
|
2028 |
_LIT(KThreadName,"MoveGroup");
|
|
2029 |
_LIT(KEventWaiting,"Event Waiting when none expected.");
|
|
2030 |
TInt command;
|
|
2031 |
iThreadParam.iScreenNumber=iTest->iScreenNumber;
|
|
2032 |
iFirstFunction=TThreadStartUp(CTWindowTest::MoveGroup,&iThreadParam);
|
|
2033 |
TRequestStatus status;
|
|
2034 |
TSize scrSize(TheClient->iScreen->SizeInPixels());
|
|
2035 |
CTWindowGroup* group1=new(ELeave) CTWindowGroup(TheClient);
|
|
2036 |
group1->ConstructL();
|
|
2037 |
CleanupStack::PushL(group1);
|
|
2038 |
TInt winId1=group1->GroupWin()->Identifier();
|
|
2039 |
CBlankWindow* win1=new(ELeave) CBlankWindow(TRgb::Gray4(1));
|
|
2040 |
CleanupStack::PushL(win1);
|
|
2041 |
win1->SetUpL(TPoint(1,1),TSize(2*scrSize.iWidth/3,2*scrSize.iHeight/3),group1,*TheClient->iGc);
|
|
2042 |
win1->RealDraw(ETrue);
|
|
2043 |
win1->Win()->SetBackgroundColor(TRgb::Gray4(3));
|
|
2044 |
CTWindowGroup* group2=new(ELeave) CTWindowGroup(TheClient);
|
|
2045 |
group2->ConstructL();
|
|
2046 |
CleanupStack::PushL(group2);
|
|
2047 |
TInt winId2=group2->GroupWin()->Identifier();
|
|
2048 |
CBlankWindow* win2=new(ELeave) CBlankWindow(TRgb::Gray4(2));
|
|
2049 |
CleanupStack::PushL(win2);
|
|
2050 |
win2->SetUpL(TPoint(scrSize.iWidth/3-5,scrSize.iHeight/3-5),TSize(2*scrSize.iWidth/3,2*scrSize.iHeight/3),group2,*TheClient->iGc);
|
|
2051 |
win2->RealDraw(ETrue);
|
|
2052 |
win2->Win()->SetBackgroundColor(TRgb::Gray4(0));
|
|
2053 |
|
|
2054 |
TheClient->WaitForRedrawsToFinish();
|
|
2055 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2056 |
command=winId1;
|
|
2057 |
iThreadParam.iCommand=command;
|
|
2058 |
TBool noEventWaiting=!TheClient->IsEventWaiting();
|
|
2059 |
TEST(noEventWaiting);
|
|
2060 |
if (!noEventWaiting)
|
|
2061 |
LOG_MESSAGE(KEventWaiting);
|
|
2062 |
_LIT(KTest1,"FocusChangedL: 1st test completed");
|
|
2063 |
LOG_MESSAGE(KTest1);
|
|
2064 |
CProcess* iMoveGroup=CProcess::NewSimpleThreadL(KThreadName,&iFirstFunction,&status);
|
|
2065 |
User::WaitForRequest(status);
|
|
2066 |
delete iMoveGroup;
|
|
2067 |
TEST(TheClient->WaitForEvent());
|
|
2068 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2069 |
|
|
2070 |
command=winId2;
|
|
2071 |
iThreadParam.iCommand=command;
|
|
2072 |
TheClient->WaitForRedrawsToFinish();
|
|
2073 |
noEventWaiting=!TheClient->IsEventWaiting();
|
|
2074 |
TEST(noEventWaiting);
|
|
2075 |
if (!noEventWaiting)
|
|
2076 |
LOG_MESSAGE(KEventWaiting);
|
|
2077 |
_LIT(KTest2,"FocusChangedL: 2nd test completed");
|
|
2078 |
LOG_MESSAGE(KTest2);
|
|
2079 |
iMoveGroup=CProcess::NewSimpleThreadL(KThreadName,&iFirstFunction,&status);
|
|
2080 |
User::WaitForRequest(status);
|
|
2081 |
delete iMoveGroup;
|
|
2082 |
TEST(TheClient->WaitForEvent());
|
|
2083 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2084 |
|
|
2085 |
command=winId2|(1<<EPosShift);
|
|
2086 |
iThreadParam.iCommand=command;
|
|
2087 |
TheClient->WaitForRedrawsToFinish();
|
|
2088 |
noEventWaiting=!TheClient->IsEventWaiting();
|
|
2089 |
TEST(noEventWaiting);
|
|
2090 |
if (!noEventWaiting)
|
|
2091 |
LOG_MESSAGE(KEventWaiting);
|
|
2092 |
_LIT(KTest3,"FocusChangedL: 3rd test completed");
|
|
2093 |
LOG_MESSAGE(KTest3);
|
|
2094 |
iMoveGroup=CProcess::NewSimpleThreadL(KThreadName,&iFirstFunction,&status);
|
|
2095 |
User::WaitForRequest(status);
|
|
2096 |
delete iMoveGroup;
|
|
2097 |
TEST(TheClient->WaitForEvent());
|
|
2098 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2099 |
|
|
2100 |
command=winId1|(1<<EPosShift);
|
|
2101 |
iThreadParam.iCommand=command;
|
|
2102 |
TheClient->WaitForRedrawsToFinish();
|
|
2103 |
noEventWaiting=!TheClient->IsEventWaiting();
|
|
2104 |
TEST(noEventWaiting);
|
|
2105 |
if (!noEventWaiting)
|
|
2106 |
LOG_MESSAGE(KEventWaiting);
|
|
2107 |
_LIT(KTest4,"FocusChangedL: 4th test completed");
|
|
2108 |
LOG_MESSAGE(KTest4);
|
|
2109 |
iMoveGroup=CProcess::NewSimpleThreadL(KThreadName,&iFirstFunction,&status);
|
|
2110 |
User::WaitForRequest(status);
|
|
2111 |
delete iMoveGroup;
|
|
2112 |
TEST(TheClient->WaitForEvent());
|
|
2113 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2114 |
|
|
2115 |
TheClient->WaitForRedrawsToFinish();
|
|
2116 |
noEventWaiting=!TheClient->IsEventWaiting();
|
|
2117 |
TEST(noEventWaiting);
|
|
2118 |
if (!noEventWaiting)
|
|
2119 |
LOG_MESSAGE(KEventWaiting);
|
|
2120 |
_LIT(KTest5,"FocusChangedL: 5th and last test completed");
|
|
2121 |
LOG_MESSAGE(KTest5);
|
|
2122 |
CleanupStack::PopAndDestroy(2,group2);
|
|
2123 |
TheClient->Flush();
|
|
2124 |
TEST(TheClient->WaitForEvent());
|
|
2125 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2126 |
CleanupStack::PopAndDestroy(2,group1);
|
|
2127 |
}
|
|
2128 |
|
|
2129 |
#define ALT_PRI 78
|
|
2130 |
void CTWindowTest::EventsToAllL()
|
|
2131 |
{
|
|
2132 |
CTClient* client1=new(ELeave) CTClient;
|
|
2133 |
CleanupStack::PushL(client1);
|
|
2134 |
client1->SetScreenNumber(iTest->iScreenNumber);
|
|
2135 |
client1->ConstructL();
|
|
2136 |
CTClient* client2=new(ELeave) CTClient;
|
|
2137 |
CleanupStack::PushL(client2);
|
|
2138 |
client2->SetScreenNumber(iTest->iScreenNumber);
|
|
2139 |
client2->ConstructL();
|
|
2140 |
CEvWindowGroup* group1a=CEvWindowGroup::NewLC(client1,this);
|
|
2141 |
CEvWindowGroup* group1b=CEvWindowGroup::NewLC(client1,this);
|
|
2142 |
CEvWindowGroup* group2a=CEvWindowGroup::NewLC(client2,this);
|
|
2143 |
CEvWindowGroup* group2b=CEvWindowGroup::NewLC(client2,this);
|
|
2144 |
/*_LIT(KLog,"Window Group Id's: %d,%d,%d,%d");
|
|
2145 |
LOG_MESSAGE5(KLog,group1a->GroupWin()->Identifier(),group1b->GroupWin()->Identifier(),group2a->GroupWin()->Identifier(),group2b->GroupWin()->Identifier());*/
|
|
2146 |
group1a->SendEvent(KBaseUserEvent+1);
|
|
2147 |
group2b->SendEvent(KBaseUserEvent+2);
|
|
2148 |
client1->WaitForAllEventProcessingToFinish();
|
|
2149 |
client2->WaitForAllEventProcessingToFinish();
|
|
2150 |
TWsEvent event;
|
|
2151 |
// Assigned random value because before PREQ1226, TWsevent's data wasn't zero initialised.
|
|
2152 |
// In techview, following function
|
|
2153 |
// void CEikServAppUi::HandleSystemEventL(const TWsEvent& aEvent)
|
|
2154 |
// was relaying on TWsevent's data not be zero
|
|
2155 |
*(event.Int()) = 0XCCCCCCCC;
|
|
2156 |
event.SetType(KBaseUserEvent+3);
|
|
2157 |
group1a->SetExpectedEvent(KBaseUserEvent+3);
|
|
2158 |
group1b->SetExpectedEvent(KBaseUserEvent+3);
|
|
2159 |
group2a->SetExpectedEvent(KBaseUserEvent+3);
|
|
2160 |
group2b->SetExpectedEvent(KBaseUserEvent+3);
|
|
2161 |
TheClient->iWs.SendEventToAllWindowGroups(event);
|
|
2162 |
client1->WaitForAllEventProcessingToFinish();
|
|
2163 |
client2->WaitForAllEventProcessingToFinish();
|
|
2164 |
event.SetType(KBaseUserEvent+4);
|
|
2165 |
group1a->SetExpectedEvent(KBaseUserEvent+4);
|
|
2166 |
group1b->SetExpectedEvent(KBaseUserEvent+4);
|
|
2167 |
group2a->SetExpectedEvent(KBaseUserEvent+4);
|
|
2168 |
group2b->SetExpectedEvent(KBaseUserEvent+4);
|
|
2169 |
TheClient->iWs.SendEventToAllWindowGroups(event);
|
|
2170 |
client1->WaitForAllEventProcessingToFinish();
|
|
2171 |
client2->WaitForAllEventProcessingToFinish();
|
|
2172 |
event.SetType(KBaseUserEvent+5);
|
|
2173 |
//group1a->SetExpectedEvent(KBaseUserEvent+5);
|
|
2174 |
group1b->SetExpectedEvent(KBaseUserEvent+5);
|
|
2175 |
//group2a->SetExpectedEvent(KBaseUserEvent+5);
|
|
2176 |
group2b->SetExpectedEvent(KBaseUserEvent+5);
|
|
2177 |
TheClient->iWs.SendEventToOneWindowGroupsPerClient(event);
|
|
2178 |
client1->WaitForAllEventProcessingToFinish();
|
|
2179 |
client2->WaitForAllEventProcessingToFinish();
|
|
2180 |
group1a->WinTreeNode()->SetOrdinalPosition(0);
|
|
2181 |
client1->Flush();
|
|
2182 |
event.SetType(KBaseUserEvent+6);
|
|
2183 |
group1a->SetExpectedEvent(KBaseUserEvent+6);
|
|
2184 |
group2b->SetExpectedEvent(KBaseUserEvent+6);
|
|
2185 |
TheClient->iWs.SendEventToOneWindowGroupsPerClient(event);
|
|
2186 |
client1->WaitForAllEventProcessingToFinish();
|
|
2187 |
client2->WaitForAllEventProcessingToFinish();
|
|
2188 |
group2b->WinTreeNode()->SetOrdinalPosition(6);
|
|
2189 |
client2->Flush();
|
|
2190 |
event.SetType(KBaseUserEvent+7);
|
|
2191 |
group1a->SetExpectedEvent(KBaseUserEvent+7);
|
|
2192 |
group2a->SetExpectedEvent(KBaseUserEvent+7);
|
|
2193 |
TheClient->iWs.SendEventToOneWindowGroupsPerClient(event);
|
|
2194 |
client1->WaitForAllEventProcessingToFinish();
|
|
2195 |
client2->WaitForAllEventProcessingToFinish();
|
|
2196 |
event.SetType(KBaseUserEvent+8);
|
|
2197 |
group1a->SetExpectedEvent(KBaseUserEvent+8);
|
|
2198 |
group1b->SetExpectedEvent(KBaseUserEvent+8);
|
|
2199 |
group2a->SetExpectedEvent(KBaseUserEvent+8);
|
|
2200 |
group2b->SetExpectedEvent(KBaseUserEvent+8);
|
|
2201 |
TheClient->iWs.SendEventToAllWindowGroups(0,event);
|
|
2202 |
group1a->WinTreeNode()->SetOrdinalPosition(0,ALT_PRI);
|
|
2203 |
client1->Flush();
|
|
2204 |
client1->WaitForAllEventProcessingToFinish();
|
|
2205 |
client2->WaitForAllEventProcessingToFinish();
|
|
2206 |
event.SetType(KBaseUserEvent+9);
|
|
2207 |
group1a->SetExpectedEvent(KBaseUserEvent+9);
|
|
2208 |
TheClient->iWs.SendEventToAllWindowGroups(ALT_PRI,event);
|
|
2209 |
client1->WaitForAllEventProcessingToFinish();
|
|
2210 |
client2->WaitForAllEventProcessingToFinish();
|
|
2211 |
group2b->WinTreeNode()->SetOrdinalPosition(0,ALT_PRI);
|
|
2212 |
client2->Flush();
|
|
2213 |
client1->WaitForAllEventProcessingToFinish();
|
|
2214 |
client2->WaitForAllEventProcessingToFinish();
|
|
2215 |
event.SetType(KBaseUserEvent+10);
|
|
2216 |
group1a->SetExpectedEvent(KBaseUserEvent+10);
|
|
2217 |
group2b->SetExpectedEvent(KBaseUserEvent+10);
|
|
2218 |
TheClient->iWs.SendEventToAllWindowGroups(ALT_PRI,event);
|
|
2219 |
client1->WaitForAllEventProcessingToFinish();
|
|
2220 |
client2->WaitForAllEventProcessingToFinish();
|
|
2221 |
event.SetType(KBaseUserEvent+11);
|
|
2222 |
group1b->SetExpectedEvent(KBaseUserEvent+11);
|
|
2223 |
group2a->SetExpectedEvent(KBaseUserEvent+11);
|
|
2224 |
TheClient->iWs.SendEventToAllWindowGroups(0,event);
|
|
2225 |
client1->WaitForAllEventProcessingToFinish();
|
|
2226 |
client2->WaitForAllEventProcessingToFinish();
|
|
2227 |
event.SetType(KBaseUserEvent);
|
|
2228 |
group1a->SetExpectedEvent(KBaseUserEvent);
|
|
2229 |
group1b->SetExpectedEvent(KBaseUserEvent);
|
|
2230 |
group2a->SetExpectedEvent(KBaseUserEvent);
|
|
2231 |
group2b->SetExpectedEvent(KBaseUserEvent);
|
|
2232 |
TheClient->iWs.SendEventToAllWindowGroups(event);
|
|
2233 |
client1->WaitForAllEventProcessingToFinish();
|
|
2234 |
client2->WaitForAllEventProcessingToFinish();
|
|
2235 |
CleanupStack::PopAndDestroy(6,client1);
|
|
2236 |
}
|
|
2237 |
|
|
2238 |
void DestroyWindow(TAny* aWindow)
|
|
2239 |
{
|
|
2240 |
static_cast<RWindowTreeNode*>(aWindow)->Destroy();
|
|
2241 |
}
|
|
2242 |
|
|
2243 |
void CTWindowTest::GroupIdL()
|
|
2244 |
{
|
|
2245 |
const TInt numWindows=10;
|
|
2246 |
RWindowGroup group(TheClient->iWs);
|
|
2247 |
CleanupClosePushL(group);
|
|
2248 |
User::LeaveIfError(group.Construct(ENullWsHandle));
|
|
2249 |
TInt id=group.Identifier();
|
|
2250 |
RWindowTreeNode* prevWindow=&group;
|
|
2251 |
TInt ii;
|
|
2252 |
for (ii=0;ii<numWindows;++ii)
|
|
2253 |
{
|
|
2254 |
RBlankWindow* window=new(ELeave) RBlankWindow(TheClient->iWs);
|
|
2255 |
CleanupStack::PushL(TCleanupItem(&DestroyWindow,window));
|
|
2256 |
User::LeaveIfError(window->Construct(*prevWindow,ENullWsHandle));
|
|
2257 |
TInt retVal = window->WindowGroupId();
|
|
2258 |
TEST(retVal==id);
|
|
2259 |
if (retVal!=id)
|
|
2260 |
INFO_PRINTF3(_L("window->WindowGroupId() return value - equal to: %d , Actual: %d"), id, retVal);
|
|
2261 |
prevWindow=window;
|
|
2262 |
}
|
|
2263 |
CleanupStack::PopAndDestroy(numWindows+1);
|
|
2264 |
}
|
|
2265 |
|
|
2266 |
/**
|
|
2267 |
@SYMTestCaseID GRAPHICS-WSERV-0495
|
|
2268 |
|
|
2269 |
@SYMDEF PDEF131541
|
|
2270 |
|
|
2271 |
@SYMTestCaseDesc Sending Events using one of the functions SendEventToWindowGroup, SendEventToAllWindowGroups (x2)
|
|
2272 |
and SendEventToOneWindowGroupsPerClient when an event queue is full returns an error
|
|
2273 |
|
|
2274 |
@SYMTestPriority Low
|
|
2275 |
|
|
2276 |
@SYMTestStatus Implemented
|
|
2277 |
|
|
2278 |
@SYMTestActions Call the functions repeatly many times and check that an error gets returned eventually
|
|
2279 |
|
|
2280 |
@SYMTestExpectedResults Functions return the error KErrNoMemory
|
|
2281 |
*/
|
|
2282 |
const TInt numTest=75; //Must be at least 33
|
|
2283 |
void CTWindowTest::SaturateSendEvent()
|
|
2284 |
{
|
|
2285 |
const TInt id=TheClient->iGroup->GroupWin()->Identifier();
|
|
2286 |
TWsEvent event;
|
|
2287 |
event.SetType(KBaseUserEvent);
|
|
2288 |
TInt ii;
|
|
2289 |
|
|
2290 |
TInt err=KErrNone;
|
|
2291 |
for (ii=0; ii<=numTest && err==KErrNone;)
|
|
2292 |
{
|
|
2293 |
++ii;
|
|
2294 |
err=TheClient->iWs.SendEventToWindowGroup(id,event);
|
|
2295 |
}
|
|
2296 |
TEST(err==KErrNoMemory);
|
|
2297 |
if (err!=KErrNoMemory)
|
|
2298 |
{
|
|
2299 |
_LIT(KLog,"After %d/%d iterations SendEventToWindowGroup returned the error %d");
|
|
2300 |
LOG_MESSAGE4(KLog,ii,numTest,err);
|
|
2301 |
}
|
|
2302 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2303 |
|
|
2304 |
err=KErrNone;
|
|
2305 |
for (ii=0; ii<=numTest && err==KErrNone;)
|
|
2306 |
{
|
|
2307 |
++ii;
|
|
2308 |
err=TheClient->iWs.SendEventToAllWindowGroups(event);
|
|
2309 |
}
|
|
2310 |
TEST(err==KErrNoMemory);
|
|
2311 |
if (err!=KErrNoMemory)
|
|
2312 |
{
|
|
2313 |
_LIT(KLog,"After %d/%d iterations SendEventToAllWindowGroups returned the error %d");
|
|
2314 |
LOG_MESSAGE4(KLog,ii,numTest,err);
|
|
2315 |
}
|
|
2316 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2317 |
User::After(1000000); //1sec, give other sessions a chance to respond to the events
|
|
2318 |
|
|
2319 |
err=KErrNone;
|
|
2320 |
for (ii=0; ii<=numTest && err==KErrNone;)
|
|
2321 |
{
|
|
2322 |
++ii;
|
|
2323 |
err=TheClient->iWs.SendEventToAllWindowGroups(0,event);
|
|
2324 |
}
|
|
2325 |
TEST(err==KErrNoMemory);
|
|
2326 |
if (err!=KErrNoMemory)
|
|
2327 |
{
|
|
2328 |
_LIT(KLog,"After %d/%d iterations SendEventToAllWindowGroups_Priority0 returned the error %d");
|
|
2329 |
LOG_MESSAGE4(KLog,ii,numTest,err);
|
|
2330 |
}
|
|
2331 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2332 |
User::After(1000000); //1sec, give other sessions a chance to respond to the events
|
|
2333 |
|
|
2334 |
err=KErrNone;
|
|
2335 |
for (ii=0; ii<=numTest && err==KErrNone;)
|
|
2336 |
{
|
|
2337 |
++ii;
|
|
2338 |
err=TheClient->iWs.SendEventToOneWindowGroupsPerClient(event);
|
|
2339 |
}
|
|
2340 |
TEST(err==KErrNoMemory);
|
|
2341 |
if (err!=KErrNoMemory)
|
|
2342 |
{
|
|
2343 |
_LIT(KLog,"After %d/%d iterations SendEventToOneWindowGroupsPerClient returned the error %d");
|
|
2344 |
LOG_MESSAGE4(KLog,ii,numTest,err);
|
|
2345 |
}
|
|
2346 |
TheClient->WaitForAllEventProcessingToFinish();
|
|
2347 |
User::After(1000000); //1sec, give other sessions a chance to respond to the events
|
|
2348 |
}
|
|
2349 |
|
|
2350 |
void CTWindowTest::TestNotSupportedFunctionality()
|
|
2351 |
{
|
|
2352 |
TInt err = KErrNone;
|
|
2353 |
TSize windowSize = TSize(10,10);
|
|
2354 |
TSize testSize = TSize();
|
|
2355 |
|
|
2356 |
RWindowGroup group(TheClient->iWs);
|
|
2357 |
RWindow window(TheClient->iWs);
|
|
2358 |
|
|
2359 |
err = group.Construct((TUint32)&group, EFalse);
|
|
2360 |
TEST(err==KErrNone);
|
|
2361 |
err = window.Construct(group,(TUint32)&window);
|
|
2362 |
TEST(err==KErrNone);
|
|
2363 |
|
|
2364 |
window.SetExtent(TPoint(0,0),windowSize);
|
|
2365 |
window.Activate();
|
|
2366 |
|
|
2367 |
testSize = window.Size();
|
|
2368 |
TEST((testSize.iWidth==windowSize.iWidth) && (testSize.iHeight==windowSize.iHeight));
|
|
2369 |
|
|
2370 |
testSize = window.Size();
|
|
2371 |
TEST((testSize.iWidth==windowSize.iWidth) && (testSize.iHeight==windowSize.iHeight));
|
|
2372 |
|
|
2373 |
window.Close();
|
|
2374 |
group.Close();
|
|
2375 |
}
|
|
2376 |
|
|
2377 |
void CTWindowTest::RunTestCaseL(TInt /*aCurTestCase*/)
|
|
2378 |
{
|
|
2379 |
_LIT(KTest1,"Window");
|
|
2380 |
_LIT(KTest2,"DestroyWindowWithActiveGc");
|
|
2381 |
_LIT(KTest3,"Shadow/NoAutoClear");
|
|
2382 |
_LIT(KTest4,"Corner Tests");
|
|
2383 |
_LIT(KTest5,"Invalid Window Functions");
|
|
2384 |
_LIT(KTest7,"Mega-Tree");
|
|
2385 |
_LIT(KTest8,"Tiled Window One");
|
|
2386 |
_LIT(KTest9,"Tiled Window Two");
|
|
2387 |
_LIT(KTest10,"Color Test");
|
|
2388 |
_LIT(KTest11,"Invalid Window Functions2");
|
|
2389 |
_LIT(KTest12,"Defect 1");
|
|
2390 |
_LIT(KTest13,"Defect 2");
|
|
2391 |
_LIT(KTest14,"Parent Deleted 1");
|
|
2392 |
_LIT(KTest15,"Parent Deleted 2");
|
|
2393 |
_LIT(KTest16,"Defect 3");
|
|
2394 |
_LIT(KTest17,"Background Color");
|
|
2395 |
_LIT(KTest18,"Focus Changed");
|
|
2396 |
_LIT(KTest21,"Events To All");
|
|
2397 |
_LIT(KTest22,"Error Codes");
|
|
2398 |
_LIT(KTest23,"Group Id");
|
|
2399 |
_LIT(KTest24,"DeleteParentWindowOnly");
|
|
2400 |
#if defined(_DEBUG)
|
|
2401 |
_LIT(KTest25,"DuplicateWindowHandles");
|
|
2402 |
#else
|
|
2403 |
_LIT(KTest25skipped,"DuplicateWindowHandles skipped");
|
|
2404 |
#endif
|
|
2405 |
|
|
2406 |
((CTWindowTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
|
2407 |
|
|
2408 |
_LIT(KTest26,"Saturate SendEvent");
|
|
2409 |
_LIT(KTest27,"Not Supported Functionality");
|
|
2410 |
|
|
2411 |
switch(++iTest->iState)
|
|
2412 |
{
|
|
2413 |
/**
|
|
2414 |
@SYMTestCaseID GRAPHICS-WSERV-0029
|
|
2415 |
|
|
2416 |
@SYMDEF DEF081259
|
|
2417 |
|
|
2418 |
@SYMTestCaseDesc Test window can be created and destroyed correctly
|
|
2419 |
|
|
2420 |
@SYMTestPriority High
|
|
2421 |
|
|
2422 |
@SYMTestStatus Implemented
|
|
2423 |
|
|
2424 |
@SYMTestActions Creates and destroys a window
|
|
2425 |
|
|
2426 |
@SYMTestExpectedResults Window is created and destroyed without error
|
|
2427 |
*/
|
|
2428 |
case 1:
|
|
2429 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0029"));
|
|
2430 |
iTest->LogSubTest(KTest1);
|
|
2431 |
CreateTestWindowL();
|
|
2432 |
CheckAndDestroyWindows();
|
|
2433 |
//iState=17;
|
|
2434 |
break;
|
|
2435 |
/**
|
|
2436 |
@SYMTestCaseID GRAPHICS-WSERV-0030
|
|
2437 |
|
|
2438 |
@SYMDEF DEF081259
|
|
2439 |
|
|
2440 |
@SYMTestCaseDesc Creates and destroys window with an active gc
|
|
2441 |
|
|
2442 |
@SYMTestPriority High
|
|
2443 |
|
|
2444 |
@SYMTestStatus Implemented
|
|
2445 |
|
|
2446 |
@SYMTestActions Create and destroy a window with an active gc
|
|
2447 |
|
|
2448 |
@SYMTestExpectedResults Window is created and destroyed without error
|
|
2449 |
*/
|
|
2450 |
case 2:
|
|
2451 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0030"));
|
|
2452 |
iTest->LogSubTest(KTest2);
|
|
2453 |
CreateTestWindowL();
|
|
2454 |
DestroyWindowWithActiveGc();
|
|
2455 |
CreateTestWindowL();
|
|
2456 |
DestroyWindowWithActiveGc2L();
|
|
2457 |
break;
|
|
2458 |
/**
|
|
2459 |
@SYMTestCaseID GRAPHICS-WSERV-0031
|
|
2460 |
|
|
2461 |
@SYMDEF DEF081259
|
|
2462 |
|
|
2463 |
@SYMTestCaseDesc Test that shadow is not automatically cleared when
|
|
2464 |
drawing a window
|
|
2465 |
|
|
2466 |
@SYMTestPriority High
|
|
2467 |
|
|
2468 |
@SYMTestStatus Implemented
|
|
2469 |
|
|
2470 |
@SYMTestActions Draw windows and check that the shadow is not automatically
|
|
2471 |
cleared
|
|
2472 |
|
|
2473 |
@SYMTestExpectedResults Screen comparison returns that the shadow was not cleared
|
|
2474 |
*/
|
|
2475 |
case 3:
|
|
2476 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0031"));
|
|
2477 |
//window shadowing is no longer supported. keep the test to make sure clients can still call the methods
|
|
2478 |
iTest->LogSubTest(KTest3);
|
|
2479 |
ShadowAutoClearTest();
|
|
2480 |
break;
|
|
2481 |
/**
|
|
2482 |
@SYMTestCaseID GRAPHICS-WSERV-0032
|
|
2483 |
|
|
2484 |
@SYMDEF DEF081259
|
|
2485 |
|
|
2486 |
@SYMTestCaseDesc Test the drawing of different types of corner of
|
|
2487 |
a window
|
|
2488 |
|
|
2489 |
@SYMTestPriority High
|
|
2490 |
|
|
2491 |
@SYMTestStatus Implemented
|
|
2492 |
|
|
2493 |
@SYMTestActions Draw a window with different types of corner
|
|
2494 |
|
|
2495 |
@SYMTestExpectedResults The window is drawn correctly for each corner type
|
|
2496 |
*/
|
|
2497 |
case 4:
|
|
2498 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0032"));
|
|
2499 |
iTest->LogSubTest(KTest4);
|
|
2500 |
CornerTests();
|
|
2501 |
break;
|
|
2502 |
/**
|
|
2503 |
@SYMTestCaseID GRAPHICS-WSERV-0033
|
|
2504 |
|
|
2505 |
@SYMDEF DEF081259
|
|
2506 |
|
|
2507 |
@SYMTestCaseDesc Test for panics when window is sent wrong requests
|
|
2508 |
|
|
2509 |
@SYMTestPriority High
|
|
2510 |
|
|
2511 |
@SYMTestStatus Implemented
|
|
2512 |
|
|
2513 |
@SYMTestActions Send wrong requests to windows and deal with panic
|
|
2514 |
|
|
2515 |
@SYMTestExpectedResults The windows panic as expected
|
|
2516 |
*/
|
|
2517 |
case 5:
|
|
2518 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0033"));
|
|
2519 |
iTest->LogSubTest(KTest5);
|
|
2520 |
TestInvalidFunctionsL();
|
|
2521 |
break;
|
|
2522 |
/**
|
|
2523 |
@SYMTestCaseID GRAPHICS-WSERV-0035
|
|
2524 |
|
|
2525 |
@SYMDEF DEF081259
|
|
2526 |
|
|
2527 |
@SYMTestCaseDesc Draw 100 windows from a thread
|
|
2528 |
|
|
2529 |
@SYMTestPriority High
|
|
2530 |
|
|
2531 |
@SYMTestStatus Implemented
|
|
2532 |
|
|
2533 |
@SYMTestActions Draw 100 windows from the same thread
|
|
2534 |
|
|
2535 |
@SYMTestExpectedResults The windows are all drawn without error
|
|
2536 |
*/
|
|
2537 |
case 6:
|
|
2538 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0035"));
|
|
2539 |
iTest->LogSubTest(KTest7);
|
|
2540 |
CreateMegaTree();
|
|
2541 |
break;
|
|
2542 |
/**
|
|
2543 |
@SYMTestCaseID GRAPHICS-WSERV-0036
|
|
2544 |
|
|
2545 |
@SYMDEF DEF081259
|
|
2546 |
|
|
2547 |
@SYMTestCaseDesc Check that windows can be drawn in a tiled format
|
|
2548 |
|
|
2549 |
@SYMTestPriority High
|
|
2550 |
|
|
2551 |
@SYMTestStatus Implemented
|
|
2552 |
|
|
2553 |
@SYMTestActions Draw two windows in a tiled format and check they
|
|
2554 |
are identical
|
|
2555 |
|
|
2556 |
@SYMTestExpectedResults The tiled windows are identical
|
|
2557 |
*/
|
|
2558 |
case 7:
|
|
2559 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0036"));
|
|
2560 |
|
|
2561 |
iTest->LogSubTest(KTest8);
|
|
2562 |
TiledWindowTestL();
|
|
2563 |
break;
|
|
2564 |
/**
|
|
2565 |
@SYMTestCaseID GRAPHICS-WSERV-0037
|
|
2566 |
|
|
2567 |
@SYMDEF DEF081259
|
|
2568 |
|
|
2569 |
@SYMTestCaseDesc Check that windows and dialogs can be drawn in a
|
|
2570 |
tiled format
|
|
2571 |
|
|
2572 |
@SYMTestPriority High
|
|
2573 |
|
|
2574 |
@SYMTestStatus Implemented
|
|
2575 |
|
|
2576 |
@SYMTestActions Draw windows and dialogs in a tiled format
|
|
2577 |
|
|
2578 |
@SYMTestExpectedResults The windows and dialogs are drawn correctly
|
|
2579 |
*/
|
|
2580 |
case 8:
|
|
2581 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0037"));
|
|
2582 |
iTest->LogSubTest(KTest9);
|
|
2583 |
TiledWindowTest2L();
|
|
2584 |
break;
|
|
2585 |
/**
|
|
2586 |
@SYMTestCaseID GRAPHICS-WSERV-0038
|
|
2587 |
|
|
2588 |
@SYMDEF DEF081259
|
|
2589 |
|
|
2590 |
@SYMTestCaseDesc Check drawing into a window with different
|
|
2591 |
colour set ups
|
|
2592 |
|
|
2593 |
@SYMTestPriority High
|
|
2594 |
|
|
2595 |
@SYMTestStatus Implemented
|
|
2596 |
|
|
2597 |
@SYMTestActions Draw in a window using different colour
|
|
2598 |
configurations
|
|
2599 |
|
|
2600 |
@SYMTestExpectedResults The different colours are drawn correctly
|
|
2601 |
*/
|
|
2602 |
case 9:
|
|
2603 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0038"));
|
|
2604 |
iTest->LogSubTest(KTest10);
|
|
2605 |
ColorTestL();
|
|
2606 |
break;
|
|
2607 |
/**
|
|
2608 |
@SYMTestCaseID GRAPHICS-WSERV-0039
|
|
2609 |
|
|
2610 |
@SYMDEF DEF081259
|
|
2611 |
|
|
2612 |
@SYMTestCaseDesc Test for panics when window is sent wrong requests
|
|
2613 |
|
|
2614 |
@SYMTestPriority High
|
|
2615 |
|
|
2616 |
@SYMTestStatus Implemented
|
|
2617 |
|
|
2618 |
@SYMTestActions Send wrong requests to windows and deal with panic
|
|
2619 |
|
|
2620 |
@SYMTestExpectedResults The windows panic as expected
|
|
2621 |
*/
|
|
2622 |
case 10:
|
|
2623 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0039"));
|
|
2624 |
iTest->LogSubTest(KTest11);
|
|
2625 |
TestInvalidFunctions2L();
|
|
2626 |
break;
|
|
2627 |
/**
|
|
2628 |
@SYMTestCaseID GRAPHICS-WSERV-0040
|
|
2629 |
|
|
2630 |
@SYMDEF DEF081259
|
|
2631 |
|
|
2632 |
@SYMTestCaseDesc Test for a defect that causes ROM to crash
|
|
2633 |
|
|
2634 |
@SYMTestPriority High
|
|
2635 |
|
|
2636 |
@SYMTestStatus Implemented
|
|
2637 |
|
|
2638 |
@SYMTestActions Test a defect is not present which causes the ROM
|
|
2639 |
to crash
|
|
2640 |
|
|
2641 |
@SYMTestExpectedResults The defect is not present
|
|
2642 |
*/
|
|
2643 |
case 11:
|
|
2644 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0040"));
|
|
2645 |
iTest->LogSubTest(KTest12);
|
|
2646 |
Bug1L();
|
|
2647 |
break;
|
|
2648 |
/**
|
|
2649 |
@SYMTestCaseID GRAPHICS-WSERV-0041
|
|
2650 |
|
|
2651 |
@SYMDEF DEF081259
|
|
2652 |
|
|
2653 |
@SYMTestCaseDesc Test a previous defect has not returned
|
|
2654 |
|
|
2655 |
@SYMTestPriority High
|
|
2656 |
|
|
2657 |
@SYMTestStatus Implemented
|
|
2658 |
|
|
2659 |
@SYMTestActions Exercise the code the defect was discovered in
|
|
2660 |
|
|
2661 |
@SYMTestExpectedResults The defect is not present
|
|
2662 |
*/
|
|
2663 |
case 12:
|
|
2664 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0041"));
|
|
2665 |
iTest->LogSubTest(KTest13);
|
|
2666 |
Bug2L();
|
|
2667 |
break;
|
|
2668 |
/**
|
|
2669 |
@SYMTestCaseID GRAPHICS-WSERV-0042
|
|
2670 |
|
|
2671 |
@SYMDEF DEF081259
|
|
2672 |
DEF115543
|
|
2673 |
|
|
2674 |
@SYMTestCaseDesc Test that when a parent window is deleted a panic
|
|
2675 |
occurs
|
|
2676 |
|
|
2677 |
@SYMTestPriority High
|
|
2678 |
|
|
2679 |
@SYMTestStatus Implemented
|
|
2680 |
|
|
2681 |
@SYMTestActions Delete a parent window and check for a panic
|
|
2682 |
NOTE: DEF115543 has corrected GRAPHICS-WSERV-0042, and added a lot
|
|
2683 |
more window functions.
|
|
2684 |
|
|
2685 |
@SYMTestExpectedResults All functions either:
|
|
2686 |
Panic the owner thread with EWservPanicParentDeleted or
|
|
2687 |
Get performed without accessing any NULL iParent pointers in the WSERV thread
|
|
2688 |
*/
|
|
2689 |
case 13:
|
|
2690 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0042"));
|
|
2691 |
iTest->LogSubTest(KTest14);
|
|
2692 |
TestDeletedParentPanics1L();
|
|
2693 |
break;
|
|
2694 |
/**
|
|
2695 |
@SYMTestCaseID GRAPHICS-WSERV-0043
|
|
2696 |
|
|
2697 |
@SYMDEF DEF081259
|
|
2698 |
|
|
2699 |
@SYMTestCaseDesc Test that when a parent window is deleted a panic
|
|
2700 |
occurs
|
|
2701 |
|
|
2702 |
@SYMTestPriority High
|
|
2703 |
|
|
2704 |
@SYMTestStatus Implemented
|
|
2705 |
|
|
2706 |
@SYMTestActions Delete a parent window and check for a panic
|
|
2707 |
|
|
2708 |
@SYMTestExpectedResults The panic occurs as expected
|
|
2709 |
*/
|
|
2710 |
case 14:
|
|
2711 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0043"));
|
|
2712 |
iTest->LogSubTest(KTest15);
|
|
2713 |
TestDeletedParentPanics2L();
|
|
2714 |
break;
|
|
2715 |
/**
|
|
2716 |
@SYMTestCaseID GRAPHICS-WSERV-0044
|
|
2717 |
|
|
2718 |
@SYMDEF DEF081259
|
|
2719 |
|
|
2720 |
@SYMTestCaseDesc Check that activate then make visible and backup
|
|
2721 |
behind a window does not panic.
|
|
2722 |
|
|
2723 |
@SYMTestPriority High
|
|
2724 |
|
|
2725 |
@SYMTestStatus Implemented
|
|
2726 |
|
|
2727 |
@SYMTestActions Activate then make visible and backup
|
|
2728 |
behind a window
|
|
2729 |
|
|
2730 |
@SYMTestExpectedResults No panic occurs
|
|
2731 |
*/
|
|
2732 |
case 15:
|
|
2733 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0044"));
|
|
2734 |
iTest->LogSubTest(KTest16);
|
|
2735 |
Bug3L();
|
|
2736 |
break;
|
|
2737 |
/**
|
|
2738 |
@SYMTestCaseID GRAPHICS-WSERV-0045
|
|
2739 |
|
|
2740 |
@SYMDEF DEF081259
|
|
2741 |
|
|
2742 |
@SYMTestCaseDesc Test window being drawn with the correct background
|
|
2743 |
color when they are moved on the screen
|
|
2744 |
|
|
2745 |
@SYMTestPriority High
|
|
2746 |
|
|
2747 |
@SYMTestStatus Implemented
|
|
2748 |
|
|
2749 |
@SYMTestActions Move window on the screen and check it is drawn with
|
|
2750 |
the correct background colour
|
|
2751 |
|
|
2752 |
@SYMTestExpectedResults The background coloour is correct
|
|
2753 |
*/
|
|
2754 |
case 16:
|
|
2755 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0045"));
|
|
2756 |
iTest->LogSubTest(KTest17);
|
|
2757 |
BackColorBugL();
|
|
2758 |
break;
|
|
2759 |
/**
|
|
2760 |
@SYMTestCaseID GRAPHICS-WSERV-0046
|
|
2761 |
|
|
2762 |
@SYMDEF DEF081259
|
|
2763 |
|
|
2764 |
@SYMTestCaseDesc Test that the focus change is available after redraw
|
|
2765 |
|
|
2766 |
@SYMTestPriority High
|
|
2767 |
|
|
2768 |
@SYMTestStatus Implemented
|
|
2769 |
|
|
2770 |
@SYMTestActions Redraw and check the focus change is available
|
|
2771 |
|
|
2772 |
@SYMTestExpectedResults The focus change is available
|
|
2773 |
*/
|
|
2774 |
case 17:
|
|
2775 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0046"));
|
|
2776 |
iTest->LogSubTest(KTest18);
|
|
2777 |
FocusChangedL();
|
|
2778 |
break;
|
|
2779 |
/**
|
|
2780 |
@SYMTestCaseID GRAPHICS-WSERV-0048
|
|
2781 |
|
|
2782 |
@SYMDEF DEF081259
|
|
2783 |
|
|
2784 |
@SYMTestCaseDesc Test that events can be sent to a number of window
|
|
2785 |
groups simultaneously
|
|
2786 |
|
|
2787 |
@SYMTestPriority High
|
|
2788 |
|
|
2789 |
@SYMTestStatus Implemented
|
|
2790 |
|
|
2791 |
@SYMTestActions Send events to a number of window groups and check
|
|
2792 |
that they all receive them
|
|
2793 |
|
|
2794 |
@SYMTestExpectedResults The events and sent to the window groups correctly
|
|
2795 |
*/
|
|
2796 |
case 18:
|
|
2797 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0048"));
|
|
2798 |
iTest->LogSubTest(KTest21);
|
|
2799 |
EventsToAllL();
|
|
2800 |
break;
|
|
2801 |
/**
|
|
2802 |
@SYMTestCaseID GRAPHICS-WSERV-0049
|
|
2803 |
|
|
2804 |
@SYMDEF DEF081259
|
|
2805 |
|
|
2806 |
@SYMTestCaseDesc Test error code when incorrectly moving a window to
|
|
2807 |
a group.
|
|
2808 |
|
|
2809 |
@SYMTestPriority High
|
|
2810 |
|
|
2811 |
@SYMTestStatus Implemented
|
|
2812 |
|
|
2813 |
@SYMTestActions Try to move a window to a group and check the error
|
|
2814 |
codes
|
|
2815 |
|
|
2816 |
@SYMTestExpectedResults The correct error codes are returned
|
|
2817 |
*/
|
|
2818 |
case 19:
|
|
2819 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0049"));
|
|
2820 |
iTest->LogSubTest(KTest22);
|
|
2821 |
ErrorCodesL();
|
|
2822 |
/**
|
|
2823 |
@SYMTestCaseID GRAPHICS-WSERV-0050
|
|
2824 |
|
|
2825 |
@SYMDEF DEF081259
|
|
2826 |
|
|
2827 |
@SYMTestCaseDesc Check that the correct group id is assigned to a
|
|
2828 |
chain of windows
|
|
2829 |
|
|
2830 |
@SYMTestPriority High
|
|
2831 |
|
|
2832 |
@SYMTestStatus Implemented
|
|
2833 |
|
|
2834 |
@SYMTestActions Create a chain of windows in the same group and check
|
|
2835 |
the all have the same group id
|
|
2836 |
|
|
2837 |
@SYMTestExpectedResults The windows all have the same group id
|
|
2838 |
*/
|
|
2839 |
case 20:
|
|
2840 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0050"));
|
|
2841 |
iTest->LogSubTest(KTest23);
|
|
2842 |
GroupIdL();
|
|
2843 |
break;
|
|
2844 |
|
|
2845 |
/**
|
|
2846 |
@SYMTestCaseID GRAPHICS-WSERV-0461
|
|
2847 |
|
|
2848 |
@SYMDEF PDEF114190
|
|
2849 |
|
|
2850 |
@SYMTestCaseDesc Test window redraw queue cleanup when window is deleted in low memory conditions
|
|
2851 |
|
|
2852 |
@SYMTestPriority High
|
|
2853 |
|
|
2854 |
@SYMTestStatus Implemented
|
|
2855 |
|
|
2856 |
@SYMTestActions Have a loop which increases the number of allocations in the server thread before failure;
|
|
2857 |
Within the loop:
|
|
2858 |
1) Create a parent window and a child window of the parent;
|
|
2859 |
2) Delete the parent window only, but not the child window;
|
|
2860 |
3) Create a testWindow. This new window gets added to the redraw queue which will force it
|
|
2861 |
reordering. This would crash WSERV due to this defect because the orphaned window (which is
|
|
2862 |
the previous child window) is still in the redraw queue
|
|
2863 |
4) Delete all the windows involved;
|
|
2864 |
|
|
2865 |
@SYMTestExpectedResults The window redraw queue should be cleaned up when the first window is deleted;
|
|
2866 |
WSERV should not crash. The test should pass.
|
|
2867 |
*/
|
|
2868 |
case 21:
|
|
2869 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0461"));
|
|
2870 |
iTest->LogSubTest(KTest24);
|
|
2871 |
TestWindowDelete();
|
|
2872 |
break;
|
|
2873 |
|
|
2874 |
/**
|
|
2875 |
@SYMTestCaseID GRAPHICS-WSERV-0463
|
|
2876 |
|
|
2877 |
@SYMDEF DEF115601
|
|
2878 |
|
|
2879 |
@SYMTestCaseDesc Two RWindowGroup objects using same window client handle cause Emulator crash
|
|
2880 |
|
|
2881 |
@SYMTestPriority Medium
|
|
2882 |
|
|
2883 |
@SYMTestStatus Implemented
|
|
2884 |
|
|
2885 |
@SYMTestActions Create two window groups with the same handle.
|
|
2886 |
|
|
2887 |
@SYMTestExpectedResults WSERV should panic the client thread with the code EWservPanicDuplicateHandle
|
|
2888 |
and then destroy the window groups without crashing WSERV
|
|
2889 |
*/
|
|
2890 |
case 22:
|
|
2891 |
#if defined(_DEBUG)
|
|
2892 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0463"));
|
|
2893 |
iTest->LogSubTest(KTest25);
|
|
2894 |
TEST(iTest->TestWsPanicL(DoPanicTest6,EWservPanicDuplicateHandle,0,(TAny*)iTest->iScreenNumber,NULL));
|
|
2895 |
iTest->CloseAllPanicWindows();
|
|
2896 |
#else
|
|
2897 |
iTest->LogSubTest(KTest25skipped); //Client side panic will only occur in debug builds of WServ
|
|
2898 |
#endif
|
|
2899 |
break;
|
|
2900 |
case 23:
|
|
2901 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0495"));
|
|
2902 |
iTest->LogSubTest(KTest26);
|
|
2903 |
SaturateSendEvent();
|
|
2904 |
break;
|
|
2905 |
/**
|
|
2906 |
@SYMTestCaseID GRAPHICS-WSERV-0655
|
|
2907 |
|
|
2908 |
@SYMDEF ou1cimx1#329309
|
|
2909 |
|
|
2910 |
@SYMTestCaseDesc Fix native orientation functionality not supported
|
|
2911 |
|
|
2912 |
@SYMTestPriority Medium
|
|
2913 |
|
|
2914 |
@SYMTestStatus Implemented
|
|
2915 |
|
|
2916 |
@SYMTestActions Call fucntions related to fix native orientation on a window
|
|
2917 |
|
|
2918 |
@SYMTestExpectedResults Fix native orientation functionality not supported
|
|
2919 |
*/
|
|
2920 |
case 24:
|
|
2921 |
((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0655"));
|
|
2922 |
iTest->LogSubTest(KTest27);
|
|
2923 |
TestNotSupportedFunctionality();
|
|
2924 |
break;
|
|
2925 |
default:
|
|
2926 |
((CTWindowTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
|
|
2927 |
((CTWindowTestStep*)iStep)->CloseTMSGraphicsStep();
|
|
2928 |
TestComplete();
|
|
2929 |
break;
|
|
2930 |
}
|
|
2931 |
((CTWindowTestStep*)iStep)->RecordTestResultL();
|
|
2932 |
}
|
|
2933 |
|
|
2934 |
__WS_CONSTRUCT_STEP__(WindowTest)
|