os/graphics/windowing/windowserver/test/tauto/TREDRSTR.H
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
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".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 /**
    17  @file
    18  @test
    19  @internalComponent - Internal Symbian test code
    20 */
    21 
    22 #ifndef __TREDRSTR_H__
    23 #define __TREDRSTR_H__
    24 
    25 #include <e32std.h>
    26 #include <w32std.h>
    27 #include "../../tlib/testbase.h"
    28 #include "AUTO.H"
    29 #include "TGraphicsHarness.h"
    30 #include "TScreenModeScaling.h"
    31 
    32 
    33 class CRedrawStoreWin;
    34 class CNoDrawWin;
    35 class CBitmapMaskedWin;
    36 class CResetRedrawStoreWin;
    37 
    38 
    39 class CTRedrawStoring : public CTWsGraphicsBase
    40 	{
    41 public:
    42 	CTRedrawStoring(CTestStep* aStep);
    43 	~CTRedrawStoring();
    44 	void ConstructL();
    45 
    46 	void CheckWindowsMatch();
    47 	void CheckWindowsMatchLossy();
    48 	void CheckWindowsNotMatch();
    49 	void HideRevealTest();
    50 	void MultipleHideReveal(TInt aX,TInt aY);
    51 	void RedrawWindows();
    52 	void DoDrawingL(CWindowGc* aWinGc);
    53 	void DoDrawingL(TInt aDraw,CBitmapContext* aGc,TBool aWinGc);
    54 	void ScrollTest();
    55 	void FadeWindowTest();
    56 	void FadeWindowTest2L();
    57 	void DoDrawTest();
    58 	void DoScrollTest();
    59 	void SetScrolling(TPoint aScrollSource, TRect aScrollTarget);
    60 	//Pure Virtual Function from CTestBase
    61 	void DoNothingInRedrawTest();
    62 	void DoDisableRedrawStoreTest();
    63 	void DoBitBltAndMaskedNegTestsL();
    64 	void DoResizeTest();
    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();
    74 
    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();
    82 protected:
    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;
    92 	void ScrollWinTest();
    93 public:
    94 	TInt iDrawOrder;
    95 	TBool iQueueTest;
    96 
    97 private:
    98 	enum TDrawingMode
    99 		{
   100 		EServerRedraw,
   101 		EClientRedrawsNormal,
   102 		EClientRedrawsScrolled,
   103 		};
   104 	TPoint ComputeTextPosition(TPoint aPoint);
   105 	CTBackedUpWin* iCheckWin;
   106 	CFbsBitmap* iCheckBitmap;
   107 	CFbsBitmapDevice* iCheckDevice;
   108 	CFbsBitGc* iCheckGc;
   109 	CRedrawStoreWin* iTestWin;
   110 	TSize iWinSize;
   111 	TPoint iWinPos;
   112 	TDrawingMode iDrawMode;
   113 	RBlankWindow iBlankWin;
   114 	RRegion iRegion;
   115 	RWindow iWinTestGc;
   116 	TBool iWindowsFaded;
   117 	TRect iScrollTarget;
   118 	TPoint iScrollSource;
   119 	TBool iDoScrollTest;
   120 	CNoDrawWin* iNoDrawWin;
   121 	TBool iClientDidDraw;
   122 	CWsBitmap* iAlphaBitmap[3];
   123 	TBool iAlphaSupported;
   124 	CBitmapMaskedWin* iBitmapMaskedWin;
   125 	CBitmap* iTestBitmap;
   126 	CBitMapWin* iTestBitmapWin;
   127 	TRect iWinRect;
   128 	TPoint iTestWinPoint;
   129 	TBool iXPlus;
   130 	TBool iYPlus;
   131 	TInt iState;
   132 	TInt iYPoz;
   133 	TDisplayMode iTestDisplayMode;
   134 	CFbsBitmap *iTestWinCopy;
   135 	CFbsBitmap *iCheckWinCopy;
   136 	};
   137 
   138 class CRedrawStoreWin : public CTWin
   139 	{
   140 public:
   141 	inline CRedrawStoreWin(CTRedrawStoring* aTest) : iDrawOrder(0), iTest(aTest){}
   142 	//Virtual Function from CTBaseWin
   143 	void Draw();
   144 public:
   145 	TInt iDrawOrder;
   146 private:
   147 	CTRedrawStoring *iTest;
   148 	};
   149 
   150 class CNoDrawWin : public CTWin
   151 	{
   152 public:
   153 	void Draw();
   154 	};
   155 
   156 class CBrushDrawWin : public CTWin
   157 	{
   158 public:
   159 	CBrushDrawWin();
   160 	void Draw();
   161 	void Redraw();
   162 
   163 private:
   164 	};
   165 
   166 class CBitmapMaskedWin : public CTWin
   167 	{
   168 public:
   169 	static CBitmapMaskedWin* NewL(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap,
   170 								  CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap,
   171 								  TRgb aBackground,TRect aRect,TBool aInvertMask,TBool aWsFbs);
   172 	~CBitmapMaskedWin();
   173 	//Virtual Function from CTBaseWin
   174 	void Draw();
   175 	void SetDestRectSize(const TSize aSize);
   176 	inline void SetInvertMask(TBool aInvertMask){iInvertMask=aInvertMask;}
   177 private:
   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) {}
   183 private:
   184 	CFbsBitmap* iFbsBitmap;
   185 	CFbsBitmap* iFbsMaskBitmap;
   186 	CWsBitmap* iWsBitmap;
   187 	CWsBitmap* iWsMaskBitmap;
   188 	TRect iRect;
   189 	TBool iInvertMask;
   190 	TBool iWsFbs;
   191 	};
   192 
   193 class CPartialRedrawWin : public CTWin
   194 	{
   195 public:
   196 	void Init();
   197 	virtual void Draw();
   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);
   203 public:
   204 	TBool iClientDrawn;
   205 	TBool iClientCanDraw;
   206 private:
   207 	void DoDraw(CGraphicsContext& aGc);
   208 private:
   209 	};
   210 
   211 class CPartialRedrawBottomWin : public CTWin
   212 	{
   213 public:
   214 	void Init();
   215 	virtual void Draw();
   216 	void DrawPartial(TRect aRect);
   217 	void DrawFullWindowRect();
   218 private:
   219 	void DoDraw();
   220 	};
   221 	
   222 class CPartialRedrawTopWin : public CTWin
   223 	{
   224 public:
   225 	void Init();
   226 	virtual void Draw();
   227 	void DrawPartial(TRect aRect);
   228 	void DrawFullWindowRect();
   229 private:
   230 	void DoDraw();
   231 	};
   232 	
   233 class CPartialRedrawTiledWin : public CTWin
   234 	{
   235 public:
   236 	void Init(TRgb aColour,TBool aTransparent);
   237 	virtual void Draw();
   238 	void DrawPartial(TRect aRect);
   239 	void DrawFullWindowRect();
   240 private:
   241 	void DoDraw();
   242 private:
   243 	TRgb iColour;
   244 	};
   245 	
   246 class CInvisibleRedrawWin: public CTWin
   247 	{
   248 public:
   249 	CInvisibleRedrawWin();
   250 	TInt MakeTransparent();
   251 	void MakeVisible( TBool aVisible );
   252 	virtual void Redraw();
   253 	virtual void Redraw( const TRect &aRect );
   254 
   255 private:
   256 	void DrawIfVisible();
   257 
   258 private:
   259 	TBool iVisible;
   260 	TBool iTransparent;
   261 	};
   262 
   263 class CPartialDrawNowWin: public CTWin
   264 	{
   265 public:
   266 	CPartialDrawNowWin();
   267 	TInt MakeTransparent();
   268 	void SetLodger( const TRect &aLodger );
   269 	virtual void Redraw();
   270 	virtual void Redraw( const TRect &aRect );
   271 
   272 private:
   273 	void DrawWindowAndLodger();
   274 
   275 private:
   276 	TRect iLodger;
   277 	TBool iTransparent;
   278 	};
   279 
   280 class CPartialRedrawEmptyWin : public CTWin
   281 	{
   282 public:
   283 	void Init(TRgb aColor);
   284 	virtual void Draw();
   285 	void DrawPartial(TRect aRect);
   286 	void DrawFullWindowRect();
   287 	inline TInt ReturnCount();
   288 private:
   289 	void DoDraw();
   290 	TInt iCount;
   291 	};
   292 
   293 class CPartialRedrawPolygonWin : public CTWin
   294 	{
   295 public:
   296 	void Init(TInt aWindowMode, TRgb aColor);
   297 	virtual void Draw();
   298 	void DrawPartial();
   299 	void DrawFullWindowPolygonL();
   300 	inline TInt ReturnCount();
   301 private:
   302 	void DoDraw();
   303 	TInt iCount;
   304 	};
   305 
   306 class CRedrawRectWin : public CTWin
   307 	{
   308 public:
   309 	void Init();
   310 	void DrawNow();
   311 	void DrawFullWindowRect();
   312 	inline TInt RedrawCount();
   313 	void ResetWindow(TRgb aColour);
   314 	inline void SetLogging(CTWsGraphicsBase* aTest);
   315 	//Virtual function from CTBaseWin
   316 	void Draw();
   317 	//Virtual function from CTWin
   318 	void Redraw(const TRect& aRect);
   319 private:
   320 	void DoDraw();
   321 private:
   322 	TInt iRedrawCount;
   323 	TRgb iRectColour;
   324 	CTWsGraphicsBase* iLog;
   325 	};
   326 
   327 class CTRedrawStoringStep : public CTGraphicsStep
   328 	{
   329 public:
   330 	CTRedrawStoringStep();
   331 protected:
   332 	//from CTGraphicsStep
   333 	virtual CTGraphicsBase* CreateTestL();
   334 	};
   335 
   336 class CResetRedrawStoreWin : public CPartialRedrawWin
   337 	{
   338 public:
   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;
   345 private:
   346 	virtual void Draw();
   347 	void DoDraw(CGraphicsContext& aGc) const;
   348 	void DoDrawAnim(CGraphicsContext& aGc) const;
   349 	TRect AnimRect() const;
   350 private:
   351 	TInt iAnimState;
   352 	TBool iKeepGcActive;
   353 	TBool iUpdateInRedraw;
   354 	TBool iFailed;
   355 	CWindowGc* iExtraGc;
   356 	};
   357 
   358 const TInt KEmptyLoopThreshold = 3;
   359 
   360 _LIT(KTRedrawStoringStep,"TRedrawStoring");
   361 
   362 
   363 #endif