First public contribution.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 @internalComponent - Internal Symbian test code
27 #include "../tlib/testbase.h"
29 #include "TScreenModeScaling.h"
30 #include "TGraphicsHarness.h"
35 * Abstract base class to draw a pattern into a window.
37 * This provides a default Draw() implementation which
38 * DOES NOT set the clipping region before drawing.
40 class CRedrawWindow : public CTWin
42 friend class CTRedrawTest;
46 EDrawGraphPaperlHatched = 0,
48 EDrawCenteredRectangle
51 CRedrawWindow(CTRedrawTest* aTest);
55 * Draw the window, counting the number of calls.
56 * @post DrawRequests() returns a value increased by 1.
59 virtual void PrepareInvalidation(const TRect& aRect) = 0;
60 virtual void PerformInvalidation() = 0;
61 //Virtual function from CTBaseWin
64 void ActivateAndDraw(TInt aPattern);
65 void DrawPattern(TInt aPattern);
66 void VisibleRegion(RRegion& aRegion);
67 void ValidateAndClear();
68 void ActivateAndDraw(TInt aPattern,TRegion* aRegion);
69 TInt DrawRequests() const;
71 void ReceivedDrawRequest();
80 * Concrete class to draw a pattern into a window.
83 class CReferenceComparisonRedrawWindow : public CRedrawWindow
86 CReferenceComparisonRedrawWindow(CTRedrawTest* aTest);
89 void PrepareInvalidation(const TRect& aRect);
90 void PerformInvalidation();
93 class CRedrawWindow2 : public CRedrawWindow
96 CRedrawWindow2(CTRedrawTest* aTest);
98 //Virtual function from CTBaseWin overridden in CRedrawWindow
100 //Virtual function from CRedrawWindow
102 // from CRedrawWindow
103 void PrepareInvalidation(const TRect& aRect);
104 void PerformInvalidation();
109 class CRedrawWindow3 : public CRedrawWindow
112 CRedrawWindow3(CTRedrawTest* aTest);
114 //Virtual function from CTBaseWin overridden in CRedrawWindow
116 // from CRedrawWindow
117 void PrepareInvalidation(const TRect& aRect);
118 void PerformInvalidation();
120 void SetUp1L(TPoint pos,TSize size,CTWinBase* parent,CWindowGc& aGc);
122 void Redraw(const TRect& aRect);
127 class CTRedrawOrderWindow : public CTWin
130 CTRedrawOrderWindow(TInt aOrder, CTRedrawTest *aTest);
131 static CTRedrawOrderWindow* NewLC(TInt aOrder,CTWinBase* aParent,const TPoint& aPos,const TSize& aSize,CTRedrawTest* aTest);
132 inline static TInt RedrawNumber() {return iRedrawNumber;}
133 static void ResetRedrawNumber();
134 void Redraw(const TRect& aRect);
139 static TInt iRedrawNumber;
142 class CTCheckDefectWin : public CBasicWin
145 static CTCheckDefectWin *NewL(TPoint aPos,TSize aWinSize);
150 class CInvalidRegionChecker : public CBase
153 CInvalidRegionChecker(const CTRedrawTest& aGraphicsTest);
154 ~CInvalidRegionChecker();
156 TInt CheckInvalidRegions(const CTWindowGroup* aGroup);
157 TBool ExcludedWindow(const CTWinBase* aTWinBase) const;
158 TInt AddExcludedWindow(const CTWinBase* aExcludedWindow);
159 void RemoveExcludedWindow(const CTWinBase* aExcludedWindow);
161 void ProcessWindowGroup(const CTWinBase* aTWinBase);
162 void ProcessChildWindow(const CTWinBase* aTWinBase);
163 void ProcessWindow(const CTWinBase* aTWinBase);
165 TInt iInvalidRegionCount;
166 RPointerArray<const CTWinBase> iExcludedWindowArray;
167 const CTRedrawTest& iGraphicsTest;
170 class CTRedrawTest : public CTWsGraphicsBase
173 CTRedrawTest(CTestStep* aStep);
177 void CheckRedrawWindows();
178 void ProcessBaseInvalidate();
179 void SetBackground(const TRgb& aRgb);
180 void DumpRegion(const TRegion& aRegion);
181 inline TInt WinContent();
182 void InvalidateTestWins(const TRect& aRect);
183 void MoveInvalidAreaL();
184 void TestGetInvalidRegionL(const CArrayFixFlat<TRect>* aRectList);
185 void GetInvalidRegionTestsL();
186 void CompareRegionsL(const TRegion& aRegion1,const TRegion& aRegion2);
187 void Failed(TInt aOrder);
190 void CheckDefectINC049554L();
191 void CheckDefectPDEF099892L();
192 void CheckOrdinalPositionDefectL();
193 void CheckDefectPDEF117784L();
194 void CheckMMSDefectL(TBool aMoveBlankWindow);
195 void ConstructAndSetBlankWinLC(RBlankWindow& aWindow, TSize aSize, TPoint aPoint=TPoint(),
196 TRgb aBackgroundColor=TRgb(0,0,0));
197 void ConstructWindowLC(RWindow& aWindow, TSize aSize, TPoint aPoint=TPoint(),
198 TRgb aBackgroundColor=TRgb(255,255,255), TBool aTransparencyByAlpha=EFalse,
199 TDisplayMode aDisplayMode=EColor64K);
200 void ActivateAndSetGc(CWindowGc& aGc, RWindow& aWindow, CGraphicsContext::TBrushStyle aBrushStyle=CGraphicsContext::ESolidBrush, TRgb aBrushColor=TRgb(0,0,0),
201 CGraphicsContext::TPenStyle aPenStyle=CGraphicsContext::ENullPen, TRgb aPenColor=TRgb(0,0,0));
202 void DrawWin(CWindowGc& aGc, RWindow& aWin, TSize winSize, TRgb aRectColor1, TRgb aRectColor2, TInt aNewOrdinalPos=0, RWindow* aWinToMove=NULL, TBool aDrawAllPixels=EFalse);
203 enum TRedrawCheckType
205 ECheckRedrawActiveObjectOnly,
206 ECheckRedrawActiveObjectAndInvalidRegions
208 TInt WaitForRedrawsToFinish(TRedrawCheckType aRedrawCheckType);
210 //from CTGraphicsStep
211 virtual void RunTestCaseL(TInt aCurTestCase);
213 void ValidateAndClear(TestWindow *aWin);
218 CReferenceComparisonRedrawWindow *iBaseRedrawWin;
219 CRedrawWindow2 *iTestRedrawWin;
220 CBlankWindow *iBaseChildWin;
221 CBlankWindow *iTestChildWin;
222 TInt iDrawRequestsFromTestWindow;
224 CInvalidRegionChecker *iInvalidRegionChecker;
227 class CTRedrawTestStep : public CTGraphicsStep
232 //from CTGraphicsStep
233 virtual CTGraphicsBase* CreateTestL();
236 _LIT(KTRedrawTestStep,"TRedrawTest");