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.
sl@0
     1
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @test
sl@0
    19
 @internalComponent - Internal Symbian test code
sl@0
    20
*/
sl@0
    21
sl@0
    22
#ifndef __TREDRSTR_H__
sl@0
    23
#define __TREDRSTR_H__
sl@0
    24
sl@0
    25
#include <e32std.h>
sl@0
    26
#include <w32std.h>
sl@0
    27
#include "../../tlib/testbase.h"
sl@0
    28
#include "AUTO.H"
sl@0
    29
#include "TGraphicsHarness.h"
sl@0
    30
#include "TScreenModeScaling.h"
sl@0
    31
sl@0
    32
sl@0
    33
class CRedrawStoreWin;
sl@0
    34
class CNoDrawWin;
sl@0
    35
class CBitmapMaskedWin;
sl@0
    36
class CResetRedrawStoreWin;
sl@0
    37
sl@0
    38
sl@0
    39
class CTRedrawStoring : public CTWsGraphicsBase
sl@0
    40
	{
sl@0
    41
public:
sl@0
    42
	CTRedrawStoring(CTestStep* aStep);
sl@0
    43
	~CTRedrawStoring();
sl@0
    44
	void ConstructL();
sl@0
    45
sl@0
    46
	void CheckWindowsMatch();
sl@0
    47
	void CheckWindowsMatchLossy();
sl@0
    48
	void CheckWindowsNotMatch();
sl@0
    49
	void HideRevealTest();
sl@0
    50
	void MultipleHideReveal(TInt aX,TInt aY);
sl@0
    51
	void RedrawWindows();
sl@0
    52
	void DoDrawingL(CWindowGc* aWinGc);
sl@0
    53
	void DoDrawingL(TInt aDraw,CBitmapContext* aGc,TBool aWinGc);
sl@0
    54
	void ScrollTest();
sl@0
    55
	void FadeWindowTest();
sl@0
    56
	void FadeWindowTest2L();
sl@0
    57
	void DoDrawTest();
sl@0
    58
	void DoScrollTest();
sl@0
    59
	void SetScrolling(TPoint aScrollSource, TRect aScrollTarget);
sl@0
    60
	//Pure Virtual Function from CTestBase
sl@0
    61
	void DoNothingInRedrawTest();
sl@0
    62
	void DoDisableRedrawStoreTest();
sl@0
    63
	void DoBitBltAndMaskedNegTestsL();
sl@0
    64
	void DoResizeTest();
sl@0
    65
	void DoTestDrawBitmapMaskedL(TBool aWsBitmap=EFalse);
sl@0
    66
	void DrawBitmapAndCheckL(const TSize aSize,TDisplayMode aDisplayMode,CFbsBitmap* aSrceBitmap,CFbsBitmap* aMaskBitmap,TBool aInvertMask);
sl@0
    67
	void DoFontCacheOverflowTestL();
sl@0
    68
	void FontCacheOverflowDrawingTestL(TBool aDiffGc, RWindow& aWindow);
sl@0
    69
	void DoInvisibleRedrawStoreTestL( TBool aUseTransparency );
sl@0
    70
	void DoBrushDrawTestL();
sl@0
    71
	void DoPartialDrawNowTestL( TBool aUseTransparency );
sl@0
    72
	void DoBeginEndRedraw();
sl@0
    73
	void DoRedrawStoreAlphaChannelTransTest();
sl@0
    74
sl@0
    75
	void DoExposeTestL(TInt aIteration);
sl@0
    76
	void DoExposeTest2L(TInt aIteration);
sl@0
    77
	void DoEmptyDrawTestL(TInt aTestMode);
sl@0
    78
	void DoPolygonRedrawTestSetL();
sl@0
    79
	void DoPolygonRedrawTestL(TInt aWindowMode, TInt aTestMode);
sl@0
    80
	void DoRedrawOOMTestL();
sl@0
    81
	void RedrawStoreWithBadRectL();
sl@0
    82
protected:
sl@0
    83
	virtual void RunTestCaseL(TInt aCurTestCase);
sl@0
    84
	void DoAutoResetRedrawStoreTestL(TBool aTwoWins, TBool aAnimateBothWins, TBool aKeepGcActive, TBool aUpdateInRedraw);
sl@0
    85
	void AutoResetRedrawStoreTestsL();
sl@0
    86
	void RedrawStoreWithSetExtentL();
sl@0
    87
	void PartialRedrawWithEmptyRedrawStoreL();
sl@0
    88
	void DoPartialRedrawWithEmptyRedrawStoreL(TInt aNumWins, TBool aDoWinOnTop, TBool aRedrawWindow, TBool aChildWindows);
sl@0
    89
	CResetRedrawStoreWin* CreatePartialRedrawWinLC(const TPoint& aPos, const TSize& aSize, CTWin* aParent=NULL);
sl@0
    90
	CNoDrawWin* CreateNoDrawWinLC(const TPoint &aPos, const TSize &aSize);
sl@0
    91
	void GetTestWinSizeAndPos(TInt aWinIndex, TPoint &aPos, TSize &aSize) const;
sl@0
    92
	void ScrollWinTest();
sl@0
    93
public:
sl@0
    94
	TInt iDrawOrder;
sl@0
    95
	TBool iQueueTest;
sl@0
    96
sl@0
    97
private:
sl@0
    98
	enum TDrawingMode
sl@0
    99
		{
sl@0
   100
		EServerRedraw,
sl@0
   101
		EClientRedrawsNormal,
sl@0
   102
		EClientRedrawsScrolled,
sl@0
   103
		};
sl@0
   104
	TPoint ComputeTextPosition(TPoint aPoint);
sl@0
   105
	CTBackedUpWin* iCheckWin;
sl@0
   106
	CFbsBitmap* iCheckBitmap;
sl@0
   107
	CFbsBitmapDevice* iCheckDevice;
sl@0
   108
	CFbsBitGc* iCheckGc;
sl@0
   109
	CRedrawStoreWin* iTestWin;
sl@0
   110
	TSize iWinSize;
sl@0
   111
	TPoint iWinPos;
sl@0
   112
	TDrawingMode iDrawMode;
sl@0
   113
	RBlankWindow iBlankWin;
sl@0
   114
	RRegion iRegion;
sl@0
   115
	RWindow iWinTestGc;
sl@0
   116
	TBool iWindowsFaded;
sl@0
   117
	TRect iScrollTarget;
sl@0
   118
	TPoint iScrollSource;
sl@0
   119
	TBool iDoScrollTest;
sl@0
   120
	CNoDrawWin* iNoDrawWin;
sl@0
   121
	TBool iClientDidDraw;
sl@0
   122
	CWsBitmap* iAlphaBitmap[3];
sl@0
   123
	TBool iAlphaSupported;
sl@0
   124
	CBitmapMaskedWin* iBitmapMaskedWin;
sl@0
   125
	CBitmap* iTestBitmap;
sl@0
   126
	CBitMapWin* iTestBitmapWin;
sl@0
   127
	TRect iWinRect;
sl@0
   128
	TPoint iTestWinPoint;
sl@0
   129
	TBool iXPlus;
sl@0
   130
	TBool iYPlus;
sl@0
   131
	TInt iState;
sl@0
   132
	TInt iYPoz;
sl@0
   133
	TDisplayMode iTestDisplayMode;
sl@0
   134
	CFbsBitmap *iTestWinCopy;
sl@0
   135
	CFbsBitmap *iCheckWinCopy;
sl@0
   136
	};
