os/graphics/graphicsdeviceinterface/directgdi/test/tdrawshapes.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#include "tdrawshapes.h"
sl@0
    17
sl@0
    18
#include <e32math.h>
sl@0
    19
sl@0
    20
sl@0
    21
CTDrawShapes::CTDrawShapes()
sl@0
    22
	{
sl@0
    23
	SetTestStepName(KTDirectGdiDrawShapeStep);
sl@0
    24
	}
sl@0
    25
sl@0
    26
CTDrawShapes::~CTDrawShapes()
sl@0
    27
	{
sl@0
    28
	}
sl@0
    29
sl@0
    30
/**
sl@0
    31
@SYMTestCaseID
sl@0
    32
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0001
sl@0
    33
sl@0
    34
@SYMPREQ 
sl@0
    35
	PREQ39
sl@0
    36
sl@0
    37
@SYMREQ
sl@0
    38
	REQ9195
sl@0
    39
	REQ9201 
sl@0
    40
	REQ9202 
sl@0
    41
	REQ9222 
sl@0
    42
	REQ9223 
sl@0
    43
	REQ9236 
sl@0
    44
	REQ9237
sl@0
    45
sl@0
    46
@SYMTestCaseDesc
sl@0
    47
	Test shape drawing with basic parameters.
sl@0
    48
sl@0
    49
@SYMTestStatus
sl@0
    50
	Implemented
sl@0
    51
sl@0
    52
@SYMTestPriority
sl@0
    53
	Critical
sl@0
    54
sl@0
    55
@SYMTestActions
sl@0
    56
	Test various shape drawing methods:
sl@0
    57
	void Plot(const TPoint& aPoint)
sl@0
    58
		- Draw points on the destination surface in various colours (use colours from
sl@0
    59
		COLOR_TABLE), increasing the distance between the points.
sl@0
    60
	void DrawLine(const TPoint& aStart, const TPoint& aEnd)
sl@0
    61
		- Draw lines with various colours (use colours from COLOR_TABLE).
sl@0
    62
		- Draw line from top-left to bottom-right corner. Move starting point to the right
sl@0
    63
		and ending point to the left and draw again. Repeat increasing the distance between
sl@0
    64
		the previous and next starting and ending points, until reaching a position outside
sl@0
    65
		the destination surface.
sl@0
    66
		- Draw line from top-left to bottom-right corner. Move starting point down and ending
sl@0
    67
		point up and draw again. Repeat increasing the distance between the previous and next
sl@0
    68
		starting and ending points, until reaching a position outside the destination surface.
sl@0
    69
	void DrawLineTo(const TPoint& aPoint)
sl@0
    70
		- Draw lines with various colours (use colours from COLOR_TABLE).
sl@0
    71
		- Draw line from top-left corner to the bottom of the drawing area. Now draw a line
sl@0
    72
		in opposite direction, moving the end point a little to the right. Repeat, increasing
sl@0
    73
		the distance, by which the end point is moved right, until reaching a position outside
sl@0
    74
		the destination surface.
sl@0
    75
	void DrawLineBy(const TPoint& aVector)
sl@0
    76
		- Draw lines with various colours (use colours from COLOR_TABLE).
sl@0
    77
		- Draw line from top-left corner to the right end of the drawing area. Now draw a line
sl@0
    78
		in opposite direction, moving the end point a little down. Repeat, increasing the distance,
sl@0
    79
		by which the end point is moved down, until reaching a position outside the destination surface.
sl@0
    80
	void DrawRect(const TRect& aRect)
sl@0
    81
		- Draw empty and filled rectangles.
sl@0
    82
		- Draw rectangles with various colours (pen & brush colours; use colours from COLOR_TABLE).
sl@0
    83
		- Draw rectangle with size of the whole drawing area, shrink it and repeat until rectangle
sl@0
    84
		size reaches 0.
sl@0
    85
	void DrawRoundRect(const TRect& aRect, const TSize& aEllipse)
sl@0
    86
		- Draw empty and filled rectangles.
sl@0
    87
		- Draw rectangles with various colours (pen & brush colours; use colours from COLOR_TABLE).
sl@0
    88
		- Draw rectangle with size of the whole drawing area, shrink it, increase  the round corners
sl@0
    89
		size and repeat until rectangle size reaches 0.
sl@0
    90
	void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd)
sl@0
    91
		- Draw arcs with various colours (use colours from COLOR_TABLE).
sl@0
    92
		- Draw an arc within the rectangle size of entire drawing area.
sl@0
    93
		- Shrink the rectangle.
sl@0
    94
		- Repeat until rectangle size reaches zero, move arc's start and end points.
sl@0
    95
	void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd)
sl@0
    96
		- Draw empty and filled pies.
sl@0
    97
		- Draw pies with various colours (pen & brush colours; use colours from COLOR_TABLE).
sl@0
    98
		- Draw a pie within the rectangle size of entire drawing area.
sl@0
    99
		- Shrink the rectangle.
sl@0
   100
		- Repeat until rectangle size reaches zero, move pie's start and end points.
sl@0
   101
	void DrawPolyLine(const TArray<TPoint>& aPointList)
sl@0
   102
	void DrawPolyLineNoEndPoint(const TArray<TPoint>& aPointList)
sl@0
   103
		- Draw a poly line in the target area, constructed from a large number of points.
sl@0
   104
	void DrawPolygon(const TArray<TPoint>& aPointList, CGraphicsContext::TFillRule aFillRule=CGraphicsContext::EAlternate)
sl@0
   105
		- Draw a polygon on the target area, constructed from a large number of points.
sl@0
   106
	void DrawEllipse(const TRect& aRect)
sl@0
   107
		- Draw empty and filled ellipses.
sl@0
   108
		- Draw ellipses with various colours (pen & brush colours; use colours from COLOR_TABLE).
sl@0
   109
		- Use rectangle (aRect) with size of the whole drawing area, shrink it and repeat until
sl@0
   110
		rectangle size reaches zero.
sl@0
   111
sl@0
   112
@SYMTestExpectedResults
sl@0
   113
	All graphic operations completed successfully without errors. Individual shapes should
sl@0
   114
	be drawn in the target area. Valid bitmap should be created. This bitmap should be
sl@0
   115
	the same as a reference one.
sl@0
   116
*/
sl@0
   117
