1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TRECTLIST.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,136 @@
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 +// Generate a list of rectangles to be used as parameters for graphics tests
1.18 +//
1.19 +//
1.20 +
1.21 +/**
1.22 + @file
1.23 + @test
1.24 + @internalComponent - Internal Symbian test code
1.25 +*/
1.26 +
1.27 +
1.28 +#include "TRECTLIST.H"
1.29 +
1.30 +CTRectList::CTRectList(CTestStep* aStep) : CTWsGraphicsBase(aStep)
1.31 + {
1.32 + }
1.33 +
1.34 +CTRectList::~CTRectList()
1.35 + {
1.36 + }
1.37 +
1.38 +void CTRectList::ConstructL()
1.39 + {
1.40 + TheGc->Activate(*BaseWin->Win());
1.41 + TheGc->SetBrushColor(TRgb::Gray16(14));
1.42 + TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.43 + TheGc->SetPenStyle(CGraphicsContext::ENullPen);
1.44 + TheGc->DrawRect(TRect(BaseWin->Win()->Size()));
1.45 + TInt scale=16;
1.46 + TSize size(TestWin->Size());
1.47 + TSize scaleSize(size.iWidth/scale,size.iHeight/scale);
1.48 + iOffset1=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2);
1.49 + TheGc->DrawRect(TRect(iOffset1,scaleSize));
1.50 + TheGc->Deactivate();
1.51 +//
1.52 + TheGc->Activate(*TestWin->Win());
1.53 + TheGc->SetBrushColor(TRgb::Gray16(15));
1.54 + TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.55 + TheGc->SetPenStyle(CGraphicsContext::ENullPen);
1.56 + TheGc->DrawRect(TRect(TestWin->Win()->Size()));
1.57 + {
1.58 + TInt scale=1;
1.59 + TSize size(TestWin->Size());
1.60 + TSize scaleSize(size.iWidth/scale,size.iHeight/scale);
1.61 + iOffset2=TPoint((size.iWidth-scaleSize.iWidth)/2,(size.iWidth-scaleSize.iHeight)/2);
1.62 + TheGc->DrawRect(TRect(iOffset2,scaleSize));
1.63 + TheGc->Deactivate();
1.64 + }
1.65 + }
1.66 +
1.67 +void CTRectList::RunTestCaseL(TInt /*aCurTestCase*/)
1.68 + {
1.69 + ((CTRectListStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1.70 + switch(++iTest->iState)
1.71 + {
1.72 + /**
1.73 +@SYMTestCaseID GRAPHICS-WSERV-0028
1.74 +
1.75 +@@SYMDEF DEF081259
1.76 +
1.77 +@SYMTestCaseDesc Draw rectangles from a list in two different positions
1.78 + on the screen
1.79 +
1.80 +@SYMTestPriority High
1.81 +
1.82 +@SYMTestStatus Implemented
1.83 +
1.84 +@SYMTestActions Draw a list of rectangles to the screen
1.85 +
1.86 +@SYMTestExpectedResults Rectangles are drawn without error
1.87 +*/
1.88 + case 1:
1.89 + ((CTRectListStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0028"));
1.90 + iTest->LogSubTest(_L("RectListCheck"));
1.91 + {
1.92 + TheGc->Activate(*BaseWin->Win());
1.93 + TheGc->SetPenColor(TRgb::Gray16(7));
1.94 + TInt scale=16;
1.95 + for(TInt index=0;index<iTest->iTestRects.Count3();index++)
1.96 + {
1.97 + TRect rect=iTest->iTestRects[index];
1.98 + rect.iTl.iX/=scale;
1.99 + rect.iTl.iY/=scale;
1.100 + rect.iBr.iX/=scale;
1.101 + rect.iBr.iY/=scale;
1.102 + rect.Move(iOffset1);
1.103 + TheGc->DrawRect(rect);
1.104 + }
1.105 + TheGc->Deactivate();
1.106 + }
1.107 + {
1.108 + TheGc->Activate(*TestWin->Win());
1.109 + TheGc->SetPenColor(TRgb::Gray16(7));
1.110 + TInt scale=1;
1.111 + for(TInt index=0;index<iTest->iTestRects.Count3();index++)
1.112 + {
1.113 + TRect rect=iTest->iTestRects[index];
1.114 + rect.iTl.iX/=scale;
1.115 + rect.iTl.iY/=scale;
1.116 + rect.iBr.iX/=scale;
1.117 + rect.iBr.iY/=scale;
1.118 + rect.Move(iOffset2);
1.119 + TheGc->DrawRect(rect);
1.120 + }
1.121 + TheClient->iWs.Flush();
1.122 + TheGc->Deactivate();
1.123 + }
1.124 + TEST(ETrue);
1.125 + break;
1.126 + case 2:
1.127 + ((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.128 + iTest->LogSubTest(_L("Panic"));
1.129 + break;
1.130 + case 3:
1.131 + ((CTRectListStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1.132 + ((CTRectListStep*)iStep)->CloseTMSGraphicsStep();
1.133 + TestComplete();
1.134 + break;
1.135 + }
1.136 + ((CTRectListStep*)iStep)->RecordTestResultL();
1.137 + }
1.138 +
1.139 +__WS_CONSTRUCT_STEP__(RectList)