windowing/windowserver/test/tauto/TRECTLIST.CPP
author hgs
Tue, 22 Jun 2010 15:21:29 +0300
changeset 103 2717213c588a
permissions -rw-r--r--
201024
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
103
hgs
parents:
diff changeset
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     2
// All rights reserved.
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     7
//
hgs
parents:
diff changeset
     8
// Initial Contributors:
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    10
//
hgs
parents:
diff changeset
    11
// Contributors:
hgs
parents:
diff changeset
    12
//
hgs
parents:
diff changeset
    13
// Description:
hgs
parents:
diff changeset
    14
// Generate a list of rectangles to be used as parameters for graphics tests
hgs
parents:
diff changeset
    15
// 
hgs
parents:
diff changeset
    16
//
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
/**
hgs
parents:
diff changeset
    19
 @file
hgs
parents:
diff changeset
    20
 @test
hgs
parents:
diff changeset
    21
 @internalComponent - Internal Symbian test code
hgs
parents:
diff changeset
    22
*/
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
hgs
parents:
diff changeset
    25
#include "TRECTLIST.H"
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
CTRectList::CTRectList(CTestStep* aStep) : CTWsGraphicsBase(aStep)
hgs
parents:
diff changeset
    28
	{
hgs
parents:
diff changeset
    29
	}
hgs
parents:
diff changeset
    30
hgs
parents:
diff changeset
    31
CTRectList::~CTRectList()
hgs
parents:
diff changeset
    32
	{
hgs
parents:
diff changeset
    33
	}
hgs
parents:
diff changeset
    34
hgs
parents:
diff changeset
    35
void CTRectList::ConstructL()
hgs
parents:
diff changeset
    36
	{
hgs
parents:
diff changeset
    37
	TheGc->Activate(*BaseWin->Win());
hgs
parents:
diff changeset
    38
	TheGc->SetBrushColor(TRgb::Gray16(14));
hgs
parents:
diff changeset
    39
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
hgs
parents:
diff changeset
    40
	TheGc->SetPenStyle(CGraphicsContext::ENullPen);
hgs
parents:
diff changeset
    41
	TheGc->DrawRect(TRect(BaseWin->Win()->Size()));
hgs
parents:
diff changeset
    42
	TInt scale=16;
hgs
parents:
diff changeset
    43
	TSize size(TestWin->Size());
hgs
parents:
diff changeset
    44
	TSize scaleSize(size.iWidth/scale,size.iHeight/scale);
hgs
parents:
diff changeset
    45
	iOffset1=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2);
hgs
parents:
diff changeset
    46
	TheGc->DrawRect(TRect(iOffset1,scaleSize));
hgs
parents:
diff changeset
    47
	TheGc->Deactivate();
hgs
parents:
diff changeset
    48
//
hgs
parents:
diff changeset
    49
	TheGc->Activate(*TestWin->Win());
hgs
parents:
diff changeset
    50
	TheGc->SetBrushColor(TRgb::Gray16(15));
hgs
parents:
diff changeset
    51
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
hgs
parents:
diff changeset
    52
	TheGc->SetPenStyle(CGraphicsContext::ENullPen);
hgs
parents:
diff changeset
    53
	TheGc->DrawRect(TRect(TestWin->Win()->Size()));
hgs
parents:
diff changeset
    54
	{
hgs
parents:
diff changeset
    55
	TInt scale=1;
hgs
parents:
diff changeset
    56
	TSize size(TestWin->Size());
hgs
parents:
diff changeset
    57
	TSize scaleSize(size.iWidth/scale,size.iHeight/scale);
hgs
parents:
diff changeset
    58
	iOffset2=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2);
hgs
parents:
diff changeset
    59
	TheGc->DrawRect(TRect(iOffset2,scaleSize));
hgs
parents:
diff changeset
    60
	TheGc->Deactivate();
hgs
parents:
diff changeset
    61
	}
hgs
parents:
diff changeset
    62
	}
hgs
parents:
diff changeset
    63
	
hgs
parents:
diff changeset
    64