void CTDrawShapes::TestBasicDrawShapeL()
sl@0
   118
	{
sl@0
   119
	_LIT(KTestName, "ShapeDrawing-Basic"); 
sl@0
   120
	if(!iRunningOomTests)
sl@0
   121
		{
sl@0
   122
		INFO_PRINTF1(KTestName);
sl@0
   123
		}
sl@0
   124
sl@0
   125
	ResetGc();
sl@0
   126
sl@0
   127
	TSize size(iGdiTarget->SizeInPixels().iWidth/4,
sl@0
   128
			   iGdiTarget->SizeInPixels().iHeight/4);
sl@0
   129
sl@0
   130
	for(TInt i=0; i<17; i++)
sl@0
   131
		{
sl@0
   132
		TPoint pos(size.iWidth*(i%4), size.iHeight*(i/4));
sl@0
   133
sl@0
   134
		iGc->Reset();
sl@0
   135
sl@0
   136
		switch(i)
sl@0
   137
			{
sl@0
   138
			case 0: // void Plot(const TPoint& aPoint)
sl@0
   139
				{
sl@0
   140
				TInt step = 0;
sl@0
   141
				for(TInt y=0; y<size.iHeight; y+=step)
sl@0
   142
					{
sl@0
   143
					for(TInt x=0; x<size.iWidth; x+=step)
sl@0
   144
						{
sl@0
   145
						iGc->SetPenColor(KColor16Table[step%16]);
sl@0
   146
						iGc->SetPenStyle(DirectGdi::ENullPen);
sl@0
   147
						iGc->Plot(TPoint(x, y)+pos);
sl@0
   148
						TESTNOERRORL(iGc->GetError());
sl@0
   149
						iGc->SetPenStyle(DirectGdi::ESolidPen);
sl@0
   150
						for(TInt penSize = 0; penSize <= 2; penSize++)
sl@0
   151
							{
sl@0
   152
							iGc->SetPenSize(TSize(penSize,penSize));
sl@0
   153
							iGc->Plot(TPoint(x, y)+pos);
sl@0
   154
							TESTNOERRORL(iGc->GetError());
sl@0
   155
							}						
sl@0
   156
						step++;
sl@0
   157
						}
sl@0
   158
					}
sl@0
   159
				break;
sl@0
   160
				}
sl@0
   161
sl@0
   162
			case 1: // void DrawLine(const TPoint& aStart, const TPoint& aEnd)
sl@0
   163
				{
sl@0
   164
				TInt step = 0;
sl@0
   165
				for(TInt x1=0,x2=size.iWidth-1; x1<size.iWidth; x1+=step,x2-=step)
sl@0
   166
					{
sl@0
   167
					iGc->SetPenColor(KColor16Table[step%16]);
sl@0
   168
					iGc->DrawLine(TPoint(x1, 0)+pos, TPoint(x2, size.iHeight-1)+pos);
sl@0
   169
					TESTNOERRORL(iGc->GetError());
sl@0
   170
					step++;
sl@0
   171
					}
sl@0
   172
				
sl@0
   173
				step = 0;
sl@0
   174
				for(TInt y1=0,y2=size.iHeight-1; y1<size.iHeight; y1+=step,y2-=step)
sl@0
   175
					{
sl@0
   176
					iGc->SetPenColor(KColor16Table[step%16]);
sl@0
   177
					iGc->DrawLine(TPoint(0, y1)+pos, TPoint(size.iWidth-1, y2)+pos);
sl@0
   178
					TESTNOERRORL(iGc->GetError());
sl@0
   179
					step++;
sl@0
   180
					}
sl@0
   181
sl@0
   182
				break;
sl@0
   183
				}
sl@0
   184
sl@0
   185
			case 2: // void DrawLineTo(const TPoint& aPoint), void DrawLineBy(const TPoint& aVector)
sl@0
   186
				{
sl@0
   187
				iGc->MoveTo(pos);
sl@0
   188
				for(TInt x1=1,a=1,s=1; x1<size.iWidth; a++,x1+=a,s=-s)
sl@0
   189
					{
sl@0
   190
					iGc->SetPenColor(KColor16Table[a%16]);
sl@0
   191
					iGc->DrawLineTo(TPoint(x1, (s>0)*(size.iHeight-1))+pos);
sl@0
   192
					TESTNOERRORL(iGc->GetError());
sl@0
   193
					}
sl@0
   194
				
sl@0
   195
				iGc->MoveTo(pos);
sl@0
   196
				for(TInt y1=1,a=1,s=1; y1<size.iHeight; a++,y1+=a,s=-s)
sl@0
   197
					{
sl@0
   198
					iGc->SetPenColor(KColor16Table[a%16]);
sl@0
   199
					iGc->DrawLineBy(TPoint(s*(size.iWidth-1), a));
sl@0
   200
					TESTNOERRORL(iGc->GetError());
sl@0
   201
					}
sl@0
   202
sl@0
   203
				break;
sl@0
   204
				}
sl@0
   205
sl@0
   206
			case 4: // void DrawRect(const TRect& aRect), filled
sl@0
   207
				{
sl@0
   208
				iGc->SetBrushStyle(DirectGdi::ESolidBrush);
sl@0
   209
				}
sl@0
   210
			case 3: // void DrawRect(const TRect& aRect)
sl@0
   211
				{
sl@0
   212
				TRect rect(pos, size);
sl@0
   213
				for(TInt a=0; (rect.Size().iWidth>0) && (rect.Size().iHeight>0); a++,rect.Shrink(3, 3))
sl@0
   214
					{
sl@0
   215
					iGc->SetPenColor(KColor16Table[a%16]);
sl@0
   216
					iGc->SetBrushColor(KColor16Table[(a+2)%16]);
sl@0
   217
					iGc->DrawRect(rect);
sl@0
   218
					TESTNOERRORL(iGc->GetError());
sl@0
   219
					}
sl@0
   220
				break;
sl@0
   221
				}
sl@0
   222
			case 6: // void DrawRoundRect(const TRect& aRect, const TSize& aEllipse), filled
sl@0
   223
				{
sl@0
   224
				iGc->SetBrushStyle(DirectGdi::ESolidBrush);
sl@0
   225
				}
sl@0
   226
			case 5: // void DrawRoundRect(const TRect& aRect, const TSize& aEllipse)
sl@0
   227
				{
sl@0
   228
				TRect rect(pos, size);
sl@0
   229
				TSize csize(1, 1);
sl@0
   230
				for(TInt a=0; (rect.Size().iWidth>0) && (rect.Size().iHeight>0); a++,rect.Shrink(5, 5),csize+=TSize(2, 2))
sl@0
   231
					{
sl@0
   232
					iGc->SetPenColor(KColor16Table[a%16]);
sl@0
   233
					iGc->SetBrushColor(KColor16Table[(a+2)%16]);
sl@0
   234
					for(TInt penSize = 0; penSize <= 1; penSize++)
sl@0
   235
						{
sl@0
   236
						iGc->SetPenSize(TSize(penSize,penSize));
sl@0
   237
						iGc->SetPenStyle(DirectGdi::ENullPen);
sl@0
   238
						iGc->DrawRoundRect(rect, csize);
sl@0
   239
						TESTNOERRORL(iGc->GetError());
sl@0
   240
						iGc->SetPenStyle(DirectGdi::ESolidPen);
sl@0
   241
						iGc->DrawRoundRect(rect, csize);
sl@0
   242
						TESTNOERRORL(iGc->GetError());
sl@0
   243
						iGc->SetPenStyle(DirectGdi::EDottedPen);
sl@0
   244
						iGc->DrawRoundRect(rect, csize);
sl@0
   245
						TESTNOERRORL(iGc->GetError());
sl@0
   246
						}
sl@0
   247
					}
sl@0
   248
				break;
sl@0
   249
				}
sl@0
   250
sl@0
   251
			case 7: // void DrawArc(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd)
sl@0
   252
				{
sl@0
   253
				TRect rect(pos, size);
sl@0
   254
				TPoint pos2(pos);
sl@0
   255
				pos2 += TPoint(size.iWidth/2, size.iHeight/2); // center
sl@0
   256
				TReal start = KPiBy2;
sl@0
   257
				TReal end = 0.0;
sl@0
   258
				for(TInt a=0; (rect.Size().iWidth>0) && (rect.Size().iHeight>0); a++,rect.Shrink(3, 3),start+=0.3,end+=0.2)
sl@0
   259
					{
sl@0
   260
					TReal ss;
sl@0
   261
					TReal cc;
sl@0
   262
					Math::Sin(ss, start);
sl@0
   263
					Math::Cos(cc, start);
sl@0
   264
					TInt32 startX;
sl@0
   265
					TInt32 startY;
sl@0
   266
					Math::Int(startX, cc*100);
sl@0
   267
					Math::Int(startY, ss*100);
sl@0
   268
					Math::Sin(ss, end);
sl@0
   269
					Math::Cos(cc, end);
sl@0
   270
					TInt32 endX;
sl@0
   271
					TInt32 endY;
sl@0
   272
					Math::Int(endX, cc*100);
sl@0
   273
					Math::Int(endY, ss*100);
sl@0
   274
					
sl@0
   275
					iGc->SetPenColor(KColor16Table[a%16]);
sl@0
   276
					iGc->DrawArc(rect, TPoint(startX, startY)+pos2, TPoint(endX, endY)+pos2);
sl@0
   277
					TESTNOERRORL(iGc->GetError());
sl@0
   278
					}
sl@0
   279
sl@0
   280
				break;
sl@0
   281
				}
sl@0
   282
sl@0
   283
			case 9: // void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd), filled
sl@0
   284
					{
sl@0
   285
					iGc->SetBrushStyle(DirectGdi::ESolidBrush);
sl@0
   286
					}
sl@0
   287
			case 8: // void DrawPie(const TRect& aRect, const TPoint& aStart, const TPoint& aEnd)
sl@0
   288
				{
sl@0
   289
				TRect rect(pos, size);
sl@0
   290
				TPoint pos2(pos);
sl@0
   291
				pos2 += TPoint(size.iWidth/2, size.iHeight/2); // center
sl@0
   292
				TReal start = 0.0;
sl@0
   293
				TReal end = 0.1;
sl@0
   294
				for(TInt a=0; (rect.Size().iWidth>0) && (rect.Size().iHeight>0); a++,rect.Shrink(4, 4),start+=end,end+=0.04)
sl@0
   295
					{
sl@0
   296
					TReal ss;
sl@0
   297
					TReal cc;
sl@0
   298
					Math::Sin(ss, start+end);
sl@0
   299
					Math::Cos(cc, start+end);
sl@0
   300
					TInt32 startX;
sl@0
   301
					TInt32 startY;
sl@0
   302
					Math::Int(startX, cc*100);
sl@0
   303
					Math::Int(startY, ss*100);
sl@0
   304
					Math::Sin(ss, start);
sl@0
   305
					Math::Cos(cc, start);
sl@0
   306
					TInt32 endX;
sl@0
   307
					TInt32 endY;
sl@0
   308
					Math::Int(endX, cc*100);
sl@0
   309
					Math::Int(endY, ss*100);
sl@0
   310
					
sl@0
   311
					iGc->SetPenColor(KColor16Table[a%16]);
sl@0
   312
					iGc->SetBrushColor(KColor16Table[(a+2)%16]);
sl@0
   313
					iGc->DrawPie(rect, TPoint(startX, startY)+pos2, TPoint(endX, endY)+pos2);
sl@0
   314
					TESTNOERRORL(iGc->GetError());
sl@0
   315
					}
sl@0
   316
sl@0
   317
				break;
sl@0
   318
				}
sl@0
   319
sl@0
   320
			case 10: // void DrawPolyLine(const TArray<TPoint>* aPointList)
sl@0
   321
			case 11: // void DrawPolyLineNoEndPoint(const TArray<TPoint>* aPointList)
sl@0
   322
				{
sl@0
   323
				TInt numPoints = 60;
sl@0
   324
				CArrayFixFlat<TPoint> *array = new (ELeave)CArrayFixFlat<TPoint>(numPoints);
sl@0
   325
				CleanupStack::PushL(array);
sl@0
   326
				TPoint pos2(pos);
sl@0
   327
				pos2 += TPoint(size.iWidth/2, size.iHeight/2); // center
sl@0
   328
				TReal angle = 0.0;
sl@0
   329
				for(TInt r=numPoints; r>0; r--,angle+=0.47)
sl@0
   330
					{
sl@0
   331
					TReal ss;
sl@0
   332
					TReal cc;
sl@0
   333
					Math::Sin(ss, angle);
sl@0
   334
					Math::Cos(cc, angle);
sl@0
   335
					TInt32 x;
sl@0
   336
					TInt32 y;
sl@0
   337
					Math::Int(x, cc*r);
sl@0
   338
					Math::Int(y, ss*r);
sl@0
   339
sl@0
   340
					array->AppendL(TPoint(x, y)+pos2);
sl@0
   341
					}
sl@0
   342
sl@0
   343
				if(i == 10)
sl@0
   344
					{
sl@0
   345
					for(TInt penSize = 0; penSize <= 1; penSize++)
sl@0
   346
						{
sl@0
   347
						iGc->SetPenSize(TSize(penSize,penSize));
sl@0
   348
						iGc->DrawPolyLine(*array);
sl@0
   349
						}
sl@0
   350
					}
sl@0
   351
				else //if(i == 11)
sl@0
   352
					{
sl@0
   353
					iGc->DrawPolyLineNoEndPoint(*array);
sl@0
   354
					}
sl@0
   355
				TESTNOERRORL(iGc->GetError());
sl@0
   356
				CleanupStack::PopAndDestroy(array);
sl@0
   357
sl@0
   358
				break;
sl@0
   359
				}
sl@0
   360
sl@0
   361
			case 13:// TInt DrawPolygon(const TArray<TPoint>* aPointList, CGraphicsContext::TFillRule aFillRule=CGraphicsContext::EAlternate), filled
sl@0
   362
					{
sl@0
   363
					iGc->SetBrushStyle(DirectGdi::ESolidBrush);
sl@0
   364
					iGc->SetBrushColor(KColor16Table[1]);
sl@0
   365
					}
sl@0
   366
			case 12:// TInt DrawPolygon(const TArray<TPoint>* aPointList, CGraphicsContext::TFillRule aFillRule=CGraphicsContext::EAlternate)
sl@0
   367
				{
sl@0
   368
				TInt numPoints = 20;
sl@0
   369
				CArrayFixFlat<TPoint> *array = new (ELeave)CArrayFixFlat<TPoint>(numPoints);
sl@0
   370
				CleanupStack::PushL(array);
sl@0
   371
				TPoint pos2(pos);
sl@0
   372
				pos2 += TPoint(size.iWidth/2, size.iHeight/2); // center
sl@0
   373
				TReal angle = 0.0;
sl@0
   374
				for(TInt r=60; r>0; r-=3,angle+=0.47)
sl@0
   375
					{
sl@0
   376
					TReal ss;
sl@0
   377
					TReal cc;
sl@0
   378
					Math::Sin(ss, angle);
sl@0
   379
					Math::Cos(cc, angle);
sl@0
   380
					TInt32 x;
sl@0
   381
					TInt32 y;
sl@0
   382
					Math::Int(x, cc*r);
sl@0
   383
					Math::Int(y, ss*r);
sl@0
   384
sl@0
   385
					array->AppendL(TPoint(x, y)+pos2);
sl@0
   386
					}
sl@0
   387
sl@0
   388
				iGc->DrawPolygon(*array, DirectGdi::EAlternate);
sl@0
   389
				TESTNOERRORL(iGc->GetError());
sl@0
   390
sl@0
   391
				CleanupStack::PopAndDestroy(array);
sl@0
   392
				
sl@0
   393
				break;
sl@0
   394
				}
sl@0
   395
sl@0
   396
			case 15: // void DrawEllipse(const TRect& aRect), filled
sl@0
   397
				{
sl@0
   398
				iGc->SetBrushStyle(DirectGdi::ESolidBrush);
sl@0
   399
				}
sl@0
   400
			case 14: // void DrawEllipse(const TRect& aRect)
sl@0
   401
				{
sl@0
   402
				TRect rect(pos, size);
sl@0
   403
				for(TInt a=0; (rect.Size().iWidth>0) && (rect.Size().iHeight>0); a++,rect.Shrink(3, 5))
sl@0
   404
					{
sl@0
   405
					iGc->SetPenColor(KColor16Table[a%16]);
sl@0
   406
					iGc->SetBrushColor(KColor16Table[(a+2)%16]);
sl@0
   407
					iGc->DrawEllipse(rect);
sl@0
   408
					TESTNOERRORL(iGc->GetError());
sl@0
   409
					}
sl@0
   410
sl@0
   411
				break;
sl@0
   412
				}
sl@0
   413
			}
sl@0
   414
sl@0
   415
		TESTNOERRORL(iGc->GetError());
sl@0
   416
		}
sl@0
   417
sl@0
   418
	TESTNOERROR(WriteTargetOutput(iTestParams, KTestName()));
sl@0
   419
	}
sl@0
   420
sl@0
   421
sl@0
   422
/**
sl@0
   423
@SYMTestCaseID
sl@0
   424
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0002
sl@0
   425
sl@0
   426
@SYMPREQ 
sl@0
   427
	PREQ39
sl@0
   428
sl@0
   429
@SYMREQ
sl@0
   430
	REQ9195
sl@0
   431
	REQ9201 
sl@0
   432
	REQ9202 
sl@0
   433
	REQ9222 
sl@0
   434
	REQ9223 
sl@0
   435
	REQ9236 
sl@0
   436
	REQ9237
sl@0
   437
sl@0
   438
@SYMTestCaseDesc
sl@0
   439
	Test line drawing with basic parameters.
sl@0
   440
sl@0
   441
@SYMTestStatus
sl@0
   442
	Implemented
sl@0
   443
sl@0
   444
@SYMTestPriority
sl@0
   445
	Critical
sl@0
   446
sl@0
   447
@SYMTestActions
sl@0
   448
	Set default pen.
sl@0
   449
		- Draw lines in all directions.
sl@0
   450
		- Draw lines starting or/and ending outside the target surface.		
sl@0
   451
	Call functions with valid parameters.
sl@0
   452
	void DrawLine(const TPoint& aStart, const TPoint& aEnd)
sl@0
   453
		The test is implemented the following way: lines will be drawn from a little
sl@0
   454
		distance from the centre (to avoid lines overlapping) to a point outside of the surface
sl@0
   455
		(testing surface boundary clipping). The next line will be drawn in opposite direction
sl@0
   456
		(from outside to the centre) at a slightly incremented angle. 
sl@0
   457
	void DrawLineBy(const TPoint& aVector)
sl@0
   458
		Test for DrawLineBy() is implemented in a similar way, with checking the continuity
sl@0
   459
		of line drawing (drawing the next line from the end of the previous one).
sl@0
   460
	void DrawLineTo(const TPoint& aPoint)
sl@0
   461
		Test for DrawLineTo() is implemented in a similar way, with checking the continuity
sl@0
   462
		of line drawing (drawing the next line from the end of the previous one).
sl@0
   463
		
sl@0
   464
@SYMTestExpectedResults
sl@0
   465
	Valid bitmap should be created. This bitmap shall be compared to a reference bitmap.
sl@0
   466
*/
sl@0
   467
