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