sl@0: sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #ifndef __TFADE_H__ sl@0: #define __TFADE_H__ sl@0: sl@0: #include "AUTO.H" sl@0: sl@0: #if defined(__MARM__) sl@0: #define SMALL_RECTS sl@0: #endif sl@0: #define SIZE_X 10 sl@0: #define SIZE_Y 5 sl@0: #define DRAW_MODE EColor64K //Mode used for testing fadded drawing sl@0: #define BLACK_NORMAL 128 sl@0: #define WHITE_NORMAL 255 sl@0: #define BLACK_ALTERNATE 0 sl@0: #define WHITE_ALTERNATE 127 sl@0: #define NUMBER_OF_WINDOWS 16 sl@0: sl@0: #define MODE_LT_64K(mode) (TDisplayModeUtils::NumDisplayModeColors(mode)<65536) sl@0: sl@0: #define ETrue 1 sl@0: #define EFalse 0 sl@0: sl@0: class CTFade : public CTWsGraphicsBase sl@0: { sl@0: public: sl@0: CTFade(CTestStep* aStep); sl@0: ~CTFade(); sl@0: void ConstructL(); sl@0: TInt Content(); sl@0: void Drawing(TInt aDrawFunc, CBitmapContext *gc); sl@0: //Different Tests sl@0: void ColorTest(); sl@0: void BlankWindowL(); sl@0: void FadeChildrenL(); sl@0: void FadeChildrenAfterNewChildIsCreatedL(); sl@0: void FadeBehindL(); sl@0: void ColorTest2(); sl@0: void FadeTest(); sl@0: void Draw(TBool aAlternativeFade=EFalse); sl@0: void ObscuredL(); sl@0: void MovingL(); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: void GCDraw(); sl@0: #endif sl@0: void SystemFadeL(); sl@0: void SystemAlternateFadeL(); sl@0: void FadeBehindWhenMovedL(); sl@0: void FadeBehindTransparentWindowL(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: private: sl@0: void CreateBlankWindowL(); sl@0: void DestroyBlankWindow(); sl@0: void CreateBackupWindowL(TBool aMaintainBackup); sl@0: void CreateRedrawWindowL(); sl@0: void DestroyDrawableWindow(); sl@0: void CreateBitmapsL(); sl@0: void DestroyBitmaps(); sl@0: void Draw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade=EFalse, TBool aFade=EFalse); sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: void GCDraw(TInt aDrawFunc, TAny *aParam, TBool aAlternativeFade=EFalse); sl@0: #endif sl@0: void Draw(TInt aDrawFunc, TAny *aParam, CBitmapContext *gc); sl@0: void CompareWithBitmap(TBool aFade); sl@0: void CompareWindows(TBool aAlternativeFade=EFalse); sl@0: void TestStrips(TRect aRect,TInt aHeight,TInt aNumNotFaded,TBool aInvert=EFalse); sl@0: void TestBlocks(TRect aRect,TSize aSize,TInt aNumNotFaded,TBool aInvert=EFalse); sl@0: TInt Fade4(TInt aGray4); sl@0: TInt Fade16(TInt aGray16); sl@0: TRgb FadeRgb(TRgb aColor); sl@0: TRgb FadeRgb(TRgb aColor, TInt aFadeMapFactor, TInt aFadeMapOffset); sl@0: inline void ViewDelay(); sl@0: private: sl@0: CTBlankWindow* iBlankWin; sl@0: CTDrawableWin* iWin; sl@0: TBool iOwnWindow; sl@0: TRect iWindowRect; sl@0: TRect iBaseRect; sl@0: CFbsBitmap iNormalBitmap; sl@0: CFbsBitmap iFadedBitmap; sl@0: CFbsBitGc *iNormalBitGc; sl@0: CFbsBitGc *iFadedBitGc; sl@0: CFbsDevice *iNormalBitmapDevice; sl@0: CFbsDevice *iFadedBitmapDevice; sl@0: TInt iContent; sl@0: TDisplayMode iBaseWinMode; sl@0: TDisplayMode iDeviceDisplayMode; sl@0: TSize iTestWinSize; sl@0: TDisplayMode iFadeDrawMode; sl@0: CFbsBitmap *iTestWinCopy; sl@0: CFbsBitmap *iCheckWinCopy; sl@0: #if defined (__MARM_THUMB__) sl@0: GLDEF_D TBool CanFade; sl@0: GLDEF_D TBool CanFadeSet; sl@0: #endif sl@0: }; sl@0: sl@0: class CRedrawWin : public CTWin sl@0: { sl@0: public: sl@0: CRedrawWin(CTFade *aTest); sl@0: void ConstructL(TRect aArea); sl@0: ~CRedrawWin(); sl@0: void Draw(); sl@0: sl@0: protected: sl@0: CTFade* iTest; sl@0: }; sl@0: sl@0: class CTFadeStep : public CTGraphicsStep sl@0: { sl@0: public: sl@0: CTFadeStep(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual CTGraphicsBase* CreateTestL(); sl@0: }; sl@0: sl@0: _LIT(KTFadeStep,"TFade"); sl@0: sl@0: sl@0: #endif