void CTDrawShapes::TestDrawLineL(TDrawShapeAPI aApi)
sl@0
   468
	{
sl@0
   469
	_LIT(KDrawLine, "ShapeDrawing-DrawLine");
sl@0
   470
	_LIT(KDrawLineTo, "ShapeDrawing-DrawLineTo");
sl@0
   471
	_LIT(KDrawLineBy, "ShapeDrawing-DrawLineBy");
sl@0
   472
sl@0
   473
	TBuf<30> testName;
sl@0
   474
	if(aApi == EDrawLine)
sl@0
   475
		testName = KDrawLine();
sl@0
   476
	else if(aApi == EDrawLineTo)
sl@0
   477
		testName = KDrawLineTo();
sl@0
   478
	else if(aApi == EDrawLineBy)
sl@0
   479
		testName = KDrawLineBy();
sl@0
   480
	else
sl@0
   481
		ASSERT(EFalse); // test not supported for shapes other than those above
sl@0
   482
sl@0
   483
	if(!iRunningOomTests)
sl@0
   484
		{
sl@0
   485
		INFO_PRINTF1(testName);
sl@0
   486
		}
sl@0
   487
	
sl@0
   488
	ResetGc();
sl@0
   489
sl@0
   490
	TPoint center(iGdiTarget->SizeInPixels().iWidth/2,
sl@0
   491
			iGdiTarget->SizeInPixels().iHeight/2);
sl@0
   492
sl@0
   493
	TInt steps = 180;
sl@0
   494
	TReal radius1 = 400.0;
sl@0
   495
	TReal radius2 = 70.0;
sl@0
   496
sl@0
   497
	TPoint pp;
sl@0
   498
sl@0
   499
	if(aApi != EDrawLine)
sl@0
   500
		{
sl@0
   501
		const TInt radius = 200;
sl@0
   502
		radius1 = radius;
sl@0
   503
		radius2 = 90.0;
sl@0
   504
		pp = center;
sl@0
   505
		pp.iX += radius;
sl@0
   506
		iGc->MoveTo(pp);
sl@0
   507
		}
sl@0
   508
sl@0
   509
	for(TInt i=0; i<steps; i++)
sl@0
   510
		{
sl@0
   511
		TReal angle = KPi*2.0*i/steps;
sl@0
   512
sl@0
   513
		TReal angleSin, angleCos;
sl@0
   514
		Math::Sin(angleSin, angle);
sl@0
   515
		Math::Cos(angleCos, angle);
sl@0
   516
sl@0
   517
		TPoint p1(static_cast<TInt>(angleCos*radius1), static_cast<TInt>(angleSin*radius1));
sl@0
   518
		p1 += center;
sl@0
   519
		TPoint p2(static_cast<TInt>(angleCos*radius2), static_cast<TInt>(angleSin*radius2));
sl@0
   520
		p2 += center;
sl@0
   521
sl@0
   522
		if(i&1)
sl@0
   523
			{
sl@0
   524
			TPoint pp = p1;
sl@0
   525
			p1 = p2;
sl@0
   526
			p2 = pp;
sl@0
   527
			}
sl@0
   528
sl@0
   529
		if(aApi == EDrawLine)
sl@0
   530
			{
sl@0
   531
			for(TInt penSize = 0; penSize <= 1; penSize ++)
sl@0
   532
				{
sl@0
   533
				iGc->SetPenSize(TSize(penSize,penSize));
sl@0
   534
				iGc->SetPenStyle(DirectGdi::ESolidPen);
sl@0
   535
				iGc->DrawLine(p1, p2);
sl@0
   536
				}				
sl@0
   537
			}
sl@0
   538
		else if(aApi == EDrawLineTo)
sl@0
   539
			{
sl@0
   540
			iGc->DrawLineTo(p1);
sl@0
   541
			iGc->DrawLineTo(p2);
sl@0
   542
			}
sl@0
   543
		else // if(aApi == EDrawLineBy)
sl@0
   544
			{
sl@0
   545
			iGc->DrawLineBy(p1-pp);
sl@0
   546
			iGc->DrawLineBy(p2-p1);
sl@0
   547
			pp = p2;
sl@0
   548
			}
sl@0
   549
		}
sl@0
   550
sl@0
   551
	TESTNOERRORL(iGc->GetError());
sl@0
   552
	TESTNOERROR(WriteTargetOutput(iTestParams, testName));
sl@0
   553
	}
sl@0
   554
sl@0
   555
sl@0
   556
/**
sl@0
   557
@SYMTestCaseID
sl@0
   558
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003
sl@0
   559
sl@0
   560
@SYMPREQ 
sl@0
   561
	PREQ39
sl@0
   562
sl@0
   563
@SYMREQ
sl@0
   564
	REQ9195
sl@0
   565
	REQ9201 
sl@0
   566
	REQ9202 
sl@0
   567
	REQ9222 
sl@0
   568
	REQ9223 
sl@0
   569
	REQ9236 
sl@0
   570
	REQ9237
sl@0
   571
sl@0
   572
@SYMTestCaseDesc
sl@0
   573
	Test correctness of size and position reproduction of rectangle, ellipse, arc, and pie.
sl@0
   574
sl@0
   575
@SYMTestStatus
sl@0
   576
	Implemented
sl@0
   577
sl@0
   578
@SYMTestPriority
sl@0
   579
	Critical
sl@0
   580
sl@0
   581
@SYMTestActions
sl@0
   582
	Set default pen and brush.
sl@0
   583
		- Draw shapes at various positions and sizes.
sl@0
   584
		- Test position and size outside the target surface.
sl@0
   585
		- Test boundary positions and sizes.
sl@0
   586
	Call functions with valid parameters:
sl@0
   587
	void DrawRect(const TRect& aRect)
sl@0
   588
		The size of bounding rectangle (aRect) will be iterated over (both height and width),
sl@0
   589
		each time calling the appropriate drawing method.
sl@0
   590
	For DrawArc() and DrawPie also the starting and ending points will be changing.
sl@0
   591
sl@0
   592
@SYMTestExpectedResults
sl@0
   593
	Valid bitmap should be created. This bitmap shall be compared to a reference bitmap.
sl@0
   594
*/
sl@0
   595
void CTDrawShapes::TestDrawShapePositionAndSizeL(TDrawShapeAPI aApi,
sl@0
   596
		DirectGdi::TPenStyle aPenStyle,
sl@0
   597
		DirectGdi::TBrushStyle aBrushStyle)
sl@0
   598
	{
sl@0
   599
	_LIT(KDrawRectPositionAndSize, "ShapeDrawing-DrawRect-PositionAndSize");
sl@0
   600
	_LIT(KDrawRoundRectPositionAndSize, "ShapeDrawing-DrawRoundRect-PositionAndSize");
sl@0
   601
	_LIT(KDrawEllipsePositionAndSize, "ShapeDrawing-DrawEllipse-PositionAndSize");
sl@0
   602
	_LIT(KDrawPiePositionAndSize, "ShapeDrawing-DrawPie-PositionAndSize");
sl@0
   603
	_LIT(KDrawArcPositionAndSize, "ShapeDrawing-DrawArc-PositionAndSize");
sl@0
   604
sl@0
   605
	TBuf<70> testName;
sl@0
   606
	if(aApi == EDrawRect)
sl@0
   607
		testName = KDrawRectPositionAndSize();
sl@0
   608
	else if(aApi == EDrawRoundRect)
sl@0
   609
		testName = KDrawRoundRectPositionAndSize();
sl@0
   610
	else if(aApi == EDrawEllipse)
sl@0
   611
		testName = KDrawEllipsePositionAndSize();
sl@0
   612
	else if(aApi == EDrawPie)
sl@0
   613
		testName = KDrawPiePositionAndSize();
sl@0
   614
	else if(aApi == EDrawArc)
sl@0
   615
		testName = KDrawArcPositionAndSize();
sl@0
   616
	else
sl@0
   617
		ASSERT(EFalse); // test not supported for shapes other than those above
sl@0
   618
sl@0
   619
	if(aPenStyle == DirectGdi::ENullPen)
sl@0
   620
		{
sl@0
   621
		testName.Append(KSeparator);
sl@0
   622
		testName.Append(KPenNameNull);
sl@0
   623
		}
sl@0
   624
	
sl@0
   625
	if(aBrushStyle != DirectGdi::ENullBrush)
sl@0
   626
		{
sl@0
   627
		testName.Append(KSeparator);
sl@0
   628
		testName.Append(KBrushStyleTableNames[aBrushStyle]);
sl@0
   629
		}
sl@0
   630
sl@0
   631
	if(!iRunningOomTests)
sl@0
   632
		{
sl@0
   633
		INFO_PRINTF1(testName);
sl@0
   634
		}
sl@0
   635
	
sl@0
   636
	ResetGc();
sl@0
   637
sl@0
   638
	TInt width = iGdiTarget->SizeInPixels().iWidth;
sl@0
   639
	TInt height = iGdiTarget->SizeInPixels().iHeight;
sl@0
   640
	TInt rectWidth = 0;
sl@0
   641
	TInt rectHeight = 0;
sl@0
   642
	TInt step = 0;
sl@0
   643
sl@0
   644
	iGc->SetPenStyle(aPenStyle);
sl@0
   645
	iGc->SetBrushStyle(aBrushStyle);
sl@0
   646
sl@0
   647
	for(TInt y=-45, offsetY=0; y<height+30; y+=rectHeight+1, offsetY++, rectHeight++)
sl@0
   648
		{
sl@0
   649
		rectWidth = 0;
sl@0
   650
		for(TInt x=-45, offsetX=0; x<width+30; x+=rectWidth+1, offsetX++, rectWidth++)
sl@0
   651
			{
sl@0
   652
			TRect rect(TPoint(x+offsetY, y+offsetX), TSize(rectWidth, rectHeight));
sl@0
   653
sl@0
   654
			iGc->SetBrushColor(KColor16Table[step%16]);
sl@0
   655
			step++;
sl@0
   656
sl@0
   657
			if(aApi == EDrawRect)
sl@0
   658
				{
sl@0
   659
				iGc->DrawRect(rect);
sl@0
   660
				}
sl@0
   661
			else if(aApi == EDrawRoundRect)
sl@0
   662
				{
sl@0
   663
				iGc->DrawRoundRect(rect, TSize(offsetX/3, offsetY/3));
sl@0
   664
				}
sl@0
   665
			else if(aApi == EDrawEllipse)
sl@0
   666
				{
sl@0
   667
				iGc->DrawEllipse(rect);
sl@0
   668
				}
sl@0
   669
			else
sl@0
   670
				{
sl@0
   671
				TReal angle1 = offsetX*0.2;
sl@0
   672
				TReal angle2 = angle1-(offsetY+1)*0.18;
sl@0
   673
sl@0
   674
				TReal angleSin, angleCos;
sl@0
   675
				Math::Sin(angleSin, angle1);
sl@0
   676
				Math::Cos(angleCos, angle1);
sl@0
   677
				TPoint p1(static_cast<TInt>(angleCos*100), static_cast<TInt>(angleSin*100));
sl@0
   678
sl@0
   679
				Math::Sin(angleSin, angle2);
sl@0
   680
				Math::Cos(angleCos, angle2);
sl@0
   681
				TPoint p2(static_cast<TInt>(angleCos*100), static_cast<TInt>(angleSin*100));
sl@0
   682
sl@0
   683
				p1 += rect.Center();
sl@0
   684
				p2 += rect.Center();
sl@0
   685
sl@0
   686
				if(aApi == EDrawPie)
sl@0
   687
					{
sl@0
   688
					iGc->DrawPie(rect, p1, p2);
sl@0
   689
					}
sl@0
   690
				else //if(aApi == EDrawArc)
sl@0
   691
					{
sl@0
   692
					iGc->DrawArc(rect, p1, p2);
sl@0
   693
					}
sl@0
   694
				}
sl@0
   695
			TESTNOERRORL(iGc->GetError());
sl@0
   696
			}
sl@0
   697
		}
sl@0
   698
	TESTNOERROR(WriteTargetOutput(iTestParams, testName));
sl@0
   699
	}
sl@0
   700
sl@0
   701
sl@0
   702
/**
sl@0
   703
@SYMTestCaseID
sl@0
   704
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0004
sl@0
   705
sl@0
   706
@SYMPREQ 
sl@0
   707
	PREQ39
sl@0
   708
sl@0
   709
@SYMREQ
sl@0
   710
	REQ9195
sl@0
   711
	REQ9201 
sl@0
   712
	REQ9202 
sl@0
   713
	REQ9222 
sl@0
   714
	REQ9223 
sl@0
   715
	REQ9236 
sl@0
   716
	REQ9237
sl@0
   717
sl@0
   718
@SYMTestCaseDesc
sl@0
   719
	Test functions behaviour after calling with invalid parameters.
sl@0
   720
sl@0
   721
@SYMTestStatus
sl@0
   722
	Implemented
sl@0
   723
sl@0
   724
@SYMTestPriority
sl@0
   725
	Critical
sl@0
   726
sl@0
   727
@SYMTestActions
sl@0
   728
	Test shape drawing methods invalid parameters handling.
sl@0
   729
	Set default pen and brush.
sl@0
   730
	Set valid parameters (see ShapeDrawing-Basic).
sl@0
   731
	Replace valid parameters with invalid ones:
sl@0
   732
		negative size
sl@0
   733
			aRect.iTl = ( -30, -30 ) ; aRect.iBr = ( -10, -10 )
sl@0
   734
			aRect.iTl = ( 30, 30 ) ; aRect.iBr = ( 10, 10 )
sl@0
   735
			aEllipse.iWidth = -30
sl@0
   736
			aEllipse.iHeight = -30
sl@0
   737
		zero size
sl@0
   738
			aRect.iTl = ( -30, -30 ) ; aRect.iBr = ( -30, -30 )
sl@0
   739
			aRect.iTl = ( 30, 30 ) ; aRect.iBr = ( 30, 30 )
sl@0
   740
			Trect(10,50,10,80)
sl@0
   741
			TRect(80,90,140,90)
sl@0
   742
			aEllipse.iWidth = 0
sl@0
   743
			aEllipse.iHeight = 0
sl@0
   744
sl@0
   745
@SYMTestExpectedResults
sl@0
   746
	Function shall detect invalid parameters and return. Nothing will be drawn on the target surface.
sl@0
   747
*/
sl@0
   748