sl@0
   137
sl@0
   138
class CRedrawStoreWin : public CTWin
sl@0
   139
	{
sl@0
   140
public:
sl@0
   141
	inline CRedrawStoreWin(CTRedrawStoring* aTest) : iDrawOrder(0), iTest(aTest){}
sl@0
   142
	//Virtual Function from CTBaseWin
sl@0
   143
	void Draw();
sl@0
   144
public:
sl@0
   145
	TInt iDrawOrder;
sl@0
   146
private:
sl@0
   147
	CTRedrawStoring *iTest;
sl@0
   148
	};
sl@0
   149
sl@0
   150
class CNoDrawWin : public CTWin
sl@0
   151
	{
sl@0
   152
public:
sl@0
   153
	void Draw();
sl@0
   154
	};
sl@0
   155
sl@0
   156
class CBrushDrawWin : public CTWin
sl@0
   157
	{
sl@0
   158
public:
sl@0
   159
	CBrushDrawWin();
sl@0
   160
	void Draw();
sl@0
   161
	void Redraw();
sl@0
   162
sl@0
   163
private:
sl@0
   164
	};
sl@0
   165
sl@0
   166
class CBitmapMaskedWin : public CTWin
sl@0
   167
	{
sl@0
   168
public:
sl@0
   169
	static CBitmapMaskedWin* NewL(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap,
sl@0
   170
								  CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap,
sl@0
   171
								  TRgb aBackground,TRect aRect,TBool aInvertMask,TBool aWsFbs);
sl@0
   172
	~CBitmapMaskedWin();
sl@0
   173
	//Virtual Function from CTBaseWin
sl@0
   174
	void Draw();
sl@0
   175
	void SetDestRectSize(const TSize aSize);
sl@0
   176
	inline void SetInvertMask(TBool aInvertMask){iInvertMask=aInvertMask;}
sl@0
   177
private:
sl@0
   178
	inline CBitmapMaskedWin(CFbsBitmap* aFbsBitmap,CFbsBitmap* aFbsMaskBitmap,CWsBitmap* aWsBitmap,CWsBitmap* aWsMaskBitmap,
sl@0
   179
							TRect aRect,TBool aInvertMask,TBool aWsFbs):
sl@0
   180
							iFbsBitmap(aFbsBitmap),iFbsMaskBitmap(aFbsMaskBitmap),
sl@0
   181
							iWsBitmap(aWsBitmap),iWsMaskBitmap(aWsMaskBitmap),
sl@0
   182
							iRect(aRect),iInvertMask(aInvertMask),iWsFbs(aWsFbs) {}
sl@0
   183
private:
sl@0
   184
	CFbsBitmap* iFbsBitmap;
sl@0
   185
	CFbsBitmap* iFbsMaskBitmap;
sl@0
   186
	CWsBitmap* iWsBitmap;
sl@0
   187
	CWsBitmap* iWsMaskBitmap;
sl@0
   188
	TRect iRect;
sl@0
   189
	TBool iInvertMask;
sl@0
   190
	TBool iWsFbs;
sl@0
   191
	};
