1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TGWHANDLE.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1871 @@
1.4 +// Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// GWHANDLE.CPP
1.18 +// Test group window handle functions
1.19 +//
1.20 +//
1.21 +
1.22 +/**
1.23 + @file
1.24 + @test
1.25 +*/
1.26 +
1.27 +#include "TGWHANDLE.H"
1.28 +
1.29 +
1.30 +CTGwHandle::CTGwHandle(CTestStep* aStep):
1.31 + CTWsGraphicsBase(aStep)
1.32 + {
1.33 + }
1.34 +
1.35 +void CTGwHandle::ConstructL()
1.36 + {
1.37 + }
1.38 +
1.39 +CTGwHandle::~CTGwHandle()
1.40 + {
1.41 + }
1.42 +
1.43 +TInt CTGwHandle::NumberOfWndGroupsWithZeroPriority(TInt aScreenNumber)
1.44 + {
1.45 + __ASSERT_ALWAYS(aScreenNumber <= 1, User::Invariant());
1.46 + return TheClient->iWs.NumWindowGroups(aScreenNumber,0);
1.47 + }
1.48 +
1.49 +void CTGwHandle::GetGwListL(CArrayFixFlat<TInt> *aWindowHandles)
1.50 + {
1.51 + User::LeaveIfError(TheClient->iWs.WindowGroupList(aWindowHandles));
1.52 + }
1.53 +
1.54 +void CTGwHandle::GetGwListL(CArrayFixFlat<TInt> *aWindowHandles, TInt aScreenNumber)
1.55 + {
1.56 + User::LeaveIfError(TheClient->iWs.WindowGroupList(aWindowHandles, aScreenNumber));
1.57 + }
1.58 +
1.59 +void CTGwHandle::GetGwListL(TInt aPriority, CArrayFixFlat<TInt> *aWindowHandles)
1.60 + {
1.61 + User::LeaveIfError(TheClient->iWs.WindowGroupList(aPriority,aWindowHandles));
1.62 + }
1.63 +
1.64 +void CTGwHandle::GetGwListL(RArray<RWsSession::TWindowGroupChainInfo>* aWindowHandles)
1.65 + {
1.66 + User::LeaveIfError(TheClient->iWs.WindowGroupList(aWindowHandles));
1.67 + }
1.68 +
1.69 +void CTGwHandle::GetGwListL(TInt aPriority, RArray<RWsSession::TWindowGroupChainInfo>* aWindowHandles)
1.70 + {
1.71 + User::LeaveIfError(TheClient->iWs.WindowGroupList(aPriority, aWindowHandles));
1.72 + }
1.73 +
1.74 +void CTGwHandle::GwNamesL()
1.75 + {
1.76 + enum {EConnectHandle1=123456};
1.77 + enum {EWindowGroupHandle1=234567};
1.78 + enum {EWindowGroupHandle2=666666};
1.79 +//
1.80 + TInt foreground;
1.81 + User::LeaveIfError(foreground=TheClient->iWs.GetFocusWindowGroup());
1.82 + RWsSession ws1;
1.83 + User::LeaveIfError(ws1.Connect());
1.84 +
1.85 + // assign to the correct screen
1.86 + CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
1.87 + CleanupStack::PushL(screen);
1.88 + User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
1.89 +
1.90 + RWindowGroup gw1(ws1);
1.91 + User::LeaveIfError(gw1.Construct(EWindowGroupHandle1));
1.92 + gw1.SetOwningWindowGroup(foreground);
1.93 + RWindowGroup gw2(ws1);
1.94 + User::LeaveIfError(gw2.Construct(EWindowGroupHandle2));
1.95 + gw2.SetOwningWindowGroup(foreground);
1.96 +//
1.97 + TBuf<8> getName;
1.98 +//
1.99 +// Check default name is simply a null string
1.100 +//
1.101 + TInt retVal = gw1.Name(getName);
1.102 + TEST(retVal==KErrNone);
1.103 + if (retVal!=KErrNone)
1.104 + INFO_PRINTF3(_L("gw1.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.105 +
1.106 + TEST(getName==_L(""));
1.107 + if (getName!=_L(""))
1.108 + INFO_PRINTF3(_L("getName==_L() - Expected: %d, Actual: %d"), ETrue, EFalse);
1.109 +//
1.110 + TBuf<8> name1(_L("A_Name1"));
1.111 + TBuf<8> name2(_L("A_Name2"));
1.112 +//
1.113 + retVal = gw1.SetName(name1);
1.114 + TEST(retVal==KErrNone);
1.115 + if (retVal!=KErrNone)
1.116 + INFO_PRINTF3(_L("gw1.SetName(name1) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.117 +
1.118 + retVal = gw2.SetName(name2);
1.119 + TEST(retVal==KErrNone);
1.120 + if (retVal!=KErrNone)
1.121 + INFO_PRINTF3(_L("(gw2.SetName(name2) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.122 +
1.123 + retVal = gw1.Name(getName);
1.124 + TEST(retVal==KErrNone);
1.125 + if (retVal!=KErrNone)
1.126 + INFO_PRINTF3(_L("(gw1.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.127 +
1.128 + TEST(getName==name1);
1.129 + if (getName!=name1)
1.130 + INFO_PRINTF3(_L("getName==name1 - Expected: %d, Actual: %d"), ETrue, EFalse);
1.131 +//
1.132 + retVal = gw2.Name(getName);
1.133 + TEST(retVal==KErrNone);
1.134 + if (retVal!=KErrNone)
1.135 + INFO_PRINTF3(_L("(gw2.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.136 +
1.137 + TEST(getName==name2);
1.138 + if (getName!=name2)
1.139 + INFO_PRINTF3(_L("getName==name2 - Expected: %d, Actual: %d"), ETrue, EFalse);
1.140 +
1.141 +//
1.142 +// A few weird characters in the name should work fine
1.143 +//
1.144 + retVal = gw2.SetName(_L("xx*"));
1.145 + TEST(retVal==KErrNone);
1.146 + if (retVal!=KErrNone)
1.147 + INFO_PRINTF3(_L("(gw2.SetName(_L(xx*)) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.148 +
1.149 + retVal = gw2.Name(getName);
1.150 + TEST(retVal==KErrNone);
1.151 + if (retVal!=KErrNone)
1.152 + INFO_PRINTF3(_L("(gw2.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.153 +
1.154 + TEST(getName==_L("xx*"));
1.155 + if (getName!=_L("xx*"))
1.156 + INFO_PRINTF3(_L("getName==_L(xx*) - Expected: %d, Actual: %d"), ETrue, EFalse);
1.157 +
1.158 +//
1.159 + retVal = gw2.SetName(_L(":"));
1.160 + TEST(retVal==KErrNone);
1.161 + if (retVal!=KErrNone)
1.162 + INFO_PRINTF3(_L("(gw2.SetName(_L(:)) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.163 +
1.164 + retVal = gw2.Name(getName);
1.165 + TEST(retVal==KErrNone);
1.166 + if (retVal!=KErrNone)
1.167 + INFO_PRINTF3(_L("(gw2.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.168 +
1.169 + TEST(getName==_L(":"));
1.170 + if (getName!=_L(":"))
1.171 + INFO_PRINTF3(_L("getName==_L(:) - Expected: %d, Actual: %d"), ETrue, EFalse);
1.172 +
1.173 +//
1.174 +// Setting the name back to a null name
1.175 +//
1.176 + retVal = gw2.SetName(_L(""));
1.177 + TEST(retVal==KErrNone);
1.178 + if (retVal!=KErrNone)
1.179 + INFO_PRINTF3(_L("gw2.SetName(_L()) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.180 +
1.181 + retVal = gw2.Name(getName);
1.182 + TEST(retVal==KErrNone);
1.183 + if (retVal!=KErrNone)
1.184 + INFO_PRINTF3(_L("gw2.Name(getName) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.185 +
1.186 + TEST(getName==_L(""));
1.187 + if (getName!=_L(""))
1.188 + INFO_PRINTF3(_L("getName==_L() - Expected: %d, Actual: %d"), ETrue, EFalse);
1.189 +
1.190 +//
1.191 +// Getting a name into a too short buffer should fill thew whole buffer from the left hand part
1.192 +// of the window name and return KErrOverflow
1.193 +//
1.194 + gw2.SetName(name2);
1.195 + TBuf<4> shortBuf;
1.196 + retVal = gw2.Name(shortBuf);
1.197 + TEST(retVal==KErrOverflow);
1.198 + if (retVal!=KErrOverflow)
1.199 + INFO_PRINTF3(_L("gw2.Name(shortBuf) return value - Expected: %d, Actual: %d"), KErrOverflow, retVal);
1.200 +
1.201 + TEST(shortBuf==name2.Left(4));
1.202 + if (shortBuf!=name2.Left(4))
1.203 + INFO_PRINTF3(_L("shortBuf==name2.Left(4) - Expected: %d, Actual: %d"), ETrue, EFalse);
1.204 +
1.205 +//
1.206 +// passing a 0 length TPtr pointing to NULL should be safe, simply returning KErrOverflow
1.207 +//
1.208 + TPtr nullPtr(NULL,0);
1.209 + retVal = gw2.Name(nullPtr);
1.210 + TEST(retVal==KErrOverflow);
1.211 + if (retVal!=KErrOverflow)
1.212 + INFO_PRINTF3(_L("gw2.Name(nullPtr) return value - Expected: %d, Actual: %d"), KErrOverflow, retVal);
1.213 +
1.214 + TEST(nullPtr==_L(""));
1.215 + if (nullPtr!=_L(""))
1.216 + INFO_PRINTF3(_L("nullPtr==_L() - Expected: %d, Actual: %d"), ETrue, EFalse);
1.217 +
1.218 +//
1.219 +// Getting a null name into a null descriptor
1.220 +//
1.221 + gw2.SetName(_L(""));
1.222 + TPtr nullPtr2(NULL,0);
1.223 + retVal = gw2.Name(nullPtr);
1.224 + TEST(retVal==KErrNone);
1.225 + if (retVal!=KErrNone)
1.226 + INFO_PRINTF3(_L("gw2.Name(nullPtr) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.227 +
1.228 + TEST(nullPtr2==_L(""));
1.229 + if (nullPtr2!=_L(""))
1.230 + INFO_PRINTF3(_L("nullPtr2==_L() - Expected: %d, Actual: %d"), ETrue, EFalse);
1.231 +//
1.232 + gw1.Close();
1.233 + gw2.Close();
1.234 + CleanupStack::PopAndDestroy(screen);
1.235 + ws1.Close();
1.236 + }
1.237 +
1.238 +void CTGwHandle::GwIdentifierTestL()
1.239 + {
1.240 + enum {EWindowGroupHandle1=234567};
1.241 + enum {EWindowGroupHandle2=666666};
1.242 + enum {EWindowGroupHandle3=999};
1.243 +//
1.244 + CArrayFixFlat<TInt>* windowHandles=new(ELeave) CArrayFixFlat<TInt>(5);
1.245 + CleanupStack::PushL(windowHandles);
1.246 + GetGwListL(0, windowHandles);
1.247 + TInt retVal = TheClient->iWs.GetFocusWindowGroup();
1.248 + TEST(retVal==(*windowHandles)[0]);
1.249 + if (retVal!=(*windowHandles)[0])
1.250 + INFO_PRINTF3(_L("TheClient->iWs.GetFocusWindowGroup() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
1.251 +
1.252 +//
1.253 + RWsSession ws1;
1.254 + User::LeaveIfError(ws1.Connect());
1.255 + CleanupClosePushL(ws1);
1.256 +
1.257 + // assign to the correct screen
1.258 + CWsScreenDevice* screen1 = new (ELeave) CWsScreenDevice(ws1);
1.259 + CleanupStack::PushL(screen1);
1.260 + User::LeaveIfError(screen1->Construct(iTest->iScreenNumber));
1.261 +
1.262 + RWindowGroup gw1(ws1);
1.263 + User::LeaveIfError(gw1.Construct(EWindowGroupHandle1));
1.264 + gw1.SetOwningWindowGroup((*windowHandles)[0]);
1.265 + RWsSession ws2;
1.266 + User::LeaveIfError(ws2.Connect());
1.267 + CleanupClosePushL(ws2);
1.268 +
1.269 + // assign to the correct screen
1.270 + CWsScreenDevice* screen2 = new (ELeave) CWsScreenDevice(ws2);
1.271 + CleanupStack::PushL(screen2);
1.272 + User::LeaveIfError(screen2->Construct(iTest->iScreenNumber));
1.273 +
1.274 + RWindowGroup gw2(ws2);
1.275 + User::LeaveIfError(gw2.Construct(EWindowGroupHandle2));
1.276 +//
1.277 + GetGwListL(0, windowHandles);
1.278 +//
1.279 +
1.280 + retVal = gw2.Identifier();
1.281 + TEST(retVal==(*windowHandles)[0]);
1.282 + if (retVal!=(*windowHandles)[0])
1.283 + INFO_PRINTF3(_L("gw2.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
1.284 +
1.285 + retVal = gw1.Identifier();
1.286 + TEST(retVal==(*windowHandles)[1]);
1.287 + if (retVal!=(*windowHandles)[1])
1.288 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
1.289 +
1.290 + retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]);
1.291 + TEST(retVal==EWindowGroupHandle2);
1.292 + if (retVal!=EWindowGroupHandle2)
1.293 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle2, retVal);
1.294 +
1.295 + retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]);
1.296 + TEST(retVal==EWindowGroupHandle1);
1.297 + if (retVal!=EWindowGroupHandle1)
1.298 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle1, retVal);
1.299 +//
1.300 + retVal = TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[1]);
1.301 + TEST(retVal==0);
1.302 + if (retVal!=0)
1.303 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), 0, retVal);
1.304 +
1.305 + retVal = TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[0]);
1.306 + TEST(retVal==0);
1.307 + if (retVal!=0)
1.308 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), 0, retVal);
1.309 +
1.310 +//
1.311 + TThreadId threadId;
1.312 + TheClient->iWs.GetWindowGroupClientThreadId((*windowHandles)[0],threadId);
1.313 +
1.314 + TUint64 ret = RThread().Id();
1.315 + TEST(ret==threadId);
1.316 + if (ret!=threadId)
1.317 + INFO_PRINTF3(_L("RThread().Id() return value - Expected: %d, Actual: %d"), (TInt)threadId, (TInt)ret);
1.318 +
1.319 + TheClient->iWs.GetWindowGroupClientThreadId((*windowHandles)[1],threadId);
1.320 +
1.321 + TUint64 retVal2 = RThread().Id();
1.322 + TEST(retVal2==threadId);
1.323 + if (retVal2!=threadId)
1.324 + INFO_PRINTF3(_L("RThread().Id() return value - Expected: %d, Actual: %d"), (TInt)threadId, (TInt)retVal2);
1.325 +//
1.326 + retVal = gw1.OrdinalPosition();
1.327 + TEST(retVal==1);
1.328 + if (retVal!=1)
1.329 + INFO_PRINTF3(_L("gw1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1.330 +
1.331 + retVal = gw2.OrdinalPosition();
1.332 + TEST(retVal==0);
1.333 + if (retVal!=0)
1.334 + INFO_PRINTF3(_L("gw2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1.335 +
1.336 + retVal = TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[1],0);
1.337 + TEST(retVal==KErrNone);
1.338 + if (retVal!=KErrNone)
1.339 + INFO_PRINTF3(_L("TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[1],0) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.340 +
1.341 + retVal = gw1.OrdinalPosition();
1.342 + TEST(retVal==0);
1.343 + if (retVal!=0)
1.344 + INFO_PRINTF3(_L("gw1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1.345 +
1.346 + retVal = gw2.OrdinalPosition();
1.347 + TEST(retVal==1);
1.348 + if (retVal!=1)
1.349 + INFO_PRINTF3(_L("gw2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1.350 +//
1.351 + retVal = TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[1],1);
1.352 + TEST(retVal==KErrNone);
1.353 + if (retVal!=KErrNone)
1.354 + INFO_PRINTF3(_L("TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[1],1) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.355 +
1.356 + retVal = gw1.OrdinalPosition();
1.357 + TEST(retVal==1);
1.358 + if (retVal!=1)
1.359 + INFO_PRINTF3(_L("gw1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
1.360 +
1.361 + retVal = gw2.OrdinalPosition();
1.362 + TEST(retVal==0);
1.363 + if (retVal!=0)
1.364 + INFO_PRINTF3(_L("gw2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
1.365 +
1.366 + retVal = TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[0],1);
1.367 + TEST(retVal==KErrNone);
1.368 + if (retVal!=KErrNone)
1.369 + INFO_PRINTF3(_L("TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[0],1) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.370 +
1.371 + GetGwListL(0, windowHandles);
1.372 + retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]);
1.373 + TEST(retVal==EWindowGroupHandle1);
1.374 + if (retVal!=EWindowGroupHandle1)
1.375 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle1, retVal);
1.376 +
1.377 + retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]);
1.378 + TEST(retVal==EWindowGroupHandle2);
1.379 + if (retVal!=EWindowGroupHandle2)
1.380 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle2, retVal);
1.381 +//
1.382 + RWindowGroup gw3(ws2);
1.383 + User::LeaveIfError(gw3.Construct(EWindowGroupHandle3));
1.384 + gw1.SetOrdinalPosition(0,100000); // Assume nothing else in the system is higher, else test will fail
1.385 + gw3.SetOrdinalPosition(0,100000);
1.386 + ws1.Flush();
1.387 + ws2.Flush();
1.388 +//
1.389 + GetGwListL(100000, windowHandles);
1.390 + retVal = windowHandles->Count();
1.391 + TEST(retVal==2);
1.392 + if (retVal!=2)
1.393 + INFO_PRINTF3(_L("windowHandles->Count() return value - Expected: %d, Actual: %d"), 2, retVal);
1.394 +
1.395 + retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]);
1.396 + TEST(retVal==EWindowGroupHandle3);
1.397 + if (retVal!=EWindowGroupHandle3)
1.398 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle3, retVal);
1.399 +
1.400 + retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]);
1.401 + TEST(retVal==EWindowGroupHandle1);
1.402 + if (retVal!=EWindowGroupHandle1)
1.403 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle1, retVal);
1.404 +
1.405 +//
1.406 + retVal = TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[0]);
1.407 + TEST(retVal==100000);
1.408 + if (retVal!=100000)
1.409 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), 100000, retVal);
1.410 +
1.411 + retVal = TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[1]);
1.412 + TEST(retVal==100000);
1.413 + if (retVal!=100000)
1.414 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), 100000, retVal);
1.415 +//
1.416 + GetGwListL(-12453, windowHandles); // Test 0 count, Assumes no window with priority
1.417 + retVal = windowHandles->Count();
1.418 + TEST(retVal==0);
1.419 + if (retVal!=0)
1.420 + INFO_PRINTF3(_L("windowHandles->Count() return value - Expected: %d, Actual: %d"), 0, retVal);
1.421 +
1.422 +//
1.423 + GetGwListL(windowHandles, iTest->iScreenNumber);
1.424 + retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]);
1.425 + TEST(retVal==EWindowGroupHandle3);
1.426 + if (retVal!=EWindowGroupHandle3)
1.427 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[0]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle3, retVal);
1.428 +
1.429 + retVal = TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]);
1.430 + TEST(retVal==EWindowGroupHandle1);
1.431 + if (retVal!=EWindowGroupHandle1)
1.432 + INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupHandle((*windowHandles)[1]) return value - Expected: %d, Actual: %d"), EWindowGroupHandle1, retVal);
1.433 +//
1.434 +// Check passing bad identifiers
1.435 +//
1.436 + retVal = TheClient->iWs.SetWindowGroupOrdinalPosition(-1,0);
1.437 + TEST(retVal==KErrNotFound);
1.438 + if (retVal!=KErrNotFound)
1.439 + INFO_PRINTF3(_L("TheClient->iWs.SetWindowGroupOrdinalPosition(-1,0) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
1.440 +
1.441 + retVal = TheClient->iWs.GetWindowGroupHandle(-3);
1.442 + TEST(retVal==KErrNotFound);
1.443 + if (retVal!=KErrNotFound)
1.444 + INFO_PRINTF3(_L("TTheClient->iWs.GetWindowGroupHandle(-3) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
1.445 +
1.446 +//
1.447 + gw1.Close();
1.448 + gw2.Close();
1.449 + gw3.Close();
1.450 +
1.451 + CleanupStack::PopAndDestroy(5, windowHandles);
1.452 + }
1.453 +
1.454 +void CTGwHandle::OwnerToForegroundL()
1.455 + {
1.456 + enum {EWindowGroupHandle1=234567};
1.457 + enum {EWindowGroupHandle2a=666666};
1.458 + enum {EWindowGroupHandle2b=666667};
1.459 +//
1.460 + CArrayFixFlat<TInt> *windowHandles=new(ELeave) CArrayFixFlat<TInt>(5);
1.461 + CleanupStack::PushL(windowHandles);
1.462 + GetGwListL(0, windowHandles);
1.463 + TInt oldForeground=(*windowHandles)[0];
1.464 +//
1.465 + RWsSession ws1;
1.466 + User::LeaveIfError(ws1.Connect());
1.467 + CleanupClosePushL(ws1);
1.468 +
1.469 + // assign to the correct screen
1.470 + CWsScreenDevice* screen1 = new (ELeave) CWsScreenDevice(ws1);
1.471 + CleanupStack::PushL(screen1);
1.472 + User::LeaveIfError(screen1->Construct(iTest->iScreenNumber));
1.473 +
1.474 + RWindowGroup gw1(ws1);
1.475 + User::LeaveIfError(gw1.Construct(EWindowGroupHandle1));
1.476 + CleanupClosePushL(gw1);
1.477 + RWsSession ws2;
1.478 + User::LeaveIfError(ws2.Connect());
1.479 + CleanupClosePushL(ws2);
1.480 +
1.481 + // assign to the correct screen
1.482 + CWsScreenDevice* screen2 = new (ELeave) CWsScreenDevice(ws2);
1.483 + CleanupStack::PushL(screen2);
1.484 + User::LeaveIfError(screen2->Construct(iTest->iScreenNumber));
1.485 +
1.486 + RWindowGroup gw2a(ws2);
1.487 + User::LeaveIfError(gw2a.Construct(EWindowGroupHandle2a));
1.488 + CleanupClosePushL(gw2a);
1.489 + RWindowGroup gw2b(ws2);
1.490 + User::LeaveIfError(gw2b.Construct(EWindowGroupHandle2b));
1.491 + CleanupClosePushL(gw2b);
1.492 + gw1.SetOrdinalPosition(1);
1.493 +//
1.494 +// Turn auto flushing on as we're using multiple connections and it would be easy to forget to flush one
1.495 +//
1.496 + ws1.SetAutoFlush(ETrue);
1.497 + ws2.SetAutoFlush(ETrue);
1.498 + TheClient->iWs.SetAutoFlush(ETrue);
1.499 +//
1.500 + GetGwListL(0, windowHandles);
1.501 +//
1.502 + TInt retVal = gw2b.Identifier();
1.503 + TEST(retVal==(*windowHandles)[0]);
1.504 + if (retVal!=(*windowHandles)[0])
1.505 + INFO_PRINTF3(_L("gw2b.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
1.506 +
1.507 + retVal = gw1.Identifier();
1.508 + TEST(retVal==(*windowHandles)[1]);
1.509 + if (retVal!=(*windowHandles)[1])
1.510 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
1.511 +
1.512 + retVal = gw2a.Identifier();
1.513 + TEST(retVal==(*windowHandles)[2]);
1.514 + if (retVal!=(*windowHandles)[2])
1.515 + INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[2], retVal);
1.516 +
1.517 + retVal = oldForeground;
1.518 + TEST(retVal==(*windowHandles)[3]);
1.519 + if (retVal!=(*windowHandles)[3])
1.520 + INFO_PRINTF3(_L("oldForeground - Expected: %d, Actual: %d"), (*windowHandles)[3], oldForeground);
1.521 +//
1.522 + CleanupStack::PopAndDestroy(&gw2b);
1.523 + GetGwListL(0, windowHandles);
1.524 +
1.525 + retVal = gw2a.Identifier();
1.526 + TEST(retVal==(*windowHandles)[0]);
1.527 + if (retVal!=(*windowHandles)[0])
1.528 + INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
1.529 + // Check 2a jumped over 1 in the ordinal list
1.530 +
1.531 + retVal = gw1.Identifier();
1.532 + TEST(retVal==(*windowHandles)[1]);
1.533 + if (retVal!=(*windowHandles)[1])
1.534 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
1.535 +
1.536 + retVal = oldForeground;
1.537 + TEST(retVal==(*windowHandles)[2]);
1.538 + if (retVal!=(*windowHandles)[2])
1.539 + INFO_PRINTF3(_L("oldForeground - Expected: %d, Actual: %d"), (*windowHandles)[2], oldForeground);
1.540 +
1.541 +//
1.542 + User::LeaveIfError(gw2b.Construct(EWindowGroupHandle2b));
1.543 + CleanupClosePushL(gw2b);
1.544 + gw2b.SetOwningWindowGroup(oldForeground);
1.545 + CleanupStack::PopAndDestroy(&gw2b);
1.546 + GetGwListL(0, windowHandles);
1.547 + retVal = oldForeground;
1.548 + TEST(retVal==(*windowHandles)[0]);
1.549 + if (retVal!=(*windowHandles)[0])
1.550 + INFO_PRINTF3(_L("oldForeground - Expected: %d, Actual: %d"), (*windowHandles)[0], oldForeground);
1.551 + // Check old foreground bought to foreground
1.552 +
1.553 + retVal = gw2a.Identifier();
1.554 + TEST(retVal==(*windowHandles)[1]);
1.555 + if (retVal!=(*windowHandles)[1])
1.556 + INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
1.557 +
1.558 + retVal = gw1.Identifier();
1.559 + TEST(retVal==(*windowHandles)[2]);
1.560 + if (retVal!=(*windowHandles)[2])
1.561 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[2], retVal);
1.562 +
1.563 + TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[0],2);
1.564 +//
1.565 + User::LeaveIfError(gw2b.Construct(EWindowGroupHandle2b));
1.566 + CleanupClosePushL(gw2b);
1.567 + gw2b.SetOwningWindowGroup((*windowHandles)[1]);
1.568 + gw2b.SetOrdinalPosition(KOrdinalPositionSwitchToOwningWindow); // Should bring 2a to foreground
1.569 + GetGwListL(0, windowHandles);
1.570 +
1.571 + retVal = gw2a.Identifier();
1.572 + TEST(retVal==(*windowHandles)[0]);
1.573 + if (retVal!=(*windowHandles)[0])
1.574 + INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
1.575 +
1.576 + retVal = gw2b.Identifier();
1.577 + TEST(retVal==(*windowHandles)[1]);
1.578 + if (retVal!=(*windowHandles)[1])
1.579 + INFO_PRINTF3(_L("gw2b.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
1.580 +
1.581 + retVal = gw1.Identifier();
1.582 + TEST(retVal==(*windowHandles)[2]);
1.583 + if (retVal!=(*windowHandles)[2])
1.584 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[2], retVal);
1.585 +//
1.586 + CleanupStack::PopAndDestroy(&gw2b);
1.587 + GetGwListL(0, windowHandles);
1.588 + retVal = gw2a.Identifier();
1.589 + TEST(retVal==(*windowHandles)[0]);
1.590 + if (retVal!=(*windowHandles)[0])
1.591 + INFO_PRINTF3(_L("gw2a.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[0], retVal);
1.592 +
1.593 + retVal = gw1.Identifier();
1.594 + TEST(retVal==(*windowHandles)[1]);
1.595 + if (retVal!=(*windowHandles)[1])
1.596 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
1.597 +//
1.598 + CleanupStack::PopAndDestroy(&gw2a); // Should bring shell to foreground
1.599 + GetGwListL(0, windowHandles);
1.600 +
1.601 +// check whether the shell is on
1.602 + TThreadId threadId;
1.603 + ws2.GetWindowGroupClientThreadId((*windowHandles)[0],threadId);
1.604 + TBool shellRunning=ETrue;
1.605 +
1.606 + TFullName shellName;
1.607 + // apply to primary screen only where SHELL is running
1.608 + TFindThread findThread(iTest->iScreenNumber==KDefaultScreen?_L("WSHELL*::*"):_L("WxSHELL*::*"));
1.609 + if(findThread.Next(shellName)==KErrNone)
1.610 + {
1.611 + RThread shell;
1.612 + User::LeaveIfError(shell.Open(shellName));
1.613 + TEST(shell.Id()==threadId);
1.614 + if (retVal!=(*windowHandles)[1])
1.615 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[1], retVal);
1.616 +
1.617 + shell.Close();
1.618 + }
1.619 + else
1.620 + {
1.621 + shellRunning=EFalse;
1.622 + }
1.623 +
1.624 +
1.625 + // Check gw1 second
1.626 + retVal = gw1.Identifier();
1.627 + TEST(retVal==(*windowHandles)[shellRunning ? 1 : 0]);
1.628 + if (retVal!=(*windowHandles)[shellRunning ? 1 : 0])
1.629 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[shellRunning ? 1 : 0], retVal);
1.630 +
1.631 + retVal = oldForeground;
1.632 + TEST(retVal==(*windowHandles)[shellRunning ? 2 : 1]);
1.633 + if (retVal!=(*windowHandles)[shellRunning ? 2 : 1])
1.634 + INFO_PRINTF3(_L("gw1.Identifier() return value - Expected: %d, Actual: %d"), (*windowHandles)[shellRunning ? 2 : 1], retVal);
1.635 + // and oldforeground second
1.636 +
1.637 +//
1.638 + CleanupStack::PopAndDestroy(5, &ws1);
1.639 +//
1.640 +// Kick shell back into background, 'cause that's where it belongs
1.641 +//
1.642 + TheClient->iWs.SetWindowGroupOrdinalPosition((*windowHandles)[0],-1);
1.643 + TheClient->iWs.SetAutoFlush(EFalse);
1.644 +//
1.645 + CleanupStack::PopAndDestroy(windowHandles);
1.646 + }
1.647 +
1.648 +void CTGwHandle::FindWindowGroupIdentifierTestL()
1.649 + {
1.650 + enum {EWindowGroupHandle1=234567};
1.651 + enum {EWindowGroupHandle2=666666};
1.652 + enum {EWindowGroupHandle3=123};
1.653 + TInt foreground=TheClient->iWs.GetFocusWindowGroup();
1.654 + RWsSession ws1;
1.655 + User::LeaveIfError(ws1.Connect());
1.656 +
1.657 + // assign to the correct screen
1.658 + CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
1.659 + CleanupStack::PushL(screen);
1.660 + User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
1.661 + CleanupStack::Pop(screen);
1.662 +
1.663 + CleanupClosePushL(ws1);
1.664 +//
1.665 + RWindowGroup gw1(ws1);
1.666 + User::LeaveIfError(gw1.Construct(EWindowGroupHandle1));
1.667 + CleanupClosePushL(gw1);
1.668 + gw1.SetOwningWindowGroup(foreground);
1.669 + RWindowGroup gw2(ws1);
1.670 + User::LeaveIfError(gw2.Construct(EWindowGroupHandle2));
1.671 + CleanupClosePushL(gw2);
1.672 + gw1.SetOwningWindowGroup(foreground);
1.673 + RWindowGroup gw3(ws1);
1.674 + User::LeaveIfError(gw3.Construct(EWindowGroupHandle3));
1.675 + CleanupClosePushL(gw3);
1.676 + gw3.SetOwningWindowGroup(foreground);
1.677 +//
1.678 + TInt id1=gw1.Identifier();
1.679 + TInt id2=gw2.Identifier();
1.680 + TInt id3=gw3.Identifier();
1.681 +//
1.682 + gw1.SetName(_L("qwerty123abcd"));
1.683 + gw2.SetName(_L("123"));
1.684 + gw3.SetName(_L("qqqabcdxxx123"));
1.685 +//
1.686 + TInt retVal = ws1.FindWindowGroupIdentifier(0,_L("123"),0);
1.687 + TEST(retVal==id2);
1.688 + if (retVal!=id2)
1.689 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(123),0) return value - Expected: %d, Actual: %d"), id2, retVal);
1.690 +
1.691 +//
1.692 + retVal = ws1.FindWindowGroupIdentifier(0,_L("*123*"),0);
1.693 + TEST(retVal==id3);
1.694 + if (retVal!=id3)
1.695 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(*123*),0) return value - Expected: %d, Actual: %d"), id3, retVal);
1.696 +
1.697 + retVal = ws1.FindWindowGroupIdentifier(id3,_L("*123*"),0);
1.698 + TEST(retVal==id2);
1.699 + if (retVal!=id2)
1.700 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id3,_L(*123*),0) return value - Expected: %d, Actual: %d"), id2, retVal);
1.701 +
1.702 + retVal = ws1.FindWindowGroupIdentifier(id2,_L("*123*"),0);
1.703 + TEST(retVal==id1);
1.704 + if (retVal!=id1)
1.705 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id2,_L(*123*),0) return value - Expected: %d, Actual: %d"), id1, retVal);
1.706 +
1.707 +//
1.708 + retVal = ws1.FindWindowGroupIdentifier(0,_L("*abcd*"),0);
1.709 + TEST(retVal==id3);
1.710 + if (retVal!=id3)
1.711 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(*abcd*),0) return value - Expected: %d, Actual: %d"), id3, retVal);
1.712 +
1.713 + retVal = ws1.FindWindowGroupIdentifier(id3,_L("*abcd*"),0);
1.714 + TEST(retVal==id1);
1.715 + if (retVal!=id1)
1.716 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id3,_L(*abcd*),0)return value - Expected: %d, Actual: %d"), id1, retVal);
1.717 +//
1.718 + retVal = ws1.FindWindowGroupIdentifier(0,_L("*123*"),7);
1.719 + TEST(retVal==id3);
1.720 + if (retVal!=id3)
1.721 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(*123*),7)return value - Expected: %d, Actual: %d"), id3, retVal);
1.722 +
1.723 + retVal = ws1.FindWindowGroupIdentifier(id3,_L("*123*"),7);
1.724 + TEST(retVal==KErrNotFound);
1.725 + if (retVal!=KErrNotFound)
1.726 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id3,_L(*123*),7) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
1.727 +
1.728 + retVal = ws1.FindWindowGroupIdentifier(0,_L("*abc*"),4);
1.729 + TEST(retVal==id1);
1.730 + if (retVal!=id1)
1.731 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(*abc*),4) return value - Expected: %d, Actual: %d"), id1, retVal);
1.732 +
1.733 + retVal = ws1.FindWindowGroupIdentifier(id1,_L("*abc*"),4);
1.734 + TEST(retVal==KErrNotFound);
1.735 + if (retVal!=KErrNotFound)
1.736 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id1,_L(*abc*),4) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
1.737 +
1.738 + retVal = ws1.FindWindowGroupIdentifier(0,_L("xxx*"),7);
1.739 + TEST(retVal==id3);
1.740 + if (retVal!=id3)
1.741 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(xxx*),7) return value - Expected: %d, Actual: %d"), id3, retVal);
1.742 +
1.743 + retVal = ws1.FindWindowGroupIdentifier(0,_L("xxx*"),8);
1.744 + TEST(retVal==KErrNotFound);
1.745 + if (retVal!=KErrNotFound)
1.746 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(0,_L(xxx*),8) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
1.747 +//
1.748 + retVal = ws1.FindWindowGroupIdentifier(id1,_L("12"),0);
1.749 + TEST(retVal==KErrNotFound);
1.750 + if (retVal!=KErrNotFound)
1.751 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id1,_L(12),0) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
1.752 +
1.753 + retVal = ws1.FindWindowGroupIdentifier(id1,_L("qqq"),0);
1.754 + TEST(retVal==KErrNotFound);
1.755 + if (retVal!=KErrNotFound)
1.756 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id1,_L(qqq),0) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
1.757 +
1.758 + retVal = ws1.FindWindowGroupIdentifier(id1,_L("abcd"),3);
1.759 + TEST(retVal==KErrNotFound);
1.760 + if (retVal!=KErrNotFound)
1.761 + INFO_PRINTF3(_L("ws1.FindWindowGroupIdentifier(id1,_L(abcd),3) return value - Expected: %d, Actual: %d"), KErrNotFound, retVal);
1.762 +//
1.763 + delete screen;
1.764 + CleanupStack::PopAndDestroy(4, &ws1);
1.765 + }
1.766 +
1.767 +void CTGwHandle::DefaultOwningWindowL()
1.768 + {
1.769 + TInt foreground=TheClient->iWs.GetFocusWindowGroup();
1.770 + RWsSession ws1;
1.771 + User::LeaveIfError(ws1.Connect());
1.772 +
1.773 + // assign to the correct screen
1.774 + CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
1.775 + CleanupStack::PushL(screen);
1.776 + User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
1.777 +
1.778 +//
1.779 + INFO_PRINTF1(_L("DefaultOwningWindow1"));
1.780 + RWindowGroup gw1(ws1);
1.781 + User::LeaveIfError(gw1.Construct(1));
1.782 + gw1.SetOwningWindowGroup(foreground);
1.783 + RWindowGroup gw2(ws1);
1.784 + User::LeaveIfError(gw2.Construct(2));
1.785 + gw2.SetOwningWindowGroup(foreground);
1.786 + RWindowGroup gw3(ws1);
1.787 + User::LeaveIfError(gw3.Construct(3));
1.788 + gw3.SetOwningWindowGroup(foreground);
1.789 + RWindowGroup gw4(ws1);
1.790 + User::LeaveIfError(gw4.Construct(4));
1.791 + gw4.SetOwningWindowGroup(foreground);
1.792 + INFO_PRINTF1(_L(" Created Group Window"));
1.793 +//
1.794 + TInt prevOwningGroup=ws1.GetDefaultOwningWindow();
1.795 + gw1.DefaultOwningWindow();
1.796 + TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
1.797 + if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
1.798 + INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
1.799 +
1.800 + gw2.DefaultOwningWindow();
1.801 + TEST(gw2.Identifier()==ws1.GetDefaultOwningWindow());
1.802 + if (gw2.Identifier()!=ws1.GetDefaultOwningWindow())
1.803 + INFO_PRINTF3(_L("gw2.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw2.Identifier());
1.804 +
1.805 + gw2.Close();
1.806 + TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
1.807 + if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
1.808 + INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
1.809 +
1.810 + gw3.DefaultOwningWindow();
1.811 + gw4.DefaultOwningWindow();
1.812 + gw3.Close();
1.813 + TEST(gw4.Identifier()==ws1.GetDefaultOwningWindow());
1.814 + if (gw4.Identifier()!=ws1.GetDefaultOwningWindow())
1.815 + INFO_PRINTF3(_L("gw4.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw4.Identifier());
1.816 +
1.817 + gw4.Close();
1.818 + TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
1.819 + if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
1.820 + INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
1.821 +
1.822 + gw1.Close();
1.823 + TEST(prevOwningGroup==ws1.GetDefaultOwningWindow());
1.824 + if (prevOwningGroup!=ws1.GetDefaultOwningWindow())
1.825 + INFO_PRINTF3(_L("prevOwningGroup==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), prevOwningGroup);
1.826 +
1.827 + INFO_PRINTF1(_L(" Closed Group Window"));
1.828 +
1.829 + User::LeaveIfError(gw1.Construct(1));
1.830 + gw1.SetOwningWindowGroup(foreground);
1.831 + User::LeaveIfError(gw2.Construct(2));
1.832 + gw2.SetOwningWindowGroup(foreground);
1.833 + User::LeaveIfError(gw3.Construct(3));
1.834 + gw3.SetOwningWindowGroup(foreground);
1.835 + INFO_PRINTF1(_L(" ReCreated Group Window"));
1.836 + gw1.DefaultOwningWindow();
1.837 + gw1.DefaultOwningWindow();
1.838 + gw1.Close();
1.839 + gw2.DefaultOwningWindow();
1.840 + gw2.DefaultOwningWindow();
1.841 + gw3.Close();
1.842 + gw2.Close();
1.843 + INFO_PRINTF1(_L(" Re-Closed Group Window"));
1.844 +
1.845 + User::LeaveIfError(gw1.Construct(1));
1.846 + gw1.SetOwningWindowGroup(foreground);
1.847 + User::LeaveIfError(gw2.Construct(2));
1.848 + gw2.SetOwningWindowGroup(foreground);
1.849 + User::LeaveIfError(gw3.Construct(3));
1.850 + gw3.SetOwningWindowGroup(foreground);
1.851 + User::LeaveIfError(gw4.Construct(4));
1.852 + gw4.SetOwningWindowGroup(foreground);
1.853 + INFO_PRINTF1(_L(" ReCreated Group Window Again"));
1.854 + gw1.DefaultOwningWindow();
1.855 + gw2.DefaultOwningWindow();
1.856 + gw1.DefaultOwningWindow();
1.857 + gw1.Close();
1.858 + gw2.Close();
1.859 + gw3.DefaultOwningWindow();
1.860 + gw4.DefaultOwningWindow();
1.861 + gw3.DefaultOwningWindow();
1.862 + gw4.Close();
1.863 + gw3.Close();
1.864 + INFO_PRINTF1(_L(" Re-Closed Group Window Again"));
1.865 +
1.866 + User::LeaveIfError(gw1.Construct(1));
1.867 + gw1.DefaultOwningWindow();
1.868 + TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
1.869 + if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
1.870 + INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
1.871 +
1.872 + gw1.DefaultOwningWindow();
1.873 + TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
1.874 + if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
1.875 + INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
1.876 +
1.877 + User::LeaveIfError(gw2.Construct(2));
1.878 + TEST(gw1.Identifier()==ws1.GetDefaultOwningWindow());
1.879 + if (gw1.Identifier()!=ws1.GetDefaultOwningWindow())
1.880 + INFO_PRINTF3(_L("gw1.Identifier()==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1.Identifier());
1.881 +
1.882 + gw2.Close();
1.883 + gw1.Close();
1.884 +
1.885 + CleanupStack::PopAndDestroy(screen);
1.886 + ws1.Close();
1.887 + }
1.888 +
1.889 +void CTGwHandle::DefaultOwningWindow2L()
1.890 +//This test originally resulted in a crash, while the above test originally resulted in lockups.
1.891 + {
1.892 + RWsSession ws1;
1.893 + User::LeaveIfError(ws1.Connect());
1.894 +
1.895 + // assign to the correct screen
1.896 + CWsScreenDevice* screen1 = new (ELeave) CWsScreenDevice(ws1);
1.897 + CleanupStack::PushL(screen1);
1.898 + User::LeaveIfError(screen1->Construct(iTest->iScreenNumber));
1.899 +
1.900 + RWsSession ws2;
1.901 + User::LeaveIfError(ws2.Connect());
1.902 +
1.903 + // assign to the correct screen
1.904 + CWsScreenDevice* screen2 = new (ELeave) CWsScreenDevice(ws2);
1.905 + CleanupStack::PushL(screen2);
1.906 + User::LeaveIfError(screen2->Construct(iTest->iScreenNumber));
1.907 +
1.908 +//
1.909 + RWindowGroup gw1(ws1);
1.910 + User::LeaveIfError(gw1.Construct(1));
1.911 + RWindowGroup gw2(ws2);
1.912 + User::LeaveIfError(gw2.Construct(2));
1.913 + RWindowGroup gw3(ws1);
1.914 + User::LeaveIfError(gw3.Construct(3));
1.915 +//
1.916 + const TInt gw1Id=gw1.Identifier();
1.917 + gw1.DefaultOwningWindow();
1.918 + gw2.DefaultOwningWindow();
1.919 + /*const TInt gw2Id=*/gw2.Identifier();
1.920 + gw1.DefaultOwningWindow();
1.921 + TEST(gw1Id==ws1.GetDefaultOwningWindow());
1.922 + if (gw1Id!=ws1.GetDefaultOwningWindow())
1.923 + INFO_PRINTF3(_L("gw1Id==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1Id);
1.924 +
1.925 + gw3.DefaultOwningWindow();
1.926 + gw3.Close();
1.927 + TEST(gw1Id==ws1.GetDefaultOwningWindow());
1.928 + if (gw1Id!=ws1.GetDefaultOwningWindow())
1.929 + INFO_PRINTF3(_L("gw1Id==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw1Id);
1.930 +
1.931 + gw1.Close();
1.932 + TInt gw2Id=gw2.Identifier();
1.933 + TEST(gw2Id==ws1.GetDefaultOwningWindow());
1.934 + if (gw2Id!=ws1.GetDefaultOwningWindow())
1.935 + INFO_PRINTF3(_L("gw2Id==ws1.GetDefaultOwningWindow() - Expected: %d, Actual: %d"), ws1.GetDefaultOwningWindow(), gw2Id);
1.936 +
1.937 + gw2.SetOrdinalPosition(0);
1.938 + gw2.Close();
1.939 + ws2.Flush();
1.940 + TRawEvent rawEvent;
1.941 + rawEvent.Set(TRawEvent::EKeyDown,32);
1.942 + TheClient->iWs.SimulateRawEvent(rawEvent);
1.943 + TheClient->iWs.Flush();
1.944 +//
1.945 + CleanupStack::PopAndDestroy(2,screen1);
1.946 + ws1.Close();
1.947 + ws2.Close();
1.948 + }
1.949 +
1.950 +#define FREQ 500
1.951 +void CTGwHandle::IdentifierWrapAroundTestL()
1.952 + {
1.953 + TInt report=-1;
1.954 + RWsSession ws1;
1.955 + User::LeaveIfError(ws1.Connect());
1.956 +
1.957 + // assign to the correct screen
1.958 + CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
1.959 + CleanupStack::PushL(screen);
1.960 + User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
1.961 +
1.962 + RWindowGroup gw1(ws1);
1.963 + User::LeaveIfError(gw1.Construct(1));
1.964 + gw1.EnableReceiptOfFocus(EFalse);
1.965 + TInt id1=gw1.Identifier();
1.966 + RWindowGroup gw2(ws1);
1.967 + User::LeaveIfError(gw2.Construct(2));
1.968 + gw2.EnableReceiptOfFocus(EFalse);
1.969 + TInt id2=gw2.Identifier();
1.970 + gw2.Close(); // Allow gw2 id to be re-used
1.971 + TInt id3;
1.972 +
1.973 + do
1.974 + {
1.975 + RWindowGroup gw3(ws1);
1.976 + User::LeaveIfError(gw3.Construct(2));
1.977 + gw3.EnableReceiptOfFocus(EFalse);
1.978 + id3=gw3.Identifier();
1.979 + if ((id3/FREQ)!=(report/FREQ)) // || id3<=10)
1.980 + {
1.981 + report=id3;
1.982 + iTest->LogMessage(id3);
1.983 + }
1.984 + TEST(id3!=id1); // Check id1 is not re-used as the window hasn't been freed yet
1.985 + if (id3==id1)
1.986 + {
1.987 + _LIT(KErr,"Window Group Id Reused!");
1.988 + LOG_MESSAGE(KErr);
1.989 + }
1.990 + gw3.Close();
1.991 + } while(id3!=id2);
1.992 +
1.993 + CleanupStack::PopAndDestroy(screen);
1.994 + ws1.Close();
1.995 + }
1.996 +
1.997 +void GwHandleDestroyWindow(TAny* aWindow)
1.998 + {
1.999 + static_cast<RWindowTreeNode*>(aWindow)->Destroy();
1.1000 + }
1.1001 +
1.1002 +RWindowGroup* CTGwHandle::CreateWindowGroupLC(RWsSession& aWs,TUint32 aClientHandle,TInt aParentId/*=0*/)
1.1003 + {
1.1004 + RWindowGroup* gw=new(ELeave) RWindowGroup(aWs);
1.1005 + CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,gw));
1.1006 + if (aParentId>0)
1.1007 + {
1.1008 + User::LeaveIfError(gw->ConstructChildApp(aParentId,aClientHandle,EFalse));
1.1009 + }
1.1010 + else
1.1011 + {
1.1012 + User::LeaveIfError(gw->Construct(aClientHandle,EFalse));
1.1013 + }
1.1014 + return gw;
1.1015 + }
1.1016 +
1.1017 +void CTGwHandle::CreateGroupWindowsLC(RWsSession& aWs)
1.1018 + {
1.1019 + for(TInt ii=ENumGroups-1;ii>=0;--ii)
1.1020 + iGroups[ii]=CreateWindowGroupLC(aWs,ii);
1.1021 + }
1.1022 +
1.1023 +void CTGwHandle::CreateChainedGroupWindowsLC(RWsSession& aWs,TBool aSecondChain)
1.1024 + {
1.1025 + TInt parentId=0;
1.1026 + for(TInt ii=ENumChained-1;ii>=0;--ii)
1.1027 + {
1.1028 + iChained[ii]=CreateWindowGroupLC(aWs,ENumGroups+ii,parentId);
1.1029 + parentId=iChained[ii]->Identifier();
1.1030 + }
1.1031 + if(aSecondChain)
1.1032 + {
1.1033 + parentId =0;
1.1034 + for(TInt ii=ENumChained-1;ii>=0;--ii)
1.1035 + {
1.1036 + iChained2[ii]=CreateWindowGroupLC(aWs,ENumGroups+ENumGroups+ii,parentId);
1.1037 + parentId=iChained2[ii]->Identifier();
1.1038 + }
1.1039 + }
1.1040 + }
1.1041 +
1.1042 +void CTGwHandle::MoveGroups(RWindowGroup** aGroups,TInt aGp,TInt aNum,TInt aPos,TInt aInc/*=2*/)
1.1043 + {
1.1044 + TInt ii;
1.1045 + for(ii=aNum;ii>0;--ii)
1.1046 + {
1.1047 + aGroups[aGp]->SetOrdinalPosition(aPos);
1.1048 + aGp+=(aInc>0?1:-1);
1.1049 + aPos+=aInc;
1.1050 + }
1.1051 + }
1.1052 +
1.1053 +void CTGwHandle::TestGroups(TInt aPos)
1.1054 + {
1.1055 + TInt retVal;
1.1056 + TInt ii = 0;
1.1057 + for(ii=0;ii<ENumChained;++ii)
1.1058 + {
1.1059 + retVal = iChained[ii]->OrdinalPosition();
1.1060 + TEST(retVal==aPos+ii);
1.1061 + if (retVal!=aPos+ii)
1.1062 + INFO_PRINTF3(_L("iChained[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos+ii, retVal);
1.1063 + }
1.1064 +
1.1065 + for(ii=0;ii<ENumGroups;++ii)
1.1066 + {
1.1067 + retVal = iGroups[ii]->OrdinalPosition();
1.1068 + TInt ret = (ii<aPos?ii:ii+ENumChained);
1.1069 + TEST(retVal==ret);
1.1070 + if (retVal!=ret)
1.1071 + INFO_PRINTF3(_L("iGroups[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), ret, retVal);
1.1072 + }
1.1073 + }
1.1074 +
1.1075 +void CTGwHandle::TestGroupsBefore(TInt aPos)
1.1076 + {
1.1077 + TInt ii;
1.1078 + TInt retVal;
1.1079 + if (aPos>0)
1.1080 + {
1.1081 + for (ii=0;ii<aPos;++ii)
1.1082 + {
1.1083 + retVal = iGroups[ii]->OrdinalPosition();
1.1084 + TEST(retVal==ii);
1.1085 + if (retVal!=ii)
1.1086 + INFO_PRINTF3(_L("iGroups[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), ii, retVal);
1.1087 + }
1.1088 + }
1.1089 + for (ii=0;ii<ENumChained;++ii)
1.1090 + {
1.1091 + retVal = iChained[ii]->OrdinalPosition();
1.1092 + TEST(retVal==aPos+2*ii);
1.1093 + if (retVal!=aPos+2*ii)
1.1094 + INFO_PRINTF3(_L("iChained[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos+2*ii, retVal);
1.1095 + }
1.1096 + for (ii=0;ii<ENumChained-1;++ii)
1.1097 + {
1.1098 + retVal = iGroups[aPos+ii]->OrdinalPosition();
1.1099 + TEST(retVal==aPos+1+2*ii);
1.1100 + if (retVal!=aPos+1+2*ii)
1.1101 + INFO_PRINTF3(_L("iGroups[aPos+ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos+1+2*ii, retVal);
1.1102 + }
1.1103 + for (ii=aPos+ENumChained-1;ii<ENumGroups;++ii)
1.1104 + {
1.1105 + retVal = iGroups[ii]->OrdinalPosition();
1.1106 + TEST(retVal==ii+ENumChained);
1.1107 + if (retVal!=ii+ENumChained)
1.1108 + INFO_PRINTF3(_L("iGroups[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), ii+ENumChained, retVal);
1.1109 + }
1.1110 + }
1.1111 +
1.1112 +void CTGwHandle::WindowGroupChaining()
1.1113 + {
1.1114 + RWsSession& ws=TheClient->iWs;
1.1115 + CreateGroupWindowsLC(ws);
1.1116 + CreateChainedGroupWindowsLC(ws);
1.1117 + TestGroups(0);
1.1118 + TInt start,target,moveGp;
1.1119 + for(moveGp=0;moveGp<ENumChained;++moveGp)
1.1120 + {
1.1121 + for(target=0;target<ENumGroups+1;++target)
1.1122 + {
1.1123 + for(start=0;start<ENumGroups-ENumChained+2;++start)
1.1124 + {
1.1125 + if (target>start+1)
1.1126 + MoveGroups(iGroups,target-1,target-start-1,ENumChained+target-1,-1);
1.1127 + if (target<start && start>0)
1.1128 + MoveGroups(iGroups,0,start,0,1);
1.1129 + MoveGroups(iGroups,start,ENumChained-1,start+1);
1.1130 + TestGroupsBefore(start);
1.1131 + iChained[moveGp]->SetOrdinalPosition(target+moveGp);
1.1132 + TestGroups(target);
1.1133 + }
1.1134 + }
1.1135 + iChained[0]->SetOrdinalPosition(0);
1.1136 + TestGroups(0);
1.1137 + }
1.1138 + CleanupStack::PopAndDestroy(ENumGroups+ENumChained,iGroups[ENumGroups-1]);
1.1139 + }
1.1140 +
1.1141 +void CTGwHandle::WindowGroupChaining2()
1.1142 + {
1.1143 + RWsSession& ws=TheClient->iWs;
1.1144 + RWindowGroup* chain1=CreateWindowGroupLC(ws,1);
1.1145 + chain1->SetOrdinalPosition(0,1);
1.1146 + RWindowGroup* chain2=CreateWindowGroupLC(ws,2,chain1->Identifier());
1.1147 + TInt retVal = chain2->OrdinalPriority();
1.1148 + TEST(retVal==1);
1.1149 + if (retVal!=1)
1.1150 + INFO_PRINTF3(_L("chain2->OrdinalPriority() return value - Expected: %d, Actual: %d"), 1, retVal);
1.1151 +
1.1152 + chain1->SetOrdinalPosition(0,2);
1.1153 + retVal = chain2->OrdinalPriority();
1.1154 + TEST(retVal==2);
1.1155 + if (retVal!=2)
1.1156 + INFO_PRINTF3(_L("chain2->OrdinalPriority() return value - Expected: %d, Actual: %d"), 2, retVal);
1.1157 +
1.1158 + chain2->SetOrdinalPosition(0,3);
1.1159 + retVal = chain1->OrdinalPriority();
1.1160 + TEST(retVal==3);
1.1161 + if (retVal!=3)
1.1162 + INFO_PRINTF3(_L("chain1->OrdinalPriority() return value - Expected: %d, Actual: %d"), 3, retVal);
1.1163 +
1.1164 + CleanupStack::PopAndDestroy(2,chain1);
1.1165 +
1.1166 + //Test that two different sessions can't chain window-groups without permisson.
1.1167 + //Both sessions must use the same screen.
1.1168 + RWsSession ws2;
1.1169 + User::LeaveIfError(ws2.Connect());
1.1170 + CleanupClosePushL(ws2);
1.1171 + chain1=CreateWindowGroupLC(ws2,1);
1.1172 + TInt id1=chain1->Identifier();
1.1173 +
1.1174 + RWsSession ws3;
1.1175 + User::LeaveIfError(ws3.Connect());
1.1176 + CleanupClosePushL(ws3);
1.1177 + RWindowGroup chain(ws3);
1.1178 +
1.1179 + RDebug::Print(KPlatsecBegin);
1.1180 + retVal = chain.ConstructChildApp(id1,2);
1.1181 + TEST(retVal==KErrPermissionDenied);
1.1182 + if (retVal!=KErrPermissionDenied)
1.1183 + INFO_PRINTF3(_L("chain.ConstructChildApp(id1,2) return value - Expected: %d, Actual: %d"), KErrPermissionDenied, retVal);
1.1184 +
1.1185 + RDebug::Print(KPlatsecEnd);
1.1186 + chain1->AllowProcessToCreateChildWindowGroups(TUid::Uid(0x10205152)); //Secure ID
1.1187 + retVal = chain.ConstructChildApp(id1,2);
1.1188 + TEST(retVal==KErrNone);
1.1189 + if (retVal!=KErrNone)
1.1190 + INFO_PRINTF3(_L("chain.ConstructChildApp(id1,2) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
1.1191 +
1.1192 + chain.Close();
1.1193 + CleanupStack::PopAndDestroy(3,&ws2);
1.1194 + }
1.1195 +
1.1196 +void CTGwHandle::UnchainWindowGroupsL()
1.1197 + {
1.1198 + RArray<RWsSession::TWindowGroupChainInfo>* windowHandles=new(ELeave) RArray<RWsSession::TWindowGroupChainInfo>;
1.1199 + CleanupStack::PushL(windowHandles);
1.1200 + CleanupClosePushL(*windowHandles);
1.1201 + GetGwListL(0,windowHandles);
1.1202 + TInt shellWindow=windowHandles->Count();
1.1203 + //Creating chained window groups.
1.1204 + CreateChainedGroupWindowsLC(TheClient->iWs);
1.1205 + GetGwListL(0,windowHandles);
1.1206 + //Test total window groups in the list
1.1207 + TInt retVal = windowHandles->Count();
1.1208 + TEST(retVal==ENumChained+shellWindow);
1.1209 + if (retVal!=ENumChained+shellWindow)
1.1210 + INFO_PRINTF3(_L("windowHandles->Count() return value - Expected: %d, Actual: %d"), ENumChained+shellWindow, retVal);
1.1211 + //Two unchained group windows
1.1212 +
1.1213 + //Test Parent Id
1.1214 + TInt parentId=0;
1.1215 + for(TInt ii=ENumChained-1;ii>=0;ii--)
1.1216 + {
1.1217 + RWsSession::TWindowGroupChainInfo window;
1.1218 + window.iId=iChained[ii]->Identifier();
1.1219 + TInt loc=windowHandles->Find(window);
1.1220 + TEST(loc!=KErrNotFound);
1.1221 + if (loc==KErrNotFound)
1.1222 + INFO_PRINTF3(_L("windowHandles->Find(window) return value - Expected: %d, Actual: %d"), KErrNotFound, loc);
1.1223 +
1.1224 + if(loc!=KErrNotFound)
1.1225 + {
1.1226 + TEST((*windowHandles)[loc].iParentId==parentId);
1.1227 + if ((*windowHandles)[loc].iParentId!=parentId)
1.1228 + INFO_PRINTF3(_L("(*windowHandles)[loc].iParentId==parentId - Expected: %d, Actual: %d"), parentId, (*windowHandles)[loc].iParentId);
1.1229 +
1.1230 + parentId=window.iId;
1.1231 + }
1.1232 + }
1.1233 + //Test unchaining of chained window groups
1.1234 + for(TInt count=ENumChained-1;count>=0;count--)
1.1235 + {
1.1236 + iChained[count]->Close();
1.1237 + GetGwListL(0,windowHandles);
1.1238 + TEST(windowHandles->Count()== count+shellWindow);
1.1239 + if (windowHandles->Count()!= count+shellWindow)
1.1240 + INFO_PRINTF3(_L("windowHandles->Count()==count+shellWindow - Expected: %d, Actual: %d"), count+shellWindow, windowHandles->Count());
1.1241 +
1.1242 + }
1.1243 + CleanupStack::PopAndDestroy(ENumChained,iChained[ENumChained-1]);
1.1244 +
1.1245 + //delete middle windowgroup of chain which should kill all the child windows
1.1246 + CreateChainedGroupWindowsLC(TheClient->iWs);
1.1247 + TInt windowPos=2;
1.1248 + CleanupStack::Pop(2,iChained[1]); //Pop first 2 items iChained[0] and iChained[1]
1.1249 + iChained[windowPos]->Close();//Close the 3rd WindowGroup in the chain.should unchain 4 and 5 window group.
1.1250 + CleanupStack::PopAndDestroy(iChained[windowPos]);
1.1251 + CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[1]));
1.1252 + CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[0]));
1.1253 + GetGwListL(0,windowHandles);
1.1254 + retVal = ChainedWindowCount(windowHandles);
1.1255 + TEST(retVal==ENumChained-windowPos-1);
1.1256 + if (retVal!=ENumChained-windowPos-1)
1.1257 + INFO_PRINTF3(_L("ChainedWindowCount(windowHandles) return value - Expected: %d, Actual: %d"), ENumChained-windowPos-1, retVal);
1.1258 +
1.1259 +// CleanupStack::PopAndDestroy(ENumChained-1,iChained[ENumChained-1]);
1.1260 +
1.1261 + windowPos=3;
1.1262 + CleanupStack::Pop(2,iChained[1]);
1.1263 + iChained[windowPos]->Close();//Close the 2nd WindowGroup in the chain.
1.1264 + //should unchain all .
1.1265 + CleanupStack::PopAndDestroy(iChained[windowPos]);
1.1266 + CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[1]));
1.1267 + CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[0]));
1.1268 + GetGwListL(0,windowHandles);
1.1269 + retVal = ChainedWindowCount(windowHandles);
1.1270 + TEST(retVal==ENumChained-windowPos-2);
1.1271 + if (retVal!=ENumChained-windowPos-2)
1.1272 + INFO_PRINTF3(_L("ChainedWindowCount(windowHandles) return value - Expected: %d, Actual: %d"), ENumChained-windowPos-2, retVal);
1.1273 +
1.1274 + windowPos=4;
1.1275 + CleanupStack::Pop(2,iChained[1]);
1.1276 + iChained[windowPos]->Close();//Closing parent window group in chain. There should be no chain
1.1277 + CleanupStack::PopAndDestroy(iChained[windowPos]);
1.1278 + CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[1]));
1.1279 + CleanupStack::PushL(TCleanupItem(&GwHandleDestroyWindow,iChained[0]));
1.1280 + GetGwListL(0,windowHandles);
1.1281 + retVal = ChainedWindowCount(windowHandles);
1.1282 + TEST(retVal==ENumChained-windowPos-1);
1.1283 + if (retVal!=ENumChained-windowPos-1)
1.1284 + INFO_PRINTF3(_L("ChainedWindowCount(windowHandles) return value - Expected: %d, Actual: %d"), ENumChained-windowPos-1, retVal);
1.1285 +
1.1286 + CleanupStack::PopAndDestroy(ENumChained-3,iChained[ENumChained-4]);
1.1287 + windowHandles->Close();
1.1288 + CleanupStack::PopAndDestroy(windowHandles); // causes windowsHandles->Close() called
1.1289 + CleanupStack::PopAndDestroy(windowHandles); // causes delete windowsHandles called
1.1290 + }
1.1291 +
1.1292 +TInt CTGwHandle::ChainedWindowCount(RArray<RWsSession::TWindowGroupChainInfo>* aWindowHandles)
1.1293 + {
1.1294 + TInt wndGrpCount=0;
1.1295 + for(TInt ii=0;ii<aWindowHandles->Count();ii++)
1.1296 + {
1.1297 + if((*aWindowHandles)[ii].iParentId!=-1)
1.1298 + wndGrpCount++;
1.1299 + }
1.1300 + return wndGrpCount;
1.1301 + }
1.1302 +
1.1303 +void CTGwHandle::TestOrdinalPositionL()
1.1304 + {
1.1305 + TInt noOfGroupWnds = NumberOfWndGroupsWithZeroPriority(iTest->iScreenNumber);
1.1306 + //Creating the chained window groups
1.1307 + CreateChainedGroupWindowsLC(TheClient->iWs);
1.1308 + TestOrdinalPos(0);
1.1309 + //Test the ordinal position of all chained windows by setting the WndPos window
1.1310 + //to chainPos position
1.1311 + for(TInt wndPos=0;wndPos<ENumChained;wndPos++)
1.1312 + {
1.1313 + for(TInt chainPos=0;chainPos<15;chainPos++)
1.1314 + {
1.1315 + iChained[wndPos]->SetOrdinalPosition(chainPos);
1.1316 + TInt dung = chainPos-wndPos;
1.1317 + if(dung > noOfGroupWnds)
1.1318 + {
1.1319 + dung = noOfGroupWnds;
1.1320 + }
1.1321 + dung = Max(dung, 0);
1.1322 + TestOrdinalPos(chainPos - wndPos > noOfGroupWnds ? noOfGroupWnds : Max(chainPos - wndPos, 0));
1.1323 + }
1.1324 + }
1.1325 + //Test for negative ordinal number
1.1326 + iChained[0]->SetOrdinalPosition(-2);
1.1327 + TestOrdinalPos(noOfGroupWnds);
1.1328 + CleanupStack::PopAndDestroy(ENumChained,iChained[ENumChained-1]);
1.1329 + }
1.1330 +
1.1331 +void CTGwHandle::TestOrdinalPositionNoDebugL()
1.1332 + {
1.1333 + TInt noOfGroupWnds = NumberOfWndGroupsWithZeroPriority(iTest->iScreenNumber);
1.1334 + //Creating the chained window groups
1.1335 + CreateChainedGroupWindowsLC(TheClient->iWs);
1.1336 + //Test the ordinal position of all chained windows
1.1337 + TestOrdinalPosNoDebug(0);
1.1338 + //Test the ordinal position of all chained windows by setting the WndPos window
1.1339 + //to chainPos position
1.1340 + for(TInt wndPos=0;wndPos<ENumChained;wndPos++)
1.1341 + {
1.1342 + for(TInt chainPos=0;chainPos<15;chainPos++)
1.1343 + {
1.1344 + iChained[wndPos]->SetOrdinalPosition(chainPos);
1.1345 + TestOrdinalPosNoDebug(chainPos - wndPos > noOfGroupWnds ? noOfGroupWnds : Max(chainPos - wndPos, 0));
1.1346 + }
1.1347 + }
1.1348 + //Test for negative ordinal number
1.1349 + iChained[0]->SetOrdinalPosition(-2);
1.1350 + TestOrdinalPosNoDebug(noOfGroupWnds);
1.1351 + CleanupStack::PopAndDestroy(ENumChained,iChained[ENumChained-1]);
1.1352 + }
1.1353 +
1.1354 +void CTGwHandle::TestOrdinalPos(TInt aPos)
1.1355 + {
1.1356 + for(TInt ii=0;ii<ENumChained;ii++)
1.1357 + {
1.1358 + TInt iCha = iChained[ii]->OrdinalPosition();
1.1359 + TEST(iCha==aPos++);
1.1360 + if (iCha!=aPos-1)
1.1361 + {
1.1362 + INFO_PRINTF3(_L("iChained[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos-1, iCha);
1.1363 + }
1.1364 + }
1.1365 + }
1.1366 +
1.1367 +void CTGwHandle::TestOrdinalPosNoDebug(TInt aPos)
1.1368 + {
1.1369 + for(TInt ii=0;ii<ENumChained;ii++)
1.1370 + {
1.1371 + TInt iCha = iChained[ii]->OrdinalPosition();
1.1372 + TEST(iCha==aPos++);
1.1373 + if (iCha!=aPos-1)
1.1374 + INFO_PRINTF3(_L("iChained[ii]->OrdinalPosition() return value - Expected: %d, Actual: %d"), aPos-1, iCha);
1.1375 +
1.1376 + }
1.1377 + }
1.1378 +
1.1379 +void CTGwHandle:: TestclosingclientL()
1.1380 + {
1.1381 + RWsSession ws1;
1.1382 + User::LeaveIfError(ws1.Connect());
1.1383 + CleanupClosePushL(ws1);
1.1384 +
1.1385 + // assign to the correct screen
1.1386 + CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws1);
1.1387 + CleanupStack::PushL(screen);
1.1388 + User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
1.1389 +
1.1390 + // Creating first Window Group
1.1391 + RWindowGroup gw1(ws1);
1.1392 + User::LeaveIfError(gw1.Construct(ENullWsHandle));
1.1393 + ws1.SetWindowGroupOrdinalPosition(gw1.Identifier(),0);
1.1394 +
1.1395 + // Creating second Window Group
1.1396 + RWindowGroup gw2(ws1);
1.1397 + User::LeaveIfError(gw2.Construct(ENullWsHandle));
1.1398 + gw2.SetOwningWindowGroup(gw1.Identifier());
1.1399 + gw2.SetOrdinalPosition(1);
1.1400 + CleanupStack::PopAndDestroy(screen);
1.1401 + CleanupStack::PopAndDestroy(&ws1);
1.1402 + }
1.1403 +
1.1404 +void CTGwHandle::TestClearingAndSettingChildGroupsL()
1.1405 + {
1.1406 + RArray<RWsSession::TWindowGroupChainInfo> windowHandles;
1.1407 + CleanupClosePushL(windowHandles);
1.1408 + //Creating a chain of 5 window groups.
1.1409 + CreateChainedGroupWindowsLC(TheClient->iWs);
1.1410 + TInt ret=KErrNone;
1.1411 + // Want to test clearing and setting of window groups for chain lengths of 5 down to 2
1.1412 + for(TInt jj=ENumChained-1;jj>0;jj--)
1.1413 + {
1.1414 + // For each window group in the chain, test clearing and setting a child group
1.1415 + for(TInt ii=jj;ii>0;ii--)
1.1416 + {
1.1417 + RWsSession::TWindowGroupChainInfo window1;
1.1418 + window1.iId=iChained[ii]->Identifier();
1.1419 + GetGwListL(0,&windowHandles);
1.1420 + TInt loc=windowHandles.Find(window1);
1.1421 + TEST(loc!=KErrNotFound);
1.1422 + if(loc!=KErrNotFound)
1.1423 + {
1.1424 + RWsSession::TWindowGroupChainInfo window2;
1.1425 + window2.iId=iChained[ii-1]->Identifier();
1.1426 + loc = windowHandles.Find(window2);
1.1427 + TEST(loc!=KErrNotFound);
1.1428 + // First test that the parent of the next window in the chain is the previous in the chain
1.1429 + if(loc!=KErrNotFound)
1.1430 + {
1.1431 + TEST(windowHandles[loc].iParentId==window1.iId);
1.1432 + }
1.1433 + // Then clear and test that the parent of the next window in the chain
1.1434 + // is no longer the previous window in the chain
1.1435 + ret=iChained[ii]->ClearChildGroup();
1.1436 + TEST(ret==KErrNone);
1.1437 + // Try to clear a child group when it's already cleared - should return KErrArgument
1.1438 + ret=iChained[ii]->ClearChildGroup();
1.1439 + TEST(ret==KErrArgument);
1.1440 + GetGwListL(0,&windowHandles);
1.1441 + loc = windowHandles.Find(window2);
1.1442 + TEST(loc!=KErrNotFound);
1.1443 + // Test that it has no parent (0) or is unchained (-1)
1.1444 + if(loc!=KErrNotFound)
1.1445 + {
1.1446 + if(ii==1) // last in chain therefore unchained, should return -1
1.1447 + TEST(windowHandles[loc].iParentId==-1);
1.1448 + else // otherwise should return 0 signifying in a chain but with no parent
1.1449 + TEST(windowHandles[loc].iParentId==0);
1.1450 + }
1.1451 + // Reset the former child group as a child to the current group
1.1452 + ret=iChained[ii]->SetChildGroup(window2.iId);
1.1453 + TEST(ret==KErrNone);
1.1454 + // Test that it has now got it's parent back
1.1455 + GetGwListL(0,&windowHandles);
1.1456 + loc = windowHandles.Find(window2);
1.1457 + TEST(loc!=KErrNotFound);
1.1458 + if(loc!=KErrNotFound)
1.1459 + {
1.1460 + TEST(windowHandles[loc].iParentId==window1.iId);
1.1461 + }
1.1462 + }
1.1463 + }
1.1464 + // Reduce chain length by 1
1.1465 + ret=iChained[jj]->ClearChildGroup();
1.1466 + TEST(ret==KErrNone);
1.1467 + }
1.1468 + // Try to clear the child group of a window that's not in a queue - returns KErrArgument
1.1469 + ret=iChained[0]->ClearChildGroup();
1.1470 + TEST(ret==KErrArgument);
1.1471 + // Test calling set on a non-existent window group - fictional id, larger than what exists
1.1472 + ret=iChained[0]->SetChildGroup(9999);
1.1473 + TEST(ret==KErrArgument);
1.1474 + // Cleanup
1.1475 + CleanupStack::PopAndDestroy(ENumChained,iChained[ENumChained-1]);
1.1476 + CleanupStack::PopAndDestroy(&windowHandles);
1.1477 + }
1.1478 +
1.1479 +void CTGwHandle::TestAgainstLoopsWhenAddingChildGroupsL()
1.1480 + {
1.1481 + //Creating two chains of 5 window groups.
1.1482 + CreateChainedGroupWindowsLC(TheClient->iWs,ETrue);
1.1483 + TInt ret=KErrNone;
1.1484 +
1.1485 + //Try to append any of element of this chain to the lastone (itself included)
1.1486 + //All these attempts should fail (otherwise a infinite loop will be set up)
1.1487 + for(TInt ii=ENumChained-1;ii>=0;ii--)
1.1488 + {
1.1489 + TInt windowId = iChained[ii]->Identifier();
1.1490 + // Try to append it to the last one
1.1491 + ret=iChained[0]->SetChildGroup(windowId);
1.1492 + TEST(ret==KErrArgument);
1.1493 + if(ret!=KErrArgument)
1.1494 + {
1.1495 + _LIT(KLog,"Error: SetChildGroup with a GpWin belonging to the same queue succeeded, return value :%d");
1.1496 + LOG_MESSAGE2(KLog,ret);
1.1497 + }
1.1498 + }
1.1499 + //Try to append any elements belonging to another chain to the last one of this chain
1.1500 + //All these trials should fail (otherwise a infinite loop will be set up)
1.1501 + //Except for the parent of the second chain.
1.1502 + for(TInt ii=0;ii<ENumChained;ii++)
1.1503 + {
1.1504 + TInt windowId = iChained2[ii]->Identifier();
1.1505 + // Try to append it to the last one
1.1506 + ret=iChained[0]->SetChildGroup(windowId);
1.1507 + if(ii != ENumChained-1)
1.1508 + {
1.1509 + TEST(ret==KErrArgument);
1.1510 + if(ret!=KErrArgument)
1.1511 + {
1.1512 + _LIT(KLog,"Error: SetChildGroup with a GpWin which already has a parent succeeded, return value :%d");
1.1513 + LOG_MESSAGE2(KLog,ret);
1.1514 + }
1.1515 + iChained[0]->ClearChildGroup();
1.1516 + }
1.1517 + else
1.1518 + {
1.1519 + TEST(ret==KErrNone);
1.1520 + if(ret!=KErrNone)
1.1521 + {
1.1522 + _LIT(KLog,"Error: SetChildGroup with a GpWin with no parent failed, return value :%d");
1.1523 + LOG_MESSAGE2(KLog,ret);
1.1524 + }
1.1525 + }
1.1526 + }
1.1527 + TInt windowId = iChained2[ENumChained-1]->Identifier();
1.1528 + ret=iChained[ENumChained-1]->SetChildGroup(windowId);
1.1529 + TEST(ret==KErrArgument);
1.1530 + if(ret!=KErrArgument)
1.1531 + {
1.1532 + _LIT(KLog,"Error: SetChildGroup successful on a GpWin which already has a child, return value :%d");
1.1533 + LOG_MESSAGE2(KLog,ret);
1.1534 + }
1.1535 + //Now take a window group not belonging to any queue
1.1536 + //just take the parent's chain and pop it
1.1537 + //and try to append it to itself
1.1538 + ret=iChained[ENumChained-1]->ClearChildGroup();
1.1539 + TEST(ret==KErrNone);
1.1540 + ret=iChained[ENumChained-1]->SetChildGroup(iChained[ENumChained-1]->Identifier());
1.1541 + TEST(ret==KErrArgument);
1.1542 + if(ret!=KErrArgument)
1.1543 + {
1.1544 + _LIT(KLog,"Error: Setting GpWin as a child of itself succeeded, return value :%d");
1.1545 + LOG_MESSAGE2(KLog,ret);
1.1546 + }
1.1547 + CleanupStack::PopAndDestroy(ENumChained+ENumChained,iChained[ENumChained-1]);
1.1548 + }
1.1549 +void CTGwHandle::RunTestCaseL(TInt /*aCurTestCase*/)
1.1550 + {
1.1551 + _LIT(KTest0,"Window group names");
1.1552 + _LIT(KTest1,"Window group identifiers");
1.1553 + _LIT(KTest2,"Owner to foreground");
1.1554 + _LIT(KTest3,"FindWindowGroupIdentifier test");
1.1555 + _LIT(KTest4,"IdentifierWrapAround test");
1.1556 + _LIT(KTest5,"DefaultOwningWindow test");
1.1557 + _LIT(KTest6,"DefaultOwningWindow2 test");
1.1558 + _LIT(KTest7,"Window Group Chaining");
1.1559 + _LIT(KTest8,"Window Group Chaining2");
1.1560 + _LIT(KTest9,"Unchaining window group");
1.1561 + _LIT(KTest10,"Ordinal Postion Test");
1.1562 + _LIT(KTest11,"CrashTest on closing client");
1.1563 + _LIT(KTest12,"Setting and Clearing Child Groups");
1.1564 + _LIT(KTest13,"No Infinite Loops in Setting Child Groups");
1.1565 + ((CTGwHandleStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.1566 + switch(++iTest->iState)
1.1567 + {
1.1568 +/**
1.1569 +
1.1570 + @SYMTestCaseID GRAPHICS-WSERV-0316
1.1571 +
1.1572 + @SYMDEF DEF081259
1.1573 +
1.1574 + @SYMTestCaseDesc Test setting window group names
1.1575 +
1.1576 + @SYMTestPriority High
1.1577 +
1.1578 + @SYMTestStatus Implemented
1.1579 +
1.1580 + @SYMTestActions Set the name of a window group to different values and check the
1.1581 + value is set correctly
1.1582 +
1.1583 + @SYMTestExpectedResults The window group name is set correctly
1.1584 +
1.1585 +*/
1.1586 + case 1:
1.1587 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0316"));
1.1588 + //iState=9; break;
1.1589 + iTest->LogSubTest(KTest0);
1.1590 + GwNamesL();
1.1591 + break;
1.1592 +/**
1.1593 +
1.1594 + @SYMTestCaseID GRAPHICS-WSERV-0317
1.1595 +
1.1596 + @SYMDEF DEF081259
1.1597 +
1.1598 + @SYMTestCaseDesc Test setting window group identifiers
1.1599 +
1.1600 + @SYMTestPriority High
1.1601 +
1.1602 + @SYMTestStatus Implemented
1.1603 +
1.1604 + @SYMTestActions Set the identifiers of a window groups. manipulate the window groups and
1.1605 + check the identifiers remain correct
1.1606 +
1.1607 + @SYMTestExpectedResults The identifiers are correct for each window group after
1.1608 + manipulation
1.1609 +
1.1610 +*/
1.1611 + case 2:
1.1612 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0317"));
1.1613 + iTest->LogSubTest(KTest1);
1.1614 + GwIdentifierTestL();
1.1615 + break;
1.1616 +/**
1.1617 +
1.1618 + @SYMTestCaseID GRAPHICS-WSERV-0318
1.1619 +
1.1620 + @SYMDEF DEF081259
1.1621 +
1.1622 + @SYMTestCaseDesc Test moving different window groups to the foreground and bringing
1.1623 + back the backgorund
1.1624 +
1.1625 + @SYMTestPriority High
1.1626 +
1.1627 + @SYMTestStatus Implemented
1.1628 +
1.1629 + @SYMTestActions Create some window groups and move them in turn to the foreground before
1.1630 + restoring the background
1.1631 +
1.1632 + @SYMTestExpectedResults Window groups move to and from the foreground with error
1.1633 +
1.1634 +*/
1.1635 + case 3:
1.1636 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0318"));
1.1637 + iTest->LogSubTest(KTest2);
1.1638 + OwnerToForegroundL();
1.1639 + break;
1.1640 +/**
1.1641 +
1.1642 + @SYMTestCaseID GRAPHICS-WSERV-0319
1.1643 +
1.1644 + @SYMDEF DEF081259
1.1645 +
1.1646 + @SYMTestCaseDesc Test returning different window groups identifiers by searching
1.1647 + on the name
1.1648 +
1.1649 + @SYMTestPriority High
1.1650 +
1.1651 + @SYMTestStatus Implemented
1.1652 +
1.1653 + @SYMTestActions Create some window groups and return their identifiers by searching on
1.1654 + their names
1.1655 +
1.1656 + @SYMTestExpectedResults The correct identifiers are returned for each name
1.1657 +
1.1658 +*/
1.1659 + case 4:
1.1660 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0319"));
1.1661 + iTest->LogSubTest(KTest3);
1.1662 + FindWindowGroupIdentifierTestL();
1.1663 + break;
1.1664 +/**
1.1665 +
1.1666 + @SYMTestCaseID GRAPHICS-WSERV-0320
1.1667 +
1.1668 + @SYMDEF DEF081259
1.1669 +
1.1670 + @SYMTestCaseDesc Test that a windows group identifier is not used twice
1.1671 +
1.1672 + @SYMTestPriority High
1.1673 +
1.1674 + @SYMTestStatus Implemented
1.1675 +
1.1676 + @SYMTestActions Assign a window group identifier to one window group and check
1.1677 + the same identifier can not be used for a second group
1.1678 +
1.1679 + @SYMTestExpectedResults Window group identifier can not be reused
1.1680 +
1.1681 +*/
1.1682 + case 5:
1.1683 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0320"));
1.1684 + iTest->LogSubTest(KTest4);
1.1685 + IdentifierWrapAroundTestL();
1.1686 + break;
1.1687 +/**
1.1688 +
1.1689 + @SYMTestCaseID GRAPHICS-WSERV-0321
1.1690 +
1.1691 + @SYMDEF DEF081259
1.1692 +
1.1693 + @SYMTestCaseDesc Test that the default owning window for window groups is set
1.1694 + correctly
1.1695 +
1.1696 + @SYMTestPriority High
1.1697 +
1.1698 + @SYMTestStatus Implemented
1.1699 +
1.1700 + @SYMTestActions Set different default owning windows for different window groups.
1.1701 + Check the windows have been set correctly.
1.1702 +
1.1703 + @SYMTestExpectedResults The default owning windows for the groups are set correctly
1.1704 +
1.1705 +*/
1.1706 + case 6:
1.1707 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0321"));
1.1708 + iTest->LogSubTest(KTest5);
1.1709 + DefaultOwningWindowL();
1.1710 + break;
1.1711 +/**
1.1712 +
1.1713 + @SYMTestCaseID GRAPHICS-WSERV-0322
1.1714 +
1.1715 + @SYMDEF DEF081259
1.1716 +
1.1717 + @SYMTestCaseDesc Test that the default owning window for window groups is set
1.1718 + correctly
1.1719 +
1.1720 + @SYMTestPriority High
1.1721 +
1.1722 + @SYMTestStatus Implemented
1.1723 +
1.1724 + @SYMTestActions Set different default owning windows for different window groups.
1.1725 + Check the windows have been set correctly.
1.1726 +
1.1727 + @SYMTestExpectedResults The default owning windows for the groups are set correctly
1.1728 +
1.1729 +*/
1.1730 + case 7:
1.1731 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0322"));
1.1732 + iTest->LogSubTest(KTest6);
1.1733 + DefaultOwningWindow2L();
1.1734 + TheClient->iGroup->WinTreeNode()->SetOrdinalPosition(0);
1.1735 + break;
1.1736 +/**
1.1737 +
1.1738 + @SYMTestCaseID GRAPHICS-WSERV-0323
1.1739 +
1.1740 + @SYMDEF DEF081259
1.1741 +
1.1742 + @SYMTestCaseDesc Test that window groups can be chained correctly
1.1743 +
1.1744 + @SYMTestPriority High
1.1745 +
1.1746 + @SYMTestStatus Implemented
1.1747 +
1.1748 + @SYMTestActions Create a chain of window groups and check that the chain of groups
1.1749 + can be manipluated correctly
1.1750 +
1.1751 + @SYMTestExpectedResults The chain can be manipulated correctly
1.1752 +
1.1753 +*/
1.1754 + case 8:
1.1755 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0323"));
1.1756 + iTest->LogSubTest(KTest7);
1.1757 + WindowGroupChaining();
1.1758 + break;
1.1759 +/**
1.1760 +
1.1761 + @SYMTestCaseID GRAPHICS-WSERV-0324
1.1762 +
1.1763 + @SYMDEF DEF081259
1.1764 +
1.1765 + @SYMTestCaseDesc Test that window groups can be chained correctly
1.1766 +
1.1767 + @SYMTestPriority High
1.1768 +
1.1769 + @SYMTestStatus Implemented
1.1770 +
1.1771 + @SYMTestActions Create a chain of window groups and check that the chain of groups
1.1772 + can be manipluated correctly
1.1773 +
1.1774 + @SYMTestExpectedResults The chain can be manipulated correctly
1.1775 +
1.1776 +*/
1.1777 + case 9:
1.1778 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0324"));
1.1779 + iTest->LogSubTest(KTest8);
1.1780 + WindowGroupChaining2();
1.1781 + break;
1.1782 +/**
1.1783 +
1.1784 + @SYMTestCaseID GRAPHICS-WSERV-0325
1.1785 +
1.1786 + @SYMDEF DEF081259
1.1787 +
1.1788 + @SYMTestCaseDesc Test that window groups can be unchained correctly
1.1789 +
1.1790 + @SYMTestPriority High
1.1791 +
1.1792 + @SYMTestStatus Implemented
1.1793 +
1.1794 + @SYMTestActions Create chains of window groups and check that the window groups can be
1.1795 + unchained correctly
1.1796 +
1.1797 + @SYMTestExpectedResults The chain can be unchained correctly
1.1798 +
1.1799 +*/
1.1800 + case 10:
1.1801 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0325"));
1.1802 + iTest->LogSubTest(KTest9);
1.1803 + UnchainWindowGroupsL();
1.1804 + break;
1.1805 +/**
1.1806 +
1.1807 + @SYMTestCaseID GRAPHICS-WSERV-0326
1.1808 +
1.1809 + @SYMDEF DEF081259
1.1810 +
1.1811 + @SYMTestCaseDesc Test the ordinal position of chained window groups
1.1812 +
1.1813 + @SYMTestPriority High
1.1814 +
1.1815 + @SYMTestStatus Implemented
1.1816 +
1.1817 + @SYMTestActions Create chains of window groups and check their ordinal position is correct
1.1818 + for different scenarios
1.1819 +
1.1820 + @SYMTestExpectedResults Ordinal position of chained window group is correct
1.1821 +
1.1822 +*/
1.1823 + case 11:
1.1824 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0326"));
1.1825 + iTest->LogSubTest(KTest10);
1.1826 + TestOrdinalPositionL();
1.1827 + break;
1.1828 + case 12:
1.1829 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0326"));
1.1830 + iTest->LogSubTest(KTest10);
1.1831 + TestOrdinalPositionNoDebugL();
1.1832 + break;
1.1833 +/**
1.1834 +
1.1835 + @SYMTestCaseID GRAPHICS-WSERV-0327
1.1836 +
1.1837 + @SYMDEF DEF081259
1.1838 +
1.1839 + @SYMTestCaseDesc Test that window groups are dealt with correctly if their client is closed
1.1840 +
1.1841 + @SYMTestPriority High
1.1842 +
1.1843 + @SYMTestStatus Implemented
1.1844 +
1.1845 + @SYMTestActions Create window groups and then close there client.
1.1846 +
1.1847 + @SYMTestExpectedResults The window groups of the closed client are handled without error
1.1848 +
1.1849 +*/
1.1850 + case 13:
1.1851 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0327"));
1.1852 + iTest->LogSubTest(KTest11);
1.1853 + TestclosingclientL();
1.1854 + break;
1.1855 + case 14:
1.1856 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0327"));
1.1857 + iTest->LogSubTest(KTest12);
1.1858 + TestClearingAndSettingChildGroupsL();
1.1859 + break;
1.1860 + case 15:
1.1861 + ((CTGwHandleStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0327"));
1.1862 + iTest->LogSubTest(KTest13);
1.1863 + TestAgainstLoopsWhenAddingChildGroupsL();
1.1864 + break;
1.1865 + default:
1.1866 + ((CTGwHandleStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.1867 + ((CTGwHandleStep*)iStep)->CloseTMSGraphicsStep();
1.1868 + TestComplete();
1.1869 + break;
1.1870 + }
1.1871 + ((CTGwHandleStep*)iStep)->RecordTestResultL();
1.1872 + }
1.1873 +
1.1874 +__WS_CONSTRUCT_STEP__(GwHandle)