void CTRectList::RunTestCaseL(TInt /*aCurTestCase*/)
hgs
parents:
diff changeset
    65
	{	
hgs
parents:
diff changeset
    66
	((CTRectListStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
hgs
parents:
diff changeset
    67
	switch(++iTest->iState)
hgs
parents:
diff changeset
    68
		{
hgs
parents:
diff changeset
    69
	/**
hgs
parents:
diff changeset
    70
@SYMTestCaseID		GRAPHICS-WSERV-0028
hgs
parents:
diff changeset
    71
hgs
parents:
diff changeset
    72
@@SYMDEF            DEF081259
hgs
parents:
diff changeset
    73
hgs
parents:
diff changeset
    74
@SYMTestCaseDesc    Draw rectangles from a list in two different positions
hgs
parents:
diff changeset
    75
					on the screen
hgs
parents:
diff changeset
    76
hgs
parents:
diff changeset
    77
@SYMTestPriority    High
hgs
parents:
diff changeset
    78
hgs
parents:
diff changeset
    79
@SYMTestStatus      Implemented
hgs
parents:
diff changeset
    80
hgs
parents:
diff changeset
    81
@SYMTestActions     Draw a list of rectangles to the screen 
hgs
parents:
diff changeset
    82
hgs
parents:
diff changeset
    83
@SYMTestExpectedResults Rectangles are drawn without error
hgs
parents:
diff changeset
    84
*/
hgs
parents:
diff changeset
    85
	case 1:
hgs
parents:
diff changeset
    86
		((CTRectListStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0028"));
hgs
parents:
diff changeset
    87
		iTest->LogSubTest(_L("RectListCheck"));	
hgs
parents:
diff changeset
    88
			{
hgs
parents:
diff changeset
    89
			TheGc->Activate(*BaseWin->Win());
hgs
parents:
diff changeset
    90
			TheGc->SetPenColor(TRgb::Gray16(7));
hgs
parents:
diff changeset
    91
			TInt scale=16;
hgs
parents:
diff changeset
    92
			for(TInt index=0;index<iTest->iTestRects.Count3();index++)
hgs
parents:
diff changeset
    93
				{
hgs
parents:
diff changeset
    94
				TRect rect=iTest->iTestRects[index];
hgs
parents:
diff changeset
    95
				rect.iTl.iX/=scale;
hgs
parents:
diff changeset
    96
				rect.iTl.iY/=scale;
hgs
parents:
diff changeset
    97
				rect.iBr.iX/=scale;
hgs
parents:
diff changeset
    98
				rect.iBr.iY/=scale;
hgs
parents:
diff changeset
    99
				rect.Move(iOffset1);
hgs
parents:
diff changeset
   100
				TheGc->DrawRect(rect);
hgs
parents:
diff changeset
   101
				}
hgs
parents:
diff changeset
   102
			TheGc->Deactivate();
hgs
parents:
diff changeset
   103
			}
hgs
parents:
diff changeset
   104
			{
hgs
parents:
diff changeset
   105
			TheGc->Activate(*TestWin->Win());
hgs
parents:
diff changeset
   106
			TheGc->SetPenColor(TRgb::Gray16(7));
hgs
parents:
diff changeset
   107
			TInt scale=1;
hgs
parents:
diff changeset
   108
			for(TInt index=0;index<iTest->iTestRects.Count3();index++)
hgs
parents:
diff changeset
   109
				{
hgs
parents:
diff changeset
   110
				TRect rect=iTest->iTestRects[index];
hgs
parents:
diff changeset
   111
				rect.iTl.iX/=scale;
hgs
parents:
diff changeset
   112
				rect.iTl.iY/=scale;
hgs
parents:
diff changeset
   113
				rect.iBr.iX/=scale;
hgs
parents:
diff changeset
   114
				rect.iBr.iY/=scale;
hgs
parents:
diff changeset
   115
				rect.Move(iOffset2);
hgs
parents:
diff changeset
   116
				TheGc->DrawRect(rect);
hgs
parents:
diff changeset
   117
				}
hgs
parents:
diff changeset
   118
			TheClient->iWs.Flush();
hgs
parents:
diff changeset
   119
			TheGc->Deactivate();
hgs
parents:
diff changeset
   120
			}
hgs
parents:
diff changeset
   121
			TEST(ETrue);
hgs
parents:
diff changeset
   122
			break;
hgs
parents:
diff changeset
   123
	case 2:
hgs
parents:
diff changeset
   124
		((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
hgs
parents:
diff changeset
   125
		iTest->LogSubTest(_L("Panic"));
hgs
parents:
diff changeset
   126
		break;
hgs
parents:
diff changeset
   127
	case 3:
hgs
parents:
diff changeset
   128
		((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
hgs
parents:
diff changeset
   129
		((CTRectListStep*)iStep)->CloseTMSGraphicsStep();
hgs
parents:
diff changeset
   130
		TestComplete();
hgs
parents:
diff changeset
   131
		break;
hgs
parents:
diff changeset
   132
		}
hgs
parents:
diff changeset
   133
	((CTRectListStep*)iStep)->RecordTestResultL();
hgs
parents:
diff changeset
   134
	}
hgs
parents:
diff changeset
   135
hgs
parents:
diff changeset
   136
__WS_CONSTRUCT_STEP__(RectList)