os/graphics/windowing/windowserver/test/tauto/TRECTLIST.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) 1996-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
// Generate a list of rectangles to be used as parameters for graphics tests
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @test
sl@0
    21
 @internalComponent - Internal Symbian test code
sl@0
    22
*/
sl@0
    23
sl@0
    24
sl@0
    25
#include "TRECTLIST.H"
sl@0
    26
sl@0
    27
CTRectList::CTRectList(CTestStep* aStep) : CTWsGraphicsBase(aStep)
sl@0
    28
	{
sl@0
    29
	}
sl@0
    30
sl@0
    31
CTRectList::~CTRectList()
sl@0
    32
	{
sl@0
    33
	}
sl@0
    34
sl@0
    35
void CTRectList::ConstructL()
sl@0
    36
	{
sl@0
    37
	TheGc->Activate(*BaseWin->Win());
sl@0
    38
	TheGc->SetBrushColor(TRgb::Gray16(14));
sl@0
    39
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
    40
	TheGc->SetPenStyle(CGraphicsContext::ENullPen);
sl@0
    41
	TheGc->DrawRect(TRect(BaseWin->Win()->Size()));
sl@0
    42
	TInt scale=16;
sl@0
    43
	TSize size(TestWin->Size());
sl@0
    44
	TSize scaleSize(size.iWidth/scale,size.iHeight/scale);
sl@0
    45
	iOffset1=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2);
sl@0
    46
	TheGc->DrawRect(TRect(iOffset1,scaleSize));
sl@0
    47
	TheGc->Deactivate();
sl@0
    48
//
sl@0
    49
	TheGc->Activate(*TestWin->Win());
sl@0
    50
	TheGc->SetBrushColor(TRgb::Gray16(15));
sl@0
    51
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
    52
	TheGc->SetPenStyle(CGraphicsContext::ENullPen);
sl@0
    53
	TheGc->DrawRect(TRect(TestWin->Win()->Size()));
sl@0
    54
	{
sl@0
    55
	TInt scale=1;
sl@0
    56
	TSize size(TestWin->Size());
sl@0
    57
	TSize scaleSize(size.iWidth/scale,size.iHeight/scale);
sl@0
    58
	iOffset2=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2);
sl@0
    59
	TheGc->DrawRect(TRect(iOffset2,scaleSize));
sl@0
    60
	TheGc->Deactivate();
sl@0
    61
	}
sl@0
    62
	}
sl@0
    63
	
sl@0
    64
void CTRectList::RunTestCaseL(TInt /*aCurTestCase*/)
sl@0
    65
	{	
sl@0
    66
	((CTRectListStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
sl@0
    67
	switch(++iTest->iState)
sl@0
    68
		{
sl@0
    69
	/**
sl@0
    70
@SYMTestCaseID		GRAPHICS-WSERV-0028
sl@0
    71
sl@0
    72
@@SYMDEF            DEF081259
sl@0
    73
sl@0
    74
@SYMTestCaseDesc    Draw rectangles from a list in two different positions
sl@0
    75
					on the screen
sl@0
    76
sl@0
    77
@SYMTestPriority    High
sl@0
    78
sl@0
    79
@SYMTestStatus      Implemented
sl@0
    80
sl@0
    81
@SYMTestActions     Draw a list of rectangles to the screen 
sl@0
    82
sl@0
    83
@SYMTestExpectedResults Rectangles are drawn without error
sl@0
    84
*/
sl@0
    85
	case 1:
sl@0
    86
		((CTRectListStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0028"));
sl@0
    87
		iTest->LogSubTest(_L("RectListCheck"));	
sl@0
    88
			{
sl@0
    89
			TheGc->Activate(*BaseWin->Win());
sl@0
    90
			TheGc->SetPenColor(TRgb::Gray16(7));
sl@0
    91
			TInt scale=16;
sl@0
    92
			for(TInt index=0;index<iTest->iTestRects.Count3();index++)
sl@0
    93
				{
sl@0
    94
				TRect rect=iTest->iTestRects[index];
sl@0
    95
				rect.iTl.iX/=scale;
sl@0
    96
				rect.iTl.iY/=scale;
sl@0
    97
				rect.iBr.iX/=scale;
sl@0
    98
				rect.iBr.iY/=scale;
sl@0
    99
				rect.Move(iOffset1);
sl@0
   100
				TheGc->DrawRect(rect);
sl@0
   101
				}
sl@0
   102
			TheGc->Deactivate();
sl@0
   103
			}
sl@0
   104
			{
sl@0
   105
			TheGc->Activate(*TestWin->Win());
sl@0
   106
			TheGc->SetPenColor(TRgb::Gray16(7));
sl@0
   107
			TInt scale=1;
sl@0
   108
			for(TInt index=0;index<iTest->iTestRects.Count3();index++)
sl@0
   109
				{
sl@0
   110
				TRect rect=iTest->iTestRects[index];
sl@0
   111
				rect.iTl.iX/=scale;
sl@0
   112
				rect.iTl.iY/=scale;
sl@0
   113
				rect.iBr.iX/=scale;
sl@0
   114
				rect.iBr.iY/=scale;
sl@0
   115
				rect.Move(iOffset2);
sl@0
   116
				TheGc->DrawRect(rect);
sl@0
   117
				}
sl@0
   118
			TheClient->iWs.Flush();
sl@0
   119
			TheGc->Deactivate();
sl@0
   120
			}
sl@0
   121
			TEST(ETrue);
sl@0
   122
			break;
sl@0
   123
	case 2:
sl@0
   124
		((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
   125
		iTest->LogSubTest(_L("Panic"));
sl@0
   126
		break;
sl@0
   127
	case 3:
sl@0
   128
		((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
   129
		((CTRectListStep*)iStep)->CloseTMSGraphicsStep();
sl@0
   130
		TestComplete();
sl@0
   131
		break;
sl@0
   132
		}
sl@0
   133
	((CTRectListStep*)iStep)->RecordTestResultL();
sl@0
   134
	}
sl@0
   135
sl@0
   136
__WS_CONSTRUCT_STEP__(RectList)