void CTDrawShapes::TestDrawShapeInvalidParametersL(TDrawShapeAPI aApi)
sl@0
   749
	{
sl@0
   750
	_LIT(KDrawRectInvalidParameters, "ShapeDrawing-DrawRect-InvalidParameters");
sl@0
   751
	_LIT(KDrawRoundRectInvalidParameters, "ShapeDrawing-DrawRoundRect-InvalidParameters");
sl@0
   752
	_LIT(KDrawEllipseInvalidParameters, "ShapeDrawing-DrawEllipse-InvalidParameters");
sl@0
   753
	_LIT(KDrawPieInvalidParameters, "ShapeDrawing-DrawPie-InvalidParameters");
sl@0
   754
	_LIT(KDrawArcInvalidParameters, "ShapeDrawing-DrawArc-InvalidParameters");
sl@0
   755
	_LIT(KDrawPolygonInvalidParameters, "ShapeDrawing-DrawPolygon-InvalidParameters");
sl@0
   756
	
sl@0
   757
	TBuf<70> testName;
sl@0
   758
	if(aApi == EDrawRect)
sl@0
   759
		testName = KDrawRectInvalidParameters();
sl@0
   760
	else if(aApi == EDrawRoundRect)
sl@0
   761
		testName = KDrawRoundRectInvalidParameters();
sl@0
   762
	else if(aApi == EDrawEllipse)
sl@0
   763
		testName = KDrawEllipseInvalidParameters();
sl@0
   764
	else if(aApi == EDrawPie)
sl@0
   765
		testName = KDrawPieInvalidParameters();
sl@0
   766
	else if(aApi == EDrawArc)
sl@0
   767
		testName = KDrawArcInvalidParameters();
sl@0
   768
	else if(aApi == EDrawPolygon)
sl@0
   769
		testName = KDrawPolygonInvalidParameters();
sl@0
   770
	else
sl@0
   771
		ASSERT(EFalse); // test not supported for shapes other than those above
sl@0
   772
sl@0
   773
	if(!iRunningOomTests)
sl@0
   774
		{
sl@0
   775
		INFO_PRINTF1(testName);
sl@0
   776
		}
sl@0
   777
	
sl@0
   778
	ResetGc();
sl@0
   779
sl@0
   780
	RArray<TRect> rects;
sl@0
   781
	CleanupClosePushL(rects);
sl@0
   782
sl@0
   783
	RArray<TSize> sizes;
sl@0
   784
	CleanupClosePushL(sizes);
sl@0
   785
sl@0
   786
	// negative rect size
sl@0
   787
	rects.AppendL(TRect(-30, -30, -10, -10));
sl@0
   788
	rects.AppendL(TRect(30, 30, 10, 10));
sl@0
   789
	rects.AppendL(TRect(100, 30, 120, 10));
sl@0
   790
	rects.AppendL(TRect(30, 100, 10, 120));
sl@0
   791
	
sl@0
   792
	// negative ellipse size
sl@0
   793
	sizes.AppendL(TSize(-30, 30));
sl@0
   794
	sizes.AppendL(TSize(30, -30));
sl@0
   795
	sizes.AppendL(TSize(-30, -30));
sl@0
   796
sl@0
   797
	// zero rect size
sl@0
   798
	rects.AppendL(TRect(-30, -30, -30, -30));
sl@0
   799
	rects.AppendL(TRect(30, 30, 30, 30));
sl@0
   800
	rects.AppendL(TRect(10, 50, 10, 80));
sl@0
   801
	rects.AppendL(TRect(80, 90, 140, 90));
sl@0
   802
sl@0
   803
	// zero ellipse size
sl@0
   804
	sizes.AppendL(TSize(0, 30));
sl@0
   805
	sizes.AppendL(TSize(30, 0));
sl@0
   806
	sizes.AppendL(TSize(0, 0));
sl@0
   807
sl@0
   808
	switch(aApi)
sl@0
   809
		{
sl@0
   810
		case EDrawRect:
sl@0
   811
			{
sl@0
   812
			for(TInt i=0; i<rects.Count(); i++)
sl@0
   813
				{
sl@0
   814
				for(TInt penSize = 0; penSize <= 1; penSize++)
sl@0
   815
					{
sl@0
   816
					iGc->SetPenSize(TSize(penSize,penSize));
sl@0
   817
					iGc->DrawRect(rects[i]);
sl@0
   818
					TESTNOERRORL(iGc->GetError());
sl@0
   819
					}
sl@0
   820
				}
sl@0
   821
			break;
sl@0
   822
			}
sl@0
   823
sl@0
   824
		case EDrawRoundRect:
sl@0
   825
			{
sl@0
   826
			for(TInt i=0; i<rects.Count(); i++)
sl@0
   827
				{
sl@0
   828
				for(TInt j=0; j<sizes.Count(); j++)
sl@0
   829
					{
sl@0
   830
					iGc->DrawRoundRect(rects[i], sizes[j]);
sl@0
   831
					TESTNOERRORL(iGc->GetError());
sl@0
   832
					}
sl@0
   833
				}
sl@0
   834
			break;
sl@0
   835
			}
sl@0
   836
sl@0
   837
		case EDrawEllipse:
sl@0
   838
			{
sl@0
   839
			for(TInt i=0; i<rects.Count(); i++)
sl@0
   840
				{		
sl@0
   841
				iGc->DrawEllipse(rects[i]);
sl@0
   842
				TESTNOERRORL(iGc->GetError());
sl@0
   843
				}
sl@0
   844
			break;
sl@0
   845
			}
sl@0
   846
sl@0
   847
		case EDrawPie:
sl@0
   848
			{
sl@0
   849
			for(TInt i=0; i<rects.Count(); i++)
sl@0
   850
				{
sl@0
   851
				TPoint pos(rects[i].Center());		
sl@0
   852
				iGc->SetPenStyle(DirectGdi::ENullPen);
sl@0
   853
				iGc->DrawPie(rects[i], TPoint(100, 0)+pos, TPoint(0, -100)+pos);
sl@0
   854
				iGc->SetPenStyle(DirectGdi::ESolidPen);
sl@0
   855
				for(TInt penSize = 0; penSize <= 1; penSize ++)
sl@0
   856
					{
sl@0
   857
					iGc->SetPenSize(TSize(penSize,penSize));
sl@0
   858
					iGc->DrawPie(rects[i], TPoint(100, 0)+pos, TPoint(0, -100)+pos);
sl@0
   859
					TESTNOERRORL(iGc->GetError());
sl@0
   860
					}				
sl@0
   861
				}
sl@0
   862
			break;
sl@0
   863
			}
sl@0
   864
sl@0
   865
		case EDrawArc:
sl@0
   866
			{
sl@0
   867
			for(TInt i=0; i<rects.Count(); i++)
sl@0
   868
				{
sl@0
   869
				TPoint pos(rects[i].Center());
sl@0
   870
				iGc->SetPenStyle(DirectGdi::ENullPen);
sl@0
   871
				iGc->DrawArc(rects[i], TPoint(100, 0)+pos, TPoint(0, -100)+pos);
sl@0
   872
				iGc->DrawArc(rects[i], TPoint(0, -100)+pos, TPoint(100, 0)+pos);
sl@0
   873
				iGc->SetPenStyle(DirectGdi::ESolidPen);
sl@0
   874
				for(TInt penSize = 0; penSize <= 1; penSize ++)
sl@0
   875
					{
sl@0
   876
					iGc->SetPenSize(TSize(penSize,penSize));
sl@0
   877
					iGc->DrawArc(rects[i], TPoint(100, 0)+pos, TPoint(0, -100)+pos);
sl@0
   878
					}
sl@0
   879
				TESTNOERRORL(iGc->GetError());
sl@0
   880
				}
sl@0
   881
			break;
sl@0
   882
			}
sl@0
   883
			
sl@0
   884
		case EDrawPolygon:
sl@0
   885
			{
sl@0
   886
			// Try to draw a polygon with 0 points, and a polygon with an invalid fill argument
sl@0
   887
			CArrayFixFlat<TPoint> *tmpArray = new (ELeave)CArrayFixFlat<TPoint>(1);			
sl@0
   888
			iGc->DrawPolygon(*tmpArray, DirectGdi::EAlternate);
sl@0
   889
			TESTNOERROR(iGc->GetError());
sl@0
   890
			iGc->DrawPolygon(*tmpArray, static_cast<DirectGdi::TFillRule>(-1));
sl@0
   891
			if (iUseDirectGdi)
sl@0
   892
				{
sl@0
   893
				TEST(iGc->GetError() == KErrArgument);
sl@0
   894
				}
sl@0
   895
			delete tmpArray;
sl@0
   896
			break;
sl@0
   897
			}
sl@0
   898
		}
sl@0
   899
sl@0
   900
	iGc->Reset();
sl@0
   901
	CleanupStack::PopAndDestroy(&sizes);
sl@0
   902
	CleanupStack::PopAndDestroy(&rects);
sl@0
   903
sl@0
   904
	// test if target is still clear
sl@0
   905
	TBool pass = TestTargetL(KRgbWhite);
sl@0
   906
	if(!pass)
sl@0
   907
		{
sl@0
   908
		// write target only if test failed
sl@0
   909
		TEST(KErrNone == WriteTargetOutput(iTestParams, testName));
sl@0
   910
		}
sl@0
   911
	TEST(pass);
sl@0
   912
	}
sl@0
   913
sl@0
   914
/**
sl@0
   915
@SYMTestCaseID
sl@0
   916
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0005
sl@0
   917
sl@0
   918
@SYMPREQ 
sl@0
   919
	PREQ39
sl@0
   920
sl@0
   921
@SYMREQ
sl@0
   922
	REQ9195
sl@0
   923
	REQ9201 
sl@0
   924
	REQ9202 
sl@0
   925
	REQ9222 
sl@0
   926
	REQ9223 
sl@0
   927
	REQ9236 
sl@0
   928
	REQ9237
sl@0
   929
sl@0
   930
@SYMTestCaseDesc
sl@0
   931
	Test a few round rectangles, some of which have corners larger than the width
sl@0
   932
	or height or the rectangles.
sl@0
   933
sl@0
   934
@SYMTestStatus
sl@0
   935
	Implemented
sl@0
   936
sl@0
   937
@SYMTestPriority
sl@0
   938
	Critical
sl@0
   939
sl@0
   940
@SYMTestActions
sl@0
   941
	The tests is implemented the following way: the rectangles' corners' width and height
sl@0
   942
	will be iterated over, and for each	iteration a set of rounded rectangles will be drawn.
sl@0
   943
	The test will be repeated with a solid brush.
sl@0
   944
sl@0
   945
@SYMTestExpectedResults
sl@0
   946
	Valid bitmap should be created. This bitmap shall be compared to a reference bitmap.
sl@0
   947
*/
sl@0
   948
void CTDrawShapes::TestDrawRoundRectL(DirectGdi::TBrushStyle aBrushStyle)
sl@0
   949
	{
sl@0
   950
	_LIT(KDrawRoundRect, "ShapeDrawing-DrawRoundRect");
sl@0
   951
sl@0
   952
	TBuf<50> testName;
sl@0
   953
	testName = KDrawRoundRect();
sl@0
   954
	if(aBrushStyle != DirectGdi::ENullBrush)
sl@0
   955
		{
sl@0
   956
		testName.Append(KSeparator);
sl@0
   957
		testName.Append(KBrushStyleTableNames[aBrushStyle]);
sl@0
   958
		}
sl@0
   959
	
sl@0
   960
	if(!iRunningOomTests)
sl@0
   961
		{
sl@0
   962
		INFO_PRINTF1(testName);
sl@0
   963
		}
sl@0
   964
	
sl@0
   965
	ResetGc();
sl@0
   966
sl@0
   967
	TInt width = iGdiTarget->SizeInPixels().iWidth;
sl@0
   968
	TInt height = iGdiTarget->SizeInPixels().iHeight;
sl@0
   969
	const TInt xRectNum = 16;
sl@0
   970
	const TInt yRectNum = 16;
sl@0
   971
	TInt step = 0;
sl@0
   972
sl@0
   973
	iGc->SetBrushStyle(aBrushStyle);
sl@0
   974
sl@0
   975
	for(TInt i=0; i<yRectNum; i++)
sl@0
   976
		{
sl@0
   977
		for(TInt j=0; j<xRectNum; j++)
sl@0
   978
			{
sl@0
   979
			TRect rect(TPoint(j*width/xRectNum, i*height/yRectNum), TSize(width/xRectNum, height/yRectNum));
sl@0
   980
sl@0
   981
			// draw many concentric rectangles, each smaller than previous
sl@0
   982
			while((rect.Size().iWidth > 2) && (rect.Size().iHeight > 2))
sl@0
   983
				{
sl@0
   984
				iGc->SetBrushColor(KColor16Table[step%16]);
sl@0
   985
				step++;
sl@0
   986
sl@0
   987
				iGc->DrawRoundRect(rect, TSize(j, i));
sl@0
   988
				TESTNOERRORL(iGc->GetError());
sl@0
   989
				rect.Shrink(3, 3);
sl@0
   990
				}
sl@0
   991
			}
sl@0
   992
		}
sl@0
   993
	TESTNOERROR(WriteTargetOutput(iTestParams, testName));
sl@0
   994
	}
