1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TFADE.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,145 @@
1.4 +
1.5 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of "Eclipse Public License v1.0"
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +/**
1.21 + @file
1.22 + @test
1.23 + @internalComponent - Internal Symbian test code
1.24 +*/
1.25 +
1.26 +#ifndef __TFADE_H__
1.27 +#define __TFADE_H__
1.28 +
1.29 +#include "AUTO.H"
1.30 +
1.31 +#if defined(__MARM__)
1.32 + #define SMALL_RECTS
1.33 +#endif
1.34 +#define SIZE_X 10
1.35 +#define SIZE_Y 5
1.36 +#define DRAW_MODE EColor64K //Mode used for testing fadded drawing
1.37 +#define BLACK_NORMAL 128
1.38 +#define WHITE_NORMAL 255
1.39 +#define BLACK_ALTERNATE 0
1.40 +#define WHITE_ALTERNATE 127
1.41 +#define NUMBER_OF_WINDOWS 16
1.42 +
1.43 +#define MODE_LT_64K(mode) (TDisplayModeUtils::NumDisplayModeColors(mode)<65536)
1.44 +
1.45 +#define ETrue 1
1.46 +#define EFalse 0
1.47 +
1.48 +class CTFade : public CTWsGraphicsBase
1.49 + {
1.50 +public:
1.51 + CTFade(CTestStep* aStep);
1.52 + ~CTFade();
1.53 + void ConstructL();
1.54 + TInt Content();
1.55 + void Drawing(TInt aDrawFunc, CBitmapContext *gc);
1.56 + //Different Tests
1.57 + void ColorTest();
1.58 + void BlankWindowL();
1.59 + void FadeChildrenL();
1.60 + void FadeChildrenAfterNewChildIsCreatedL();
1.61 + void FadeBehindL();
1.62 + void ColorTest2();
1.63 + void FadeTest();
1.64 + void Draw(TBool aAlternativeFade=EFalse);
1.65 + void ObscuredL();
1.66 + void MovingL();
1.67 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.68 + void GCDraw();
1.69 +#endif
1.70 + void SystemFadeL();
1.71 + void SystemAlternateFadeL();
1.72 + void FadeBehindWhenMovedL();
1.73 + void FadeBehindTransparentWindowL();
1.74 +protected:
1.75 +//from CTGraphicsStep
1.76 + virtual void RunTestCaseL(TInt aCurTestCase);
1.77 +private:
1.78 + void CreateBlankWindowL();
1.79 + void DestroyBlankWindow();
1.80 + void CreateBackupWindowL(TBool aMaintainBackup);
1.81 + void CreateRedrawWindowL();
1.82 + void DestroyDrawableWindow();
1.83 + void CreateBitmapsL();
1.84 + void DestroyBitmaps();
1.85 + void Draw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade=EFalse, TBool aFade=EFalse);
1.86 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1.87 + void GCDraw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade=EFalse);
1.88 +#endif
1.89 + void Draw(TInt aDrawFunc, TAny *aParam, CBitmapContext *gc);
1.90 + void CompareWithBitmap(TBool aFade);
1.91 + void CompareWindows(TBool aAlternativeFade=EFalse);
1.92 + void TestStrips(TRect aRect,TInt aHeight,TInt aNumNotFaded,TBool aInvert=EFalse);
1.93 + void TestBlocks(TRect aRect,TSize aSize,TInt aNumNotFaded,TBool aInvert=EFalse);
1.94 + TInt Fade4(TInt aGray4);
1.95 + TInt Fade16(TInt aGray16);
1.96 + TRgb FadeRgb(TRgb aColor);
1.97 + TRgb FadeRgb(TRgb aColor, TInt aFadeMapFactor, TInt aFadeMapOffset);
1.98 + inline void ViewDelay();
1.99 +private:
1.100 + CTBlankWindow* iBlankWin;
1.101 + CTDrawableWin* iWin;
1.102 + TBool iOwnWindow;
1.103 + TRect iWindowRect;
1.104 + TRect iBaseRect;
1.105 + CFbsBitmap iNormalBitmap;
1.106 + CFbsBitmap iFadedBitmap;
1.107 + CFbsBitGc *iNormalBitGc;
1.108 + CFbsBitGc *iFadedBitGc;
1.109 + CFbsDevice *iNormalBitmapDevice;
1.110 + CFbsDevice *iFadedBitmapDevice;
1.111 + TInt iContent;
1.112 + TDisplayMode iBaseWinMode;
1.113 + TDisplayMode iDeviceDisplayMode;
1.114 + TSize iTestWinSize;
1.115 + TDisplayMode iFadeDrawMode;
1.116 + CFbsBitmap *iTestWinCopy;
1.117 + CFbsBitmap *iCheckWinCopy;
1.118 +#if defined (__MARM_THUMB__)
1.119 +GLDEF_D TBool CanFade;
1.120 +GLDEF_D TBool CanFadeSet;
1.121 +#endif
1.122 + };
1.123 +
1.124 +class CRedrawWin : public CTWin
1.125 + {
1.126 +public:
1.127 + CRedrawWin(CTFade *aTest);
1.128 + void ConstructL(TRect aArea);
1.129 + ~CRedrawWin();
1.130 + void Draw();
1.131 +
1.132 +protected:
1.133 + CTFade* iTest;
1.134 + };
1.135 +
1.136 +class CTFadeStep : public CTGraphicsStep
1.137 + {
1.138 +public:
1.139 + CTFadeStep();
1.140 +protected:
1.141 + //from CTGraphicsStep
1.142 + virtual CTGraphicsBase* CreateTestL();
1.143 + };
1.144 +
1.145 +_LIT(KTFadeStep,"TFade");
1.146 +
1.147 +
1.148 +#endif