os/graphics/windowing/windowserver/test/tauto/TORDINAL.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TORDINAL.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,579 @@
     1.4 +// Copyright (c) 1996-2009 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 +// ORDINAL.CPP
    1.18 +// Test ordinal position and priority changes on windows
    1.19 +// 
    1.20 +//
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @test
    1.25 + @internalComponent - Internal Symbian test code
    1.26 +*/
    1.27 +
    1.28 +#include "TORDINAL.H"
    1.29 +
    1.30 +_LIT(KLogNextSibling,"NextSibling of iChild%d is not iChild%d");
    1.31 +_LIT(KLogNoNextSibling,"iChild%d has a NextSibling when it shouldn't");
    1.32 +_LIT(KLogPrevSibling,"PrevSibling of iChild%d is not iChild%d");
    1.33 +_LIT(KLogNoPrevSibling,"iChild%d has a PrevSibling when it shouldn't");
    1.34 +
    1.35 +CTOrdinal::CTOrdinal(CTestStep* aStep):
    1.36 +	CTWsGraphicsBase(aStep)
    1.37 +	{
    1.38 +	}
    1.39 +
    1.40 +COrdinalWindowBase::COrdinalWindowBase(CTClient *aClient, CTestBase* aTest, CTestStep* aTestStep) : iClient(aClient), iTest(aTest), iTestStep(aTestStep)
    1.41 +	{
    1.42 +	}
    1.43 +
    1.44 +COrdinalWindow::COrdinalWindow(CTClient *aClient, CTestBase* aTest, CTestStep* aTestStep) : COrdinalWindowBase(aClient, aTest, aTestStep), iClientWin(aClient->iWs)
    1.45 +	{
    1.46 +	__DECLARE_NAME(_S("COrdinalWindow"));
    1.47 +	}
    1.48 +
    1.49 +COrdinalWindowGroup::COrdinalWindowGroup(CTClient *aClient, CTestBase* aTest, CTestStep* aTestStep) : COrdinalWindowBase(aClient, aTest, aTestStep), iGroupWin(aClient->iWs)
    1.50 +	{
    1.51 +	__DECLARE_NAME(_S("COrdinalWindowGroup"));
    1.52 +	}
    1.53 +
    1.54 +COrdinalWindowBase::~COrdinalWindowBase()
    1.55 +	{
    1.56 +	if (iWin)
    1.57 +		iWin->Close();
    1.58 +	}
    1.59 +
    1.60 +void COrdinalWindowBase::Draw()
    1.61 +	{}
    1.62 +
    1.63 +inline RWindowTreeNode* COrdinalWindowBase::WinTreeNode()
    1.64 +	{
    1.65 +	return(iWin);
    1.66 +	}
    1.67 +
    1.68 +inline TUint32 COrdinalWindowBase::Handle()
    1.69 +	{
    1.70 +	return reinterpret_cast<TUint>(this);
    1.71 +	}
    1.72 +
    1.73 +COrdinalWindowBase *COrdinalWindowGroup::NewL(CTClient *aClient, CTestBase* aTest, CTestStep* aTestStep)
    1.74 +	{
    1.75 +	COrdinalWindowGroup *oWin=new(ELeave) COrdinalWindowGroup(aClient, aTest, aTestStep);
    1.76 +	TInt err=oWin->iGroupWin.Construct((TUint32)oWin);
    1.77 +	if (err<0)
    1.78 +		{
    1.79 +		delete oWin;
    1.80 +		User::Leave(err);
    1.81 +		}
    1.82 +	oWin->iWin= &oWin->iGroupWin;
    1.83 +	return(oWin);
    1.84 +	}
    1.85 +
    1.86 +COrdinalWindowBase *COrdinalWindow::NewL(CTClient* aClient, RWindowTreeNode* aParent, CTestBase* aTest, CTestStep* aTestStep)
    1.87 +	{
    1.88 +	COrdinalWindow *oWin=new(ELeave) COrdinalWindow(aClient, aTest, aTestStep);
    1.89 +	TInt err=oWin->iClientWin.Construct(*aParent,(TUint32)oWin);
    1.90 +	if (err!=KErrNone)
    1.91 +		{
    1.92 +		delete oWin;
    1.93 +		User::Leave(err);
    1.94 +		}
    1.95 +	oWin->iClientWin.Activate();
    1.96 +	oWin->iWin= &oWin->iClientWin;
    1.97 +	return(oWin);
    1.98 +	}
    1.99 +
   1.100 +TInt COrdinalWindowBase::OrdinalPosition()
   1.101 +	{
   1.102 +	return(iWin->OrdinalPosition());
   1.103 +	}
   1.104 +
   1.105 +void COrdinalWindowBase::SetOrdinalPosition(TInt aPos)
   1.106 +	{
   1.107 +	iWin->SetOrdinalPosition(aPos);
   1.108 +	}
   1.109 +
   1.110 +void COrdinalWindowBase::SetOrdinalPosition(TInt aPos,TInt aPri)
   1.111 +	{
   1.112 +	iWin->SetOrdinalPosition(aPos,aPri);
   1.113 +	}
   1.114 +
   1.115 +CTOrdinal::~CTOrdinal()
   1.116 +	{
   1.117 +	delete iClient;
   1.118 +	}
   1.119 +
   1.120 +void DZ(COrdinalWindowBase * &aX)
   1.121 +	{
   1.122 +	delete aX;
   1.123 +	aX=NULL;
   1.124 +	}
   1.125 +
   1.126 +void CTOrdinal::DestroyWindows()
   1.127 +	{
   1.128 +	DZ(iParent);
   1.129 +	DZ(iParent2);
   1.130 +	DZ(iParent3);
   1.131 +	for(TInt child=0;child<ENumChildren;++child)
   1.132 +		DZ(iChild[child]);
   1.133 +	}
   1.134 +
   1.135 +void COrdinalWindowBase::TestOP(TInt aTestPos)
   1.136 +	{
   1.137 +	iTestStep->TEST(iWin->OrdinalPosition()==aTestPos);
   1.138 +	}
   1.139 +
   1.140 +void COrdinalWindowBase::SetAndTestOP(TInt aPos,TInt aTestPos)
   1.141 +	{
   1.142 +	iWin->SetOrdinalPosition(aPos);
   1.143 +	iTestStep->TEST(iWin->OrdinalPosition()==aTestPos);
   1.144 +	}
   1.145 +
   1.146 +void COrdinalWindowBase::SetAndTestOP(TInt aPos)
   1.147 +	{
   1.148 +	SetAndTestOP(aPos, aPos);
   1.149 +	}
   1.150 +
   1.151 +TInt COrdinalWindowBase::SetToLastAndGetOP()
   1.152 +	{
   1.153 +	iWin->SetOrdinalPosition(-1);
   1.154 +	return(iWin->OrdinalPosition());
   1.155 +	}
   1.156 +
   1.157 +TInt COrdinalWindowBase::SetToLastAndGetOPPri(TInt aPri)
   1.158 +	{
   1.159 +	iWin->SetOrdinalPosition(-1, aPri);
   1.160 +	return(iWin->OrdinalPosition());
   1.161 +	}
   1.162 +
   1.163 +void COrdinalWindowBase::SetAndTestOPPri(TInt aPos,TInt aPri,TInt aTestPos)
   1.164 +	{
   1.165 +	iWin->SetOrdinalPosition(aPos,aPri);
   1.166 +	iTestStep->TEST(iWin->OrdinalPosition()==aTestPos);
   1.167 +	iTestStep->TEST(iWin->OrdinalPriority()==aPri);
   1.168 +	}
   1.169 +
   1.170 +void COrdinalWindowBase::SetAndTestOPPri(TInt aPos,TInt aPri)
   1.171 +	{
   1.172 +	SetAndTestOPPri(aPos,aPri,aPos);
   1.173 +	}
   1.174 +
   1.175 +inline COrdinalWindowBase* COrdinalWindowBase::NextSibling() const
   1.176 +	{
   1.177 +	return reinterpret_cast<COrdinalWindow*>(iWin->NextSibling());
   1.178 +	}
   1.179 +
   1.180 +inline COrdinalWindowBase* COrdinalWindowBase::PrevSibling() const
   1.181 +	{
   1.182 +	return reinterpret_cast<COrdinalWindow*>(iWin->PrevSibling());
   1.183 +	}
   1.184 +
   1.185 +void CTOrdinal::TestWindowOrderNext(TInt aBefore,TInt aAfter)
   1.186 +	{
   1.187 +	TInt retVal=(iChild[aBefore]->NextSibling()==iChild[aAfter]);
   1.188 +	TEST(retVal);
   1.189 +	if (!retVal)
   1.190 +		LOG_MESSAGE3(KLogNextSibling,aBefore,aAfter);
   1.191 +	}
   1.192 +
   1.193 +void CTOrdinal::TestWindowOrderNext(TInt aLast)
   1.194 +	{
   1.195 +	TInt retVal=(iChild[aLast]->NextSibling()==0);
   1.196 +	TEST(retVal);
   1.197 +	if (!retVal)
   1.198 +		LOG_MESSAGE2(KLogNoNextSibling,aLast);
   1.199 +	}
   1.200 +
   1.201 +void CTOrdinal::TestWindowOrderPrev(TInt aAfter,TInt aBefore)
   1.202 +	{
   1.203 +	TInt retVal=(iChild[aAfter]->PrevSibling()==iChild[aBefore]);
   1.204 +	TEST(retVal);
   1.205 +	if (!retVal)
   1.206 +		LOG_MESSAGE3(KLogPrevSibling,aAfter,aBefore);
   1.207 +	}
   1.208 +
   1.209 +void CTOrdinal::TestWindowOrderPrev(TInt aFirst)
   1.210 +	{
   1.211 +	TInt retVal=(iChild[aFirst]->PrevSibling()==0);
   1.212 +	TEST(retVal);
   1.213 +	if (!retVal)
   1.214 +		LOG_MESSAGE2(KLogNoPrevSibling,aFirst);
   1.215 +	}
   1.216 +	
   1.217 +void CTOrdinal::OrdinalPos()
   1.218 +	{
   1.219 +	TInt last=iChild[0]->SetToLastAndGetOP();
   1.220 +	iChild[0]->SetAndTestOP(0);
   1.221 +	iChild[5]->TestOP(5);
   1.222 +	iChild[1]->SetAndTestOP(3);
   1.223 +	iChild[0]->SetAndTestOP(0);
   1.224 +	iChild[0]->SetAndTestOP(-1,last);
   1.225 +	iChild[0]->SetAndTestOP(-1000,last);
   1.226 +	iChild[0]->SetAndTestOP(2);
   1.227 +	iChild[0]->SetAndTestOP(-1000,last);
   1.228 +	iChild[0]->SetAndTestOP(0);
   1.229 +	for(TInt index=0;index<=5;index++)
   1.230 +		iChild[4]->SetAndTestOP(index,index);
   1.231 +	iChild[0]->SetAndTestOP(-1,last);
   1.232 +	iChild[1]->SetAndTestOP(-1,last);
   1.233 +	iChild[2]->SetAndTestOP(-1,last);
   1.234 +	iChild[3]->SetAndTestOP(-1,last);
   1.235 +	iChild[4]->SetAndTestOP(-1,last);
   1.236 +	iChild[5]->SetAndTestOP(-1,last);
   1.237 +	TInt child;
   1.238 +	for (child=0;child<ENumChildren-1;++child)
   1.239 +		TestWindowOrderNext(child,child+1);
   1.240 +	TestWindowOrderNext(5);
   1.241 +	}
   1.242 +
   1.243 +void CTOrdinal::OrdinalPriority()
   1.244 +	{
   1.245 +	TBool retVal;
   1.246 +	TInt last12=iChild[2]->SetToLastAndGetOPPri(12);
   1.247 +	iChild[2]->TestOP(last12);
   1.248 +	TInt lastKMax=iChild[2]->SetToLastAndGetOPPri(KMaxTInt32);
   1.249 +	iChild[2]->TestOP(lastKMax);
   1.250 +	TInt last=iChild[2]->SetToLastAndGetOPPri(0);
   1.251 +	iChild[2]->TestOP(last);
   1.252 +	iChild[2]->SetAndTestOPPri(-1,12,last12);				// One and only pri 12 window
   1.253 +	iChild[3]->SetAndTestOPPri(-1,KMaxTInt32,lastKMax);	// One and only pri KMaxTInt32 window
   1.254 +	iChild[1]->SetAndTestOPPri(0,KMaxTInt32);
   1.255 +	iChild[5]->SetAndTestOP(-1,last-3);
   1.256 +	iChild[1]->TestOP(0);
   1.257 +	iChild[0]->SetAndTestOPPri(0,50);
   1.258 +	iChild[1]->SetAndTestOPPri(0,50);
   1.259 +	iChild[2]->SetAndTestOPPri(0,50);
   1.260 +	iChild[3]->SetAndTestOPPri(0,50);
   1.261 +	iChild[1]->TestOP(2);
   1.262 +	if (iGroupTest)
   1.263 +		{
   1.264 +		retVal=(reinterpret_cast<CBase*>(iChild[0]->NextSibling())==iClient->iGroup);
   1.265 +		TEST(retVal);
   1.266 +		if (!retVal)
   1.267 +			{
   1.268 +			_LIT(KLog,"iChild0 NextSibling is not the main group window");
   1.269 +			LOG_MESSAGE(KLog);
   1.270 +			}
   1.271 +		retVal=(reinterpret_cast<CBase*>(iClient->iGroup->NextSibling())==iChild[4]);
   1.272 +		TEST(retVal);
   1.273 +		if (!retVal)
   1.274 +			{
   1.275 +			_LIT(KLog,"NextSibling of main group window is not iChild4");
   1.276 +			LOG_MESSAGE(KLog);
   1.277 +			}
   1.278 +		}
   1.279 +	else
   1.280 +		TestWindowOrderNext(0,4);
   1.281 +	TestWindowOrderNext(4,5);
   1.282 +	TestWindowOrderNext(5);
   1.283 +	iChild[2]->SetAndTestOPPri(5,-1,0);
   1.284 +	iChild[3]->SetAndTestOPPri(5,-1,1);
   1.285 +	TestWindowOrderNext(5,2);
   1.286 +	iChild[0]->SetAndTestOPPri(100000,KMinTInt32,0);
   1.287 +	iChild[1]->SetAndTestOPPri(200000,KMinTInt32,1);
   1.288 +	iChild[2]->SetAndTestOPPri(300000,KMinTInt32,2);
   1.289 +	iChild[5]->SetAndTestOPPri(0,0,0);
   1.290 +	iChild[3]->TestOP(0);
   1.291 +	iChild[0]->SetAndTestOPPri(0,-1);
   1.292 +	iChild[1]->SetAndTestOPPri(0,-1);
   1.293 +	iChild[2]->SetAndTestOPPri(0,-1);
   1.294 +	iChild[3]->SetAndTestOPPri(0,1);
   1.295 +	iChild[4]->SetAndTestOPPri(0,1);
   1.296 +	iChild[5]->SetAndTestOPPri(0,1);
   1.297 +	TestWindowOrderPrev(0,1);
   1.298 +	TestWindowOrderPrev(1,2);
   1.299 +	if (iGroupTest)
   1.300 +		{
   1.301 +		retVal=(reinterpret_cast<CBase*>(iChild[2]->PrevSibling())==iClient->iGroup);
   1.302 +		TEST(retVal);
   1.303 +		if (!retVal)
   1.304 +			{
   1.305 +			_LIT(KLog,"iChild2 PrevSibling is not the main group window");
   1.306 +			LOG_MESSAGE(KLog);
   1.307 +			}
   1.308 +		retVal=(reinterpret_cast<CBase*>(iClient->iGroup->PrevSibling())==iChild[3]);
   1.309 +		TEST(retVal);
   1.310 +		if (!retVal)
   1.311 +			{
   1.312 +			_LIT(KLog,"PrevSibling of main group window is not iChild3");
   1.313 +			LOG_MESSAGE(KLog);
   1.314 +			}
   1.315 +		}
   1.316 +	else
   1.317 +		TestWindowOrderPrev(2,3);
   1.318 +	TestWindowOrderPrev(3,4);
   1.319 +	TestWindowOrderPrev(4,5);
   1.320 +	TestWindowOrderPrev(5);
   1.321 +	}
   1.322 +
   1.323 +void CTOrdinal::ConstructL()
   1.324 +	{
   1.325 +	iClient=new(ELeave) COrdinalClient();
   1.326 +	iClient->SetScreenNumber(iTest->iScreenNumber);
   1.327 +	iClient->ConstructL();
   1.328 +	}
   1.329 +
   1.330 +/**
   1.331 +@SYMTestCaseID		GRAPHICS-WSERV-0446
   1.332 +
   1.333 +@SYMCR				CR1164
   1.334 +
   1.335 +@SYMTestCaseDesc	Test ClientHandle function returns right value
   1.336 +
   1.337 +@SYMTestPriority	High
   1.338 +
   1.339 +@SYMTestStatus		Implemented
   1.340 +
   1.341 +@SYMTestActions		Call this function on windows at various times
   1.342 +
   1.343 +@SYMTestExpectedResults The value set when window was created is returned
   1.344 +*/
   1.345 +void CTOrdinal::CreateWindowsL(TInt aMode)
   1.346 +	{
   1.347 +	RWindowTreeNode* parent=NULL;
   1.348 +	RWindowTreeNode* base=iClient->iGroup->WinTreeNode();
   1.349 +	TInt errors=0;
   1.350 +
   1.351 +	if (base->Child()!=0)
   1.352 +		{
   1.353 +		_LIT(KErrText,"Main Group Window has children at start of test");
   1.354 +		LOG_MESSAGE(KErrText);
   1.355 +		AutoPanic(EAutoPanicGroupWinHasChild);
   1.356 +		}
   1.357 +	if (base->ClientHandle()!=reinterpret_cast<TUint32&>(iClient->iGroup))
   1.358 +		++errors;
   1.359 +	if (base->Parent()!=0)
   1.360 +		++errors;
   1.361 +	TEST(errors==0);
   1.362 +	if (errors>0)
   1.363 +		{
   1.364 +		_LIT(KErrText,"Handles of Main Group Window are not as expected");
   1.365 +		LOG_MESSAGE2(KErrText,errors);
   1.366 +		}
   1.367 +	iGroupTest=EFalse;
   1.368 +	switch(aMode)
   1.369 +		{
   1.370 +		case 3:
   1.371 +			iParent=COrdinalWindow::NewL(iClient,base,iTest,iStep);
   1.372 +			parent=iParent->WinTreeNode();
   1.373 +			CheckHandlesOnNewWindow(iClient->iGroup,iParent);
   1.374 +			break;
   1.375 +		case 1:
   1.376 +			parent=iClient->iGroup->WinTreeNode();
   1.377 +			break;
   1.378 +		case 2:
   1.379 +			iParent=COrdinalWindow::NewL(iClient,base,iTest,iStep);
   1.380 +			CheckHandlesOnNewWindow(iClient->iGroup,iParent);
   1.381 +			iParent2=COrdinalWindow::NewL(iClient,iParent->WinTreeNode(),iTest,iStep);
   1.382 +			CheckHandlesOnNewWindow(iParent,iParent2);
   1.383 +			iParent3=COrdinalWindow::NewL(iClient,iParent2->WinTreeNode(),iTest,iStep);
   1.384 +			parent=iParent3->WinTreeNode();
   1.385 +			CheckHandlesOnNewWindow(iParent2,iParent3);
   1.386 +			break;
   1.387 +		case 0:
   1.388 +			iGroupTest=ETrue;
   1.389 +			for (TInt child=ENumChildren-1;child>=0;--child)
   1.390 +				iChild[child]=COrdinalWindowGroup::NewL(iClient,iTest,iStep);
   1.391 +			CheckHandles(0);
   1.392 +			return;
   1.393 +		}
   1.394 +	for (TInt child=ENumChildren-1;child>=0;--child)
   1.395 +		{
   1.396 +		iChild[child]=COrdinalWindow::NewL(iClient,parent,iTest,iStep);
   1.397 +		if (iChild[child]->Handle()!=parent->Child())
   1.398 +			++errors;
   1.399 +		}
   1.400 +	TEST(errors==0);
   1.401 +	if (errors>0)
   1.402 +		{
   1.403 +		_LIT(KErrText,"%d windows were not the first child");
   1.404 +		LOG_MESSAGE2(KErrText,errors);
   1.405 +		}
   1.406 +	CheckHandles(parent->ClientHandle());
   1.407 +	}
   1.408 +
   1.409 +void CTOrdinal::CheckHandlesOnNewWindow(CTWindowGroup* aParent,COrdinalWindowBase* aWin)
   1.410 +	{
   1.411 +	TInt errors=0;
   1.412 +	if (aParent->WinTreeNode()->Child()!=aWin->Handle())
   1.413 +		++errors;
   1.414 +	if (aWin->WinTreeNode()->Parent()!=reinterpret_cast<TUint32&>(aParent))
   1.415 +		++errors;
   1.416 +	CheckHandlesOnNewWindow(errors,aWin);
   1.417 +	}
   1.418 +
   1.419 +void CTOrdinal::CheckHandlesOnNewWindow(COrdinalWindowBase* aParent,COrdinalWindowBase* aWin)
   1.420 +	{
   1.421 +	TInt errors=0;
   1.422 +	if (aParent->WinTreeNode()->Child()!=aWin->Handle())
   1.423 +		++errors;
   1.424 +	if (aWin->WinTreeNode()->Parent()!=aParent->Handle())
   1.425 +		++errors;
   1.426 +	CheckHandlesOnNewWindow(errors,aWin);
   1.427 +	}
   1.428 +	
   1.429 +void CTOrdinal::CheckHandlesOnNewWindow(TInt aErrors,COrdinalWindowBase* aWin)
   1.430 +	{
   1.431 +	RWindowTreeNode* win=aWin->WinTreeNode();
   1.432 +	if (win->ClientHandle()!=aWin->Handle())
   1.433 +		++aErrors;
   1.434 +	if (win->PrevSibling()!=0)
   1.435 +		++aErrors;
   1.436 +	if (win->NextSibling()!=0)
   1.437 +		++aErrors;
   1.438 +	if (win->Child()!=0)
   1.439 +		++aErrors;
   1.440 +	TEST(aErrors==0);
   1.441 +	if (aErrors>0)
   1.442 +		{
   1.443 +		_LIT(KErrText,"%d errors in handles of newly created window");
   1.444 +		LOG_MESSAGE2(KErrText,aErrors);
   1.445 +		}
   1.446 +	}
   1.447 +
   1.448 +void CTOrdinal::CheckHandles(TUint aParent)
   1.449 +	{
   1.450 +	TInt errors=0;
   1.451 +	TInt child;
   1.452 +	for (child=0;child<ENumChildren;++child)
   1.453 +		{
   1.454 +		if (iChild[child]->WinTreeNode()->ClientHandle()!=iChild[child]->Handle())
   1.455 +			++errors;
   1.456 +		}
   1.457 +	TEST(errors==0);
   1.458 +	if (errors>0)
   1.459 +		{
   1.460 +		_LIT(KErrText,"%d windows gave wrong client handle");
   1.461 +		LOG_MESSAGE2(KErrText,errors);
   1.462 +		errors=0;
   1.463 +		}
   1.464 +	for (child=0;child<ENumChildren;++child)
   1.465 +		{
   1.466 +		if (iChild[child]->WinTreeNode()->Parent()!=aParent)
   1.467 +			++errors;
   1.468 +		}
   1.469 +	TEST(errors==0);
   1.470 +	if (errors>0)
   1.471 +		{
   1.472 +		_LIT(KErrText,"%d children gave wrong parent handle");
   1.473 +		LOG_MESSAGE2(KErrText,errors);
   1.474 +		errors=0;
   1.475 +		}
   1.476 +	for (child=1;child<ENumChildren;++child)
   1.477 +		{
   1.478 +		if (iChild[child-1]->WinTreeNode()->NextSibling()!=iChild[child]->Handle())
   1.479 +			++errors;
   1.480 +		}
   1.481 +	if (iChild[5]->WinTreeNode()->NextSibling()!=0 && !iGroupTest)
   1.482 +		++errors;
   1.483 +	TEST(errors==0);
   1.484 +	if (errors>0)
   1.485 +		{
   1.486 +		_LIT(KErrText,"%d windows gave wrong next sibling handle");
   1.487 +		LOG_MESSAGE2(KErrText,errors);
   1.488 +		errors=0;
   1.489 +		}
   1.490 +	if (iChild[0]->WinTreeNode()->PrevSibling()!=0 && !iGroupTest)
   1.491 +		++errors;
   1.492 +	for (child=1;child<ENumChildren;++child)
   1.493 +		{
   1.494 +		if (iChild[child]->WinTreeNode()->PrevSibling()!=iChild[child-1]->Handle())
   1.495 +			++errors;
   1.496 +		}
   1.497 +	TEST(errors==0);
   1.498 +	if (errors>0)
   1.499 +		{
   1.500 +		_LIT(KErrText,"%d windows gave wrong prev sibling handle");
   1.501 +		LOG_MESSAGE2(KErrText,errors);
   1.502 +		}
   1.503 +	}
   1.504 +
   1.505 +COrdinalClient::COrdinalClient()
   1.506 +	{
   1.507 +	}
   1.508 +
   1.509 +void COrdinalClient::ConstructL()
   1.510 +	{
   1.511 +	User::LeaveIfError(iWs.Connect());
   1.512 +	// change to correct screen
   1.513 +	//
   1.514 +	iScreen = new (ELeave) CWsScreenDevice(iWs);
   1.515 +	User::LeaveIfError(iScreen->Construct(iScreenNumber));
   1.516 +		
   1.517 +	TheClient->iGroup->WinTreeNode()->SetOrdinalPosition(0,-2000000000);
   1.518 +	TheClient->iWs.Flush();
   1.519 +	iGroup=new(ELeave) CTWindowGroup(this);
   1.520 +	iGroup->ConstructL();
   1.521 +	}
   1.522 +
   1.523 +COrdinalClient::~COrdinalClient()
   1.524 +	{
   1.525 +	TheClient->iGroup->WinTreeNode()->SetOrdinalPosition(0,0);
   1.526 +	}
   1.527 +
   1.528 +void COrdinalClient::KeyL(const TKeyEvent &,const TTime &)
   1.529 +	{
   1.530 +	}
   1.531 +
   1.532 +void CTOrdinal::RunTestCaseL(TInt /*aCurTestCase*/)
   1.533 +	{
   1.534 +	_LIT(KTest1,"Ordinal 1");
   1.535 +	((CTOrdinalStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
   1.536 +	switch(++iTest->iState)
   1.537 +		{
   1.538 +/**
   1.539 +@SYMTestCaseID		GRAPHICS-WSERV-0217
   1.540 +
   1.541 +@SYMDEF             DEF081259
   1.542 +
   1.543 +@SYMTestCaseDesc    Test ordinal position and priority changes on windows
   1.544 +
   1.545 +@SYMTestPriority    High
   1.546 +
   1.547 +@SYMTestStatus      Implemented
   1.548 +
   1.549 +@SYMTestActions     Set different ordinal positions and priorities on a
   1.550 +					number of windows and check they have been set
   1.551 +					correctly
   1.552 +
   1.553 +@SYMTestExpectedResults The positions and priorities are set correctly
   1.554 +*/
   1.555 +		case 1:
   1.556 +			((CTOrdinalStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0217"));
   1.557 +			iTest->LogSubTest(KTest1);
   1.558 +			{
   1.559 +			for(TInt index=0;index<4;index++)
   1.560 +				{
   1.561 +				((CTOrdinalStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0446"));
   1.562 +				CreateWindowsL(index);
   1.563 +				((CTOrdinalStep*)iStep)->RecordTestResultL();
   1.564 +				OrdinalPos();
   1.565 +				OrdinalPriority();
   1.566 +				DestroyWindows();
   1.567 +				}
   1.568 +			}
   1.569 +			((CTOrdinalStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0217"));
   1.570 +			if (!iStep->TestStepResult() == EPass)
   1.571 +				TEST(EFalse);
   1.572 +			break;
   1.573 +		default:
   1.574 +			((CTOrdinalStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
   1.575 +			((CTOrdinalStep*)iStep)->CloseTMSGraphicsStep();
   1.576 +			TestComplete();
   1.577 +			break;
   1.578 +		};
   1.579 +	((CTOrdinalStep*)iStep)->RecordTestResultL();
   1.580 +	}
   1.581 +	
   1.582 +__WS_CONSTRUCT_STEP__(Ordinal)