sl@0
   995
sl@0
   996
sl@0
   997
/**
sl@0
   998
@SYMTestCaseID
sl@0
   999
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0006
sl@0
  1000
sl@0
  1001
@SYMPREQ 
sl@0
  1002
	PREQ39
sl@0
  1003
sl@0
  1004
@SYMREQ
sl@0
  1005
	REQ9195
sl@0
  1006
	REQ9201 
sl@0
  1007
	REQ9202 
sl@0
  1008
	REQ9222 
sl@0
  1009
	REQ9223 
sl@0
  1010
	REQ9236 
sl@0
  1011
	REQ9237
sl@0
  1012
sl@0
  1013
@SYMTestCaseDesc
sl@0
  1014
	Test drawing arc functionality.
sl@0
  1015
sl@0
  1016
@SYMTestStatus
sl@0
  1017
	Implemented
sl@0
  1018
sl@0
  1019
@SYMTestPriority
sl@0
  1020
	Critical
sl@0
  1021
sl@0
  1022
@SYMTestActions
sl@0
  1023
	Set default pen and brush.
sl@0
  1024
	Draw various chunks of arc.
sl@0
  1025
	Call functions with valid parameters.
sl@0
  1026
	The tests is implemented the following way: the arc's starting angle will be
sl@0
  1027
	iterated over, and for each iteration a set of arcs with different end angles will be drawn.
sl@0
  1028
sl@0
  1029
@SYMTestExpectedResults
sl@0
  1030
	Valid bitmap should be created. This bitmap shall be compared to a reference bitmap.
sl@0
  1031
*/
sl@0
  1032
void CTDrawShapes::TestDrawArcL()
sl@0
  1033
	{
sl@0
  1034
	_LIT(KTestName, "ShapeDrawing-DrawArc"); 
sl@0
  1035
sl@0
  1036
	if(!iRunningOomTests)
sl@0
  1037
		{
sl@0
  1038
		INFO_PRINTF1(KTestName);
sl@0
  1039
		}
sl@0
  1040
	
sl@0
  1041
	ResetGc();
sl@0
  1042
sl@0
  1043
	TInt width = iGdiTarget->SizeInPixels().iWidth;
sl@0
  1044
	TInt height = iGdiTarget->SizeInPixels().iHeight;
sl@0
  1045
	const TInt xRectNum = 8;
sl@0
  1046
	const TInt yRectNum = 8;
sl@0
  1047
	const TReal angleStep = 2.0*KPi/11.0;
sl@0
  1048
sl@0
  1049
	for(TInt i=0; i<yRectNum; i++)
sl@0
  1050
		{
sl@0
  1051
		for(TInt j=0; j<xRectNum; j++)
sl@0
  1052
			{
sl@0
  1053
			TRect rect(TPoint(j*width/xRectNum, i*height/yRectNum), TSize(width/xRectNum, height/yRectNum));
sl@0
  1054
sl@0
  1055
			TReal angle1 =(i*xRectNum+j)*2.0*KPi/(xRectNum*yRectNum);
sl@0
  1056
sl@0
  1057
			TReal angleSin, angleCos;
sl@0
  1058
			Math::Sin(angleSin, angle1);
sl@0
  1059
			Math::Cos(angleCos, angle1);
sl@0
  1060
			TPoint p1(static_cast<TInt>(angleCos*100), static_cast<TInt>(angleSin*100));
sl@0
  1061
			p1 += rect.Center();
sl@0
  1062
sl@0
  1063
			TReal angle2 = angle1-angleStep;
sl@0
  1064
sl@0
  1065
			// draw many concentric arcs, each smaller than previous and with different angles
sl@0
  1066
			while((rect.Size().iWidth > 2) && (rect.Size().iHeight > 2))
sl@0
  1067
				{
sl@0
  1068
				Math::Sin(angleSin, angle2);
sl@0
  1069
				Math::Cos(angleCos, angle2);
sl@0
  1070
				TPoint p2(static_cast<TInt>(angleCos*100), static_cast<TInt>(angleSin*100));
sl@0
  1071
				p2 += rect.Center();
sl@0
  1072
sl@0
  1073
				iGc->DrawArc(rect, p1, p2);
sl@0
  1074
				TESTNOERRORL(iGc->GetError());
sl@0
  1075
sl@0
  1076
				angle2 -= angleStep;
sl@0
  1077
				rect.Shrink(3, 3);
sl@0
  1078
				}
sl@0
  1079
			}
sl@0
  1080
		}
sl@0
  1081
	TESTNOERROR(WriteTargetOutput(iTestParams, KTestName()));
sl@0
  1082
	}
sl@0
  1083
sl@0
  1084
sl@0
  1085
/**
sl@0
  1086
@SYMTestCaseID
sl@0
  1087
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0007
sl@0
  1088
sl@0
  1089
@SYMPREQ 
sl@0
  1090
	PREQ39
sl@0
  1091
sl@0
  1092
@SYMREQ
sl@0
  1093
	REQ9195
sl@0
  1094
	REQ9201 
sl@0
  1095
	REQ9202 
sl@0
  1096
	REQ9222 
sl@0
  1097
	REQ9223 
sl@0
  1098
	REQ9236 
sl@0
  1099
	REQ9237
sl@0
  1100
sl@0
  1101
@SYMTestCaseDesc
sl@0
  1102
	Test drawing pie functionality.
sl@0
  1103
sl@0
  1104
@SYMTestStatus
sl@0
  1105
	Implemented
sl@0
  1106
sl@0
  1107
@SYMTestPriority
sl@0
  1108
	Critical
sl@0
  1109
sl@0
  1110
@SYMTestActions
sl@0
  1111
	Set default pen and brush.
sl@0
  1112
	Draw various chunks of pie.
sl@0
  1113
	Call functions with valid parameters (see Graphics-DirectGDI-ShapeDrawing-001).
sl@0
  1114
	The tests is implemented the following way: the pie's starting angle will be
sl@0
  1115
	iterated over, and for each iteration a complete circle composed of different pies will be drawn.
sl@0
  1116
sl@0
  1117
@SYMTestExpectedResults
sl@0
  1118
	A set of 64 groups of pies should be draw, each one rotated slightly more than the last. 
sl@0
  1119
	The size of the pies drawn should look the same for all rotations.
sl@0
  1120
*/
sl@0
  1121
void CTDrawShapes::TestDrawPieL(DirectGdi::TBrushStyle aBrushStyle)
sl@0
  1122
	{
sl@0
  1123
	_LIT(KDrawPie, "ShapeDrawing-DrawPie");
sl@0
  1124
sl@0
  1125
	TBuf<50> testName;
sl@0
  1126
	testName = KDrawPie();
sl@0
  1127
	if(aBrushStyle != DirectGdi::ENullBrush)
sl@0
  1128
		{
sl@0
  1129
		testName.Append(KSeparator);
sl@0
  1130
		testName.Append(KBrushStyleTableNames[aBrushStyle]);
sl@0
  1131
		}
sl@0
  1132
	
sl@0
  1133
	if(!iRunningOomTests)
sl@0
  1134
		{
sl@0
  1135
		INFO_PRINTF1(testName);
sl@0
  1136
		}
sl@0
  1137
	
sl@0
  1138
	ResetGc();
sl@0
  1139
sl@0
  1140
	TInt width = iGdiTarget->SizeInPixels().iWidth;
sl@0
  1141
	TInt height = iGdiTarget->SizeInPixels().iHeight;
sl@0
  1142
	const TInt xRectNum = 8;
sl@0
  1143
	const TInt yRectNum = 8;
sl@0
  1144
	const TReal angleStep = 2.0*KPi/21.0;
sl@0
  1145
	TInt step = 0;
sl@0
  1146
sl@0
  1147
	iGc->SetBrushStyle(aBrushStyle);
sl@0
  1148
sl@0
  1149
	for(TInt i=0; i<yRectNum; i++)
sl@0
  1150
		{
sl@0
  1151
		for(TInt j=0; j<xRectNum; j++)
sl@0
  1152
			{
sl@0
  1153
			TRect rect(TPoint(j*width/xRectNum, i*height/yRectNum), TSize(width/xRectNum, height/yRectNum));
sl@0
  1154
sl@0
  1155
			TReal angle1 =(i*xRectNum+j)*2.0*KPi/(xRectNum*yRectNum);
sl@0
  1156
sl@0
  1157
			//draw six parts of pie
sl@0
  1158
			for(TInt k=1; k<=6; k++)
sl@0
  1159
				{
sl@0
  1160
				TReal angleSin, angleCos;
sl@0
  1161
				Math::Sin(angleSin, angle1);
sl@0
  1162
				Math::Cos(angleCos, angle1);
sl@0
  1163
				TPoint p1(static_cast<TInt>(angleCos*100), static_cast<TInt>(angleSin*100));
sl@0
  1164
				p1 += rect.Center();
sl@0
  1165
sl@0
  1166
				TReal angle2 = angle1-k*angleStep;
sl@0
  1167
				Math::Sin(angleSin, angle2);
sl@0
  1168
				Math::Cos(angleCos, angle2);
sl@0
  1169
				TPoint p2(static_cast<TInt>(angleCos*100), static_cast<TInt>(angleSin*100));
sl@0
  1170
				p2 += rect.Center();
sl@0
  1171
sl@0
  1172
				iGc->SetBrushColor(KColor16Table[step%16]);
sl@0
  1173
				step++;
sl@0
  1174
sl@0
  1175
				iGc->DrawPie(rect, p1, p2);
sl@0
  1176
				TESTNOERRORL(iGc->GetError());
sl@0
  1177
sl@0
  1178
				angle1 -= k*angleStep;
sl@0
  1179
				rect.Shrink(2, 2);
sl@0
  1180
				}
sl@0
  1181
			}
sl@0
  1182
		}
sl@0
  1183
	TESTNOERROR(WriteTargetOutput(iTestParams, testName));
sl@0
  1184
	}
sl@0
  1185
sl@0
  1186
sl@0
  1187
/**
sl@0
  1188
@SYMTestCaseID
sl@0
  1189
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0008
sl@0
  1190
sl@0
  1191
@SYMPREQ 
sl@0
  1192
	PREQ39
sl@0
  1193
sl@0
  1194
@SYMREQ
sl@0
  1195
	REQ9195
sl@0
  1196
	REQ9201 
sl@0
  1197
	REQ9202 
sl@0
  1198
	REQ9222 
sl@0
  1199
	REQ9223 
sl@0
  1200
	REQ9236 
sl@0
  1201
	REQ9237
sl@0
  1202
sl@0
  1203
@SYMTestCaseDesc
sl@0
  1204
	Test drawing polyline functionality.
sl@0
  1205
sl@0
  1206
@SYMTestStatus
sl@0
  1207
	Implemented
sl@0
  1208
sl@0
  1209
@SYMTestPriority
sl@0
  1210
	Critical
sl@0
  1211
sl@0
  1212
@SYMTestActions
sl@0
  1213
	Test DrawPolyLine() and DrawPolyLineNoEndPoint() methods with various valid parameters.
sl@0
  1214
	Draw polylines with:
sl@0
  1215
		Different number of points (including zero points).
sl@0
  1216
		Different position of points.
sl@0
  1217
		Boundary point position.
sl@0
  1218
		Point position outside the target surface.
sl@0
  1219
	The test will be implemented by repeatedly drawing the same shape with varying number of points.
sl@0
  1220
sl@0
  1221
@SYMTestExpectedResults
sl@0
  1222
	Valid bitmap should be created. This bitmap shall be compared to a reference bitmap.
sl@0
  1223
*/
sl@0
  1224
