os/graphics/windowing/windowserver/test/tauto/talphawin.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/talphawin.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1273 @@
     1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Test alpha channel transparent windows
    1.18 +// Test that draw operations with non-opaque colours do alpha blending in EColor64K and EColor16MA display modes
    1.19 +// Test that alpha channel transparent windows are drawn correctly when windows move, redraw, change visibility, etc.
    1.20 +// In the draw operation tests, the left window draws opaque pink on white background, the right window blends semi-transparent red on white background,
    1.21 +// and the results are compared.
    1.22 +// In the transparent window tests, the right window contains several transparent windows, which are moved, redrawn, visibility changed, etc,
    1.23 +// the left window contains a single window in which we draw what we expect the right window to look like. The results are compared.
    1.24 +// In each case, the left and right windows should be identical
    1.25 +// 
    1.26 +//
    1.27 +
    1.28 +
    1.29 +#include "TALPHAWIN.H"
    1.30 +
    1.31 +enum
    1.32 +	{
    1.33 +	EOpDrawRect,
    1.34 +	EOpDrawLine,
    1.35 +	EOpDrawEllipse,
    1.36 +	EOpDrawText,
    1.37 +	EOpDrawTextVertical,
    1.38 +	EOpDrawTextAntiAliased,
    1.39 +	EOpBitBlt,
    1.40 +	EOpBitBltMasked,
    1.41 +	ENumDrawOps
    1.42 +	};
    1.43 +
    1.44 +
    1.45 +enum
    1.46 +	{
    1.47 +	ERed = 0x1,
    1.48 +	EGreen = 0x2,
    1.49 +	EBlue = 0x4,
    1.50 +
    1.51 +	EAlphaTransparency = 0x8,
    1.52 +	ETransparencyFactor = 0x10,
    1.53 +	// defaults to non-transparent
    1.54 +
    1.55 +	EOpaque = 0x20,
    1.56 +	ETransparent = 0x40,
    1.57 +	// defaults to semi-transparent
    1.58 +
    1.59 +	EModeColor64K = 0x80,
    1.60 +	EModeColor16MA = 0x100,
    1.61 +	// defaults to 64k
    1.62 +
    1.63 +	EInvisible = 0x200,
    1.64 +
    1.65 +	EActive = 0xf000000
    1.66 +	};
    1.67 +
    1.68 +
    1.69 +TRgb ColourFromDrawState(TInt aDrawState)
    1.70 +	{
    1.71 +	TInt red = (aDrawState & ERed) ? 255 : 0;
    1.72 +	TInt green = (aDrawState & EGreen) ? 255 : 0;
    1.73 +	TInt blue = (aDrawState & EBlue) ? 255 : 0;
    1.74 +	TInt alpha = 128;
    1.75 +	if (aDrawState & EOpaque)
    1.76 +		alpha = 255;
    1.77 +	if (aDrawState & ETransparent)
    1.78 +		alpha = 0;
    1.79 +	return TRgb(red, green, blue, alpha);
    1.80 +	}
    1.81 +
    1.82 +
    1.83 +
    1.84 +//
    1.85 +// CTAlphaWinTest
    1.86 +//
    1.87 +
    1.88 +CTAlphaWin::CTAlphaWin(CTestStep* aStep):
    1.89 +	CTWsGraphicsBase(aStep)
    1.90 +	{
    1.91 +	}
    1.92 +
    1.93 +CTAlphaWin::~CTAlphaWin()
    1.94 +	{
    1.95 +	iTestWin.DeleteAll();
    1.96 +	delete iRefWin;
    1.97 +	}
    1.98 +
    1.99 +void CTAlphaWin::ConstructL()
   1.100 +	{
   1.101 +	if(TransparencySupportedL() == KErrNotSupported)
   1.102 +			return;
   1.103 +
   1.104 +	TSize winSize = BaseWin->Size();
   1.105 +
   1.106 +	iTestWin[0] = CTAlphaWindow::NewL(this, TestWin, TPoint(0,0), winSize, ERed | EGreen | EBlue | EOpaque);
   1.107 +	iTestWin[1] = CTAlphaWindow::NewL(this, TestWin, TPoint(0,0), TSize(winSize.iWidth/2, winSize.iHeight/2), ERed | EAlphaTransparency);
   1.108 +	iTestWin[2] = CTAlphaWindow::NewL(this, TestWin, TPoint(winSize.iWidth/3,0), TSize(winSize.iWidth/2, winSize.iHeight/2), EGreen | EAlphaTransparency);
   1.109 +	iTestWin[3] = CTAlphaWindow::NewL(this, TestWin, TPoint(winSize.iWidth/6, winSize.iHeight/3), TSize(winSize.iWidth/2, winSize.iHeight/2), EBlue | EAlphaTransparency);
   1.110 +	iTestWin[4] = CTAlphaWindow::NewL(this, TestWin, TPoint(winSize.iWidth/4,winSize.iHeight/6), TSize(winSize.iWidth/3,winSize.iHeight/3), ERed | EGreen | EBlue | EAlphaTransparency | ETransparent);
   1.111 +
   1.112 +	iRefWin = CTAlphaRefWin::NewL(BaseWin, TPoint(0,0), winSize, iTestWin);
   1.113 +	//Clearing the windows
   1.114 +	BaseWin->ClearWin();
   1.115 +	TestWin->ClearWin();
   1.116 +	}
   1.117 +
   1.118 +void CTAlphaWin::ConfigureDisplayModes(TDisplayMode aRequiredMode = EColor16M)
   1.119 +	{
   1.120 +	TInt i;
   1.121 +	for (i=0; i<5; i++)
   1.122 +		{
   1.123 +		iTestWin[i]->BaseWin()->SetRequiredDisplayMode(aRequiredMode);
   1.124 +		}
   1.125 +	iRefWin->BaseWin()->SetRequiredDisplayMode(aRequiredMode);
   1.126 +	}
   1.127 +
   1.128 +
   1.129 +void CTAlphaWin::TestSemiTransparentDrawingL()
   1.130 +	{
   1.131 +	TSize winSize = BaseWin->Size();
   1.132 +
   1.133 +	// In this window, we draw opaque pink
   1.134 +	CTDrawOpWin* drawWin = CTDrawOpWin::NewL(this, BaseWin, TPoint(0,0), winSize, TRgb(255,127,127,255));
   1.135 +
   1.136 +	// In this window, we blend semi-transparent red
   1.137 +	CTDrawOpWin* blendWin = CTDrawOpWin::NewL(this, TestWin, TPoint(0,0), winSize, TRgb(255,0,0,128));
   1.138 +
   1.139 +	const TInt tolerance = 9;//8 - wouldn't be enough!! The defect 	DEF112334 was raised
   1.140 +	for (TInt i=EOpDrawRect; i<ENumDrawOps; i++)
   1.141 +		{
   1.142 +		
   1.143 +	//	User::After(1000000);// helpful when debugging
   1.144 +		drawWin->SetDrawOp(i);
   1.145 +		blendWin->SetDrawOp(i);
   1.146 +		drawWin->DrawNow();
   1.147 +		blendWin->DrawNow();
   1.148 +		TheClient->Flush();
   1.149 +		TheClient->WaitForRedrawsToFinish();
   1.150 +
   1.151 +		if((i == EOpDrawTextAntiAliased) && (TheClient->iScreen->DisplayMode() == EColor16MA) || (TheClient->iScreen->DisplayMode() == EColor16MAP))
   1.152 +			{		
   1.153 +			TSize winSize=BaseWin->Size();
   1.154 +			TRect rect1(BaseWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
   1.155 +			TRect rect2(TestWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
   1.156 +
   1.157 +			CheckRectL(rect1, rect2, winSize, TheClient->iScreen->DisplayMode(), tolerance, _L("CTAlphaWin::TestSemiTransparentDrawingL()"));
   1.158 +			}
   1.159 +		else
   1.160 +			{
   1.161 +			CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestSemiTransparentDrawingL()"));
   1.162 +			}	
   1.163 +		}
   1.164 +	delete drawWin;
   1.165 +	delete blendWin;
   1.166 +	}
   1.167 +
   1.168 +void CTAlphaWin::TestTransparentDrawingL()
   1.169 +	{
   1.170 +	TSize winSize = BaseWin->Size();
   1.171 +
   1.172 +	// In this window, we draw opaque white
   1.173 +	CTDrawOpWin* drawWin = CTDrawOpWin::NewL(this, BaseWin, TPoint(0,0), winSize, TRgb(255,255,255,255));
   1.174 +
   1.175 +	// In this window, we blend transparent red
   1.176 +	CTDrawOpWin* blendWin = CTDrawOpWin::NewL(this, TestWin, TPoint(0,0), winSize, TRgb(255,0,0,0));
   1.177 +
   1.178 +	for (TInt i=EOpDrawRect; i<ENumDrawOps; i++)
   1.179 +		{
   1.180 +		//User::After(1000000);// helpful when debugging
   1.181 +		drawWin->SetDrawOp(i);
   1.182 +		blendWin->SetDrawOp(i);
   1.183 +		drawWin->DrawNow();
   1.184 +		blendWin->DrawNow();
   1.185 +		TheClient->Flush();
   1.186 +		TheClient->WaitForRedrawsToFinish();
   1.187 +		CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestTransparentDrawingL()"));
   1.188 +		}
   1.189 +	delete drawWin;
   1.190 +	delete blendWin;
   1.191 +	}
   1.192 +
   1.193 +void CTAlphaWin::CheckRectL(const TRect& aRect1, const TRect& aRect2, TSize aSize, TDisplayMode aRequiredMode, TInt aTolerance, const TDesC& aErrorMsg)
   1.194 +	{
   1.195 +	CFbsBitmap *bmp1 = new (ELeave) CFbsBitmap;
   1.196 +	CleanupStack::PushL(bmp1);
   1.197 +	User::LeaveIfError(bmp1->Create(aSize, aRequiredMode));
   1.198 +
   1.199 +	CFbsBitmap *bmp2 = new (ELeave) CFbsBitmap;
   1.200 +	CleanupStack::PushL(bmp2);
   1.201 +	User::LeaveIfError(bmp2->Create(aSize, aRequiredMode));
   1.202 +	
   1.203 +	User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bmp1, aRect1));	
   1.204 +	User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(bmp2, aRect2));	
   1.205 +
   1.206 +	TRgb *rgbBuf1=(TRgb *)User::AllocL(aSize.iWidth*sizeof(TRgb));	
   1.207 +	TRgb *rgbBuf2=(TRgb *)User::Alloc(aSize.iWidth*sizeof(TRgb));	
   1.208 +	if(!rgbBuf2)
   1.209 +		{
   1.210 +		User::Free(rgbBuf1);
   1.211 +		User::Leave(KErrNoMemory);
   1.212 +		}
   1.213 +	TBool equal = ETrue;
   1.214 +	TInt maxDeviation = 0;
   1.215 +	for(TInt yy = 0; yy < aSize.iHeight && equal; yy++)
   1.216 +		{
   1.217 +		TPtr8 ptr1((TUint8 *)rgbBuf1,aSize.iWidth*sizeof(TRgb));
   1.218 +		bmp1->GetScanLine(ptr1, TPoint(0, yy), aSize.iWidth, ERgb);
   1.219 +		TPtr8 ptr2((TUint8 *)rgbBuf2,aSize.iWidth*sizeof(TRgb));
   1.220 +		bmp2->GetScanLine(ptr2, TPoint(0, yy), aSize.iWidth, ERgb);
   1.221 +		
   1.222 +		TRgb *rgbBufCur1 = rgbBuf1;
   1.223 +		TRgb *rgbBufCur2 = rgbBuf2;
   1.224 +		for(TInt ii = 0; ii < aSize.iWidth; ii++)
   1.225 +			{
   1.226 +			TInt delta = Abs(rgbBufCur1->Red()-rgbBufCur2->Red());
   1.227 +			TInt delta1 = Abs(rgbBufCur1->Green()-rgbBufCur2->Green());
   1.228 +			TInt delta2 = Abs(rgbBufCur1->Blue()-rgbBufCur2->Blue());
   1.229 +			
   1.230 +			if((delta > aTolerance) || (delta1 > aTolerance) || (delta2 > aTolerance))
   1.231 +				{
   1.232 +				equal = EFalse;
   1.233 +				}
   1.234 +			TInt maxItermedia = Max(delta1, delta2);
   1.235 +			maxItermedia = Max(maxItermedia, delta);
   1.236 +			maxDeviation = Max(maxItermedia, maxDeviation);
   1.237 +
   1.238 +			rgbBufCur1++;	
   1.239 +			rgbBufCur2++;	
   1.240 +			}
   1.241 +		}
   1.242 +	
   1.243 +	User::Free(rgbBuf1);
   1.244 +	User::Free(rgbBuf2);
   1.245 +
   1.246 +	CleanupStack::PopAndDestroy(2,bmp1);
   1.247 +
   1.248 +	if (!equal)
   1.249 +		{
   1.250 +		INFO_PRINTF3(_L("%S CheckRectA failed, max deviation %d"), &aErrorMsg, maxDeviation);
   1.251 +		}
   1.252 +	else if(maxDeviation)
   1.253 +		{
   1.254 +		INFO_PRINTF4(_L("%S CheckRectA passed with tolerance %d, max deviation %d"), &aErrorMsg, aTolerance, maxDeviation);
   1.255 +		}
   1.256 +		
   1.257 +	iStep->TEST(equal);
   1.258 +	}
   1.259 +
   1.260 +void CTAlphaWin::TestCondition()
   1.261 +	{
   1.262 +	// User::After(1000000);// helpful when debugging
   1.263 +	iRefWin->DrawNow();
   1.264 +	TheClient->Flush();
   1.265 +	TheClient->WaitForRedrawsToFinish();
   1.266 +	CheckRect(BaseWin,TestWin,_L("CTAlphaWin::TestCondition()"));
   1.267 +	}
   1.268 +
   1.269 +void CTAlphaWin::TestConditionL()
   1.270 +	{
   1.271 +	iRefWin->DrawNow();
   1.272 +	TheClient->Flush();
   1.273 +	TheClient->WaitForRedrawsToFinish();
   1.274 +
   1.275 +	const TInt tolerance = 9;
   1.276 +	TSize winSize=BaseWin->Size();
   1.277 +	TRect rect1(BaseWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
   1.278 +	TRect rect2(TestWin->BaseWin()->InquireOffset(*TheClient->iGroup->WinTreeNode()),winSize);
   1.279 +	CheckRectL(rect1, rect2, winSize, TheClient->iScreen->DisplayMode(), tolerance, _L("CTAlphaWin::TestCondition()"));
   1.280 +	}
   1.281 +
   1.282 +void CTAlphaWin::TestInitialConfiguration()
   1.283 +	{
   1.284 +	if(TheClient->iScreen->DisplayMode() == EColor64K)
   1.285 +		{
   1.286 +		TestConditionL();
   1.287 +		}
   1.288 +	else
   1.289 +		{
   1.290 +		TestCondition();
   1.291 +		}
   1.292 +	}
   1.293 +
   1.294 +void CTAlphaWin::TestMove()
   1.295 +	{
   1.296 +	// Test moving windows, both in front and behind
   1.297 +	for (TInt i = 0; i<5; i++)
   1.298 +		{
   1.299 +		TPoint pos = iTestWin[i]->Position();
   1.300 +		pos += TPoint(10,10);
   1.301 +		iTestWin[i]->SetPos(pos);
   1.302 +		TestCondition();
   1.303 +		}
   1.304 +	for (TInt j = 0; j<5; j++)
   1.305 +		{
   1.306 +		TPoint pos = iTestWin[j]->Position();
   1.307 +		pos -= TPoint(10,10);
   1.308 +		iTestWin[j]->SetPos(pos);
   1.309 +		TestCondition();
   1.310 +		}
   1.311 +	}
   1.312 +
   1.313 +
   1.314 +void CTAlphaWin::TestRedraw()
   1.315 +	{
   1.316 +	// Test redrawing windows, both in front and behind
   1.317 +	for (TInt i=0; i<5; i++)
   1.318 +		{
   1.319 +		iTestWin[i]->DrawNow();
   1.320 +		TestCondition();
   1.321 +		}
   1.322 +	}
   1.323 +
   1.324 +
   1.325 +void CTAlphaWin::TestInvisible()
   1.326 +	{
   1.327 +	// Test making windows visible and invisible, both in front and behind
   1.328 +	for (TInt i=0; i<5; i++)
   1.329 +		{
   1.330 +		iTestWin[i]->SetVisible(EFalse);
   1.331 +		TestCondition();
   1.332 +		iTestWin[i]->SetVisible(ETrue);
   1.333 +		TestCondition();
   1.334 +		}
   1.335 +	}
   1.336 +
   1.337 +void CTAlphaWin::TestChildrenL()
   1.338 +	{
   1.339 +	struct CTAlphaWinChildren: public TCleanupItem
   1.340 +		{
   1.341 +			static void Destroy(TAny* trg)
   1.342 +				{
   1.343 +				static_cast<CTAlphaWindow*>(trg)->DestroyChildren();				
   1.344 +				}
   1.345 +			CTAlphaWinChildren(CTAlphaWindow*trg):	TCleanupItem(Destroy,trg)	
   1.346 +				{}
   1.347 +			
   1.348 +		};
   1.349 +	CleanupStack::PushL(CTAlphaWinChildren(iTestWin[2]));
   1.350 +	iTestWin[2]->CreateChildrenL(3);
   1.351 +	TestCondition();
   1.352 +	TestMove();
   1.353 +	CleanupStack::PopAndDestroy(iTestWin[2]);
   1.354 +	}
   1.355 +
   1.356 +
   1.357 +void CTAlphaWin::TestAntiAliasedTextTransparentL()
   1.358 +	{
   1.359 +
   1.360 +	//Clear the screen
   1.361 +	for (TInt i=0; i<5; i++)
   1.362 +		{
   1.363 +		iTestWin[i]->SetVisible(EFalse);
   1.364 +		}
   1.365 +	iRefWin->SetVisible(EFalse);
   1.366 +	TheClient->iWs.Flush();
   1.367 +
   1.368 +	//Create a new test window on the left
   1.369 +	//Create a transparent window:
   1.370 +	TSize winSize = BaseWin->Size();
   1.371 +
   1.372 +	RWindow theWin(TestWin->Client()->iWs);
   1.373 +	User::LeaveIfError(theWin.Construct(*(TestWin->WinTreeNode()),(TUint32)&theWin));
   1.374 +
   1.375 +	theWin.SetExtent(TPoint(0,0), winSize);
   1.376 +	theWin.SetBackgroundColor(TRgb(127,0,255,127));
   1.377 +	TDisplayMode mode = EColor16MAP;
   1.378 +	theWin.SetRequiredDisplayMode(mode);
   1.379 +	theWin.SetVisible(ETrue);
   1.380 +	theWin.SetTransparencyAlphaChannel();
   1.381 +	theWin.Activate();
   1.382 +	TheClient->iWs.Flush();
   1.383 +	CleanupClosePushL(theWin);
   1.384 +
   1.385 +	//get windows screen device.
   1.386 +	CWsScreenDevice *device;
   1.387 +	device = new (ELeave)CWsScreenDevice(TestWin->Client()->iWs);//(TheClient->iWs);
   1.388 +	User::LeaveIfError(device->Construct(iTest->ScreenNumber()));
   1.389 +	CleanupStack::PushL(device);
   1.390 +
   1.391 +	TFontSpec fs1;
   1.392 +	CFont *font1;
   1.393 +	CFont *font2;
   1.394 +	fs1.iTypeface.iName = KTestFontTypefaceName;
   1.395 +	fs1.iHeight = 16;
   1.396 +	fs1.iFontStyle.SetBitmapType(EDefaultGlyphBitmap);
   1.397 +	int error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font1,fs1);
   1.398 +	if (error)
   1.399 +		{
   1.400 +		TheClient->iScreen->ReleaseFont(font1);
   1.401 +		User::Panic(_L("font not created"),error);
   1.402 +		}
   1.403 +	fs1.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
   1.404 +	error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font2,fs1);
   1.405 +	if (error)
   1.406 +		{
   1.407 +		TheClient->iScreen->ReleaseFont(font1);
   1.408 +		TheClient->iScreen->ReleaseFont(font2);
   1.409 +		User::Panic(_L("font not created"),error);
   1.410 +		}
   1.411 +
   1.412 +	CWindowGc *gc;
   1.413 +	device->CreateContext(gc);
   1.414 +	CleanupStack::PushL(gc);
   1.415 +
   1.416 +	theWin.Invalidate();
   1.417 +	theWin.BeginRedraw();
   1.418 +	gc->Activate(theWin);
   1.419 +
   1.420 +	gc->SetPenStyle( CGraphicsContext::ESolidPen );
   1.421 +	gc->SetPenColor( TRgb( 0, 0, 0, 127 ) );
   1.422 +
   1.423 +	//draw text for anti-aliasing needs an open font (scalable).
   1.424 +	int typefaces = TheClient->iScreen->NumTypefaces();
   1.425 +
   1.426 +	gc->UseFont(font1);
   1.427 +	gc->SetBrushStyle( CGraphicsContext::ENullBrush );
   1.428 +	gc->DrawText(_L("Test"),TPoint(10,20));
   1.429 +	gc->DiscardFont();
   1.430 +	gc->UseFont(font2);
   1.431 +	gc->DrawText(_L("Test"),TPoint(10,60));
   1.432 +	gc->DiscardFont();
   1.433 +
   1.434 +	//destruction and tidying up
   1.435 +	gc->Deactivate();
   1.436 +	theWin.EndRedraw();
   1.437 +	TheClient->iWs.Flush();
   1.438 +
   1.439 +	TheClient->iScreen->ReleaseFont(font1);
   1.440 +	TheClient->iScreen->ReleaseFont(font2);
   1.441 +	CleanupStack::PopAndDestroy(gc);//gc
   1.442 +	CleanupStack::PopAndDestroy(device);//device
   1.443 +
   1.444 +	//do not close the test window yet since there is a comparison
   1.445 +	//required
   1.446 +
   1.447 +	//now do the same on an off screen bitmap.  Then create a window
   1.448 +	//and put the bitmap onto it.
   1.449 +	//create a colour bitmap
   1.450 +	//
   1.451 +	CFbsBitmap *bitmapOne;
   1.452 +	bitmapOne = new (ELeave)CFbsBitmap();
   1.453 +	CleanupStack::PushL(bitmapOne);
   1.454 +	User::LeaveIfError(bitmapOne->Create(winSize,mode));
   1.455 +
   1.456 +	CFbsBitmapDevice *deviceOne=CFbsBitmapDevice::NewL(bitmapOne);
   1.457 +	CleanupStack::PushL(deviceOne);
   1.458 +
   1.459 +	CFont *font3;
   1.460 +	CFont *font4;
   1.461 +	fs1.iFontStyle.SetBitmapType(EDefaultGlyphBitmap);
   1.462 +	error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font3,fs1);
   1.463 +	if (error)
   1.464 +		{
   1.465 +		TheClient->iScreen->ReleaseFont(font3);
   1.466 +		User::Panic(_L("font not created"),error);
   1.467 +		}
   1.468 +	fs1.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
   1.469 +	error = TheClient->iScreen->GetNearestFontToDesignHeightInPixels((CFont*&)font4,fs1);
   1.470 +	if (error)
   1.471 +		{
   1.472 +		TheClient->iScreen->ReleaseFont(font3);
   1.473 +		TheClient->iScreen->ReleaseFont(font4);
   1.474 +		User::Panic(_L("font not created"),error);
   1.475 +		}
   1.476 +	CFbsBitGc *bGcOne = CFbsBitGc::NewL();
   1.477 +	CleanupStack::PushL(bGcOne);
   1.478 +
   1.479 +	bGcOne->Activate(deviceOne);
   1.480 +
   1.481 +	bGcOne->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.482 +	bGcOne->SetBrushColor(TRgb(127,0,255,127));
   1.483 +	bGcOne->DrawRect(TRect(0,0,winSize.iWidth,winSize.iHeight));
   1.484 +
   1.485 +	bGcOne->SetPenStyle(CGraphicsContext::ESolidPen);
   1.486 +	bGcOne->SetPenColor(TRgb(0,0,0,127));
   1.487 +
   1.488 +	bGcOne->UseFont(font3);
   1.489 +	bGcOne->SetBrushStyle( CGraphicsContext::ENullBrush );
   1.490 +	bGcOne->DrawText(_L("Test"),TPoint(10,20));
   1.491 +	bGcOne->DiscardFont();
   1.492 +	bGcOne->UseFont(font4);
   1.493 +	bGcOne->DrawText(_L("Test"),TPoint(10,60));
   1.494 +	bGcOne->DiscardFont();
   1.495 +	//destruction and tidying up
   1.496 +	//measure the text
   1.497 +	CFont::TMeasureTextOutput textSize;
   1.498 +	font4->MeasureText(_L("Test"),NULL,&textSize);
   1.499 +
   1.500 +	TheClient->iScreen->ReleaseFont(font3);
   1.501 +	TheClient->iScreen->ReleaseFont(font4);
   1.502 +
   1.503 +	//display at the left
   1.504 +	RWindow refWin(BaseWin->Client()->iWs);
   1.505 +	CleanupClosePushL(refWin);
   1.506 +	User::LeaveIfError(refWin.Construct(*(BaseWin->WinTreeNode()),(TUint32)&refWin));
   1.507 +
   1.508 +	refWin.SetExtent(TPoint(0,0), winSize);
   1.509 +	refWin.SetRequiredDisplayMode(mode);
   1.510 +	refWin.SetVisible(ETrue);
   1.511 +	refWin.SetTransparencyAlphaChannel();
   1.512 +	refWin.Activate();
   1.513 +	TheClient->iWs.Flush();
   1.514 +
   1.515 +	//a gc for the ref win
   1.516 +	CWsScreenDevice *refDevice;
   1.517 +	refDevice = new (ELeave)CWsScreenDevice(BaseWin->Client()->iWs);
   1.518 +	User::LeaveIfError(refDevice->Construct(iTest->ScreenNumber()));
   1.519 +	CleanupStack::PushL(refDevice);
   1.520 +	CWindowGc *gcRef;
   1.521 +	refDevice->CreateContext(gcRef);
   1.522 +	CleanupStack::PushL(gcRef);
   1.523 +
   1.524 +	refWin.Invalidate();
   1.525 +	refWin.BeginRedraw();
   1.526 +	gcRef->Activate(refWin);
   1.527 +	gcRef->BitBlt(TPoint(0,0), bitmapOne);
   1.528 +	gcRef->Deactivate();
   1.529 +	refWin.EndRedraw();
   1.530 +	TheClient->iWs.Flush();
   1.531 +
   1.532 +	TPoint refPos = refWin.AbsPosition();
   1.533 +	TPoint winPos = theWin.AbsPosition();
   1.534 +
   1.535 +	//Compare the anti-aliased text areas
   1.536 +	TInt textLength=textSize.iBounds.iBr.iX;
   1.537 +	TInt textHeight=Abs(textSize.iBounds.iTl.iY);
   1.538 +
   1.539 +	TRect rect1(refPos.iX+10,refPos.iY+60-textHeight,
   1.540 +			refPos.iX+10+textLength,refPos.iY+60);
   1.541 +	TRect rect2(winPos.iX+10,winPos.iY+60-textHeight,
   1.542 +			winPos.iX+10+textLength,winPos.iY+60);
   1.543 +
   1.544 +	TBool match = refDevice->RectCompare(rect1,rect2);
   1.545 +	TEST(match);
   1.546 +
   1.547 +	CleanupStack::PopAndDestroy(gcRef);
   1.548 +	CleanupStack::PopAndDestroy(refDevice);
   1.549 +	CleanupStack::PopAndDestroy(&refWin);
   1.550 +
   1.551 +	CleanupStack::PopAndDestroy(bGcOne);
   1.552 +	CleanupStack::PopAndDestroy(deviceOne);
   1.553 +	CleanupStack::PopAndDestroy(bitmapOne);
   1.554 +	CleanupStack::PopAndDestroy(&theWin);//theWin
   1.555 +
   1.556 +	}
   1.557 +//
   1.558 +// CTDrawOpWin
   1.559 +//
   1.560 +
   1.561 +CTDrawOpWin* CTDrawOpWin::NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TRgb aDrawColour)
   1.562 +	{
   1.563 +	CTDrawOpWin* theWin = new(ELeave) CTDrawOpWin(aTest,aDrawColour);
   1.564 +
   1.565 +	theWin->ConstructL(*aParent);
   1.566 +	theWin->SetExtL(aPos, aSize);
   1.567 +	theWin->AssignGC(*TheClient->iGc);
   1.568 +	if (TheClient->iScreen->DisplayMode() == EColor16MA)
   1.569 +		{
   1.570 +		theWin->BaseWin()->SetRequiredDisplayMode(EColor16MA);
   1.571 +		}
   1.572 +	else
   1.573 +		{
   1.574 +		theWin->BaseWin()->SetRequiredDisplayMode(EColor64K);
   1.575 +		}
   1.576 +		
   1.577 +	theWin->Activate();
   1.578 +	theWin->DrawNow();
   1.579 +
   1.580 +	return theWin;
   1.581 +	}
   1.582 +
   1.583 +CTDrawOpWin::CTDrawOpWin(CTAlphaWin* aTest, TRgb aDrawColour)
   1.584 +: iTest(aTest), iDrawColour(aDrawColour)
   1.585 +	{}
   1.586 +
   1.587 +
   1.588 +void CTDrawOpWin::SetDrawOp(TInt aDrawOp)
   1.589 +	{
   1.590 +	iDrawOp = aDrawOp;
   1.591 +	}
   1.592 +
   1.593 +
   1.594 +void CTDrawOpWin::Draw()
   1.595 +	{
   1.596 +	_LIT(KText,"Text test");
   1.597 +
   1.598 +	iGc->SetPenColor(iDrawColour);
   1.599 +	iGc->SetBrushColor(iDrawColour);
   1.600 +	TSize size = Size();
   1.601 +	TInt top = 5;
   1.602 +	TInt left = 5;
   1.603 +	TInt bottom = size.iHeight - 5;
   1.604 +	TInt right = size.iWidth - 5;
   1.605 +	TInt square = Min(bottom-top,right-left);
   1.606 +
   1.607 +	switch (iDrawOp)
   1.608 +		{
   1.609 +	case EOpDrawRect:
   1.610 +		iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.611 +		iGc->SetPenStyle(CGraphicsContext::ENullPen);
   1.612 +		iGc->DrawRect(TRect(left,top,right,bottom));
   1.613 +		break;
   1.614 +	case EOpDrawLine:
   1.615 +		//!! FAILS
   1.616 +		//!! The endpoint of the line is drawn twice, with the result that it is darker when we do blending
   1.617 +		//!! Not intending to fix at the moment
   1.618 +		/*
   1.619 +		iGc->SetPenStyle(CGraphicsContext::ESolidPen);
   1.620 +		iGc->SetPenSize(TSize(4,4));
   1.621 +		// The lines must not overlap, otherwise the blended lines will be darker at the overlap
   1.622 +		iGc->DrawLine(TPoint(left+5,top), TPoint(left+square,top));
   1.623 +		iGc->DrawLine(TPoint(left+5,top+5), TPoint(left+square,top+square));
   1.624 +		iGc->DrawLine(TPoint(left,top+5), TPoint(left,top+square));
   1.625 +		*/
   1.626 +		break;
   1.627 +	case EOpDrawEllipse:
   1.628 +		iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.629 +		iGc->SetPenStyle(CGraphicsContext::ENullPen);
   1.630 +		iGc->DrawEllipse(TRect(left,top,right,bottom));
   1.631 +		break;
   1.632 +	case EOpDrawText:
   1.633 +	case EOpDrawTextVertical:
   1.634 +		{
   1.635 +		iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
   1.636 +		iGc->SetPenStyle(CGraphicsContext::ESolidPen);
   1.637 +		CFont* font;
   1.638 +		TFontSpec fontSpec(KTestFontTypefaceName,200);
   1.639 +		User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(font, fontSpec));
   1.640 +		iGc->UseFont(font);
   1.641 +		if (iDrawOp==EOpDrawText)
   1.642 +			iGc->DrawText(KText(), TPoint(5,30));
   1.643 +		else
   1.644 +			iGc->DrawTextVertical(KText(), TPoint(5,30), EFalse);
   1.645 +		iGc->DiscardFont();
   1.646 +		TheClient->iScreen->ReleaseFont(font);
   1.647 +		}
   1.648 +		break;
   1.649 +	case EOpDrawTextAntiAliased:
   1.650 +		{
   1.651 +		iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
   1.652 +		iGc->SetPenStyle(CGraphicsContext::ESolidPen);
   1.653 +		CFont* font;
   1.654 +		TFontSpec fontSpec(KTestFontTypefaceName,600);
   1.655 +		fontSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold);
   1.656 +		fontSpec.iFontStyle.SetBitmapType(EAntiAliasedGlyphBitmap);
   1.657 +
   1.658 +		User::LeaveIfError(TheClient->iScreen->GetNearestFontToDesignHeightInTwips(font, fontSpec));
   1.659 +		iGc->UseFont(font);
   1.660 +		iGc->DrawText(KText(), TPoint(5,30));
   1.661 +		iGc->DiscardFont();
   1.662 +		TheClient->iScreen->ReleaseFont(font);
   1.663 +		}
   1.664 +		break;
   1.665 +	case EOpBitBlt:
   1.666 +		break;
   1.667 +	case EOpBitBltMasked:
   1.668 +		break;
   1.669 +	default:
   1.670 +		break;
   1.671 +		};
   1.672 +	}
   1.673 +
   1.674 +
   1.675 +
   1.676 +//
   1.677 +// CTAlphaWindow
   1.678 +//
   1.679 +
   1.680 +CTAlphaWindow::~CTAlphaWindow()
   1.681 +	{
   1.682 +	DestroyChildren();
   1.683 +	}
   1.684 +
   1.685 +CTAlphaWindow* CTAlphaWindow::NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TInt aDrawState)
   1.686 +	{
   1.687 +	CTAlphaWindow* theWin = new (ELeave) CTAlphaWindow(aTest);
   1.688 +
   1.689 +	theWin->ConstructL(*aParent);
   1.690 +	theWin->SetExtL(aPos, aSize);
   1.691 +	theWin->SetDrawState(aDrawState);
   1.692 +
   1.693 +	theWin->AssignGC(*TheClient->iGc);
   1.694 +
   1.695 +	theWin->Activate();
   1.696 +	theWin->iDrawState |= EActive;
   1.697 +	theWin->DrawNow();
   1.698 +
   1.699 +	return theWin;
   1.700 +	}
   1.701 +
   1.702 +void CTAlphaWindow::SetDrawState(TInt aDrawState)
   1.703 +	{
   1.704 +	TBool active = iDrawState & EActive;
   1.705 +	iDrawState = aDrawState & 0x7fffffff;
   1.706 +
   1.707 +	TRgb colour = ColourFromDrawState(iDrawState);
   1.708 +	((RWindow*) DrawableWin())->SetBackgroundColor(colour);
   1.709 +
   1.710 +	if (iDrawState & EModeColor16MA)
   1.711 +		BaseWin()->SetRequiredDisplayMode(EColor16MA);
   1.712 +	else
   1.713 +		BaseWin()->SetRequiredDisplayMode(EColor64K);
   1.714 +
   1.715 +	BaseWin()->SetVisible(! (iDrawState & EInvisible));
   1.716 +
   1.717 +	if (!active)
   1.718 +		{
   1.719 +		if (iDrawState & EAlphaTransparency)
   1.720 +			((RWindow*) DrawableWin())->SetTransparencyAlphaChannel();
   1.721 +		else if (iDrawState & ETransparencyFactor)
   1.722 +			((RWindow*) DrawableWin())->SetTransparencyFactor(TRgb(128,128,128));
   1.723 +		}
   1.724 +
   1.725 +	if (active)
   1.726 +		iDrawState |= EActive;
   1.727 +	}
   1.728 +
   1.729 +void CTAlphaWindow::SetVisible(TBool aVisible)
   1.730 +	{
   1.731 +	if (aVisible)
   1.732 +		iDrawState &= ~EInvisible;
   1.733 +	else
   1.734 +		iDrawState |= EInvisible;
   1.735 +	BaseWin()->SetVisible(aVisible);
   1.736 +	}
   1.737 +
   1.738 +void CTAlphaWindow::CreateChildrenL(TInt aDepth)
   1.739 +	{
   1.740 +	DestroyChildren();
   1.741 +	if (aDepth>0)
   1.742 +		{
   1.743 +		TSize size = Size();
   1.744 +		iChild1 = CTAlphaWindow::NewL(iTest, this, TPoint(size.iWidth/3,0), TSize(2*size.iWidth/3, 2*size.iHeight/3), ERed | EGreen | EBlue | EOpaque);
   1.745 +		iChild2 = CTAlphaWindow::NewL(iTest, this, TPoint(0,size.iHeight/3), TSize(2*size.iWidth/3, 2*size.iHeight/3), ERed | EGreen | EBlue | EAlphaTransparency);
   1.746 +		iChild2->CreateChildrenL(aDepth-1);
   1.747 +		}
   1.748 +	}
   1.749 +
   1.750 +void CTAlphaWindow::DestroyChildren()
   1.751 +	{
   1.752 +	if (iChild1)
   1.753 +		{
   1.754 +		iChild1->DestroyChildren();
   1.755 +		delete iChild1;
   1.756 +		iChild1 = NULL;
   1.757 +		}
   1.758 +	if (iChild2)
   1.759 +		{
   1.760 +		iChild2->DestroyChildren();
   1.761 +		delete iChild2;
   1.762 +		iChild2 = NULL;
   1.763 +		}
   1.764 +	}
   1.765 +
   1.766 +TInt CTAlphaWindow::DrawState()
   1.767 +	{
   1.768 +	return iDrawState;
   1.769 +	}
   1.770 +
   1.771 +void CTAlphaWindow::Draw()
   1.772 +	{
   1.773 +	// we draw a diagonal line from top left to bottom right
   1.774 +	// we use the complementary colour to the window background colour
   1.775 +	TInt red = (iDrawState & ERed) ? 0 : 255;
   1.776 +	TInt green = (iDrawState & EGreen) ? 0 : 255;
   1.777 +	TInt blue = (iDrawState & EBlue) ? 0 : 255;
   1.778 +	TRgb color(red,green,blue);
   1.779 +
   1.780 +	TSize size = Size();
   1.781 +	iGc->SetPenColor(color);
   1.782 +	iGc->SetPenSize(TSize(4,4));
   1.783 +	iGc->DrawLine(TPoint(0,0), TPoint(size.iWidth, size.iHeight));
   1.784 +	}
   1.785 +
   1.786 +
   1.787 +//
   1.788 +// CTAlphaRefWin
   1.789 +//
   1.790 +
   1.791 +CTAlphaRefWin::CTAlphaRefWin(TFixedArray<CTAlphaWindow*,5>& aAlphaWin)
   1.792 +: iAlphaWin(aAlphaWin)
   1.793 +	{}
   1.794 +
   1.795 +CTAlphaRefWin* CTAlphaRefWin::NewL(CTWinBase* aParent, TPoint aPos, TSize aSize, TFixedArray<CTAlphaWindow*,5>& aAlphaWin)
   1.796 +	{
   1.797 +	CTAlphaRefWin* theWin = new(ELeave) CTAlphaRefWin(aAlphaWin);
   1.798 +
   1.799 +	theWin->ConstructL(*aParent);
   1.800 +	theWin->SetExtL(aPos, aSize);
   1.801 +	theWin->AssignGC(*TheClient->iGc);
   1.802 +	theWin->BaseWin()->SetRequiredDisplayMode(EColor64K);
   1.803 +
   1.804 +	theWin->Activate();
   1.805 +	theWin->DrawNow();
   1.806 +
   1.807 +	return theWin;
   1.808 +	}
   1.809 +
   1.810 +void CTAlphaRefWin::Draw()
   1.811 +	{
   1.812 +	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.813 +	iGc->SetBrushColor(KRgbWhite);
   1.814 +	iGc->Clear();
   1.815 +
   1.816 +	// Note, the order of the windows in the array must correspond to their z-order
   1.817 +	for (TInt i=0; i<5; i++)
   1.818 +		DrawWindow(iAlphaWin[i], iAlphaWin[i]->Position());
   1.819 +	}
   1.820 +
   1.821 +void CTAlphaRefWin::DrawWindow(CTAlphaWindow* aWindow, TPoint aPos)
   1.822 +	{
   1.823 +	TInt drawState = aWindow->DrawState();
   1.824 +	if ( (drawState & EInvisible) || ! (drawState & EActive) )
   1.825 +		return;
   1.826 +
   1.827 +	TRgb colour = ColourFromDrawState(drawState);
   1.828 +	if (drawState & EOpaque)
   1.829 +		colour.SetAlpha(255);
   1.830 +	if (drawState & ETransparent)
   1.831 +		colour.SetAlpha(0);
   1.832 +	iGc->SetBrushColor(colour);
   1.833 +
   1.834 +	TPoint tl = aPos;
   1.835 +	TPoint br = tl + aWindow->Size();
   1.836 +	TRect rect(tl,br);
   1.837 +	iGc->Clear(rect);
   1.838 +
   1.839 +	TInt red = (drawState & ERed) ? 0 : 255;
   1.840 +	TInt green = (drawState & EGreen) ? 0 : 255;
   1.841 +	TInt blue = (drawState & EBlue) ? 0 : 255;
   1.842 +	colour = TRgb(red,green,blue);
   1.843 +
   1.844 +	iGc->SetClippingRect(rect);
   1.845 +
   1.846 +	TSize size = Size();
   1.847 +	iGc->SetPenColor(colour);
   1.848 +	iGc->SetPenSize(TSize(4,4));
   1.849 +	iGc->DrawLine(tl, br);
   1.850 +
   1.851 +	iGc->CancelClippingRect();
   1.852 +
   1.853 +	if (aWindow->iChild1)
   1.854 +		DrawWindow(aWindow->iChild1, aPos + aWindow->iChild1->Position() );
   1.855 +	if (aWindow->iChild2)
   1.856 +		DrawWindow(aWindow->iChild2, aPos + aWindow->iChild2->Position() );
   1.857 +	}
   1.858 +
   1.859 +
   1.860 +//
   1.861 +// Main test loop
   1.862 +//
   1.863 +void CTAlphaWin::RunTestCaseL(TInt /*aCurTestCase*/)
   1.864 +	{
   1.865 +	//User::After(TTimeIntervalMicroSeconds32(1000 * 1000));
   1.866 +	((CTAlphaWinStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
   1.867 +	switch (++iTest->iState)
   1.868 +		{
   1.869 +/**
   1.870 +
   1.871 +  @SYMTestCaseID GRAPHICS-WSERV-0278
   1.872 +
   1.873 +  @SYMDEF             DEF081259
   1.874 +
   1.875 +  @SYMPREQ 915
   1.876 +
   1.877 +  @SYMTestCaseDesc Semi-transparent drawing
   1.878 +
   1.879 +  @SYMTestPriority High
   1.880 +
   1.881 +  @SYMTestStatus Implemented
   1.882 +
   1.883 +  @SYMTestActions Use draw operations with semi-transparent pen or brush colours
   1.884 +
   1.885 +  @SYMTestExpectedResults Draw operations must do alpha blending
   1.886 +
   1.887 +*/
   1.888 +	case 1:
   1.889 +		{
   1.890 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0278"));
   1.891 +		if(TransparencySupportedL() == KErrNotSupported)
   1.892 +			{
   1.893 +			LOG_MESSAGE(_L("Test(1) complete - Transparency not supported\n"));
   1.894 +			TestComplete();
   1.895 +			break;
   1.896 +			}
   1.897 +		TDisplayMode mode = TheClient->iScreen->DisplayMode();
   1.898 +		if (mode < EColor64K)
   1.899 +			{
   1.900 +			LOG_MESSAGE(_L("Test(1) complete - Display mode < EColor64K\n"));
   1.901 +			TestComplete();
   1.902 +			break;
   1.903 +			}
   1.904 +		_LIT(KSemiTrans64K,"(1) Semi transparent drawing Color64K");
   1.905 +		iTest->LogSubTest(KSemiTrans64K);
   1.906 +		TestSemiTransparentDrawingL();
   1.907 +		break;
   1.908 +		}
   1.909 +		
   1.910 +/**
   1.911 +
   1.912 +  @SYMTestCaseID GRAPHICS-WSERV-0287
   1.913 +
   1.914 +  @SYMDEF             DEF081259
   1.915 +
   1.916 +  @SYMPREQ 915
   1.917 +
   1.918 +  @SYMTestCaseDesc Invisible. All windows are in EColor16MA display mode.
   1.919 +
   1.920 +  @SYMTestPriority High
   1.921 +
   1.922 +  @SYMTestStatus Implemented
   1.923 +
   1.924 +  @SYMTestActions Transparent alpha channel windows are made invisible and visible both in front and behind one another
   1.925 +
   1.926 +  @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
   1.927 +
   1.928 +*/
   1.929 +	case 2:
   1.930 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0287"));
   1.931 +		ConfigureDisplayModes(EColor16MA);
   1.932 +		if(TransparencySupportedL()==KErrNone)
   1.933 +			{
   1.934 +			_LIT(KInvisible16MA,"(2) Invisible Color16MA");
   1.935 +			iTest->LogSubTest(KInvisible16MA);
   1.936 +			TestInvisible();
   1.937 +			}
   1.938 +		break;
   1.939 +
   1.940 +/**
   1.941 +
   1.942 +  @SYMTestCaseID GRAPHICS-WSERV-0280
   1.943 +
   1.944 +  @SYMDEF             DEF081259
   1.945 +
   1.946 +  @SYMPREQ 915
   1.947 +
   1.948 +  @SYMTestCaseDesc Initial Configuration. All windows are in EColor64K display mode.
   1.949 +
   1.950 +  @SYMTestPriority High
   1.951 +
   1.952 +  @SYMTestStatus Implemented
   1.953 +
   1.954 +  @SYMTestActions Several windows are set to be transparent alpha channel, and given semi-transparent or transparent background colours
   1.955 +
   1.956 +  @SYMTestExpectedResults The transparent window configuration matches a reference drawing created using only alpha blending
   1.957 +
   1.958 +*/
   1.959 +	//Test 3 to 6 can't be run without transparency support
   1.960 +	case 3:
   1.961 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0280"));
   1.962 +		ConfigureDisplayModes(EColor64K);
   1.963 +		if(TransparencySupportedL()==KErrNone)
   1.964 +			{
   1.965 +			_LIT(KInitialConfiguration64K,"(3) Initial configuration Color64K");
   1.966 +			iTest->LogSubTest(KInitialConfiguration64K);
   1.967 +			TestInitialConfiguration();
   1.968 +			}
   1.969 +		break;
   1.970 +/**
   1.971 +
   1.972 +  @SYMTestCaseID GRAPHICS-WSERV-0281
   1.973 +
   1.974 +  @SYMDEF             DEF081259
   1.975 +
   1.976 +  @SYMPREQ 915
   1.977 +
   1.978 +  @SYMTestCaseDesc Move. All windows are in EColor64K display mode.
   1.979 +
   1.980 +  @SYMTestPriority High
   1.981 +
   1.982 +  @SYMTestStatus Implemented
   1.983 +
   1.984 +  @SYMTestActions Transparent alpha channel windows are moved both in front and behind one another
   1.985 +
   1.986 +  @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
   1.987 +
   1.988 +*/
   1.989 +	case 4:
   1.990 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0281"));
   1.991 +		if(TransparencySupportedL()==KErrNone)
   1.992 +			{
   1.993 +			_LIT(KMove64K,"(4) Move Color64K");
   1.994 +			iTest->LogSubTest(KMove64K);
   1.995 +			TestMove();
   1.996 +			}
   1.997 +		break;
   1.998 +/**
   1.999 +
  1.1000 +  @SYMTestCaseID GRAPHICS-WSERV-0282
  1.1001 +
  1.1002 +  @SYMDEF             DEF081259
  1.1003 +
  1.1004 +  @SYMPREQ 915
  1.1005 +
  1.1006 +  @SYMTestCaseDesc Redraw. All windows are in EColor64K display mode.
  1.1007 +
  1.1008 +  @SYMTestPriority High
  1.1009 +
  1.1010 +  @SYMTestStatus Implemented
  1.1011 +
  1.1012 +  @SYMTestActions Transparent alpha channel windows are redrawn both in front and behind one another
  1.1013 +
  1.1014 +  @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
  1.1015 +
  1.1016 +*/
  1.1017 +	case 5:
  1.1018 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0282"));
  1.1019 +		if(TransparencySupportedL()==KErrNone)
  1.1020 +			{
  1.1021 +			_LIT(KRedraw64K,"(5) Redraw Color64K");
  1.1022 +			iTest->LogSubTest(KRedraw64K);
  1.1023 +			TestRedraw();
  1.1024 +			}
  1.1025 +		break;
  1.1026 +/**
  1.1027 +
  1.1028 +  @SYMTestCaseID GRAPHICS-WSERV-0283-0001
  1.1029 +
  1.1030 +  @SYMDEF             DEF081259
  1.1031 +
  1.1032 +  @SYMPREQ 915
  1.1033 +
  1.1034 +  @SYMTestCaseDesc Invisible. All windows are in EColor64K display mode.
  1.1035 +
  1.1036 +  @SYMTestPriority High
  1.1037 +
  1.1038 +  @SYMTestStatus Implemented
  1.1039 +
  1.1040 +  @SYMTestActions Transparent alpha channel windows are made invisible and visible both in front and behind one another
  1.1041 +
  1.1042 +  @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
  1.1043 +
  1.1044 +*/
  1.1045 +	case 6:
  1.1046 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0283-0001"));
  1.1047 +		if(TransparencySupportedL()==KErrNone)
  1.1048 +			{
  1.1049 +			_LIT(KInvisible64K,"(6) Invisible Color64K");
  1.1050 +			iTest->LogSubTest(KInvisible64K);
  1.1051 +			TestInvisible();
  1.1052 +			}
  1.1053 +		break;
  1.1054 +/**
  1.1055 +
  1.1056 +  @SYMTestCaseID GRAPHICS-WSERV-0283-0002
  1.1057 +
  1.1058 +  @SYMDEF             DEF081259
  1.1059 +
  1.1060 +  @SYMPREQ 915
  1.1061 +
  1.1062 +  @SYMTestCaseDesc Children. All windows are in EColor64K display mode.
  1.1063 +
  1.1064 +  @SYMTestPriority High
  1.1065 +
  1.1066 +  @SYMTestStatus Implemented
  1.1067 +
  1.1068 +  @SYMTestActions Transparent alpha channel windows are given child windows, both transparent and non-transparent,
  1.1069 + 			    	and are then moved, redrawn, set visible or invisible both in front and behind one another
  1.1070 +
  1.1071 +  @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
  1.1072 +
  1.1073 +*/
  1.1074 +	case 7:
  1.1075 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0283-0002"));
  1.1076 +		_LIT(KChildren64K,"(7)Children Color64K");
  1.1077 +		iTest->LogSubTest(KChildren64K);
  1.1078 +		TestChildrenL();
  1.1079 +		break;
  1.1080 +/**
  1.1081 +
  1.1082 +  @SYMTestCaseID GRAPHICS-WSERV-0356
  1.1083 +
  1.1084 +  @SYMDEF             DEF081259
  1.1085 +
  1.1086 +  @SYMPREQ 915
  1.1087 +
  1.1088 +  @SYMTestCaseDesc Initial Configuration. All windows are in EColor64k Dispaly Mode
  1.1089 +
  1.1090 +  @SYMTestPriority High
  1.1091 +
  1.1092 +  @SYMTestStatus Implemented
  1.1093 +
  1.1094 +  @SYMTestActions Tests Anti-aliasing of text
  1.1095 +
  1.1096 +  @SYMTestExpectedResults Anti-alisaing should behave correctly
  1.1097 +
  1.1098 +*/
  1.1099 +	case 8:
  1.1100 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0356"));
  1.1101 +		_LIT(KAntiAliasedText64K,"(8) AntiAliasedText DEF082251 Color64K");
  1.1102 +		iTest->LogSubTest(KAntiAliasedText64K);
  1.1103 +		TestAntiAliasedTextTransparentL();
  1.1104 +		break;
  1.1105 +
  1.1106 +/**
  1.1107 +
  1.1108 +  @SYMTestCaseID GRAPHICS-WSERV-0284
  1.1109 +
  1.1110 +  @SYMDEF             DEF081259
  1.1111 +
  1.1112 +  @SYMPREQ 915
  1.1113 +
  1.1114 +  @SYMTestCaseDesc Initial Configuration. All windows are in EColor16MA display mode.
  1.1115 +
  1.1116 +  @SYMTestPriority High
  1.1117 +
  1.1118 +  @SYMTestStatus Implemented
  1.1119 +
  1.1120 +  @SYMTestActions Several windows are set to be transparent alpha channel, and given semi-transparent or transparent background colours
  1.1121 +
  1.1122 +  @SYMTestExpectedResults The transparent window configuration matches a reference drawing created using only alpha blending
  1.1123 +
  1.1124 +*/
  1.1125 +	case 9:
  1.1126 +		{ 
  1.1127 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0284"));
  1.1128 +		ConfigureDisplayModes(EColor16MA);
  1.1129 +		TDisplayMode mode1 = TheClient->iScreen->DisplayMode();
  1.1130 +	 	_LIT(KInitialConfiguration16MA,"(9)Initial configuration Color16MA");
  1.1131 +		iTest->LogSubTest(KInitialConfiguration16MA);
  1.1132 +		TestInitialConfiguration();
  1.1133 +		break;
  1.1134 +		}
  1.1135 +/**
  1.1136 +
  1.1137 +  @SYMTestCaseID GRAPHICS-WSERV-0285
  1.1138 +
  1.1139 +  @SYMDEF             DEF081259
  1.1140 +
  1.1141 +  @SYMPREQ 915
  1.1142 +
  1.1143 +  @SYMTestCaseDesc Move. All windows are in EColor16MA display mode.
  1.1144 +
  1.1145 +  @SYMTestPriority High
  1.1146 +
  1.1147 +  @SYMTestStatus Implemented
  1.1148 +
  1.1149 +  @SYMTestActions Transparent alpha channel windows are moved both in front and behind one another
  1.1150 +
  1.1151 +  @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
  1.1152 +
  1.1153 +*/
  1.1154 +	case 10:
  1.1155 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0285"));
  1.1156 +		_LIT(KMove16MA,"(10)Move Color16MA");
  1.1157 +		iTest->LogSubTest(KMove16MA);
  1.1158 +		TestMove();
  1.1159 +		break;
  1.1160 +/**
  1.1161 +
  1.1162 +  @SYMTestCaseID GRAPHICS-WSERV-0286
  1.1163 +
  1.1164 +  @SYMDEF             DEF081259
  1.1165 +
  1.1166 +  @SYMPREQ 915
  1.1167 +
  1.1168 +  @SYMTestCaseDesc Redraw. All windows are in EColor16MA display mode.
  1.1169 +
  1.1170 +  @SYMTestPriority High
  1.1171 +
  1.1172 +  @SYMTestStatus Implemented
  1.1173 +
  1.1174 +  @SYMTestActions Transparent alpha channel windows are redrawn both in front and behind one another
  1.1175 +
  1.1176 +  @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
  1.1177 +
  1.1178 +*/
  1.1179 +	case 11:
  1.1180 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0286"));
  1.1181 +		_LIT(KRedraw16MA,"(11)Redraw Color16MA");
  1.1182 +		iTest->LogSubTest(KRedraw16MA);
  1.1183 +		TestRedraw();
  1.1184 +		break;
  1.1185 +		
  1.1186 +/**
  1.1187 +
  1.1188 +  @SYMTestCaseID GRAPHICS-WSERV-0279
  1.1189 +
  1.1190 +  @SYMDEF             DEF081259
  1.1191 +
  1.1192 +  @SYMPREQ 915
  1.1193 +
  1.1194 +  @SYMTestCaseDesc Transparent drawing
  1.1195 +
  1.1196 +  @SYMTestPriority High
  1.1197 +
  1.1198 +  @SYMTestStatus Implemented
  1.1199 +
  1.1200 +  @SYMTestActions Use draw operations with transparent pen or brush colours
  1.1201 +
  1.1202 +  @SYMTestExpectedResults Draw operations with transparent pen or brush colours should leave the destination unchanged
  1.1203 +
  1.1204 +*/
  1.1205 +
  1.1206 +	case 12:
  1.1207 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0279"));
  1.1208 +		ConfigureDisplayModes(EColor64K);
  1.1209 +		_LIT(KTrans64K,"(12) Transparent drawing Color64K");
  1.1210 +		iTest->LogSubTest(KTrans64K);
  1.1211 +		TestTransparentDrawingL();
  1.1212 +		break;
  1.1213 +
  1.1214 +
  1.1215 +/**
  1.1216 +
  1.1217 +  @SYMTestCaseID GRAPHICS-WSERV-0288
  1.1218 +
  1.1219 +  @SYMDEF             DEF081259
  1.1220 +
  1.1221 +  @SYMPREQ 915
  1.1222 +
  1.1223 +  @SYMTestCaseDesc Children. All windows are in EColor16MA display mode.
  1.1224 +
  1.1225 +  @SYMTestPriority High
  1.1226 +
  1.1227 +  @SYMTestStatus Implemented
  1.1228 +
  1.1229 +  @SYMTestActions Transparent alpha channel windows are given child windows, both transparent and non-transparent,
  1.1230 + 			    	and are then moved, redrawn, set visible or invisible both in front and behind one another
  1.1231 +
  1.1232 +  @SYMTestExpectedResults The windows are redrawn correctly, as compared to a reference drawing
  1.1233 +
  1.1234 +*/
  1.1235 +	case 13:
  1.1236 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0288"));
  1.1237 +		_LIT(KChildren16MA,"(13) Children Color16MA");
  1.1238 +		iTest->LogSubTest(KChildren16MA);
  1.1239 +		TestChildrenL();
  1.1240 +		break;
  1.1241 +/**
  1.1242 +
  1.1243 +  @SYMTestCaseID GRAPHICS-WSERV-0357
  1.1244 +
  1.1245 +  @SYMDEF             DEF081259
  1.1246 +
  1.1247 +  @SYMPREQ 915
  1.1248 +
  1.1249 +  @SYMTestCaseDesc Initial Configuration. All windows are in EColor16MA Dispaly Mode
  1.1250 +
  1.1251 +  @SYMTestPriority High
  1.1252 +
  1.1253 +  @SYMTestStatus Implemented
  1.1254 +
  1.1255 +  @SYMTestActions Tests Anti-aliasing of text
  1.1256 +
  1.1257 +  @SYMTestExpectedResults Anti-alisaing should behave correctly
  1.1258 +
  1.1259 +*/
  1.1260 +	case 14:
  1.1261 +		((CTAlphaWinStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0357"));
  1.1262 +		_LIT(KAntiAliasedText16MA,"(14) AntiAliasedText DEF082251 Color16MA");
  1.1263 +		iTest->LogSubTest(KAntiAliasedText16MA);
  1.1264 +		TestAntiAliasedTextTransparentL();
  1.1265 +		break;
  1.1266 +	default:
  1.1267 +		((CTAlphaWinStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
  1.1268 +		((CTAlphaWinStep*)iStep)->CloseTMSGraphicsStep();
  1.1269 +		TestComplete();
  1.1270 +		break;
  1.1271 +		}
  1.1272 +	((CTAlphaWinStep*)iStep)->RecordTestResultL();
  1.1273 +	}
  1.1274 +
  1.1275 +__WS_CONSTRUCT_STEP__(AlphaWin)
  1.1276 +