1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TREDRAW.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,239 @@
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 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +#ifndef __TREDRAW_H__
1.26 +#define __TREDRAW_H__
1.27 +
1.28 +#include <e32std.h>
1.29 +#include <w32std.h>
1.30 +#include "../tlib/testbase.h"
1.31 +#include "AUTO.H"
1.32 +#include "TScreenModeScaling.h"
1.33 +#include "TGraphicsHarness.h"
1.34 +
1.35 +class CTRedrawTest;
1.36 +
1.37 +/**
1.38 + * Abstract base class to draw a pattern into a window.
1.39 + *
1.40 + * This provides a default Draw() implementation which
1.41 + * DOES NOT set the clipping region before drawing.
1.42 + */
1.43 +class CRedrawWindow : public CTWin
1.44 + {
1.45 + friend class CTRedrawTest;
1.46 +public:
1.47 + enum TDrawPattern
1.48 + {
1.49 + EDrawGraphPaperlHatched = 0,
1.50 + EDrawSlantingHatched,
1.51 + EDrawCenteredRectangle
1.52 + };
1.53 +public:
1.54 + CRedrawWindow(CTRedrawTest* aTest);
1.55 + ~CRedrawWindow();
1.56 +public:
1.57 + /*
1.58 + * Draw the window, counting the number of calls.
1.59 + * @post DrawRequests() returns a value increased by 1.
1.60 + */
1.61 + virtual void Reset();
1.62 + virtual void PrepareInvalidation(const TRect& aRect) = 0;
1.63 + virtual void PerformInvalidation() = 0;
1.64 + //Virtual function from CTBaseWin
1.65 + void Draw();
1.66 +public:
1.67 + void ActivateAndDraw(TInt aPattern);
1.68 + void DrawPattern(TInt aPattern);
1.69 + void VisibleRegion(RRegion& aRegion);
1.70 + void ValidateAndClear();
1.71 + void ActivateAndDraw(TInt aPattern,TRegion* aRegion);
1.72 + TInt DrawRequests() const;
1.73 +protected:
1.74 + void ReceivedDrawRequest();
1.75 + TPoint iOffset;
1.76 + RRegion iInvalid;
1.77 + CTRedrawTest *iTest;
1.78 +private:
1.79 + TInt iDrawRequests;
1.80 + };
1.81 +
1.82 +/**
1.83 + * Concrete class to draw a pattern into a window.
1.84 + *
1.85 + */
1.86 +class CReferenceComparisonRedrawWindow : public CRedrawWindow
1.87 + {
1.88 +public:
1.89 + CReferenceComparisonRedrawWindow(CTRedrawTest* aTest);
1.90 +public:
1.91 + // from CRedrawWindow
1.92 + void PrepareInvalidation(const TRect& aRect);
1.93 + void PerformInvalidation();
1.94 + };
1.95 +
1.96 +class CRedrawWindow2 : public CRedrawWindow
1.97 + {
1.98 +public:
1.99 + CRedrawWindow2(CTRedrawTest* aTest);
1.100 +public:
1.101 + //Virtual function from CTBaseWin overridden in CRedrawWindow
1.102 + void Draw();
1.103 + //Virtual function from CRedrawWindow
1.104 + void Reset();
1.105 + // from CRedrawWindow
1.106 + void PrepareInvalidation(const TRect& aRect);
1.107 + void PerformInvalidation();
1.108 +private:
1.109 + TBool iClipped;
1.110 + };
1.111 +
1.112 +class CRedrawWindow3 : public CRedrawWindow
1.113 + {
1.114 +public:
1.115 + CRedrawWindow3(CTRedrawTest* aTest);
1.116 +public:
1.117 + //Virtual function from CTBaseWin overridden in CRedrawWindow
1.118 + void Draw();
1.119 + // from CRedrawWindow
1.120 + void PrepareInvalidation(const TRect& aRect);
1.121 + void PerformInvalidation();
1.122 +public:
1.123 + void SetUp1L(TPoint pos,TSize size,CTWinBase* parent,CWindowGc& aGc);
1.124 + void Activate();
1.125 + void Redraw(const TRect& aRect);
1.126 +protected:
1.127 + TBool isActive;
1.128 + };
1.129 +
1.130 +class CTRedrawOrderWindow : public CTWin
1.131 + {
1.132 +public:
1.133 + CTRedrawOrderWindow(TInt aOrder, CTRedrawTest *aTest);
1.134 + static CTRedrawOrderWindow* NewLC(TInt aOrder,CTWinBase* aParent,const TPoint& aPos,const TSize& aSize,CTRedrawTest* aTest);
1.135 + inline static TInt RedrawNumber() {return iRedrawNumber;}
1.136 + static void ResetRedrawNumber();
1.137 + void Redraw(const TRect& aRect);
1.138 + void Draw();
1.139 +private:
1.140 + CTRedrawTest* iTest;
1.141 + TInt iOrder;
1.142 + static TInt iRedrawNumber;
1.143 + };
1.144 +
1.145 +class CTCheckDefectWin : public CBasicWin
1.146 + {
1.147 +public:
1.148 + static CTCheckDefectWin *NewL(TPoint aPos,TSize aWinSize);
1.149 +private:
1.150 + CTCheckDefectWin(){}
1.151 + };
1.152 +
1.153 +class CInvalidRegionChecker : public CBase
1.154 + {
1.155 +public:
1.156 + CInvalidRegionChecker(const CTRedrawTest& aGraphicsTest);
1.157 + ~CInvalidRegionChecker();
1.158 +
1.159 + TInt CheckInvalidRegions(const CTWindowGroup* aGroup);
1.160 + TBool ExcludedWindow(const CTWinBase* aTWinBase) const;
1.161 + TInt AddExcludedWindow(const CTWinBase* aExcludedWindow);
1.162 + void RemoveExcludedWindow(const CTWinBase* aExcludedWindow);
1.163 +private:
1.164 + void ProcessWindowGroup(const CTWinBase* aTWinBase);
1.165 + void ProcessChildWindow(const CTWinBase* aTWinBase);
1.166 + void ProcessWindow(const CTWinBase* aTWinBase);
1.167 +private:
1.168 + TInt iInvalidRegionCount;
1.169 + RPointerArray<const CTWinBase> iExcludedWindowArray;
1.170 + const CTRedrawTest& iGraphicsTest;
1.171 + };
1.172 +
1.173 +class CTRedrawTest : public CTWsGraphicsBase
1.174 + {
1.175 +public:
1.176 + CTRedrawTest(CTestStep* aStep);
1.177 + ~CTRedrawTest();
1.178 + void doDestruct();
1.179 + void ConstructL();
1.180 + void CheckRedrawWindows();
1.181 + void ProcessBaseInvalidate();
1.182 + void SetBackground(const TRgb& aRgb);
1.183 + void DumpRegion(const TRegion& aRegion);
1.184 + inline TInt WinContent();
1.185 + void InvalidateTestWins(const TRect& aRect);
1.186 + void MoveInvalidAreaL();
1.187 + void TestGetInvalidRegionL(const CArrayFixFlat<TRect>* aRectList);
1.188 + void GetInvalidRegionTestsL();
1.189 + void CompareRegionsL(const TRegion& aRegion1,const TRegion& aRegion2);
1.190 + void Failed(TInt aOrder);
1.191 + void CheckOrderL();
1.192 + void TestRect();
1.193 + void CheckDefectINC049554L();
1.194 + void CheckDefectPDEF099892L();
1.195 + void CheckOrdinalPositionDefectL();
1.196 + void CheckDefectPDEF117784L();
1.197 + void CheckMMSDefectL(TBool aMoveBlankWindow);
1.198 + void ConstructAndSetBlankWinLC(RBlankWindow& aWindow, TSize aSize, TPoint aPoint=TPoint(),
1.199 + TRgb aBackgroundColor=TRgb(0,0,0));
1.200 + void ConstructWindowLC(RWindow& aWindow, TSize aSize, TPoint aPoint=TPoint(),
1.201 + TRgb aBackgroundColor=TRgb(255,255,255), TBool aTransparencyByAlpha=EFalse,
1.202 + TDisplayMode aDisplayMode=EColor64K);
1.203 + void ActivateAndSetGc(CWindowGc& aGc, RWindow& aWindow, CGraphicsContext::TBrushStyle aBrushStyle=CGraphicsContext::ESolidBrush, TRgb aBrushColor=TRgb(0,0,0),
1.204 + CGraphicsContext::TPenStyle aPenStyle=CGraphicsContext::ENullPen, TRgb aPenColor=TRgb(0,0,0));
1.205 + void DrawWin(CWindowGc& aGc, RWindow& aWin, TSize winSize, TRgb aRectColor1, TRgb aRectColor2, TInt aNewOrdinalPos=0, RWindow* aWinToMove=NULL, TBool aDrawAllPixels=EFalse);
1.206 + enum TRedrawCheckType
1.207 + {
1.208 + ECheckRedrawActiveObjectOnly,
1.209 + ECheckRedrawActiveObjectAndInvalidRegions
1.210 + };
1.211 + TInt WaitForRedrawsToFinish(TRedrawCheckType aRedrawCheckType);
1.212 +protected:
1.213 +//from CTGraphicsStep
1.214 + virtual void RunTestCaseL(TInt aCurTestCase);
1.215 +private:
1.216 + void ValidateAndClear(TestWindow *aWin);
1.217 +private:
1.218 + TSize iWinSize;
1.219 + TBool iDoCheck;
1.220 + TInt iRedrawNo;
1.221 + CReferenceComparisonRedrawWindow *iBaseRedrawWin;
1.222 + CRedrawWindow2 *iTestRedrawWin;
1.223 + CBlankWindow *iBaseChildWin;
1.224 + CBlankWindow *iTestChildWin;
1.225 + TInt iDrawRequestsFromTestWindow;
1.226 + TInt iWinContent;
1.227 + CInvalidRegionChecker *iInvalidRegionChecker;
1.228 + };
1.229 +
1.230 +class CTRedrawTestStep : public CTGraphicsStep
1.231 + {
1.232 +public:
1.233 + CTRedrawTestStep();
1.234 +protected:
1.235 + //from CTGraphicsStep
1.236 + virtual CTGraphicsBase* CreateTestL();
1.237 + };
1.238 +
1.239 +_LIT(KTRedrawTestStep,"TRedrawTest");
1.240 +
1.241 +
1.242 +#endif