void CTDrawShapes::TestDrawPolyLineL(TDrawShapeAPI aApi)
sl@0
  1225
	{
sl@0
  1226
	_LIT(KDrawPolyLine, "ShapeDrawing-DrawPolyLine");
sl@0
  1227
	_LIT(KDrawPolyLineNoEndPoint, "ShapeDrawing-DrawPolyLineNoEndPoint");
sl@0
  1228
sl@0
  1229
	TBuf<50> testName;
sl@0
  1230
	if(aApi == EDrawPolyLine)
sl@0
  1231
		testName = KDrawPolyLine();
sl@0
  1232
	else //if(aApi == EDrawPolyLineNoEndPoint)
sl@0
  1233
		testName = KDrawPolyLineNoEndPoint();
sl@0
  1234
sl@0
  1235
	if(!iRunningOomTests)
sl@0
  1236
		{
sl@0
  1237
		INFO_PRINTF1(testName);
sl@0
  1238
		}
sl@0
  1239
	
sl@0
  1240
	ResetGc();
sl@0
  1241
	
sl@0
  1242
	TInt width = iGdiTarget->SizeInPixels().iWidth;
sl@0
  1243
	TInt height = iGdiTarget->SizeInPixels().iHeight;
sl@0
  1244
	TSize size(width/10, height/10);
sl@0
  1245
	TSize size2(size.iWidth/2, size.iHeight/2);
sl@0
  1246
sl@0
  1247
	const TInt pCount = 28;
sl@0
  1248
	CArrayFixFlat<TPoint> *tmpArray = new (ELeave)CArrayFixFlat<TPoint>(pCount);
sl@0
  1249
	CleanupStack::PushL(tmpArray);
sl@0
  1250
sl@0
  1251
	TReal angle = 0.0;
sl@0
  1252
	for(TInt r=pCount-1; r>0; r--,angle+=0.6)
sl@0
  1253
		{
sl@0
  1254
		TReal ss;
sl@0
  1255
		TReal cc;
sl@0
  1256
		Math::Sin(ss, angle);
sl@0
  1257
		Math::Cos(cc, angle);
sl@0
  1258
		TInt32 x;
sl@0
  1259
		TInt32 y;
sl@0
  1260
		Math::Int(x, cc*r);
sl@0
  1261
		Math::Int(y, ss*r);
sl@0
  1262
sl@0
  1263
		tmpArray->AppendL(TPoint(x, y)+size2.AsPoint());
sl@0
  1264
		//duplicate point to test consecutive points with the same position
sl@0
  1265
		if(r==15)
sl@0
  1266
			{
sl@0
  1267
			tmpArray->AppendL(TPoint(x, y)+size2.AsPoint());
sl@0
  1268
			}
sl@0
  1269
		}
sl@0
  1270
sl@0
  1271
	CArrayFixFlat<TPoint> *array = new (ELeave)CArrayFixFlat<TPoint>(pCount);
sl@0
  1272
	CleanupStack::PushL(array);
sl@0
  1273
sl@0
  1274
	for(TInt y=-size2.iHeight,k=0; y<height+size2.iHeight; y+=size.iHeight, k++)
sl@0
  1275
		{
sl@0
  1276
		for(TInt x=-size2.iWidth,l=0; x<width+size2.iWidth; x+=size.iWidth, l++)
sl@0
  1277
			{
sl@0
  1278
			TPoint pos(x+k, y+l);
sl@0
  1279
sl@0
  1280
			TInt pNum = Abs(l-5) + Abs(k-5)*5 +1;
sl@0
  1281
			if(pNum > pCount)
sl@0
  1282
				pNum = pCount;
sl@0
  1283
sl@0
  1284
			for(TInt i=0; i<pNum; i++)
sl@0
  1285
				{
sl@0
  1286
				array->AppendL(tmpArray->At(i)+pos);
sl@0
  1287
				}
sl@0
  1288
			
sl@0
  1289
			if(aApi == EDrawPolyLine)
sl@0
  1290
				{
sl@0
  1291
				iGc->SetPenStyle(DirectGdi::EDottedPen);
sl@0
  1292
				iGc->DrawPolyLine(*array);
sl@0
  1293
				iGc->SetPenStyle(DirectGdi::ESolidPen);
sl@0
  1294
				iGc->DrawPolyLine(*array);
sl@0
  1295
				}
sl@0
  1296
			else //if(aApi == EDrawPolyLineNoEndPoint)
sl@0
  1297
				iGc->DrawPolyLineNoEndPoint(*array);
sl@0
  1298
			TESTNOERRORL(iGc->GetError());
sl@0
  1299
			array->Delete(0, pNum);
sl@0
  1300
			}
sl@0
  1301
		}
sl@0
  1302
	CleanupStack::PopAndDestroy(2, tmpArray);
sl@0
  1303
	TESTNOERROR(WriteTargetOutput(iTestParams, testName));
sl@0
  1304
	}
sl@0
  1305
sl@0
  1306
sl@0
  1307
/**
sl@0
  1308
@SYMTestCaseID
sl@0
  1309
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0009
sl@0
  1310
sl@0
  1311
@SYMPREQ 
sl@0
  1312
	PREQ39
sl@0
  1313
sl@0
  1314
@SYMREQ
sl@0
  1315
	REQ9195
sl@0
  1316
	REQ9201 
sl@0
  1317
	REQ9202 
sl@0
  1318
	REQ9222 
sl@0
  1319
	REQ9223 
sl@0
  1320
	REQ9236 
sl@0
  1321
	REQ9237
sl@0
  1322
sl@0
  1323
@SYMTestCaseDesc
sl@0
  1324
	Test drawing  polygon functionality.
sl@0
  1325
sl@0
  1326
@SYMTestStatus
sl@0
  1327
	Implemented
sl@0
  1328
sl@0
  1329
@SYMTestPriority
sl@0
  1330
	Critical
sl@0
  1331
sl@0
  1332
@SYMTestActions
sl@0
  1333
	Test DrawPolygon() methods with various valid parameters.
sl@0
  1334
	Draw polygons with:
sl@0
  1335
		Different number of points (including zero points and two points).
sl@0
  1336
		Different position of points.
sl@0
  1337
		Boundary point positions.
sl@0
  1338
		Point positions outside the target surface.
sl@0
  1339
		Test self-crossing polygons
sl@0
  1340
		Test fill rules.
sl@0
  1341
	The test will be implemented by repeatedly drawing the same shape with varying number of points.
sl@0
  1342
sl@0
  1343
@SYMTestExpectedResults
sl@0
  1344
	Valid bitmap should be created. This bitmap shall be compared to a reference bitmap.
sl@0
  1345
*/
sl@0
  1346
void CTDrawShapes::TestDrawPolygonL(TInt aWidth, TInt aHeight, DirectGdi::TBrushStyle aBrushStyle, DirectGdi::TFillRule aFillRule)
sl@0
  1347
	{
sl@0
  1348
	_LIT(KDrawPolygon, "ShapeDrawing-DrawPolygon");
sl@0
  1349
sl@0
  1350
	TBuf<50> testName;
sl@0
  1351
	testName = KDrawPolygon();
sl@0
  1352
	if(aBrushStyle != DirectGdi::ENullBrush)
sl@0
  1353
		{
sl@0
  1354
		testName.Append(KSeparator);
sl@0
  1355
		testName.Append(KBrushStyleTableNames[aBrushStyle]);
sl@0
  1356
		testName.Append(KSeparator);
sl@0
  1357
		testName.Append(KFillRuleNames[aFillRule]);
sl@0
  1358
		}
sl@0
  1359
	
sl@0
  1360
	if(!iRunningOomTests)
sl@0
  1361
		{
sl@0
  1362
		INFO_PRINTF1(testName);
sl@0
  1363
		}
sl@0
  1364
	
sl@0
  1365
	ResetGc();
sl@0
  1366
sl@0
  1367
	TSize size(aWidth/10, aHeight/10);
sl@0
  1368
	TSize size2(size.iWidth/2, size.iHeight/2);
sl@0
  1369
sl@0
  1370
	const TInt pCount = 28;
sl@0
  1371
	CArrayFixFlat<TPoint> *tmpArray = new (ELeave)CArrayFixFlat<TPoint>(pCount);
sl@0
  1372
	CleanupStack::PushL(tmpArray);
sl@0
  1373
sl@0
  1374
	TReal angle = 0.0;
sl@0
  1375
	for(TInt r=pCount-1; r>0; r--,angle+=0.6)
sl@0
  1376
		{
sl@0
  1377
		TReal ss;
sl@0
  1378
		TReal cc;
sl@0
  1379
		Math::Sin(ss, angle);
sl@0
  1380
		Math::Cos(cc, angle);
sl@0
  1381
		TInt32 x;
sl@0
  1382
		TInt32 y;
sl@0
  1383
		Math::Int(x, cc*r);
sl@0
  1384
		Math::Int(y, ss*r);
sl@0
  1385
sl@0
  1386
		tmpArray->AppendL(TPoint(x, y)+size2.AsPoint());
sl@0
  1387
		//duplicate point to test consecutive points with the same position
sl@0
  1388
		if(r==15)
sl@0
  1389
			{
sl@0
  1390
			tmpArray->AppendL(TPoint(x, y)+size2.AsPoint());
sl@0
  1391
			}
sl@0
  1392
		}
sl@0
  1393
sl@0
  1394
	CArrayFixFlat<TPoint> *array = new (ELeave)CArrayFixFlat<TPoint>(pCount);
sl@0
  1395
	CleanupStack::PushL(array);
sl@0
  1396
sl@0
  1397
	iGc->SetBrushStyle(aBrushStyle);
sl@0
  1398
sl@0
  1399
	TInt step = 0;
sl@0
  1400
	TBool ZeroPenSizeSet = EFalse;
sl@0
  1401
sl@0
  1402
	for(TInt y=-size2.iHeight,k=0; y<aHeight+size2.iHeight; y+=size.iHeight, k++)
sl@0
  1403
		{
sl@0
  1404
		for(TInt x=-size2.iWidth,l=0; x<aWidth+size2.iWidth; x+=size.iWidth, l++)
sl@0
  1405
			{
sl@0
  1406
			TPoint pos(x+k, y+l);
sl@0
  1407
sl@0
  1408
			TInt pNum = Abs(l-5) + Abs(k-5)*5 +1;
sl@0
  1409
			if(pNum > pCount)
sl@0
  1410
				pNum = pCount;
sl@0
  1411
sl@0
  1412
			for(TInt i=0; i<pNum; i++)
sl@0
  1413
				{
sl@0
  1414
				array->AppendL(tmpArray->At(i)+pos);
sl@0
  1415
				}
sl@0
  1416
sl@0
  1417
			iGc->SetBrushColor(KColor16Table[step%16]);
sl@0
  1418
			step++;
sl@0
  1419
			
sl@0
  1420
			if(ZeroPenSizeSet)
sl@0
  1421
				{
sl@0
  1422
				iGc->SetPenSize(TSize(1,1));
sl@0
  1423
				}
sl@0
  1424
			else
sl@0
  1425
				{
sl@0
  1426
				iGc->SetPenSize(TSize(0,0));
sl@0
  1427
				ZeroPenSizeSet = ETrue;
sl@0
  1428
				}				
sl@0
  1429
sl@0
  1430
			iGc->DrawPolygon(*array, aFillRule);
sl@0
  1431
			TESTNOERRORL(iGc->GetError());
sl@0
  1432
			array->Delete(0, pNum);
sl@0
  1433
			}
sl@0
  1434
		}
sl@0
  1435
	CleanupStack::PopAndDestroy(2, tmpArray);
sl@0
  1436
sl@0
  1437
	TESTNOERROR(WriteTargetOutput(iTestParams, testName));
sl@0
  1438
	}
sl@0
  1439
sl@0
  1440
/**
sl@0
  1441
@SYMTestCaseID
sl@0
  1442
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0010
sl@0
  1443
sl@0
  1444
@SYMPREQ 
sl@0
  1445
	PREQ39
sl@0
  1446
sl@0
  1447
@SYMREQ
sl@0
  1448
	REQ9195
sl@0
  1449
	REQ9201 
sl@0
  1450
	REQ9202 
sl@0
  1451
	REQ9222 
sl@0
  1452
	REQ9223 
sl@0
  1453
	REQ9236 
sl@0
  1454
	REQ9237
sl@0
  1455
sl@0
  1456
@SYMTestCaseDesc
sl@0
  1457
	Test Plot() functionality.
sl@0
  1458
sl@0
  1459
@SYMTestStatus
sl@0
  1460
	Implemented
sl@0
  1461
sl@0
  1462
@SYMTestPriority
sl@0
  1463
	Critical
sl@0
  1464
sl@0
  1465
@SYMTestActions
sl@0
  1466
	Draw many plots using pen size 1.
sl@0
  1467
	Draw various other plots of differing pen sizes and colours.
sl@0
  1468
sl@0
  1469
@SYMTestExpectedResults
sl@0
  1470
	VValid bitmap should be created. This bitmap should be the same as the reference bitmap.
sl@0
  1471
*/
sl@0
  1472
