1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TREDRSTR.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,363 @@
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 __TREDRSTR_H__
1.26 +#define __TREDRSTR_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 "TGraphicsHarness.h"
1.33 +#include "TScreenModeScaling.h"
1.34 +
1.35 +
1.36 +class CRedrawStoreWin;
1.37 +class CNoDrawWin;
1.38 +class CBitmapMaskedWin;
1.39 +class CResetRedrawStoreWin;
1.40 +
1.41 +
1.42 +class CTRedrawStoring : public CTWsGraphicsBase
1.43 + {
1.44 +public:
1.45 + CTRedrawStoring(CTestStep* aStep);
1.46 + ~CTRedrawStoring();
1.47 + void ConstructL();
1.48 +
1.49 + void CheckWindowsMatch();
1.50 + void CheckWindowsMatchLossy();
1.51 + void CheckWindowsNotMatch();
1.52 + void HideRevealTest();
1.53 + void MultipleHideReveal(TInt aX,TInt aY);
1.54 + void RedrawWindows();
1.55 + void DoDrawingL(CWindowGc* aWinGc);
1.56 + void DoDrawingL(TInt aDraw,CBitmapContext* aGc,TBool aWinGc);
1.57 + void ScrollTest();
1.58 + void FadeWindowTest();
1.59 + void FadeWindowTest2L();
1.60 + void DoDrawTest();
1.61 + void DoScrollTest();
1.62 + void SetScrolling(TPoint aScrollSource, TRect aScrollTarget);
1.63 + //Pure Virtual Function from CTestBase
1.64 + void DoNothingInRedrawTest();
1.65 + void DoDisableRedrawStoreTest();
1.66 + void DoBitBltAndMaskedNegTestsL();
1.67 + void DoResizeTest();
1.68 + void DoTestDrawBitmapMaskedL(TBool aWsBitmap=EFalse);
1.69 + void DrawBitmapAndCheckL(const TSize aSize,TDisplayMode aDisplayMode,CFbsBitmap* aSrceBitmap,CFbsBitmap* aMaskBitmap,TBool aInvertMask);
1.70 + void DoFontCacheOverflowTestL();
1.71 + void FontCacheOverflowDrawingTestL(TBool aDiffGc, RWindow& aWindow);
1.72 + void DoInvisibleRedrawStoreTestL( TBool aUseTransparency );
1.73 + void DoBrushDrawTestL();
1.74 + void DoPartialDrawNowTestL( TBool aUseTransparency );
1.75 + void DoBeginEndRedraw();
1.76 + void DoRedrawStoreAlphaChannelTransTest();
1.77 +
1.78 + void DoExposeTestL(TInt aIteration);
1.79 + void DoExposeTest2L(TInt aIteration);
1.80 + void DoEmptyDrawTestL(TInt aTestMode);
1.81 + void DoPolygonRedrawTestSetL();
1.82 + void DoPolygonRedrawTestL(TInt aWindowMode, TInt aTestMode);
1.83 + void DoRedrawOOMTestL();
1.84 + void RedrawStoreWithBadRectL();
1.85 +protected:
1.86 + virtual void RunTestCaseL(TInt aCurTestCase);
1.87 + void DoAutoResetRedrawStoreTestL(TBool aTwoWins, TBool aAnimateBothWins, TBool aKeepGcActive, TBool aUpdateInRedraw);
1.88 + void AutoResetRedrawStoreTestsL();
1.89 + void RedrawStoreWithSetExtentL();
1.90 + void PartialRedrawWithEmptyRedrawStoreL();
1.91 + void DoPartialRedrawWithEmptyRedrawStoreL(TInt aNumWins, TBool aDoWinOnTop, TBool aRedrawWindow, TBool aChildWindows);
1.92 + CResetRedrawStoreWin* CreatePartialRedrawWinLC(const TPoint& aPos, const TSize& aSize, CTWin* aParent=NULL);
1.93 + CNoDrawWin* CreateNoDrawWinLC(const TPoint &aPos, const TSize &aSize);
1.94 + void GetTestWinSizeAndPos(TInt aWinIndex, TPoint &aPos, TSize &aSize) const;
1.95 + void ScrollWinTest();
1.96 +public:
1.97 + TInt iDrawOrder;
1.98 + TBool iQueueTest;
1.99 +
1.100 +private:
1.101 + enum TDrawingMode
1.102 + {
1.103 + EServerRedraw,
1.104 + EClientRedrawsNormal,
1.105 + EClientRedrawsScrolled,
1.106 + };
1.107 + TPoint ComputeTextPosition(TPoint aPoint);
1.108 + CTBackedUpWin* iCheckWin;
1.109 + CFbsBitmap* iCheckBitmap;
1.110 + CFbsBitmapDevice* iCheckDevice;
1.111 + CFbsBitGc* iCheckGc;
1.112 + CRedrawStoreWin* iTestWin;
1.113 + TSize iWinSize;
1.114 + TPoint iWinPos;
1.115 + TDrawingMode iDrawMode;
1.116 + RBlankWindow iBlankWin;
1.117 + RRegion iRegion;
1.118 + RWindow iWinTestGc;
1.119 + TBool iWindowsFaded;
1.120 + TRect iScrollTarget;
1.121 + TPoint iScrollSource;
1.122 + TBool iDoScrollTest;
1.123 + CNoDrawWin* iNoDrawWin;
1.124 + TBool iClientDidDraw;
1.125 + CWsBitmap* iAlphaBitmap[3];
1.126 + TBool iAlphaSupported;
1.127 + CBitmapMaskedWin* iBitmapMaskedWin;
1.128 + CBitmap* iTestBitmap;
1.129 + CBitMapWin* iTestBitmapWin;
1.130 + TRect iWinRect;
1.131 + TPoint iTestWinPoint;
1.132 + TBool iXPlus;
1.133 + TBool iYPlus;
1.134 + TInt iState;
1.135 + TInt iYPoz;
1.136 + TDisplayMode iTestDisplayMode;
1.137 + CFbsBitmap *iTestWinCopy;
1.138 + CFbsBitmap *iCheckWinCopy;
1.139 + };
1.140 +
1.141 +class CRedrawStoreWin : public CTWin
1.142 + {
1.143 +public:
1.144 + inline CRedrawStoreWin(CTRedrawStoring* aTest) : iDrawOrder(0), iTest(aTest){}
1.145 + //Virtual Function from CTBaseWin
1.146 + void Draw();
1.147 +public:
1.148 + TInt iDrawOrder;
1.149 +private:
1.150 + CTRedrawStoring *iTest;
1.151 + };
1.152 +
1.153 +class CNoDrawWin : public CTWin
1.154 + {
1.155 +public:
1.156 + void Draw();
1.157 + };
1.158 +
1.159 +class CBrushDrawWin : public CTWin
1.160 + {
1.161 +public:
1.162 + CBrushDrawWin();
1.163 + void Draw();
1.164 + void Redraw();
1.165 +
1.166 +private:
1.167 + };
1.168 +
1.169 +class CBitmapMaskedWin : public CTWin
1.170 + {
1.171 +public:
1.172 + static CBitmapMaskedWin* NewL(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap,
1.173 + CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap,
1.174 + TRgb aBackground,TRect aRect,TBool aInvertMask,TBool aWsFbs);
1.175 + ~CBitmapMaskedWin();
1.176 + //Virtual Function from CTBaseWin
1.177 + void Draw();
1.178 + void SetDestRectSize(const TSize aSize);
1.179 + inline void SetInvertMask(TBool aInvertMask){iInvertMask=aInvertMask;}
1.180 +private:
1.181 + inline CBitmapMaskedWin(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap,CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap,
1.182 + TRect aRect,TBool aInvertMask,TBool aWsFbs):
1.183 + iFbsBitmap(aFbsBitmap),iFbsMaskBitmap(aFbsMaskBitmap),
1.184 + iWsBitmap(aWsBitmap),iWsMaskBitmap(aWsMaskBitmap),
1.185 + iRect(aRect),iInvertMask(aInvertMask),iWsFbs(aWsFbs) {}
1.186 +private:
1.187 + CFbsBitmap* iFbsBitmap;
1.188 + CFbsBitmap* iFbsMaskBitmap;
1.189 + CWsBitmap* iWsBitmap;
1.190 + CWsBitmap* iWsMaskBitmap;
1.191 + TRect iRect;
1.192 + TBool iInvertMask;
1.193 + TBool iWsFbs;
1.194 + };
1.195 +
1.196 +class CPartialRedrawWin : public CTWin
1.197 + {
1.198 +public:
1.199 + void Init();
1.200 + virtual void Draw();
1.201 + void DrawToBmp(CGraphicsContext& aGc);
1.202 + void DrawPartial(TPartialRedrawType aPartialRedrawType);
1.203 + static void DrawRects(CGraphicsContext& aGc, TSize aSize, TPoint aPosition,
1.204 + TBool aIsFullRedraw, TPartialRedrawType aPartialRedrawType);
1.205 + void RedrawSubRectWithBitmapL(TRgb aBitmapColour);
1.206 +public:
1.207 + TBool iClientDrawn;
1.208 + TBool iClientCanDraw;
1.209 +private:
1.210 + void DoDraw(CGraphicsContext& aGc);
1.211 +private:
1.212 + };
1.213 +
1.214 +class CPartialRedrawBottomWin : public CTWin
1.215 + {
1.216 +public:
1.217 + void Init();
1.218 + virtual void Draw();
1.219 + void DrawPartial(TRect aRect);
1.220 + void DrawFullWindowRect();
1.221 +private:
1.222 + void DoDraw();
1.223 + };
1.224 +
1.225 +class CPartialRedrawTopWin : public CTWin
1.226 + {
1.227 +public:
1.228 + void Init();
1.229 + virtual void Draw();
1.230 + void DrawPartial(TRect aRect);
1.231 + void DrawFullWindowRect();
1.232 +private:
1.233 + void DoDraw();
1.234 + };
1.235 +
1.236 +class CPartialRedrawTiledWin : public CTWin
1.237 + {
1.238 +public:
1.239 + void Init(TRgb aColour,TBool aTransparent);
1.240 + virtual void Draw();
1.241 + void DrawPartial(TRect aRect);
1.242 + void DrawFullWindowRect();
1.243 +private:
1.244 + void DoDraw();
1.245 +private:
1.246 + TRgb iColour;
1.247 + };
1.248 +
1.249 +class CInvisibleRedrawWin: public CTWin
1.250 + {
1.251 +public:
1.252 + CInvisibleRedrawWin();
1.253 + TInt MakeTransparent();
1.254 + void MakeVisible( TBool aVisible );
1.255 + virtual void Redraw();
1.256 + virtual void Redraw( const TRect &aRect );
1.257 +
1.258 +private:
1.259 + void DrawIfVisible();
1.260 +
1.261 +private:
1.262 + TBool iVisible;
1.263 + TBool iTransparent;
1.264 + };
1.265 +
1.266 +class CPartialDrawNowWin: public CTWin
1.267 + {
1.268 +public:
1.269 + CPartialDrawNowWin();
1.270 + TInt MakeTransparent();
1.271 + void SetLodger( const TRect &aLodger );
1.272 + virtual void Redraw();
1.273 + virtual void Redraw( const TRect &aRect );
1.274 +
1.275 +private:
1.276 + void DrawWindowAndLodger();
1.277 +
1.278 +private:
1.279 + TRect iLodger;
1.280 + TBool iTransparent;
1.281 + };
1.282 +
1.283 +class CPartialRedrawEmptyWin : public CTWin
1.284 + {
1.285 +public:
1.286 + void Init(TRgb aColor);
1.287 + virtual void Draw();
1.288 + void DrawPartial(TRect aRect);
1.289 + void DrawFullWindowRect();
1.290 + inline TInt ReturnCount();
1.291 +private:
1.292 + void DoDraw();
1.293 + TInt iCount;
1.294 + };
1.295 +
1.296 +class CPartialRedrawPolygonWin : public CTWin
1.297 + {
1.298 +public:
1.299 + void Init(TInt aWindowMode, TRgb aColor);
1.300 + virtual void Draw();
1.301 + void DrawPartial();
1.302 + void DrawFullWindowPolygonL();
1.303 + inline TInt ReturnCount();
1.304 +private:
1.305 + void DoDraw();
1.306 + TInt iCount;
1.307 + };
1.308 +
1.309 +class CRedrawRectWin : public CTWin
1.310 + {
1.311 +public:
1.312 + void Init();
1.313 + void DrawNow();
1.314 + void DrawFullWindowRect();
1.315 + inline TInt RedrawCount();
1.316 + void ResetWindow(TRgb aColour);
1.317 + inline void SetLogging(CTWsGraphicsBase* aTest);
1.318 + //Virtual function from CTBaseWin
1.319 + void Draw();
1.320 + //Virtual function from CTWin
1.321 + void Redraw(const TRect& aRect);
1.322 +private:
1.323 + void DoDraw();
1.324 +private:
1.325 + TInt iRedrawCount;
1.326 + TRgb iRectColour;
1.327 + CTWsGraphicsBase* iLog;
1.328 + };
1.329 +
1.330 +class CTRedrawStoringStep : public CTGraphicsStep
1.331 + {
1.332 +public:
1.333 + CTRedrawStoringStep();
1.334 +protected:
1.335 + //from CTGraphicsStep
1.336 + virtual CTGraphicsBase* CreateTestL();
1.337 + };
1.338 +
1.339 +class CResetRedrawStoreWin : public CPartialRedrawWin
1.340 + {
1.341 +public:
1.342 + ~CResetRedrawStoreWin();
1.343 + void SetUpdateInRedraw(TBool aUpdateInRedraw);
1.344 + void SetKeepGcActive(TBool aState);
1.345 + void UpdateAnim(TInt aSteps);
1.346 + void PreSetSize(const TSize &aSize);
1.347 + TBool Failed() const;
1.348 +private:
1.349 + virtual void Draw();
1.350 + void DoDraw(CGraphicsContext& aGc) const;
1.351 + void DoDrawAnim(CGraphicsContext& aGc) const;
1.352 + TRect AnimRect() const;
1.353 +private:
1.354 + TInt iAnimState;
1.355 + TBool iKeepGcActive;
1.356 + TBool iUpdateInRedraw;
1.357 + TBool iFailed;
1.358 + CWindowGc* iExtraGc;
1.359 + };
1.360 +
1.361 +const TInt KEmptyLoopThreshold = 3;
1.362 +
1.363 +_LIT(KTRedrawStoringStep,"TRedrawStoring");
1.364 +
1.365 +
1.366 +#endif