os/graphics/windowing/windowserver/test/tauto/TFADE.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
sl@0
     2
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
// All rights reserved.
sl@0
     4
// This component and the accompanying materials are made available
sl@0
     5
// under the terms of "Eclipse Public License v1.0"
sl@0
     6
// which accompanies this distribution, and is available
sl@0
     7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
//
sl@0
     9
// Initial Contributors:
sl@0
    10
// Nokia Corporation - initial contribution.
sl@0
    11
//
sl@0
    12
// Contributors:
sl@0
    13
//
sl@0
    14
// Description:
sl@0
    15
//
sl@0
    16
sl@0
    17
/**
sl@0
    18
 @file
sl@0
    19
 @test
sl@0
    20
 @internalComponent - Internal Symbian test code
sl@0
    21
*/
sl@0
    22
sl@0
    23
#ifndef __TFADE_H__
sl@0
    24
#define __TFADE_H__
sl@0
    25
sl@0
    26
#include "AUTO.H"
sl@0
    27
sl@0
    28
#if defined(__MARM__)
sl@0
    29
	#define SMALL_RECTS
sl@0
    30
#endif
sl@0
    31
#define SIZE_X 10
sl@0
    32
#define SIZE_Y 5
sl@0
    33
#define DRAW_MODE EColor64K		//Mode used for testing fadded drawing
sl@0
    34
#define BLACK_NORMAL 128
sl@0
    35
#define WHITE_NORMAL 255
sl@0
    36
#define BLACK_ALTERNATE 0
sl@0
    37
#define WHITE_ALTERNATE 127
sl@0
    38
#define NUMBER_OF_WINDOWS	16
sl@0
    39
sl@0
    40
#define MODE_LT_64K(mode)	(TDisplayModeUtils::NumDisplayModeColors(mode)<65536)
sl@0
    41
sl@0
    42
#define ETrue	1
sl@0
    43
#define EFalse	0
sl@0
    44
sl@0
    45
class CTFade : public CTWsGraphicsBase
sl@0
    46
	{
sl@0
    47
public:
sl@0
    48
	CTFade(CTestStep* aStep);
sl@0
    49
	~CTFade();
sl@0
    50
	void ConstructL();
sl@0
    51
	TInt Content();
sl@0
    52
	void Drawing(TInt aDrawFunc, CBitmapContext *gc);
sl@0
    53
	//Different Tests
sl@0
    54
	void ColorTest();
sl@0
    55
	void BlankWindowL();
sl@0
    56
	void FadeChildrenL();
sl@0
    57
	void FadeChildrenAfterNewChildIsCreatedL();
sl@0
    58
	void FadeBehindL();
sl@0
    59
	void ColorTest2();
sl@0
    60
	void FadeTest();
sl@0
    61
	void Draw(TBool aAlternativeFade=EFalse);
sl@0
    62
	void ObscuredL();
sl@0
    63
	void MovingL();
sl@0
    64
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
    65
	void GCDraw();
sl@0
    66
#endif
sl@0
    67
	void SystemFadeL();
sl@0
    68
	void SystemAlternateFadeL();
sl@0
    69
	void FadeBehindWhenMovedL();
sl@0
    70
	void FadeBehindTransparentWindowL();
sl@0
    71
protected:
sl@0
    72
//from 	CTGraphicsStep
sl@0
    73
	virtual void RunTestCaseL(TInt aCurTestCase);
sl@0
    74
private:
sl@0
    75
	void CreateBlankWindowL();
sl@0
    76
	void DestroyBlankWindow();
sl@0
    77
	void CreateBackupWindowL(TBool aMaintainBackup);
sl@0
    78
	void CreateRedrawWindowL();
sl@0
    79
	void DestroyDrawableWindow();
sl@0
    80
	void CreateBitmapsL();
sl@0
    81
	void DestroyBitmaps();
sl@0
    82
	void Draw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade=EFalse, TBool aFade=EFalse);
sl@0
    83
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
sl@0
    84
	void GCDraw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade=EFalse);
sl@0
    85
#endif
sl@0
    86
	void Draw(TInt aDrawFunc, TAny *aParam, CBitmapContext *gc);
sl@0
    87
	void CompareWithBitmap(TBool aFade);
sl@0
    88
	void CompareWindows(TBool aAlternativeFade=EFalse);
sl@0
    89
	void TestStrips(TRect aRect,TInt aHeight,TInt aNumNotFaded,TBool aInvert=EFalse);
sl@0
    90
	void TestBlocks(TRect aRect,TSize aSize,TInt aNumNotFaded,TBool aInvert=EFalse);
sl@0
    91
	TInt Fade4(TInt aGray4);
sl@0
    92
	TInt Fade16(TInt aGray16);
sl@0
    93
	TRgb FadeRgb(TRgb aColor);
sl@0
    94
	TRgb FadeRgb(TRgb aColor, TInt aFadeMapFactor, TInt aFadeMapOffset);
sl@0
    95
	inline void ViewDelay();
sl@0
    96
private:
sl@0
    97
	CTBlankWindow* iBlankWin;
sl@0
    98
	CTDrawableWin* iWin;
sl@0
    99
	TBool iOwnWindow;
sl@0
   100
	TRect iWindowRect;
sl@0
   101
	TRect iBaseRect;
sl@0
   102
	CFbsBitmap iNormalBitmap;
sl@0
   103
	CFbsBitmap iFadedBitmap;
sl@0
   104
	CFbsBitGc *iNormalBitGc;
sl@0
   105
	CFbsBitGc *iFadedBitGc;
sl@0
   106
	CFbsDevice *iNormalBitmapDevice;
sl@0
   107
	CFbsDevice *iFadedBitmapDevice;
sl@0
   108
	TInt iContent;
sl@0
   109
	TDisplayMode iBaseWinMode;
sl@0
   110
	TDisplayMode iDeviceDisplayMode;
sl@0
   111
	TSize iTestWinSize;
sl@0
   112
	TDisplayMode iFadeDrawMode;
sl@0
   113
	CFbsBitmap *iTestWinCopy;
sl@0
   114
	CFbsBitmap *iCheckWinCopy;
sl@0
   115
#if defined (__MARM_THUMB__)
sl@0
   116
GLDEF_D TBool CanFade;
sl@0
   117
GLDEF_D TBool CanFadeSet;
sl@0
   118
#endif
sl@0
   119
	};
sl@0
   120
sl@0
   121
class CRedrawWin : public CTWin
sl@0
   122
	{
sl@0
   123
public:
sl@0
   124
	CRedrawWin(CTFade *aTest);
sl@0
   125
	void ConstructL(TRect aArea);
sl@0
   126
	~CRedrawWin();
sl@0
   127
	void Draw();
sl@0
   128
	
sl@0
   129
protected:
sl@0
   130
	CTFade* iTest;
sl@0
   131
	};
sl@0
   132
sl@0
   133
class CTFadeStep : public CTGraphicsStep
sl@0
   134
	{
sl@0
   135
public:
sl@0
   136
	CTFadeStep();
sl@0
   137
protected:
sl@0
   138
	//from CTGraphicsStep
sl@0
   139
	virtual CTGraphicsBase* CreateTestL();
sl@0
   140
	};
sl@0
   141
sl@0
   142
_LIT(KTFadeStep,"TFade");
sl@0
   143
sl@0
   144
sl@0
   145
#endif