void CTDrawShapes::TestPlot()
sl@0
  1473
	{
sl@0
  1474
	_LIT(KTestName, "ShapeDrawing-Plot");
sl@0
  1475
	if(!iRunningOomTests)
sl@0
  1476
		{
sl@0
  1477
		INFO_PRINTF1(KTestName);
sl@0
  1478
		}
sl@0
  1479
sl@0
  1480
	ResetGc();
sl@0
  1481
sl@0
  1482
	const TInt width = iGdiTarget->SizeInPixels().iWidth;
sl@0
  1483
	const TInt height = iGdiTarget->SizeInPixels().iHeight;
sl@0
  1484
	
sl@0
  1485
	// Plot many 1-pixel points.
sl@0
  1486
	TPoint plotPoint(10,10);
sl@0
  1487
	while (plotPoint.iY < height)
sl@0
  1488
		{
sl@0
  1489
		iGc->Plot(plotPoint);
sl@0
  1490
		plotPoint.iX += 10;
sl@0
  1491
		if (plotPoint.iX > width)
sl@0
  1492
			{
sl@0
  1493
			plotPoint.iX -= width;
sl@0
  1494
			plotPoint.iY += 10;
sl@0
  1495
			}
sl@0
  1496
		}
sl@0
  1497
	
sl@0
  1498
	// Plot points of various sizes/colours.
sl@0
  1499
	TInt count = 0;
sl@0
  1500
	TInt size;
sl@0
  1501
	plotPoint = TPoint(10,10);
sl@0
  1502
	while (plotPoint.iY < height)
sl@0
  1503
		{
sl@0
  1504
		iGc->SetPenColor(KColor16Table[count%16]);
sl@0
  1505
		size = (count*2) % 15;
sl@0
  1506
		iGc->SetPenSize(TSize(size, size));
sl@0
  1507
		iGc->Plot(plotPoint);
sl@0
  1508
		plotPoint.iX += 20;
sl@0
  1509
		plotPoint.iY += 10;
sl@0
  1510
		if (plotPoint.iX > width)
sl@0
  1511
			{
sl@0
  1512
			plotPoint.iX -= width;
sl@0
  1513
			}
sl@0
  1514
		++count;
sl@0
  1515
		}
sl@0
  1516
	TESTNOERROR(iGc->GetError());
sl@0
  1517
	
sl@0
  1518
	TESTNOERROR(WriteTargetOutput(iTestParams, KTestName()));
sl@0
  1519
	
sl@0
  1520
	iGc->Reset();
sl@0
  1521
	}
sl@0
  1522
sl@0
  1523
/**
sl@0
  1524
@SYMTestCaseID
sl@0
  1525
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0011
sl@0
  1526
sl@0
  1527
@SYMPREQ 
sl@0
  1528
	PREQ39
sl@0
  1529
sl@0
  1530
@SYMREQ
sl@0
  1531
	REQ9195
sl@0
  1532
	REQ9201 
sl@0
  1533
	REQ9202 
sl@0
  1534
	REQ9222 
sl@0
  1535
	REQ9223 
sl@0
  1536
	REQ9236 
sl@0
  1537
	REQ9237
sl@0
  1538
sl@0
  1539
@SYMTestCaseDesc
sl@0
  1540
	Test drawing arc functionality.
sl@0
  1541
sl@0
  1542
@SYMTestStatus
sl@0
  1543
	Implemented
sl@0
  1544
sl@0
  1545
@SYMTestPriority
sl@0
  1546
	Critical
sl@0
  1547
sl@0
  1548
@SYMTestActions
sl@0
  1549
	Set default pen and brush.
sl@0
  1550
	Draw 4 arcs of an ellipse on the same ellipse, one in each quadrant.
sl@0
  1551
	Draw lines from the centre of that ellipse to the points defining the beginning and end points of the arcs.
sl@0
  1552
sl@0
  1553
	Draw 3 arcs with an angle extent of >90 degrees which span more than one quadrant.
sl@0
  1554
	Draw lines from the centre of that ellipse to the points defining the beginning and end points of the arcs.
sl@0
  1555
sl@0
  1556
@SYMTestExpectedResults
sl@0
  1557
	Valid bitmap should be created. This bitmap shall be compared to a reference bitmap.
sl@0
  1558
*/
sl@0
  1559
void CTDrawShapes::TestDrawLargeArc()
sl@0
  1560
	{
sl@0
  1561
	_LIT(KTestName, "ShapeDrawing-DrawArc-LargeArcs"); 
sl@0
  1562
sl@0
  1563
	if(!iRunningOomTests)
sl@0
  1564
		{
sl@0
  1565
		INFO_PRINTF1(KTestName);
sl@0
  1566
		}
sl@0
  1567
	
sl@0
  1568
	ResetGc();
sl@0
  1569
sl@0
  1570
	// Draw arcs with short extents using same base ellipse.
sl@0
  1571
	iGc->DrawArc(TRect(100,63,150,193), TPoint(110,4), TPoint(71,43));
sl@0
  1572
	iGc->DrawLine(TPoint(125,128), TPoint(71,43));
sl@0
  1573
	iGc->DrawLine(TPoint(125,128), TPoint(110,4));
sl@0
  1574
	
sl@0
  1575
	iGc->DrawArc(TRect(100,63,150,193), TPoint(71,213), TPoint(110,252));
sl@0
  1576
	iGc->DrawLine(TPoint(125,128), TPoint(71,213));
sl@0
  1577
	iGc->DrawLine(TPoint(125,128), TPoint(110,252));
sl@0
  1578
	
sl@0
  1579
	iGc->DrawArc(TRect(100,63,150,193), TPoint(140,252), TPoint(179,213));
sl@0
  1580
	iGc->DrawLine(TPoint(125,128), TPoint(140,252));
sl@0
  1581
	iGc->DrawLine(TPoint(125,128), TPoint(179,213));
sl@0
  1582
	
sl@0
  1583
	iGc->DrawArc(TRect(100,63,150,193), TPoint(179,43), TPoint(140,4));
sl@0
  1584
	iGc->DrawLine(TPoint(125,128), TPoint(179,43));
sl@0
  1585
	iGc->DrawLine(TPoint(125,128), TPoint(140,4));
sl@0
  1586
	
sl@0
  1587
	
sl@0
  1588
	// Draw arc with large extent starting and finishing in same quadrant.
sl@0
  1589
	iGc->DrawArc(TRect(300,63,350,193), TPoint(271,43), TPoint(310,4));
sl@0
  1590
	iGc->DrawLine(TPoint(325,128), TPoint(271,43));
sl@0
  1591
	iGc->DrawLine(TPoint(325,128), TPoint(310,4));
sl@0
  1592
	
sl@0
  1593
	// Draw arc with large extent starting and finishing in neighbouring quadrants.
sl@0
  1594
	iGc->DrawArc(TRect(100,319,150,449), TPoint(71,299), TPoint(179,299));
sl@0
  1595
	iGc->DrawLine(TPoint(125,381), TPoint(71,299));
sl@0
  1596
	iGc->DrawLine(TPoint(125,381), TPoint(179,299));
sl@0
  1597
		
sl@0
  1598
	// Draw arc with large extent starting and finishing in opposite quadrants.
sl@0
  1599
	iGc->DrawArc(TRect(300,319,350,449), TPoint(271,299), TPoint(340,508));
sl@0
  1600
	iGc->DrawLine(TPoint(325,381), TPoint(271,299));
sl@0
  1601
	iGc->DrawLine(TPoint(325,381), TPoint(340,508));
sl@0
  1602
	
sl@0
  1603
	TESTNOERROR(WriteTargetOutput(iTestParams, KTestName()));
sl@0
  1604
	}
sl@0
  1605
sl@0
  1606
/**
sl@0
  1607
@SYMTestCaseID
sl@0
  1608
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0012
sl@0
  1609
sl@0
  1610
@SYMPREQ 
sl@0
  1611
	PREQ39
sl@0
  1612
sl@0
  1613
@SYMREQ
sl@0
  1614
	REQ9195
sl@0
  1615
	REQ9201 
sl@0
  1616
	REQ9202 
sl@0
  1617
	REQ9222 
sl@0
  1618
	REQ9223 
sl@0
  1619
	REQ9236 
sl@0
  1620
	REQ9237
sl@0
  1621
sl@0
  1622
@SYMTestCaseDesc
sl@0
  1623
	Tests polygon drawing behaviour when called with invalid parameters.
sl@0
  1624
sl@0
  1625
@SYMTestStatus
sl@0
  1626
	Implemented
sl@0
  1627
sl@0
  1628
@SYMTestPriority
sl@0
  1629
	Critical
sl@0
  1630
sl@0
  1631
@SYMTestActions
sl@0
  1632
	Draw several polygons where some of the points are repeated.
sl@0
  1633
sl@0
  1634
@SYMTestExpectedResults
sl@0
  1635
	No errors or panics should be reported.
sl@0
  1636
*/
sl@0
  1637
void CTDrawShapes::TestSetAttributesInvalidParametersL()
sl@0
  1638
	{
sl@0
  1639
	_LIT(KTestName, "ShapeDrawing-SetAttributes-InvalidParameters");
sl@0
  1640
	if(!iRunningOomTests)
sl@0
  1641
		{
sl@0
  1642
		INFO_PRINTF1(KTestName);
sl@0
  1643
		}
sl@0
  1644
	
sl@0
  1645
	ResetGc();
sl@0
  1646
	
sl@0
  1647
	CArrayFixFlat<TPoint> *array = new (ELeave)CArrayFixFlat<TPoint>(20);
sl@0
  1648
	CleanupStack::PushL(array);
sl@0
  1649
	
sl@0
  1650
	// points with the same positions
sl@0
  1651
	array->Reset();
sl@0
  1652
	array->AppendL(TPoint(10, 10));
sl@0
  1653
	array->AppendL(TPoint(20, 53));
sl@0
  1654
	array->AppendL(TPoint(20, 53));
sl@0
  1655
	array->AppendL(TPoint(20, 53));
sl@0
  1656
	array->AppendL(TPoint(42, 27));
sl@0
  1657
	array->AppendL(TPoint(42, 27));
sl@0
  1658
sl@0
  1659
	iGc->Reset();
sl@0
  1660
	iGc->DrawPolygon(*array, DirectGdi::EAlternate);
sl@0
  1661
	TESTNOERRORL(iGc->GetError());
sl@0
  1662
	iGc->SetOrigin(TPoint(100, 100));
sl@0
  1663
	iGc->SetBrushStyle(DirectGdi::ESolidBrush);
sl@0
  1664
	iGc->SetBrushColor(KColor16Table[5]);
sl@0
  1665
	iGc->DrawPolygon(*array, DirectGdi::EAlternate);
sl@0
  1666
	TESTNOERRORL(iGc->GetError());
sl@0
  1667
	iGc->SetOrigin(TPoint(200, 200));
sl@0
  1668
	iGc->DrawPolygon(*array, DirectGdi::EWinding);
sl@0
  1669
	TESTNOERRORL(iGc->GetError());
sl@0
  1670
	
sl@0
  1671
	CleanupStack::PopAndDestroy(array);
sl@0
  1672
sl@0
  1673
	TESTNOERROR(WriteTargetOutput(iTestParams, KTestName()));
sl@0
  1674
	}
sl@0
  1675
sl@0
  1676
/**
sl@0
  1677
@SYMTestCaseID
sl@0
  1678
	GRAPHICS-DIRECTGDI-SHAPEDRAWING-0013
sl@0
  1679
sl@0
  1680
@SYMPREQ 
sl@0
  1681
	PREQ39
sl@0
  1682
sl@0
  1683
@SYMREQ
sl@0
  1684
	REQ9195
sl@0
  1685
	REQ9201 
sl@0
  1686
	REQ9202 
sl@0
  1687
	REQ9222 
sl@0
  1688
	REQ9223 
sl@0
  1689
	REQ9236 
sl@0
  1690
	REQ9237
sl@0
  1691
sl@0
  1692
@SYMTestCaseDesc
sl@0
  1693
	Draw some shapes with semi-transparent pen outlines.
sl@0
  1694
sl@0
  1695
@SYMTestStatus
sl@0
  1696
	Implemented
sl@0
  1697
sl@0
  1698
@SYMTestPriority
sl@0
  1699
	Critical
sl@0
  1700
sl@0
  1701
@SYMTestActions
sl@0
  1702
	Set the pen to a 10% opacity red colour.
sl@0
  1703
	Set the brush fill colour to solid green.
sl@0
  1704
	Call DrawRect() and DrawPoylgon() with varying pen-sizes.
sl@0
  1705
	(Ellipses and arcs have been deliberately left out because the algorithm used for BitGdi
sl@0
  1706
	involves multiple plots at the same point resulting in multiple blends and incorrect colour,
sl@0
  1707
	meaning the test would always fail.)
sl@0
  1708
sl@0
  1709
@SYMTestExpectedResults
sl@0
  1710
	The outline colour should match for all shapes, and be a consistant colour
sl@0
  1711
	for the entire outline of the shape.
sl@0
  1712
	The brush fill should reach the centre of the pen outlines, and be visible through the
sl@0
  1713
	semi-transparent outline.
sl@0
  1714
*/
sl@0
  1715