sl@0
   192
sl@0
   193
class CPartialRedrawWin : public CTWin
sl@0
   194
	{
sl@0
   195
public:
sl@0
   196
	void Init();
sl@0
   197
	virtual void Draw();
sl@0
   198
	void DrawToBmp(CGraphicsContext& aGc);
sl@0
   199
	void DrawPartial(TPartialRedrawType aPartialRedrawType);
sl@0
   200
	static void DrawRects(CGraphicsContext& aGc, TSize aSize, TPoint aPosition,
sl@0
   201
		TBool aIsFullRedraw, TPartialRedrawType aPartialRedrawType);
sl@0
   202
	void RedrawSubRectWithBitmapL(TRgb aBitmapColour);
sl@0
   203
public:
sl@0
   204
	TBool iClientDrawn;
sl@0
   205
	TBool iClientCanDraw;
sl@0
   206
private:
sl@0
   207
	void DoDraw(CGraphicsContext& aGc);
sl@0
   208
private:
sl@0
   209
	};
sl@0
   210
sl@0
   211
class CPartialRedrawBottomWin : public CTWin
sl@0
   212
	{
sl@0
   213
public:
sl@0
   214
	void Init();
sl@0
   215
	virtual void Draw();
sl@0
   216
	void DrawPartial(TRect aRect);
sl@0
   217
	void DrawFullWindowRect();
sl@0
   218
private:
sl@0
   219
	void DoDraw();
sl@0
   220
	};
sl@0
   221
	
sl@0
   222
class CPartialRedrawTopWin : public CTWin
sl@0
   223
	{
sl@0
   224
public:
sl@0
   225
	void Init();
sl@0
   226
	virtual void Draw();
sl@0
   227
	void DrawPartial(TRect aRect);
sl@0
   228
	void DrawFullWindowRect();
sl@0
   229
private:
sl@0
   230
	void DoDraw();
sl@0
   231
	};
sl@0
   232
	
sl@0
   233
class CPartialRedrawTiledWin : public CTWin
sl@0
   234
	{
sl@0
   235
public:
sl@0
   236
	void Init(TRgb aColour,TBool aTransparent);
sl@0
   237
	virtual void Draw();
sl@0
   238
	void DrawPartial(TRect aRect);
sl@0
   239
	void DrawFullWindowRect();
sl@0
   240
private:
sl@0
   241
	void DoDraw();
sl@0
   242
private:
sl@0
   243
	TRgb iColour;
sl@0
   244
	};
sl@0
   245
	
sl@0
   246
class CInvisibleRedrawWin: public CTWin
sl@0
   247
	{
sl@0
   248
public:
sl@0
   249
	CInvisibleRedrawWin();
sl@0
   250
	TInt MakeTransparent();
sl@0
   251
	void MakeVisible( TBool aVisible );
sl@0
   252
	virtual void Redraw();
sl@0
   253
	virtual void Redraw( const TRect &aRect );
sl@0
   254
sl@0
   255
private:
sl@0
   256
	void DrawIfVisible();
sl@0
   257
sl@0
   258
private:
sl@0
   259
	TBool iVisible;
sl@0
   260
	TBool iTransparent;
sl@0
   261
	};
sl@0
   262
sl@0
   263
