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
22 #ifndef __TREDRSTR_H__
23 #define __TREDRSTR_H__
27 #include "../../tlib/testbase.h"
29 #include "TGraphicsHarness.h"
30 #include "TScreenModeScaling.h"
33 class CRedrawStoreWin;
35 class CBitmapMaskedWin;
36 class CResetRedrawStoreWin;
39 class CTRedrawStoring : public CTWsGraphicsBase
42 CTRedrawStoring(CTestStep* aStep);
46 void CheckWindowsMatch();
47 void CheckWindowsMatchLossy();
48 void CheckWindowsNotMatch();
49 void HideRevealTest();
50 void MultipleHideReveal(TInt aX,TInt aY);
52 void DoDrawingL(CWindowGc* aWinGc);
53 void DoDrawingL(TInt aDraw,CBitmapContext* aGc,TBool aWinGc);
55 void FadeWindowTest();
56 void FadeWindowTest2L();
59 void SetScrolling(TPoint aScrollSource, TRect aScrollTarget);
60 //Pure Virtual Function from CTestBase
61 void DoNothingInRedrawTest();
62 void DoDisableRedrawStoreTest();
63 void DoBitBltAndMaskedNegTestsL();
65 void DoTestDrawBitmapMaskedL(TBool aWsBitmap=EFalse);
66 void DrawBitmapAndCheckL(const TSize aSize,TDisplayMode aDisplayMode,CFbsBitmap* aSrceBitmap,CFbsBitmap* aMaskBitmap,TBool aInvertMask);
67 void DoFontCacheOverflowTestL();
68 void FontCacheOverflowDrawingTestL(TBool aDiffGc, RWindow& aWindow);
69 void DoInvisibleRedrawStoreTestL( TBool aUseTransparency );
70 void DoBrushDrawTestL();
71 void DoPartialDrawNowTestL( TBool aUseTransparency );
72 void DoBeginEndRedraw();
73 void DoRedrawStoreAlphaChannelTransTest();
75 void DoExposeTestL(TInt aIteration);
76 void DoExposeTest2L(TInt aIteration);
77 void DoEmptyDrawTestL(TInt aTestMode);
78 void DoPolygonRedrawTestSetL();
79 void DoPolygonRedrawTestL(TInt aWindowMode, TInt aTestMode);
80 void DoRedrawOOMTestL();
81 void RedrawStoreWithBadRectL();
83 virtual void RunTestCaseL(TInt aCurTestCase);
84 void DoAutoResetRedrawStoreTestL(TBool aTwoWins, TBool aAnimateBothWins, TBool aKeepGcActive, TBool aUpdateInRedraw);
85 void AutoResetRedrawStoreTestsL();
86 void RedrawStoreWithSetExtentL();
87 void PartialRedrawWithEmptyRedrawStoreL();
88 void DoPartialRedrawWithEmptyRedrawStoreL(TInt aNumWins, TBool aDoWinOnTop, TBool aRedrawWindow, TBool aChildWindows);
89 CResetRedrawStoreWin* CreatePartialRedrawWinLC(const TPoint& aPos, const TSize& aSize, CTWin* aParent=NULL);
90 CNoDrawWin* CreateNoDrawWinLC(const TPoint &aPos, const TSize &aSize);
91 void GetTestWinSizeAndPos(TInt aWinIndex, TPoint &aPos, TSize &aSize) const;
101 EClientRedrawsNormal,
102 EClientRedrawsScrolled,
104 TPoint ComputeTextPosition(TPoint aPoint);
105 CTBackedUpWin* iCheckWin;
106 CFbsBitmap* iCheckBitmap;
107 CFbsBitmapDevice* iCheckDevice;
109 CRedrawStoreWin* iTestWin;
112 TDrawingMode iDrawMode;
113 RBlankWindow iBlankWin;
118 TPoint iScrollSource;
120 CNoDrawWin* iNoDrawWin;
121 TBool iClientDidDraw;
122 CWsBitmap* iAlphaBitmap[3];
123 TBool iAlphaSupported;
124 CBitmapMaskedWin* iBitmapMaskedWin;
125 CBitmap* iTestBitmap;
126 CBitMapWin* iTestBitmapWin;
128 TPoint iTestWinPoint;
133 TDisplayMode iTestDisplayMode;
134 CFbsBitmap *iTestWinCopy;
135 CFbsBitmap *iCheckWinCopy;
138 class CRedrawStoreWin : public CTWin
141 inline CRedrawStoreWin(CTRedrawStoring* aTest) : iDrawOrder(0), iTest(aTest){}
142 //Virtual Function from CTBaseWin
147 CTRedrawStoring *iTest;
150 class CNoDrawWin : public CTWin
156 class CBrushDrawWin : public CTWin
166 class CBitmapMaskedWin : public CTWin
169 static CBitmapMaskedWin* NewL(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap,
170 CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap,
171 TRgb aBackground,TRect aRect,TBool aInvertMask,TBool aWsFbs);
173 //Virtual Function from CTBaseWin
175 void SetDestRectSize(const TSize aSize);
176 inline void SetInvertMask(TBool aInvertMask){iInvertMask=aInvertMask;}
178 inline CBitmapMaskedWin(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap,CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap,
179 TRect aRect,TBool aInvertMask,TBool aWsFbs):
180 iFbsBitmap(aFbsBitmap),iFbsMaskBitmap(aFbsMaskBitmap),
181 iWsBitmap(aWsBitmap),iWsMaskBitmap(aWsMaskBitmap),
182 iRect(aRect),iInvertMask(aInvertMask),iWsFbs(aWsFbs) {}
184 CFbsBitmap* iFbsBitmap;
185 CFbsBitmap* iFbsMaskBitmap;
186 CWsBitmap* iWsBitmap;
187 CWsBitmap* iWsMaskBitmap;
193 class CPartialRedrawWin : public CTWin
198 void DrawToBmp(CGraphicsContext& aGc);
199 void DrawPartial(TPartialRedrawType aPartialRedrawType);
200 static void DrawRects(CGraphicsContext& aGc, TSize aSize, TPoint aPosition,
201 TBool aIsFullRedraw, TPartialRedrawType aPartialRedrawType);
202 void RedrawSubRectWithBitmapL(TRgb aBitmapColour);
205 TBool iClientCanDraw;
207 void DoDraw(CGraphicsContext& aGc);
211 class CPartialRedrawBottomWin : public CTWin
216 void DrawPartial(TRect aRect);
217 void DrawFullWindowRect();
222 class CPartialRedrawTopWin : public CTWin
227 void DrawPartial(TRect aRect);
228 void DrawFullWindowRect();
233 class CPartialRedrawTiledWin : public CTWin
236 void Init(TRgb aColour,TBool aTransparent);
238 void DrawPartial(TRect aRect);
239 void DrawFullWindowRect();
246 class CInvisibleRedrawWin: public CTWin
249 CInvisibleRedrawWin();
250 TInt MakeTransparent();
251 void MakeVisible( TBool aVisible );
252 virtual void Redraw();
253 virtual void Redraw( const TRect &aRect );
256 void DrawIfVisible();
263 class CPartialDrawNowWin: public CTWin
266 CPartialDrawNowWin();
267 TInt MakeTransparent();
268 void SetLodger( const TRect &aLodger );
269 virtual void Redraw();
270 virtual void Redraw( const TRect &aRect );
273 void DrawWindowAndLodger();
280 class CPartialRedrawEmptyWin : public CTWin
283 void Init(TRgb aColor);
285 void DrawPartial(TRect aRect);
286 void DrawFullWindowRect();
287 inline TInt ReturnCount();
293 class CPartialRedrawPolygonWin : public CTWin
296 void Init(TInt aWindowMode, TRgb aColor);
299 void DrawFullWindowPolygonL();
300 inline TInt ReturnCount();
306 class CRedrawRectWin : public CTWin
311 void DrawFullWindowRect();
312 inline TInt RedrawCount();
313 void ResetWindow(TRgb aColour);
314 inline void SetLogging(CTWsGraphicsBase* aTest);
315 //Virtual function from CTBaseWin
317 //Virtual function from CTWin
318 void Redraw(const TRect& aRect);
324 CTWsGraphicsBase* iLog;
327 class CTRedrawStoringStep : public CTGraphicsStep
330 CTRedrawStoringStep();
332 //from CTGraphicsStep
333 virtual CTGraphicsBase* CreateTestL();
336 class CResetRedrawStoreWin : public CPartialRedrawWin
339 ~CResetRedrawStoreWin();
340 void SetUpdateInRedraw(TBool aUpdateInRedraw);
341 void SetKeepGcActive(TBool aState);
342 void UpdateAnim(TInt aSteps);
343 void PreSetSize(const TSize &aSize);
344 TBool Failed() const;
347 void DoDraw(CGraphicsContext& aGc) const;
348 void DoDrawAnim(CGraphicsContext& aGc) const;
349 TRect AnimRect() const;
353 TBool iUpdateInRedraw;
358 const TInt KEmptyLoopThreshold = 3;
360 _LIT(KTRedrawStoringStep,"TRedrawStoring");