void CTDrawShapes::TestDrawShapeTransparentOutlineL()
sl@0
  1716
	{
sl@0
  1717
	_LIT(KTestName, "ShapeDrawing-TransparentOutline");
sl@0
  1718
	if(!iRunningOomTests)
sl@0
  1719
		{
sl@0
  1720
		INFO_PRINTF1(KTestName);
sl@0
  1721
		}
sl@0
  1722
	
sl@0
  1723
	ResetGc();
sl@0
  1724
	
sl@0
  1725
	const TInt width = iGdiTarget->SizeInPixels().iWidth;
sl@0
  1726
	const TInt height = iGdiTarget->SizeInPixels().iHeight;
sl@0
  1727
	
sl@0
  1728
	iGc->SetPenColor(TRgb(255,0,0,25));
sl@0
  1729
	iGc->SetBrushColor(TRgb(0,255,0,255));
sl@0
  1730
	iGc->SetBrushStyle(DirectGdi::ESolidBrush);
sl@0
  1731
	
sl@0
  1732
	const TInt KCount = 3;
sl@0
  1733
	TInt left = 10;
sl@0
  1734
	for (TInt count = 0; count < KCount; ++count)
sl@0
  1735
		{
sl@0
  1736
		// The sw version allocates memory when you set a pen size and this memory is not freed
sl@0
  1737
		// until after the __UHEAP_MARKEND macro when running OOM tests, this causes a memory 
sl@0
  1738
		// leak when this test leaves. The following TCleanupItem has been added to reset the pen
sl@0
  1739
		// size to 1,1 on account of a leave as settting the pen size to 1,1 deletes the allocated
sl@0
  1740
		// pen memory.
sl@0
  1741
		CleanupStack::PushL(TCleanupItem(ResetPenSize, iGc));
sl@0
  1742
sl@0
  1743
		switch(count)
sl@0
  1744
			{
sl@0
  1745
			case 0:
sl@0
  1746
				iGc->SetPenSize(TSize(1,1));
sl@0
  1747
				break;
sl@0
  1748
			case 1:
sl@0
  1749
				iGc->SetPenSize(TSize(15,7));
sl@0
  1750
				break;
sl@0
  1751
			case 2:
sl@0
  1752
				iGc->SetPenSize(TSize(width/(KCount*2),width/(KCount*2)));
sl@0
  1753
				break;
sl@0
  1754
			}
sl@0
  1755
		TInt right = left + (width/(KCount+2));
sl@0
  1756
		iGc->SetPenStyle(DirectGdi::ESolidPen);
sl@0
  1757
		iGc->DrawRect(TRect(left, height/10, right, height/5));
sl@0
  1758
		CArrayFixFlat<TPoint> *array = new (ELeave)CArrayFixFlat<TPoint>(20);
sl@0
  1759
		CleanupStack::PushL(array);
sl@0
  1760
		array->AppendL(TPoint(left, height*3/5));
sl@0
  1761
		array->AppendL(TPoint(left, height*9/10));
sl@0
  1762
		array->AppendL(TPoint(right, height*9/10));
sl@0
  1763
		iGc->DrawPolygon(*array, DirectGdi::EWinding);
sl@0
  1764
		CleanupStack::PopAndDestroy(2);
sl@0
  1765
		left = right + 50;
sl@0
  1766
		}
sl@0
  1767
sl@0
  1768
	TESTNOERRORL(iGc->GetError());
sl@0
  1769
	TESTNOERROR(WriteTargetOutput(iTestParams, KTestName()));
sl@0
  1770
	}
sl@0
  1771
sl@0
  1772
/**
sl@0
  1773
Override of base class virtual
sl@0
  1774
@leave Gets system wide error code
sl@0
  1775
@return - TVerdict code
sl@0
  1776
*/
sl@0
  1777
TVerdict CTDrawShapes::doTestStepPreambleL()
sl@0
  1778
	{			
sl@0
  1779
	CTDirectGdiStepBase::doTestStepPreambleL();	
sl@0
  1780
	return TestStepResult();
sl@0
  1781
	}
sl@0
  1782
	
sl@0
  1783
/** 
sl@0
  1784
Override of base class pure virtual
sl@0
  1785
Our implementation only gets called if the base class doTestStepPreambleL() did
sl@0
  1786
not leave. That being the case, the current test result value will be EPass.
sl@0
  1787
@leave Gets system wide error code
sl@0
  1788
@return TVerdict code
sl@0
  1789
*/	
sl@0
  1790
TVerdict CTDrawShapes::doTestStepL()
sl@0
  1791
	{		
sl@0
  1792
	// Test for each pixel format
sl@0
  1793
	for(TInt targetPixelFormatIndex = iTargetPixelFormatArray.Count() - 1; targetPixelFormatIndex >= 0 ; targetPixelFormatIndex--)
sl@0
  1794
		{
sl@0
  1795
		iTestParams.iTargetPixelFormat = iTargetPixelFormatArray[targetPixelFormatIndex];
sl@0
  1796
		SetTargetL(iTestParams.iTargetPixelFormat, EOneContextOneTarget, TSize(512, 512));
sl@0
  1797
		RunTestsL();
sl@0
  1798
		// only run OOM tests for one target pixel format to prevent duplication of tests
sl@0
  1799
		if (targetPixelFormatIndex == 0)
sl@0
  1800
			{
sl@0
  1801
			RunOomTestsL();  //from base class
sl@0
  1802
			}
sl@0
  1803
		}
sl@0
  1804
	CloseTMSGraphicsStep();
sl@0
  1805
	return TestStepResult();
sl@0
  1806
	}
sl@0
  1807
sl@0
  1808
/**
sl@0
  1809
Override of base class pure virtual
sl@0
  1810
Lists the tests to be run
sl@0
  1811
*/
sl@0
  1812
void CTDrawShapes::RunTestsL()
sl@0
  1813
	{
sl@0
  1814
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0001"));
sl@0
  1815
	TestBasicDrawShapeL();
sl@0
  1816
	RecordTestResultL();
sl@0
  1817
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0010"));
sl@0
  1818
	TestPlot();
sl@0
  1819
	RecordTestResultL();
sl@0
  1820
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0013"));
sl@0
  1821
	TestDrawShapeTransparentOutlineL();
sl@0
  1822
	RecordTestResultL();
sl@0
  1823
sl@0
  1824
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0008"));
sl@0
  1825
	TestDrawPolyLineL(EDrawPolyLine);
sl@0
  1826
	RecordTestResultL();
sl@0
  1827
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0008"));
sl@0
  1828
	TestDrawPolyLineL(EDrawPolyLineNoEndPoint);
sl@0
  1829
	RecordTestResultL();
sl@0
  1830
	
sl@0
  1831
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0009"));
sl@0
  1832
	TestDrawPolygonL(iGdiTarget->SizeInPixels().iWidth, iGdiTarget->SizeInPixels().iHeight);
sl@0
  1833
	RecordTestResultL();
sl@0
  1834
	if(!iRunningOomTests)
sl@0
  1835
		{
sl@0
  1836
		SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0009"));
sl@0
  1837
		TestDrawPolygonL(iGdiTarget->SizeInPixels().iWidth, iGdiTarget->SizeInPixels().iHeight, DirectGdi::ESolidBrush, DirectGdi::EAlternate);
sl@0
  1838
		RecordTestResultL();
sl@0
  1839
		SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0009"));
sl@0
  1840
		TestDrawPolygonL(iGdiTarget->SizeInPixels().iWidth, iGdiTarget->SizeInPixels().iHeight, DirectGdi::ESolidBrush, DirectGdi::EWinding);
sl@0
  1841
		RecordTestResultL();
sl@0
  1842
		}
sl@0
  1843
sl@0
  1844
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0002"));
sl@0
  1845
	TestDrawLineL(EDrawLine);
sl@0
  1846
	RecordTestResultL();
sl@0
  1847
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0002"));
sl@0
  1848
	TestDrawLineL(EDrawLineTo);
sl@0
  1849
	RecordTestResultL();
sl@0
  1850
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0002"));
sl@0
  1851
	TestDrawLineL(EDrawLineBy);
sl@0
  1852
	RecordTestResultL();
sl@0
  1853
sl@0
  1854
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0005"));
sl@0
  1855
	TestDrawRoundRectL();
sl@0
  1856
	RecordTestResultL();
sl@0
  1857
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0005"));
sl@0
  1858
	TestDrawRoundRectL(DirectGdi::ESolidBrush);
sl@0
  1859
	RecordTestResultL();
sl@0
  1860
sl@0
  1861
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0006"));
sl@0
  1862
	TestDrawArcL();
sl@0
  1863
	RecordTestResultL();
sl@0
  1864
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0011"));
sl@0
  1865
	TestDrawLargeArc();
sl@0
  1866
	RecordTestResultL();
sl@0
  1867
sl@0
  1868
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0007"));
sl@0
  1869
	TestDrawPieL();
sl@0
  1870
	RecordTestResultL();
sl@0
  1871
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0007"));
sl@0
  1872
	TestDrawPieL(DirectGdi::ESolidBrush);
sl@0
  1873
	RecordTestResultL();
sl@0
  1874
sl@0
  1875
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1876
	TestDrawShapePositionAndSizeL(EDrawRect, DirectGdi::ESolidPen, DirectGdi::ENullBrush);
sl@0
  1877
	RecordTestResultL();
sl@0
  1878
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1879
	TestDrawShapePositionAndSizeL(EDrawRoundRect, DirectGdi::ESolidPen, DirectGdi::ENullBrush);
sl@0
  1880
	RecordTestResultL();
sl@0
  1881
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1882
	TestDrawShapePositionAndSizeL(EDrawEllipse, DirectGdi::ESolidPen, DirectGdi::ENullBrush);
sl@0
  1883
	RecordTestResultL();
sl@0
  1884
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1885
	TestDrawShapePositionAndSizeL(EDrawPie, DirectGdi::ESolidPen, DirectGdi::ENullBrush);
sl@0
  1886
	RecordTestResultL();
sl@0
  1887
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1888
	TestDrawShapePositionAndSizeL(EDrawArc, DirectGdi::ESolidPen, DirectGdi::ENullBrush);
sl@0
  1889
	RecordTestResultL();
sl@0
  1890
	
sl@0
  1891
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1892
	TestDrawShapePositionAndSizeL(EDrawRect, DirectGdi::ESolidPen, DirectGdi::ESolidBrush);
sl@0
  1893
	RecordTestResultL();
sl@0
  1894
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1895
	TestDrawShapePositionAndSizeL(EDrawRoundRect, DirectGdi::ESolidPen, DirectGdi::ESolidBrush);
sl@0
  1896
	RecordTestResultL();
sl@0
  1897
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1898
	TestDrawShapePositionAndSizeL(EDrawEllipse, DirectGdi::ESolidPen, DirectGdi::ESolidBrush);
sl@0
  1899
	RecordTestResultL();
sl@0
  1900
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1901
	TestDrawShapePositionAndSizeL(EDrawPie, DirectGdi::ESolidPen, DirectGdi::ESolidBrush);
sl@0
  1902
	RecordTestResultL();
sl@0
  1903
	
sl@0
  1904
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1905
	TestDrawShapePositionAndSizeL(EDrawRect, DirectGdi::ENullPen, DirectGdi::ESolidBrush);
sl@0
  1906
	RecordTestResultL();
sl@0
  1907
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1908
	TestDrawShapePositionAndSizeL(EDrawRoundRect, DirectGdi::ENullPen, DirectGdi::ESolidBrush);
sl@0
  1909
	RecordTestResultL();
sl@0
  1910
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1911
	TestDrawShapePositionAndSizeL(EDrawEllipse, DirectGdi::ENullPen, DirectGdi::ESolidBrush);
sl@0
  1912
	RecordTestResultL();
sl@0
  1913
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0003"));
sl@0
  1914
	TestDrawShapePositionAndSizeL(EDrawPie, DirectGdi::ENullPen, DirectGdi::ESolidBrush);
sl@0
  1915
	RecordTestResultL();
sl@0
  1916
sl@0
  1917
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0004"));
sl@0
  1918
	TestDrawShapeInvalidParametersL(EDrawRect);
sl@0
  1919
	RecordTestResultL();
sl@0
  1920
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0004"));
sl@0
  1921
	TestDrawShapeInvalidParametersL(EDrawRoundRect);
sl@0
  1922
	RecordTestResultL();
sl@0
  1923
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0004"));
sl@0
  1924
	TestDrawShapeInvalidParametersL(EDrawEllipse);
sl@0
  1925
	RecordTestResultL();
sl@0
  1926
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0004"));
sl@0
  1927
	TestDrawShapeInvalidParametersL(EDrawPie);
sl@0
  1928
	RecordTestResultL();
sl@0
  1929
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0004"));
sl@0
  1930
	TestDrawShapeInvalidParametersL(EDrawArc);
sl@0
  1931
	RecordTestResultL();
sl@0
  1932
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0004"));
sl@0
  1933
	TestDrawShapeInvalidParametersL(EDrawPolygon);
sl@0
  1934
	RecordTestResultL();
sl@0
  1935
sl@0
  1936
	SetTestStepID(_L("GRAPHICS-DIRECTGDI-SHAPEDRAWING-0012"));
sl@0
  1937
	TestSetAttributesInvalidParametersL();
sl@0
  1938
	RecordTestResultL();
sl@0
  1939
	}