class CPartialDrawNowWin: public CTWin
sl@0
   264
	{
sl@0
   265
public:
sl@0
   266
	CPartialDrawNowWin();
sl@0
   267
	TInt MakeTransparent();
sl@0
   268
	void SetLodger( const TRect &aLodger );
sl@0
   269
	virtual void Redraw();
sl@0
   270
	virtual void Redraw( const TRect &aRect );
sl@0
   271
sl@0
   272
private:
sl@0
   273
	void DrawWindowAndLodger();
sl@0
   274
sl@0
   275
private:
sl@0
   276
	TRect iLodger;
sl@0
   277
	TBool iTransparent;
sl@0
   278
	};
sl@0
   279
sl@0
   280
class CPartialRedrawEmptyWin : public CTWin
sl@0
   281
	{
sl@0
   282
public:
sl@0
   283
	void Init(TRgb aColor);
sl@0
   284
	virtual void Draw();
sl@0
   285
	void DrawPartial(TRect aRect);
sl@0
   286
	void DrawFullWindowRect();
sl@0
   287
	inline TInt ReturnCount();
sl@0
   288
private:
sl@0
   289
	void DoDraw();
sl@0
   290
	TInt iCount;
sl@0
   291
	};
sl@0
   292
sl@0
   293
class CPartialRedrawPolygonWin : public CTWin
sl@0
   294
	{
sl@0
   295
public:
sl@0
   296
	void Init(TInt aWindowMode, TRgb aColor);
sl@0
   297
	virtual void Draw();
sl@0
   298
	void DrawPartial();
sl@0
   299
	void DrawFullWindowPolygonL();
sl@0
   300
	inline TInt ReturnCount();
sl@0
   301
private:
sl@0
   302
	void DoDraw();
sl@0
   303
	TInt iCount;
sl@0
   304
	};
sl@0
   305
sl@0
   306
class CRedrawRectWin : public CTWin
sl@0
   307
	{
sl@0
   308
public:
sl@0
   309
	void Init();
sl@0
   310
	void DrawNow();
sl@0
   311
	void DrawFullWindowRect();
sl@0
   312
	inline TInt RedrawCount();
sl@0
   313
	void ResetWindow(TRgb aColour);
sl@0
   314
	inline void SetLogging(CTWsGraphicsBase* aTest);
sl@0
   315
	//Virtual function from CTBaseWin
sl@0
   316
	void Draw();
sl@0
   317
	//Virtual function from CTWin
sl@0
   318
	void Redraw(const TRect& aRect);
sl@0
   319
private:
sl@0
   320
	void DoDraw();
sl@0
   321
private:
sl@0
   322
	TInt iRedrawCount;
sl@0
   323
	TRgb iRectColour;
sl@0
   324
	CTWsGraphicsBase* iLog;
sl@0
   325
	};
sl@0
   326
sl@0
   327
class CTRedrawStoringStep : public CTGraphicsStep
sl@0
   328
	{
sl@0
   329
public:
sl@0
   330
	CTRedrawStoringStep();
sl@0
   331
protected:
sl@0
   332
	//from CTGraphicsStep
sl@0
   333
	virtual CTGraphicsBase* CreateTestL();
sl@0
   334
	};
sl@0
   335
sl@0
   336
class CResetRedrawStoreWin : public CPartialRedrawWin
sl@0
   337
	{
sl@0
   338
public:
sl@0
   339
	~CResetRedrawStoreWin();
sl@0
   340
	void SetUpdateInRedraw(TBool aUpdateInRedraw);
sl@0
   341
	void SetKeepGcActive(TBool aState);
sl@0
   342
	void UpdateAnim(TInt aSteps);
sl@0
   343
	void PreSetSize(const TSize &aSize);
sl@0
   344
	TBool Failed() const;
sl@0
   345
private:
sl@0
   346
	virtual void Draw();
sl@0
   347
	void DoDraw(CGraphicsContext& aGc) const;
sl@0
   348
	void DoDrawAnim(CGraphicsContext& aGc) const;
sl@0
   349
	TRect AnimRect() const;
sl@0
   350
private:
sl@0
   351
	TInt iAnimState;
sl@0
   352
	TBool iKeepGcActive;
sl@0
   353
	TBool iUpdateInRedraw;
sl@0
   354
	TBool iFailed;
sl@0
   355
	CWindowGc* iExtraGc;
sl@0
   356
	};
sl@0
   357
sl@0
   358
const TInt KEmptyLoopThreshold = 3;
sl@0
   359
sl@0
   360
_LIT(KTRedrawStoringStep,"TRedrawStoring");
sl@0
   361
sl@0
   362
sl@0
   363
#endif