First public contribution.
1 // Copyright (c) 1996-2010 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
15 // Test group window handle functions
24 #include "TGWHANDLE.H"
27 CTGwHandle::CTGwHandle(CTestStep* aStep):
28 CTWsGraphicsBase(aStep)
32 void CTGwHandle::ConstructL()
36 CTGwHandle::~CTGwHandle()
40 TInt CTGwHandle::NumberOfWndGroupsWithZeroPriority(TInt aScreenNumber)
42 __ASSERT_ALWAYS(aScreenNumber <= 1, User::Invariant());
43 return TheClient->iWs.NumWindowGroups(aScreenNumber,0);
46 void CTGwHandle::GetGwListL(CArrayFixFlat<TInt> *aWindowHandles)
48 User::LeaveIfError(TheClient->iWs.WindowGroupList(aWindowHandles));
51 void CTGwHandle::GetGwListL(CArrayFixFlat<TInt> *aWindowHandles, TInt aScreenNumber)
53 User::LeaveIfError(TheClient->iWs.WindowGroupList(aWindowHandles, aScreenNumber));
56 void CTGwHandle::GetGwListL(TInt aPriority, CArrayFixFlat<TInt> *aWindowHandles)
58 User::LeaveIfError(TheClient->iWs.WindowGroupList(aPriority,aWindowHandles));
61 void CTGwHandle::GetGwListL(RArray<RWsSession::TWindowGroupChainInfo>* aWindowHandles)
63 User::LeaveIfError(TheClient->iWs.WindowGroupList(aWindowHandles));
66 void CTGwHandle::GetGwListL(TInt aPriority, RArray<RWsSession::TWindowGroupChainInfo>* aWindowHandles)
68 User::LeaveIfError(TheClient->iWs.WindowGroupList(aPriority, aWindowHandles));
71 void CTGwHandle::GwNamesL()
73 enum {EConnectHandle1=123456};
74 enum {EWindowGroupHandle1=234567};
75 enum {EWindowGroupHandle2=666666};
78 User::LeaveIfError(foreground=TheClient->iWs.GetFocusWindowGroup());
80 User::LeaveIfError(ws1.Connect());
82 // assign to the correct screen
83 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
84 CleanupStack::PushL(screen);
85 User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
87 RWindowGroup gw1(ws1);
88 User::LeaveIfError(gw1.Construct(EWindowGroupHandle1));
89 gw1.SetOwningWindowGroup(foreground);
90 RWindowGroup gw2(ws1);
91 User::LeaveIfError(gw2.Construct(EWindowGroupHandle2));
92 gw2.SetOwningWindowGroup(foreground);
96 // Check default name is simply a null string
98 TInt retVal = gw1.Name(getName);
99 TEST(retVal==KErrNone);
100 if (retVal!=KErrNone)
101 INFO_PRINTF3(_L("gw1.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
103 TEST(getName==_L(""));
105 INFO_PRINTF3(_L("getName==_L() - Expected: %d, Actual: %d"), ETrue, EFalse);
107 TBuf<8> name1(_L("A_Name1"));
108 TBuf<8> name2(_L("A_Name2"));
110 retVal = gw1.SetName(name1);
111 TEST(retVal==KErrNone);
112 if (retVal!=KErrNone)
113 INFO_PRINTF3(_L("gw1.SetName(name1) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
115 retVal = gw2.SetName(name2);
116 TEST(retVal==KErrNone);
117 if (retVal!=KErrNone)
118 INFO_PRINTF3(_L("(gw2.SetName(name2) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
120 retVal = gw1.Name(getName);
121 TEST(retVal==KErrNone);
122 if (retVal!=KErrNone)
123 INFO_PRINTF3(_L("(gw1.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
125 TEST(getName==name1);
127 INFO_PRINTF3(_L("getName==name1 - Expected: %d, Actual: %d"), ETrue, EFalse);
129 retVal = gw2.Name(getName);
130 TEST(retVal==KErrNone);
131 if (retVal!=KErrNone)
132 INFO_PRINTF3(_L("(gw2.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
134 TEST(getName==name2);
136 INFO_PRINTF3(_L("getName==name2 - Expected: %d, Actual: %d"), ETrue, EFalse);
139 // A few weird characters in the name should work fine
141 retVal = gw2.SetName(_L("xx*"));
142 TEST(retVal==KErrNone);
143 if (retVal!=KErrNone)
144 INFO_PRINTF3(_L("(gw2.SetName(_L(xx*)) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
146 retVal = gw2.Name(getName);
147 TEST(retVal==KErrNone);
148 if (retVal!=KErrNone)
149 INFO_PRINTF3(_L("(gw2.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
151 TEST(getName==_L("xx*"));
152 if (getName!=_L("xx*"))
153 INFO_PRINTF3(_L("getName==_L(xx*) - Expected: %d, Actual: %d"), ETrue, EFalse);
156 retVal = gw2.SetName(_L(":"));
157 TEST(retVal==KErrNone);
158 if (retVal!=KErrNone)
159 INFO_PRINTF3(_L("(gw2.SetName(_L(:)) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
161 retVal = gw2.Name(getName);
162 TEST(retVal==KErrNone);
163 if (retVal!=KErrNone)
164 INFO_PRINTF3(_L("(gw2.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
166 TEST(getName==_L(":"));
167 if (getName!=_L(":"))
168 INFO_PRINTF3(_L("getName==_L(:) - Expected: %d, Actual: %d"), ETrue, EFalse);
171 // Setting the name back to a null name
173 retVal = gw2.SetName(_L(""));
174 TEST(retVal==KErrNone);
175 if (retVal!=KErrNone)
176 INFO_PRINTF3(_L("gw2.SetName(_L()) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
178 retVal = gw2.Name(getName);
179 TEST(retVal==KErrNone);
180 if (retVal!=KErrNone)
181 INFO_PRINTF3(_L("gw2.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
183 TEST(getName==_L(""));
185 INFO_PRINTF3(_L("getName==_L() - Expected: %d, Actual: %d"), ETrue, EFalse);
188 // Getting a name into a too short buffer should fill thew whole buffer from the left hand part
189 // of the window name and return KErrOverflow
193 retVal = gw2.Name(shortBuf);
194 TEST(retVal==KErrOverflow);
195 if (retVal!=KErrOverflow)
196 INFO_PRINTF3(_L("gw2.Name(shortBuf) return value - Expected: %d, Actual: %d"), KErrOverflow, retVal);
198 TEST(shortBuf==name2.Left(4));
199 if (shortBuf!=name2.Left(4))
200 INFO_PRINTF3(_L("shortBuf==name2.Left(4) - Expected: %d, Actual: %d"), ETrue, EFalse);
203 // passing a 0 length TPtr pointing to NULL should be safe, simply returning KErrOverflow
205 TPtr nullPtr(NULL,0);
206 retVal = gw2.Name(nullPtr);
207 TEST(retVal==KErrOverflow);
208 if (retVal!=KErrOverflow)
209 INFO_PRINTF3(_L("gw2.Name(nullPtr) return value - Expected: %d, Actual: %d"), KErrOverflow, retVal);
211 TEST(nullPtr==_L(""));
213 INFO_PRINTF3(_L("nullPtr==_L() - Expected: %d, Actual: %d"), ETrue, EFalse);
216 // Getting a null name into a null descriptor
219 TPtr nullPtr2(NULL,0);
220 retVal = gw2.Name(nullPtr);
221 TEST(retVal==KErrNone);
222 if (retVal!=KErrNone)
223 INFO_PRINTF3(_L("gw2.Name(nullPtr) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
225 TEST(nullPtr2==_L(""));
226 if (nullPtr2!=_L(""))
227 INFO_PRINTF3(_L("nullPtr2==_L() - Expected: %d, Actual: %d"), ETrue, EFalse);
231 CleanupStack::PopAndDestroy(screen);
235 void CTGwHandle::GwIdentifierTestL()
237 enum {EWindowGroupHandle1=234567};
238 enum {EWindowGroupHandle2=666666};
239 enum {EWindowGroupHandle3=999};
241 CArrayFixFlat<TInt>* windowHandles=new(ELeave) CArrayFixFlat<TInt>(5);
242 CleanupStack::PushL(windowHandles);
243 GetGwListL(0, windowHandles);
244 TInt retVal = TheClient->iWs.GetFocusWindowGroup();
245 TEST(retVal==(*windowHandles)[0]);
246 if (retVal!=(*windowHandles)[0])
247 INFO_PRINTF3(_L("TheClient->iWs.GetFocusWindowGroup() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
251 User::LeaveIfError(ws1.Connect());
252 CleanupClosePushL(ws1);
254 // assign to the correct screen
255 CWsScreenDevice* screen1 = new (ELeave) CWsScreenDevice(ws1);
256 CleanupStack::PushL(screen1);
257 User::LeaveIfError(screen1->Construct(iTest->iScreenNumber));
259 RWindowGroup gw1(ws1);
260 User::LeaveIfError(gw1.Construct(EWindowGroupHandle1));
261 gw1.SetOwningWindowGroup((*windowHandles)[0]);
263 User::LeaveIfError(ws2.Connect());
264 CleanupClosePushL(ws2);
266 // assign to the correct screen
267 CWsScreenDevice* screen2 = new (ELeave) CWsScreenDevice(ws2);
268 CleanupStack::PushL(screen2);
269 User::LeaveIfError(screen2->Construct(iTest->iScreenNumber));
271 RWindowGroup gw2(ws2);
272 User::LeaveIfError(gw2.Construct(EWindowGroupHandle2));
274 GetGwListL(0, windowHandles);
277 retVal = gw2.Identifier();
278 TEST(retVal==(*windowHandles)[0]);
279 if (retVal!=(*windowHandles)[0])
280 INFO_PRINTF3(_L("gw2.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
282 retVal = gw1.Identifier();
283 TEST(retVal==(*windowHandles)[1]);
284 if (retVal!=(*windowHandles)[1])
285 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
287 retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]);
288 TEST(retVal==EWindowGroupHandle2);
289 if (retVal!=EWindowGroupHandle2)
290 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle2, retVal);
292 retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]);
293 TEST(retVal==EWindowGroupHandle1);
294 if (retVal!=EWindowGroupHandle1)
295 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle1, retVal);
297 retVal = TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[1]);
300 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), 0, retVal);
302 retVal = TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[0]);
305 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), 0, retVal);
309 TheClient->iWs.GetWindowGroupClientThreadId((*windowHandles)[0],threadId);
311 TUint64 ret = RThread().Id();
314 INFO_PRINTF3(_L("RThread().Id() return value - Expected: %d, Actual: %d"), (TInt)threadId, (TInt)ret);
316 TheClient->iWs.GetWindowGroupClientThreadId((*windowHandles)[1],threadId);
318 TUint64 retVal2 = RThread().Id();
319 TEST(retVal2==threadId);
320 if (retVal2!=threadId)
321 INFO_PRINTF3(_L("RThread().Id() return value - Expected: %d, Actual: %d"), (TInt)threadId, (TInt)retVal2);
323 retVal = gw1.OrdinalPosition();
326 INFO_PRINTF3(_L("gw1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
328 retVal = gw2.OrdinalPosition();
331 INFO_PRINTF3(_L("gw2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
333 retVal = TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[1],0);
334 TEST(retVal==KErrNone);
335 if (retVal!=KErrNone)
336 INFO_PRINTF3(_L("TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[1],0) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
338 retVal = gw1.OrdinalPosition();
341 INFO_PRINTF3(_L("gw1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
343 retVal = gw2.OrdinalPosition();
346 INFO_PRINTF3(_L("gw2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
348 retVal = TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[1],1);
349 TEST(retVal==KErrNone);
350 if (retVal!=KErrNone)
351 INFO_PRINTF3(_L("TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[1],1) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
353 retVal = gw1.OrdinalPosition();
356 INFO_PRINTF3(_L("gw1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
358 retVal = gw2.OrdinalPosition();
361 INFO_PRINTF3(_L("gw2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
363 retVal = TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[0],1);
364 TEST(retVal==KErrNone);
365 if (retVal!=KErrNone)
366 INFO_PRINTF3(_L("TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[0],1) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
368 GetGwListL(0, windowHandles);
369 retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]);
370 TEST(retVal==EWindowGroupHandle1);
371 if (retVal!=EWindowGroupHandle1)
372 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle1, retVal);
374 retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]);
375 TEST(retVal==EWindowGroupHandle2);
376 if (retVal!=EWindowGroupHandle2)
377 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle2, retVal);
379 RWindowGroup gw3(ws2);
380 User::LeaveIfError(gw3.Construct(EWindowGroupHandle3));
381 gw1.SetOrdinalPosition(0,100000); // Assume nothing else in the system is higher, else test will fail
382 gw3.SetOrdinalPosition(0,100000);
386 GetGwListL(100000, windowHandles);
387 retVal = windowHandles->Count();
390 INFO_PRINTF3(_L("windowHandles->Count() return value - Expected: %d, Actual: %d"), 2, retVal);
392 retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]);
393 TEST(retVal==EWindowGroupHandle3);
394 if (retVal!=EWindowGroupHandle3)
395 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle3, retVal);
397 retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]);
398 TEST(retVal==EWindowGroupHandle1);
399 if (retVal!=EWindowGroupHandle1)
400 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle1, retVal);
403 retVal = TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[0]);
404 TEST(retVal==100000);
406 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), 100000, retVal);
408 retVal = TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[1]);
409 TEST(retVal==100000);
411 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), 100000, retVal);
413 GetGwListL(-12453, windowHandles); // Test 0 count, Assumes no window with priority
414 retVal = windowHandles->Count();
417 INFO_PRINTF3(_L("windowHandles->Count() return value - Expected: %d, Actual: %d"), 0, retVal);
420 GetGwListL(windowHandles, iTest->iScreenNumber);
421 retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]);
422 TEST(retVal==EWindowGroupHandle3);
423 if (retVal!=EWindowGroupHandle3)
424 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle3, retVal);
426 retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]);
427 TEST(retVal==EWindowGroupHandle1);
428 if (retVal!=EWindowGroupHandle1)
429 INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle1, retVal);
431 // Check passing bad identifiers
433 retVal = TheClient->iWs.SetWindowGroupOrdinalPosition(-1,0);
434 TEST(retVal==KErrNotFound);
435 if (retVal!=KErrNotFound)
436 INFO_PRINTF3(_L("TheClient->iWs.SetWindowGroupOrdinalPosition(-1,0) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
438 retVal = TheClient->iWs.GetWindowGroupHandle(-3);
439 TEST(retVal==KErrNotFound);
440 if (retVal!=KErrNotFound)
441 INFO_PRINTF3(_L("TTheClient->iWs.GetWindowGroupHandle(-3) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
448 CleanupStack::PopAndDestroy(5, windowHandles);
451 void CTGwHandle::OwnerToForegroundL()
453 enum {EWindowGroupHandle1=234567};
454 enum {EWindowGroupHandle2a=666666};
455 enum {EWindowGroupHandle2b=666667};
457 CArrayFixFlat<TInt> *windowHandles=new(ELeave) CArrayFixFlat<TInt>(5);
458 CleanupStack::PushL(windowHandles);
459 GetGwListL(0, windowHandles);
460 TInt oldForeground=(*windowHandles)[0];
463 User::LeaveIfError(ws1.Connect());
464 CleanupClosePushL(ws1);
466 // assign to the correct screen
467 CWsScreenDevice* screen1 = new (ELeave) CWsScreenDevice(ws1);
468 CleanupStack::PushL(screen1);
469 User::LeaveIfError(screen1->Construct(iTest->iScreenNumber));
471 RWindowGroup gw1(ws1);
472 User::LeaveIfError(gw1.Construct(EWindowGroupHandle1));
473 CleanupClosePushL(gw1);
475 User::LeaveIfError(ws2.Connect());
476 CleanupClosePushL(ws2);
478 // assign to the correct screen
479 CWsScreenDevice* screen2 = new (ELeave) CWsScreenDevice(ws2);
480 CleanupStack::PushL(screen2);
481 User::LeaveIfError(screen2->Construct(iTest->iScreenNumber));
483 RWindowGroup gw2a(ws2);
484 User::LeaveIfError(gw2a.Construct(EWindowGroupHandle2a));
485 CleanupClosePushL(gw2a);
486 RWindowGroup gw2b(ws2);
487 User::LeaveIfError(gw2b.Construct(EWindowGroupHandle2b));
488 CleanupClosePushL(gw2b);
489 gw1.SetOrdinalPosition(1);
491 // Turn auto flushing on as we're using multiple connections and it would be easy to forget to flush one
493 ws1.SetAutoFlush(ETrue);
494 ws2.SetAutoFlush(ETrue);
495 TheClient->iWs.SetAutoFlush(ETrue);
497 GetGwListL(0, windowHandles);
499 TInt retVal = gw2b.Identifier();
500 TEST(retVal==(*windowHandles)[0]);
501 if (retVal!=(*windowHandles)[0])
502 INFO_PRINTF3(_L("gw2b.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
504 retVal = gw1.Identifier();
505 TEST(retVal==(*windowHandles)[1]);
506 if (retVal!=(*windowHandles)[1])
507 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
509 retVal = gw2a.Identifier();
510 TEST(retVal==(*windowHandles)[2]);
511 if (retVal!=(*windowHandles)[2])
512 INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[2], retVal);
514 retVal = oldForeground;
515 TEST(retVal==(*windowHandles)[3]);
516 if (retVal!=(*windowHandles)[3])
517 INFO_PRINTF3(_L("oldForeground - Expected: %d, Actual: %d"), (*windowHandles)[3], oldForeground);
519 CleanupStack::PopAndDestroy(&gw2b);
520 GetGwListL(0, windowHandles);
522 retVal = gw2a.Identifier();
523 TEST(retVal==(*windowHandles)[0]);
524 if (retVal!=(*windowHandles)[0])
525 INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
526 // Check 2a jumped over 1 in the ordinal list
528 retVal = gw1.Identifier();
529 TEST(retVal==(*windowHandles)[1]);
530 if (retVal!=(*windowHandles)[1])
531 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
533 retVal = oldForeground;
534 TEST(retVal==(*windowHandles)[2]);
535 if (retVal!=(*windowHandles)[2])
536 INFO_PRINTF3(_L("oldForeground - Expected: %d, Actual: %d"), (*windowHandles)[2], oldForeground);
539 User::LeaveIfError(gw2b.Construct(EWindowGroupHandle2b));
540 CleanupClosePushL(gw2b);
541 gw2b.SetOwningWindowGroup(oldForeground);
542 CleanupStack::PopAndDestroy(&gw2b);
543 GetGwListL(0, windowHandles);
544 retVal = oldForeground;
545 TEST(retVal==(*windowHandles)[0]);
546 if (retVal!=(*windowHandles)[0])
547 INFO_PRINTF3(_L("oldForeground - Expected: %d, Actual: %d"), (*windowHandles)[0], oldForeground);
548 // Check old foreground bought to foreground
550 retVal = gw2a.Identifier();
551 TEST(retVal==(*windowHandles)[1]);
552 if (retVal!=(*windowHandles)[1])
553 INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
555 retVal = gw1.Identifier();
556 TEST(retVal==(*windowHandles)[2]);
557 if (retVal!=(*windowHandles)[2])
558 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[2], retVal);
560 TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[0],2);
562 User::LeaveIfError(gw2b.Construct(EWindowGroupHandle2b));
563 CleanupClosePushL(gw2b);
564 gw2b.SetOwningWindowGroup((*windowHandles)[1]);
565 gw2b.SetOrdinalPosition(KOrdinalPositionSwitchToOwningWindow); // Should bring 2a to foreground
566 GetGwListL(0, windowHandles);
568 retVal = gw2a.Identifier();
569 TEST(retVal==(*windowHandles)[0]);
570 if (retVal!=(*windowHandles)[0])
571 INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
573 retVal = gw2b.Identifier();
574 TEST(retVal==(*windowHandles)[1]);
575 if (retVal!=(*windowHandles)[1])
576 INFO_PRINTF3(_L("gw2b.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
578 retVal = gw1.Identifier();
579 TEST(retVal==(*windowHandles)[2]);
580 if (retVal!=(*windowHandles)[2])
581 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[2], retVal);
583 CleanupStack::PopAndDestroy(&gw2b);
584 GetGwListL(0, windowHandles);
585 retVal = gw2a.Identifier();
586 TEST(retVal==(*windowHandles)[0]);
587 if (retVal!=(*windowHandles)[0])
588 INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
590 retVal = gw1.Identifier();
591 TEST(retVal==(*windowHandles)[1]);
592 if (retVal!=(*windowHandles)[1])
593 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
595 CleanupStack::PopAndDestroy(&gw2a); // Should bring shell to foreground
596 GetGwListL(0, windowHandles);
598 // check whether the shell is on
600 ws2.GetWindowGroupClientThreadId((*windowHandles)[0],threadId);
601 TBool shellRunning=ETrue;
604 // apply to primary screen only where SHELL is running
605 TFindThread findThread(iTest->iScreenNumber==KDefaultScreen?_L("WSHELL*::*"):_L("WxSHELL*::*"));
606 if(findThread.Next(shellName)==KErrNone)
609 User::LeaveIfError(shell.Open(shellName));
610 TEST(shell.Id()==threadId);
611 if (retVal!=(*windowHandles)[1])
612 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
623 retVal = gw1.Identifier();
624 TEST(retVal==(*windowHandles)[shellRunning ? 1 : 0]);
625 if (retVal!=(*windowHandles)[shellRunning ? 1 : 0])
626 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[shellRunning ? 1 : 0], retVal);
628 retVal = oldForeground;
629 TEST(retVal==(*windowHandles)[shellRunning ? 2 : 1]);
630 if (retVal!=(*windowHandles)[shellRunning ? 2 : 1])
631 INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[shellRunning ? 2 : 1], retVal);
632 // and oldforeground second
635 CleanupStack::PopAndDestroy(5, &ws1);
637 // Kick shell back into background, 'cause that's where it belongs
639 TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[0],-1);
640 TheClient->iWs.SetAutoFlush(EFalse);
642 CleanupStack::PopAndDestroy(windowHandles);
645 void CTGwHandle::FindWindowGroupIdentifierTestL()
647 enum {EWindowGroupHandle1=234567};
648 enum {EWindowGroupHandle2=666666};
649 enum {EWindowGroupHandle3=123};
650 TInt foreground=TheClient->iWs.GetFocusWindowGroup();
652 User::LeaveIfError(ws1.Connect());
654 // assign to the correct screen
655 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
656 CleanupStack::PushL(screen);
657 User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
658 CleanupStack::Pop(screen);
660 CleanupClosePushL(ws1);
662 RWindowGroup gw1(ws1);
663 User::LeaveIfError(gw1.Construct(EWindowGroupHandle1));
664 CleanupClosePushL(gw1);
665 gw1.SetOwningWindowGroup(foreground);
666 RWindowGroup gw2(ws1);
667 User::LeaveIfError(gw2.Construct(EWindowGroupHandle2));
668 CleanupClosePushL(gw2);
669 gw1.SetOwningWindowGroup(foreground);
670 RWindowGroup gw3(ws1);
671 User::LeaveIfError(gw3.Construct(EWindowGroupHandle3));
672 CleanupClosePushL(gw3);
673 gw3.SetOwningWindowGroup(foreground);
675 TInt id1=gw1.Identifier();
676 TInt id2=gw2.Identifier();
677 TInt id3=gw3.Identifier();
679 gw1.SetName(_L("qwerty123abcd"));
680 gw2.SetName(_L("123"));
681 gw3.SetName(_L("qqqabcdxxx123"));
683 TInt retVal = ws1.FindWindowGroupIdentifier(0,_L("123"),0);
686 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(123),0) return value - Expected: %d, Actual: %d"), id2, retVal);
689 retVal = ws1.FindWindowGroupIdentifier(0,_L("*123*"),0);
692 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(*123*),0) return value - Expected: %d, Actual: %d"), id3, retVal);
694 retVal = ws1.FindWindowGroupIdentifier(id3,_L("*123*"),0);
697 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id3,_L(*123*),0) return value - Expected: %d, Actual: %d"), id2, retVal);
699 retVal = ws1.FindWindowGroupIdentifier(id2,_L("*123*"),0);
702 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id2,_L(*123*),0) return value - Expected: %d, Actual: %d"), id1, retVal);
705 retVal = ws1.FindWindowGroupIdentifier(0,_L("*abcd*"),0);
708 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(*abcd*),0) return value - Expected: %d, Actual: %d"), id3, retVal);
710 retVal = ws1.FindWindowGroupIdentifier(id3,_L("*abcd*"),0);
713 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id3,_L(*abcd*),0)return value - Expected: %d, Actual: %d"), id1, retVal);
715 retVal = ws1.FindWindowGroupIdentifier(0,_L("*123*"),7);
718 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(*123*),7)return value - Expected: %d, Actual: %d"), id3, retVal);
720 retVal = ws1.FindWindowGroupIdentifier(id3,_L("*123*"),7);
721 TEST(retVal==KErrNotFound);
722 if (retVal!=KErrNotFound)
723 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id3,_L(*123*),7) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
725 retVal = ws1.FindWindowGroupIdentifier(0,_L("*abc*"),4);
728 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(*abc*),4) return value - Expected: %d, Actual: %d"), id1, retVal);
730 retVal = ws1.FindWindowGroupIdentifier(id1,_L("*abc*"),4);
731 TEST(retVal==KErrNotFound);
732 if (retVal!=KErrNotFound)
733 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id1,_L(*abc*),4) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
735 retVal = ws1.FindWindowGroupIdentifier(0,_L("xxx*"),7);
738 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(xxx*),7) return value - Expected: %d, Actual: %d"), id3, retVal);
740 retVal = ws1.FindWindowGroupIdentifier(0,_L("xxx*"),8);
741 TEST(retVal==KErrNotFound);
742 if (retVal!=KErrNotFound)
743 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(xxx*),8) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
745 retVal = ws1.FindWindowGroupIdentifier(id1,_L("12"),0);
746 TEST(retVal==KErrNotFound);
747 if (retVal!=KErrNotFound)
748 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id1,_L(12),0) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
750 retVal = ws1.FindWindowGroupIdentifier(id1,_L("qqq"),0);
751 TEST(retVal==KErrNotFound);
752 if (retVal!=KErrNotFound)
753 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id1,_L(qqq),0) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
755 retVal = ws1.FindWindowGroupIdentifier(id1,_L("abcd"),3);
756 TEST(retVal==KErrNotFound);
757 if (retVal!=KErrNotFound)
758 INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id1,_L(abcd),3) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
761 CleanupStack::PopAndDestroy(4, &ws1);
764 void CTGwHandle::DefaultOwningWindowL()
766 TInt foreground=TheClient->iWs.GetFocusWindowGroup();
768 User::LeaveIfError(ws1.Connect());
770 // assign to the correct screen
771 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
772 CleanupStack::PushL(screen);
773 User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
776 INFO_PRINTF1(_L("DefaultOwningWindow1"));
777 RWindowGroup gw1(ws1);
778 User::LeaveIfError(gw1.Construct(1));
779 gw1.SetOwningWindowGroup(foreground);
780 RWindowGroup gw2(ws1);
781 User::LeaveIfError(gw2.Construct(2));
782 gw2.SetOwningWindowGroup(foreground);
783 RWindowGroup gw3(ws1);
784 User::LeaveIfError(gw3.Construct(3));
785 gw3.SetOwningWindowGroup(foreground);
786 RWindowGroup gw4(ws1);
787 User::LeaveIfError(gw4.Construct(4));
788 gw4.SetOwningWindowGroup(foreground);
789 INFO_PRINTF1(_L(" Created Group Window"));
791 TInt prevOwningGroup=ws1.GetDefaultOwningWindow();
792 gw1.DefaultOwningWindow();
793 TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
794 if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
795 INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
797 gw2.DefaultOwningWindow();
798 TEST(gw2.Identifier()==ws1.GetDefaultOwningWindow());
799 if (gw2.Identifier()!=ws1.GetDefaultOwningWindow())
800 INFO_PRINTF3(_L("gw2.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw2.Identifier());
803 TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
804 if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
805 INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
807 gw3.DefaultOwningWindow();
808 gw4.DefaultOwningWindow();
810 TEST(gw4.Identifier()==ws1.GetDefaultOwningWindow());
811 if (gw4.Identifier()!=ws1.GetDefaultOwningWindow())
812 INFO_PRINTF3(_L("gw4.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw4.Identifier());
815 TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
816 if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
817 INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
820 TEST(prevOwningGroup==ws1.GetDefaultOwningWindow());
821 if (prevOwningGroup!=ws1.GetDefaultOwningWindow())
822 INFO_PRINTF3(_L("prevOwningGroup==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), prevOwningGroup);
824 INFO_PRINTF1(_L(" Closed Group Window"));
826 User::LeaveIfError(gw1.Construct(1));
827 gw1.SetOwningWindowGroup(foreground);
828 User::LeaveIfError(gw2.Construct(2));
829 gw2.SetOwningWindowGroup(foreground);
830 User::LeaveIfError(gw3.Construct(3));
831 gw3.SetOwningWindowGroup(foreground);
832 INFO_PRINTF1(_L(" ReCreated Group Window"));
833 gw1.DefaultOwningWindow();
834 gw1.DefaultOwningWindow();
836 gw2.DefaultOwningWindow();
837 gw2.DefaultOwningWindow();
840 INFO_PRINTF1(_L(" Re-Closed Group Window"));
842 User::LeaveIfError(gw1.Construct(1));
843 gw1.SetOwningWindowGroup(foreground);
844 User::LeaveIfError(gw2.Construct(2));
845 gw2.SetOwningWindowGroup(foreground);
846 User::LeaveIfError(gw3.Construct(3));
847 gw3.SetOwningWindowGroup(foreground);
848 User::LeaveIfError(gw4.Construct(4));
849 gw4.SetOwningWindowGroup(foreground);
850 INFO_PRINTF1(_L(" ReCreated Group Window Again"));
851 gw1.DefaultOwningWindow();
852 gw2.DefaultOwningWindow();
853 gw1.DefaultOwningWindow();
856 gw3.DefaultOwningWindow();
857 gw4.DefaultOwningWindow();
858 gw3.DefaultOwningWindow();
861 INFO_PRINTF1(_L(" Re-Closed Group Window Again"));
863 User::LeaveIfError(gw1.Construct(1));
864 gw1.DefaultOwningWindow();
865 TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
866 if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
867 INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
869 gw1.DefaultOwningWindow();
870 TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
871 if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
872 INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
874 User::LeaveIfError(gw2.Construct(2));
875 TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
876 if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
877 INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
882 CleanupStack::PopAndDestroy(screen);
886 void CTGwHandle::DefaultOwningWindow2L()
887 //This test originally resulted in a crash, while the above test originally resulted in lockups.
890 User::LeaveIfError(ws1.Connect());
892 // assign to the correct screen
893 CWsScreenDevice* screen1 = new (ELeave) CWsScreenDevice(ws1);
894 CleanupStack::PushL(screen1);
895 User::LeaveIfError(screen1->Construct(iTest->iScreenNumber));
898 User::LeaveIfError(ws2.Connect());
900 // assign to the correct screen
901 CWsScreenDevice* screen2 = new (ELeave) CWsScreenDevice(ws2);
902 CleanupStack::PushL(screen2);
903 User::LeaveIfError(screen2->Construct(iTest->iScreenNumber));
906 RWindowGroup gw1(ws1);
907 User::LeaveIfError(gw1.Construct(1));
908 RWindowGroup gw2(ws2);
909 User::LeaveIfError(gw2.Construct(2));
910 RWindowGroup gw3(ws1);
911 User::LeaveIfError(gw3.Construct(3));
913 const TInt gw1Id=gw1.Identifier();
914 gw1.DefaultOwningWindow();
915 gw2.DefaultOwningWindow();
916 /*const TInt gw2Id=*/gw2.Identifier();
917 gw1.DefaultOwningWindow();
918 TEST(gw1Id==ws1.GetDefaultOwningWindow());
919 if (gw1Id!=ws1.GetDefaultOwningWindow())
920 INFO_PRINTF3(_L("gw1Id==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1Id);
922 gw3.DefaultOwningWindow();
924 TEST(gw1Id==ws1.GetDefaultOwningWindow());
925 if (gw1Id!=ws1.GetDefaultOwningWindow())
926 INFO_PRINTF3(_L("gw1Id==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1Id);
929 TInt gw2Id=gw2.Identifier();
930 TEST(gw2Id==ws1.GetDefaultOwningWindow());
931 if (gw2Id!=ws1.GetDefaultOwningWindow())
932 INFO_PRINTF3(_L("gw2Id==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw2Id);
934 gw2.SetOrdinalPosition(0);
938 rawEvent.Set(TRawEvent::EKeyDown,32);
939 TheClient->iWs.SimulateRawEvent(rawEvent);
940 TheClient->iWs.Flush();
942 CleanupStack::PopAndDestroy(2,screen1);
948 void CTGwHandle::IdentifierWrapAroundTestL()
952 User::LeaveIfError(ws1.Connect());
954 // assign to the correct screen
955 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
956 CleanupStack::PushL(screen);
957 User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
959 RWindowGroup gw1(ws1);
960 User::LeaveIfError(gw1.Construct(1));
961 gw1.EnableReceiptOfFocus(EFalse);
962 TInt id1=gw1.Identifier();
963 RWindowGroup gw2(ws1);
964 User::LeaveIfError(gw2.Construct(2));
965 gw2.EnableReceiptOfFocus(EFalse);
966 TInt id2=gw2.Identifier();
967 gw2.Close(); // Allow gw2 id to be re-used
972 RWindowGroup gw3(ws1);
973 User::LeaveIfError(gw3.Construct(2));
974 gw3.EnableReceiptOfFocus(EFalse);
975 id3=gw3.Identifier();
976 if ((id3/FREQ)!=(report/FREQ)) // || id3<=10)
979 iTest->LogMessage(id3);
981 TEST(id3!=id1); // Check id1 is not re-used as the window hasn't been freed yet
984 _LIT(KErr,"Window Group Id Reused!");
990 CleanupStack::PopAndDestroy(screen);
994 void GwHandleDestroyWindow(TAny* aWindow)
996 static_cast<RWindowTreeNode*>(aWindow)->Destroy();
999 RWindowGroup* CTGwHandle::CreateWindowGroupLC(RWsSession& aWs,TUint32 aClientHandle,TInt aParentId/*=0*/)
1001 RWindowGroup* gw=new(ELeave) RWindowGroup(aWs);
1002 CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,gw));
1005 User::LeaveIfError(gw->ConstructChildApp(aParentId,aClientHandle,EFalse));
1009 User::LeaveIfError(gw->Construct(aClientHandle,EFalse));
1014 void CTGwHandle::CreateGroupWindowsLC(RWsSession& aWs)
1016 for(TInt ii=ENumGroups-1;ii>=0;--ii)
1017 iGroups[ii]=CreateWindowGroupLC(aWs,ii);
1020 void CTGwHandle::CreateChainedGroupWindowsLC(RWsSession& aWs,TBool aSecondChain)
1023 for(TInt ii=ENumChained-1;ii>=0;--ii)
1025 iChained[ii]=CreateWindowGroupLC(aWs,ENumGroups+ii,parentId);
1026 parentId=iChained[ii]->Identifier();
1031 for(TInt ii=ENumChained-1;ii>=0;--ii)
1033 iChained2[ii]=CreateWindowGroupLC(aWs,ENumGroups+ENumGroups+ii,parentId);
1034 parentId=iChained2[ii]->Identifier();
1039 void CTGwHandle::MoveGroups(RWindowGroup** aGroups,TInt aGp,TInt aNum,TInt aPos,TInt aInc/*=2*/)
1042 for(ii=aNum;ii>0;--ii)
1044 aGroups[aGp]->SetOrdinalPosition(aPos);
1050 void CTGwHandle::TestGroups(TInt aPos)
1054 for(ii=0;ii<ENumChained;++ii)
1056 retVal = iChained[ii]->OrdinalPosition();
1057 TEST(retVal==aPos+ii);
1058 if (retVal!=aPos+ii)
1059 INFO_PRINTF3(_L("iChained[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos+ii, retVal);
1062 for(ii=0;ii<ENumGroups;++ii)
1064 retVal = iGroups[ii]->OrdinalPosition();
1065 TInt ret = (ii<aPos?ii:ii+ENumChained);
1068 INFO_PRINTF3(_L("iGroups[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), ret, retVal);
1072 void CTGwHandle::TestGroupsBefore(TInt aPos)
1078 for (ii=0;ii<aPos;++ii)
1080 retVal = iGroups[ii]->OrdinalPosition();
1083 INFO_PRINTF3(_L("iGroups[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), ii, retVal);
1086 for (ii=0;ii<ENumChained;++ii)
1088 retVal = iChained[ii]->OrdinalPosition();
1089 TEST(retVal==aPos+2*ii);
1090 if (retVal!=aPos+2*ii)
1091 INFO_PRINTF3(_L("iChained[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos+2*ii, retVal);
1093 for (ii=0;ii<ENumChained-1;++ii)
1095 retVal = iGroups[aPos+ii]->OrdinalPosition();
1096 TEST(retVal==aPos+1+2*ii);
1097 if (retVal!=aPos+1+2*ii)
1098 INFO_PRINTF3(_L("iGroups[aPos+ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos+1+2*ii, retVal);
1100 for (ii=aPos+ENumChained-1;ii<ENumGroups;++ii)
1102 retVal = iGroups[ii]->OrdinalPosition();
1103 TEST(retVal==ii+ENumChained);
1104 if (retVal!=ii+ENumChained)
1105 INFO_PRINTF3(_L("iGroups[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), ii+ENumChained, retVal);
1109 void CTGwHandle::WindowGroupChaining()
1111 RWsSession& ws=TheClient->iWs;
1112 CreateGroupWindowsLC(ws);
1113 CreateChainedGroupWindowsLC(ws);
1115 TInt start,target,moveGp;
1116 for(moveGp=0;moveGp<ENumChained;++moveGp)
1118 for(target=0;target<ENumGroups+1;++target)
1120 for(start=0;start<ENumGroups-ENumChained+2;++start)
1123 MoveGroups(iGroups,target-1,target-start-1,ENumChained+target-1,-1);
1124 if (target<start && start>0)
1125 MoveGroups(iGroups,0,start,0,1);
1126 MoveGroups(iGroups,start,ENumChained-1,start+1);
1127 TestGroupsBefore(start);
1128 iChained[moveGp]->SetOrdinalPosition(target+moveGp);
1132 iChained[0]->SetOrdinalPosition(0);
1135 CleanupStack::PopAndDestroy(ENumGroups+ENumChained,iGroups[ENumGroups-1]);
1138 void CTGwHandle::WindowGroupChaining2()
1140 RWsSession& ws=TheClient->iWs;
1141 RWindowGroup* chain1=CreateWindowGroupLC(ws,1);
1142 chain1->SetOrdinalPosition(0,1);
1143 RWindowGroup* chain2=CreateWindowGroupLC(ws,2,chain1->Identifier());
1144 TInt retVal = chain2->OrdinalPriority();
1147 INFO_PRINTF3(_L("chain2->OrdinalPriority() return value - Expected: %d, Actual: %d"), 1, retVal);
1149 chain1->SetOrdinalPosition(0,2);
1150 retVal = chain2->OrdinalPriority();
1153 INFO_PRINTF3(_L("chain2->OrdinalPriority() return value - Expected: %d, Actual: %d"), 2, retVal);
1155 chain2->SetOrdinalPosition(0,3);
1156 retVal = chain1->OrdinalPriority();
1159 INFO_PRINTF3(_L("chain1->OrdinalPriority() return value - Expected: %d, Actual: %d"), 3, retVal);
1161 CleanupStack::PopAndDestroy(2,chain1);
1163 //Test that two different sessions can't chain window-groups without permisson.
1164 //Both sessions must use the same screen.
1166 User::LeaveIfError(ws2.Connect());
1167 CleanupClosePushL(ws2);
1168 chain1=CreateWindowGroupLC(ws2,1);
1169 TInt id1=chain1->Identifier();
1172 User::LeaveIfError(ws3.Connect());
1173 CleanupClosePushL(ws3);
1174 RWindowGroup chain(ws3);
1176 RDebug::Print(KPlatsecBegin);
1177 retVal = chain.ConstructChildApp(id1,2);
1178 TEST(retVal==KErrPermissionDenied);
1179 if (retVal!=KErrPermissionDenied)
1180 INFO_PRINTF3(_L("chain.ConstructChildApp(id1,2) return value - Expected: %d, Actual: %d"), KErrPermissionDenied, retVal);
1182 RDebug::Print(KPlatsecEnd);
1183 chain1->AllowProcessToCreateChildWindowGroups(TUid::Uid(0x10205152)); //Secure ID
1184 retVal = chain.ConstructChildApp(id1,2);
1185 TEST(retVal==KErrNone);
1186 if (retVal!=KErrNone)
1187 INFO_PRINTF3(_L("chain.ConstructChildApp(id1,2) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1190 CleanupStack::PopAndDestroy(3,&ws2);
1193 void CTGwHandle::UnchainWindowGroupsL()
1195 RArray<RWsSession::TWindowGroupChainInfo>* windowHandles=new(ELeave) RArray<RWsSession::TWindowGroupChainInfo>;
1196 CleanupStack::PushL(windowHandles);
1197 CleanupClosePushL(*windowHandles);
1198 GetGwListL(0,windowHandles);
1199 TInt shellWindow=windowHandles->Count();
1200 //Creating chained window groups.
1201 CreateChainedGroupWindowsLC(TheClient->iWs);
1202 GetGwListL(0,windowHandles);
1203 //Test total window groups in the list
1204 TInt retVal = windowHandles->Count();
1205 TEST(retVal==ENumChained+shellWindow);
1206 if (retVal!=ENumChained+shellWindow)
1207 INFO_PRINTF3(_L("windowHandles->Count() return value - Expected: %d, Actual: %d"), ENumChained+shellWindow, retVal);
1208 //Two unchained group windows
1212 for(TInt ii=ENumChained-1;ii>=0;ii--)
1214 RWsSession::TWindowGroupChainInfo window;
1215 window.iId=iChained[ii]->Identifier();
1216 TInt loc=windowHandles->Find(window);
1217 TEST(loc!=KErrNotFound);
1218 if (loc==KErrNotFound)
1219 INFO_PRINTF3(_L("windowHandles->Find(window) return value - Expected: %d, Actual: %d"), KErrNotFound, loc);
1221 if(loc!=KErrNotFound)
1223 TEST((*windowHandles)[loc].iParentId==parentId);
1224 if ((*windowHandles)[loc].iParentId!=parentId)
1225 INFO_PRINTF3(_L("(*windowHandles)[loc].iParentId==parentId - Expected: %d, Actual: %d"), parentId, (*windowHandles)[loc].iParentId);
1227 parentId=window.iId;
1230 //Test unchaining of chained window groups
1231 for(TInt count=ENumChained-1;count>=0;count--)
1233 iChained[count]->Close();
1234 GetGwListL(0,windowHandles);
1235 TEST(windowHandles->Count()== count+shellWindow);
1236 if (windowHandles->Count()!= count+shellWindow)
1237 INFO_PRINTF3(_L("windowHandles->Count()==count+shellWindow - Expected: %d, Actual: %d"), count+shellWindow, windowHandles->Count());
1240 CleanupStack::PopAndDestroy(ENumChained,iChained[ENumChained-1]);
1242 //delete middle windowgroup of chain which should kill all the child windows
1243 CreateChainedGroupWindowsLC(TheClient->iWs);
1245 CleanupStack::Pop(2,iChained[1]); //Pop first 2 items iChained[0] and iChained[1]
1246 iChained[windowPos]->Close();//Close the 3rd WindowGroup in the chain.should unchain 4 and 5 window group.
1247 CleanupStack::PopAndDestroy(iChained[windowPos]);
1248 CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[1]));
1249 CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[0]));
1250 GetGwListL(0,windowHandles);
1251 retVal = ChainedWindowCount(windowHandles);
1252 TEST(retVal==ENumChained-windowPos-1);
1253 if (retVal!=ENumChained-windowPos-1)
1254 INFO_PRINTF3(_L("ChainedWindowCount(windowHandles) return value - Expected: %d, Actual: %d"), ENumChained-windowPos-1, retVal);
1256 // CleanupStack::PopAndDestroy(ENumChained-1,iChained[ENumChained-1]);
1259 CleanupStack::Pop(2,iChained[1]);
1260 iChained[windowPos]->Close();//Close the 2nd WindowGroup in the chain.
1261 //should unchain all .
1262 CleanupStack::PopAndDestroy(iChained[windowPos]);
1263 CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[1]));
1264 CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[0]));
1265 GetGwListL(0,windowHandles);
1266 retVal = ChainedWindowCount(windowHandles);
1267 TEST(retVal==ENumChained-windowPos-2);
1268 if (retVal!=ENumChained-windowPos-2)
1269 INFO_PRINTF3(_L("ChainedWindowCount(windowHandles) return value - Expected: %d, Actual: %d"), ENumChained-windowPos-2, retVal);
1272 CleanupStack::Pop(2,iChained[1]);
1273 iChained[windowPos]->Close();//Closing parent window group in chain. There should be no chain
1274 CleanupStack::PopAndDestroy(iChained[windowPos]);
1275 CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[1]));
1276 CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[0]));
1277 GetGwListL(0,windowHandles);
1278 retVal = ChainedWindowCount(windowHandles);
1279 TEST(retVal==ENumChained-windowPos-1);
1280 if (retVal!=ENumChained-windowPos-1)
1281 INFO_PRINTF3(_L("ChainedWindowCount(windowHandles) return value - Expected: %d, Actual: %d"), ENumChained-windowPos-1, retVal);
1283 CleanupStack::PopAndDestroy(ENumChained-3,iChained[ENumChained-4]);
1284 windowHandles->Close();
1285 CleanupStack::PopAndDestroy(windowHandles); // causes windowsHandles->Close() called
1286 CleanupStack::PopAndDestroy(windowHandles); // causes delete windowsHandles called
1289 TInt CTGwHandle::ChainedWindowCount(RArray<RWsSession::TWindowGroupChainInfo>* aWindowHandles)
1292 for(TInt ii=0;ii<aWindowHandles->Count();ii++)
1294 if((*aWindowHandles)[ii].iParentId!=-1)
1300 void CTGwHandle::TestOrdinalPositionL()
1302 TInt noOfGroupWnds = NumberOfWndGroupsWithZeroPriority(iTest->iScreenNumber);
1303 //Creating the chained window groups
1304 CreateChainedGroupWindowsLC(TheClient->iWs);
1306 //Test the ordinal position of all chained windows by setting the WndPos window
1307 //to chainPos position
1308 for(TInt wndPos=0;wndPos<ENumChained;wndPos++)
1310 for(TInt chainPos=0;chainPos<15;chainPos++)
1312 iChained[wndPos]->SetOrdinalPosition(chainPos);
1313 TInt dung = chainPos-wndPos;
1314 if(dung > noOfGroupWnds)
1316 dung = noOfGroupWnds;
1318 dung = Max(dung, 0);
1319 TestOrdinalPos(chainPos - wndPos > noOfGroupWnds ? noOfGroupWnds : Max(chainPos - wndPos, 0));
1322 //Test for negative ordinal number
1323 iChained[0]->SetOrdinalPosition(-2);
1324 TestOrdinalPos(noOfGroupWnds);
1325 CleanupStack::PopAndDestroy(ENumChained,iChained[ENumChained-1]);
1328 void CTGwHandle::TestOrdinalPositionNoDebugL()
1330 TInt noOfGroupWnds = NumberOfWndGroupsWithZeroPriority(iTest->iScreenNumber);
1331 //Creating the chained window groups
1332 CreateChainedGroupWindowsLC(TheClient->iWs);
1333 //Test the ordinal position of all chained windows
1334 TestOrdinalPosNoDebug(0);
1335 //Test the ordinal position of all chained windows by setting the WndPos window
1336 //to chainPos position
1337 for(TInt wndPos=0;wndPos<ENumChained;wndPos++)
1339 for(TInt chainPos=0;chainPos<15;chainPos++)
1341 iChained[wndPos]->SetOrdinalPosition(chainPos);
1342 TestOrdinalPosNoDebug(chainPos - wndPos > noOfGroupWnds ? noOfGroupWnds : Max(chainPos - wndPos, 0));
1345 //Test for negative ordinal number
1346 iChained[0]->SetOrdinalPosition(-2);
1347 TestOrdinalPosNoDebug(noOfGroupWnds);
1348 CleanupStack::PopAndDestroy(ENumChained,iChained[ENumChained-1]);
1351 void CTGwHandle::TestOrdinalPos(TInt aPos)
1353 for(TInt ii=0;ii<ENumChained;ii++)
1355 TInt iCha = iChained[ii]->OrdinalPosition();
1359 INFO_PRINTF3(_L("iChained[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos-1, iCha);
1364 void CTGwHandle::TestOrdinalPosNoDebug(TInt aPos)
1366 for(TInt ii=0;ii<ENumChained;ii++)
1368 TInt iCha = iChained[ii]->OrdinalPosition();
1371 INFO_PRINTF3(_L("iChained[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos-1, iCha);
1376 void CTGwHandle:: TestclosingclientL()
1379 User::LeaveIfError(ws1.Connect());
1380 CleanupClosePushL(ws1);
1382 // assign to the correct screen
1383 CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
1384 CleanupStack::PushL(screen);
1385 User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
1387 // Creating first Window Group
1388 RWindowGroup gw1(ws1);
1389 User::LeaveIfError(gw1.Construct(ENullWsHandle));
1390 ws1.SetWindowGroupOrdinalPosition(gw1.Identifier(),0);
1392 // Creating second Window Group
1393 RWindowGroup gw2(ws1);
1394 User::LeaveIfError(gw2.Construct(ENullWsHandle));
1395 gw2.SetOwningWindowGroup(gw1.Identifier());
1396 gw2.SetOrdinalPosition(1);
1397 CleanupStack::PopAndDestroy(screen);
1398 CleanupStack::PopAndDestroy(&ws1);
1401 void CTGwHandle::TestClearingAndSettingChildGroupsL()
1403 RArray<RWsSession::TWindowGroupChainInfo> windowHandles;
1404 CleanupClosePushL(windowHandles);
1405 //Creating a chain of 5 window groups.
1406 CreateChainedGroupWindowsLC(TheClient->iWs);
1408 // Want to test clearing and setting of window groups for chain lengths of 5 down to 2
1409 for(TInt jj=ENumChained-1;jj>0;jj--)
1411 // For each window group in the chain, test clearing and setting a child group
1412 for(TInt ii=jj;ii>0;ii--)
1414 RWsSession::TWindowGroupChainInfo window1;
1415 window1.iId=iChained[ii]->Identifier();
1416 GetGwListL(0,&windowHandles);
1417 TInt loc=windowHandles.Find(window1);
1418 TEST(loc!=KErrNotFound);
1419 if(loc!=KErrNotFound)
1421 RWsSession::TWindowGroupChainInfo window2;
1422 window2.iId=iChained[ii-1]->Identifier();
1423 loc = windowHandles.Find(window2);
1424 TEST(loc!=KErrNotFound);
1425 // First test that the parent of the next window in the chain is the previous in the chain
1426 if(loc!=KErrNotFound)
1428 TEST(windowHandles[loc].iParentId==window1.iId);
1430 // Then clear and test that the parent of the next window in the chain
1431 // is no longer the previous window in the chain
1432 ret=iChained[ii]->ClearChildGroup();
1433 TEST(ret==KErrNone);
1434 // Try to clear a child group when it's already cleared - should return KErrArgument
1435 ret=iChained[ii]->ClearChildGroup();
1436 TEST(ret==KErrArgument);
1437 GetGwListL(0,&windowHandles);
1438 loc = windowHandles.Find(window2);
1439 TEST(loc!=KErrNotFound);
1440 // Test that it has no parent (0) or is unchained (-1)
1441 if(loc!=KErrNotFound)
1443 if(ii==1) // last in chain therefore unchained, should return -1
1444 TEST(windowHandles[loc].iParentId==-1);
1445 else // otherwise should return 0 signifying in a chain but with no parent
1446 TEST(windowHandles[loc].iParentId==0);
1448 // Reset the former child group as a child to the current group
1449 ret=iChained[ii]->SetChildGroup(window2.iId);
1450 TEST(ret==KErrNone);
1451 // Test that it has now got it's parent back
1452 GetGwListL(0,&windowHandles);
1453 loc = windowHandles.Find(window2);
1454 TEST(loc!=KErrNotFound);
1455 if(loc!=KErrNotFound)
1457 TEST(windowHandles[loc].iParentId==window1.iId);
1461 // Reduce chain length by 1
1462 ret=iChained[jj]->ClearChildGroup();
1463 TEST(ret==KErrNone);
1465 // Try to clear the child group of a window that's not in a queue - returns KErrArgument
1466 ret=iChained[0]->ClearChildGroup();
1467 TEST(ret==KErrArgument);
1468 // Test calling set on a non-existent window group - fictional id, larger than what exists
1469 ret=iChained[0]->SetChildGroup(9999);
1470 TEST(ret==KErrArgument);
1472 CleanupStack::PopAndDestroy(ENumChained,iChained[ENumChained-1]);
1473 CleanupStack::PopAndDestroy(&windowHandles);
1476 void CTGwHandle::TestAgainstLoopsWhenAddingChildGroupsL()
1478 //Creating two chains of 5 window groups.
1479 CreateChainedGroupWindowsLC(TheClient->iWs,ETrue);
1482 //Try to append any of element of this chain to the lastone (itself included)
1483 //All these attempts should fail (otherwise a infinite loop will be set up)
1484 for(TInt ii=ENumChained-1;ii>=0;ii--)
1486 TInt windowId = iChained[ii]->Identifier();
1487 // Try to append it to the last one
1488 ret=iChained[0]->SetChildGroup(windowId);
1489 TEST(ret==KErrArgument);
1490 if(ret!=KErrArgument)
1492 _LIT(KLog,"Error: SetChildGroup with a GpWin belonging to the same queue succeeded, return value :%d");
1493 LOG_MESSAGE2(KLog,ret);
1496 //Try to append any elements belonging to another chain to the last one of this chain
1497 //All these trials should fail (otherwise a infinite loop will be set up)
1498 //Except for the parent of the second chain.
1499 for(TInt ii=0;ii<ENumChained;ii++)
1501 TInt windowId = iChained2[ii]->Identifier();
1502 // Try to append it to the last one
1503 ret=iChained[0]->SetChildGroup(windowId);
1504 if(ii != ENumChained-1)
1506 TEST(ret==KErrArgument);
1507 if(ret!=KErrArgument)
1509 _LIT(KLog,"Error: SetChildGroup with a GpWin which already has a parent succeeded, return value :%d");
1510 LOG_MESSAGE2(KLog,ret);
1512 iChained[0]->ClearChildGroup();
1516 TEST(ret==KErrNone);
1519 _LIT(KLog,"Error: SetChildGroup with a GpWin with no parent failed, return value :%d");
1520 LOG_MESSAGE2(KLog,ret);
1524 TInt windowId = iChained2[ENumChained-1]->Identifier();
1525 ret=iChained[ENumChained-1]->SetChildGroup(windowId);
1526 TEST(ret==KErrArgument);
1527 if(ret!=KErrArgument)
1529 _LIT(KLog,"Error: SetChildGroup successful on a GpWin which already has a child, return value :%d");
1530 LOG_MESSAGE2(KLog,ret);
1532 //Now take a window group not belonging to any queue
1533 //just take the parent's chain and pop it
1534 //and try to append it to itself
1535 ret=iChained[ENumChained-1]->ClearChildGroup();
1536 TEST(ret==KErrNone);
1537 ret=iChained[ENumChained-1]->SetChildGroup(iChained[ENumChained-1]->Identifier());
1538 TEST(ret==KErrArgument);
1539 if(ret!=KErrArgument)
1541 _LIT(KLog,"Error: Setting GpWin as a child of itself succeeded, return value :%d");
1542 LOG_MESSAGE2(KLog,ret);
1544 CleanupStack::PopAndDestroy(ENumChained+ENumChained,iChained[ENumChained-1]);
1546 void CTGwHandle::RunTestCaseL(TInt /*aCurTestCase*/)
1548 _LIT(KTest0,"Window group names");
1549 _LIT(KTest1,"Window group identifiers");
1550 _LIT(KTest2,"Owner to foreground");
1551 _LIT(KTest3,"FindWindowGroupIdentifier test");
1552 _LIT(KTest4,"IdentifierWrapAround test");
1553 _LIT(KTest5,"DefaultOwningWindow test");
1554 _LIT(KTest6,"DefaultOwningWindow2 test");
1555 _LIT(KTest7,"Window Group Chaining");
1556 _LIT(KTest8,"Window Group Chaining2");
1557 _LIT(KTest9,"Unchaining window group");
1558 _LIT(KTest10,"Ordinal Postion Test");
1559 _LIT(KTest11,"CrashTest on closing client");
1560 _LIT(KTest12,"Setting and Clearing Child Groups");
1561 _LIT(KTest13,"No Infinite Loops in Setting Child Groups");
1562 ((CTGwHandleStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1563 switch(++iTest->iState)
1567 @SYMTestCaseID GRAPHICS-WSERV-0316
1571 @SYMTestCaseDesc Test setting window group names
1573 @SYMTestPriority High
1575 @SYMTestStatus Implemented
1577 @SYMTestActions Set the name of a window group to different values and check the
1578 value is set correctly
1580 @SYMTestExpectedResults The window group name is set correctly
1584 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0316"));
1586 iTest->LogSubTest(KTest0);
1591 @SYMTestCaseID GRAPHICS-WSERV-0317
1595 @SYMTestCaseDesc Test setting window group identifiers
1597 @SYMTestPriority High
1599 @SYMTestStatus Implemented
1601 @SYMTestActions Set the identifiers of a window groups. manipulate the window groups and
1602 check the identifiers remain correct
1604 @SYMTestExpectedResults The identifiers are correct for each window group after
1609 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0317"));
1610 iTest->LogSubTest(KTest1);
1611 GwIdentifierTestL();
1615 @SYMTestCaseID GRAPHICS-WSERV-0318
1619 @SYMTestCaseDesc Test moving different window groups to the foreground and bringing
1622 @SYMTestPriority High
1624 @SYMTestStatus Implemented
1626 @SYMTestActions Create some window groups and move them in turn to the foreground before
1627 restoring the background
1629 @SYMTestExpectedResults Window groups move to and from the foreground with error
1633 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0318"));
1634 iTest->LogSubTest(KTest2);
1635 OwnerToForegroundL();
1639 @SYMTestCaseID GRAPHICS-WSERV-0319
1643 @SYMTestCaseDesc Test returning different window groups identifiers by searching
1646 @SYMTestPriority High
1648 @SYMTestStatus Implemented
1650 @SYMTestActions Create some window groups and return their identifiers by searching on
1653 @SYMTestExpectedResults The correct identifiers are returned for each name
1657 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0319"));
1658 iTest->LogSubTest(KTest3);
1659 FindWindowGroupIdentifierTestL();
1663 @SYMTestCaseID GRAPHICS-WSERV-0320
1667 @SYMTestCaseDesc Test that a windows group identifier is not used twice
1669 @SYMTestPriority High
1671 @SYMTestStatus Implemented
1673 @SYMTestActions Assign a window group identifier to one window group and check
1674 the same identifier can not be used for a second group
1676 @SYMTestExpectedResults Window group identifier can not be reused
1680 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0320"));
1681 iTest->LogSubTest(KTest4);
1682 IdentifierWrapAroundTestL();
1686 @SYMTestCaseID GRAPHICS-WSERV-0321
1690 @SYMTestCaseDesc Test that the default owning window for window groups is set
1693 @SYMTestPriority High
1695 @SYMTestStatus Implemented
1697 @SYMTestActions Set different default owning windows for different window groups.
1698 Check the windows have been set correctly.
1700 @SYMTestExpectedResults The default owning windows for the groups are set correctly
1704 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0321"));
1705 iTest->LogSubTest(KTest5);
1706 DefaultOwningWindowL();
1710 @SYMTestCaseID GRAPHICS-WSERV-0322
1714 @SYMTestCaseDesc Test that the default owning window for window groups is set
1717 @SYMTestPriority High
1719 @SYMTestStatus Implemented
1721 @SYMTestActions Set different default owning windows for different window groups.
1722 Check the windows have been set correctly.
1724 @SYMTestExpectedResults The default owning windows for the groups are set correctly
1728 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0322"));
1729 iTest->LogSubTest(KTest6);
1730 DefaultOwningWindow2L();
1731 TheClient->iGroup->WinTreeNode()->SetOrdinalPosition(0);
1735 @SYMTestCaseID GRAPHICS-WSERV-0323
1739 @SYMTestCaseDesc Test that window groups can be chained correctly
1741 @SYMTestPriority High
1743 @SYMTestStatus Implemented
1745 @SYMTestActions Create a chain of window groups and check that the chain of groups
1746 can be manipluated correctly
1748 @SYMTestExpectedResults The chain can be manipulated correctly
1752 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0323"));
1753 iTest->LogSubTest(KTest7);
1754 WindowGroupChaining();
1758 @SYMTestCaseID GRAPHICS-WSERV-0324
1762 @SYMTestCaseDesc Test that window groups can be chained correctly
1764 @SYMTestPriority High
1766 @SYMTestStatus Implemented
1768 @SYMTestActions Create a chain of window groups and check that the chain of groups
1769 can be manipluated correctly
1771 @SYMTestExpectedResults The chain can be manipulated correctly
1775 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0324"));
1776 iTest->LogSubTest(KTest8);
1777 WindowGroupChaining2();
1781 @SYMTestCaseID GRAPHICS-WSERV-0325
1785 @SYMTestCaseDesc Test that window groups can be unchained correctly
1787 @SYMTestPriority High
1789 @SYMTestStatus Implemented
1791 @SYMTestActions Create chains of window groups and check that the window groups can be
1794 @SYMTestExpectedResults The chain can be unchained correctly
1798 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0325"));
1799 iTest->LogSubTest(KTest9);
1800 UnchainWindowGroupsL();
1804 @SYMTestCaseID GRAPHICS-WSERV-0326
1808 @SYMTestCaseDesc Test the ordinal position of chained window groups
1810 @SYMTestPriority High
1812 @SYMTestStatus Implemented
1814 @SYMTestActions Create chains of window groups and check their ordinal position is correct
1815 for different scenarios
1817 @SYMTestExpectedResults Ordinal position of chained window group is correct
1821 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0326"));
1822 iTest->LogSubTest(KTest10);
1823 TestOrdinalPositionL();
1826 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0326"));
1827 iTest->LogSubTest(KTest10);
1828 TestOrdinalPositionNoDebugL();
1832 @SYMTestCaseID GRAPHICS-WSERV-0327
1836 @SYMTestCaseDesc Test that window groups are dealt with correctly if their client is closed
1838 @SYMTestPriority High
1840 @SYMTestStatus Implemented
1842 @SYMTestActions Create window groups and then close there client.
1844 @SYMTestExpectedResults The window groups of the closed client are handled without error
1848 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0327"));
1849 iTest->LogSubTest(KTest11);
1850 TestclosingclientL();
1853 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0327"));
1854 iTest->LogSubTest(KTest12);
1855 TestClearingAndSettingChildGroupsL();
1858 ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0327"));
1859 iTest->LogSubTest(KTest13);
1860 TestAgainstLoopsWhenAddingChildGroupsL();
1863 ((CTGwHandleStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1864 ((CTGwHandleStep*)iStep)->CloseTMSGraphicsStep();
1868 ((CTGwHandleStep*)iStep)->RecordTestResultL();
1871 __WS_CONSTRUCT_STEP__(GwHandle)