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: // Definitions common for both scren mode positioning and scaling sl@0: // 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 __TSCREENMODESCALING_H__ sl@0: #define __TSCREENMODESCALING_H__ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include "../tlib/testbase.h" sl@0: #include "AUTO.H" sl@0: #include "TGraphicsHarness.h" sl@0: sl@0: _LIT(ScalingTestName,"Screen Mode Scaling"); sl@0: sl@0: GLREF_C void ClearBitmap(CFbsBitmap* aBitMap); sl@0: sl@0: class CBasicWin : public CTWin sl@0: { sl@0: public: sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: TInt iDrawn; sl@0: }; sl@0: sl@0: class CBmpWin : public CTWin sl@0: { sl@0: public: sl@0: inline CBmpWin(CFbsBitmap& aScreenBmp) :iScreenBmp(aScreenBmp) {} sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: private: sl@0: CFbsBitmap& iScreenBmp; sl@0: }; sl@0: sl@0: class CSpriteWin : public CTWin sl@0: { sl@0: public: sl@0: inline CSpriteWin(CFbsBitmap& aSpriteBitmap) :iSpriteBitmap(aSpriteBitmap) {} sl@0: ~CSpriteWin(); sl@0: inline void SetState(TInt aState) {iState=aState;} sl@0: void UpdateState(TInt aState); sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: private: sl@0: CFbsBitmap& iSpriteBitmap; sl@0: TInt iState; sl@0: }; sl@0: sl@0: class CTestSpriteWin : public CTWin sl@0: { sl@0: public: sl@0: inline CTestSpriteWin(CFbsBitmap& aSpriteBitmap) :iSpriteBitmap(aSpriteBitmap) {} sl@0: ~CTestSpriteWin(); sl@0: inline void SetOrigin(TPoint aOrigin) {iOrigin=aOrigin;} sl@0: void UpdateWin(TPoint aOrigin); sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: private: sl@0: CFbsBitmap& iSpriteBitmap; sl@0: TPoint iOrigin; sl@0: }; sl@0: sl@0: class CBitMapWin : public CTWin sl@0: { sl@0: public: sl@0: inline CBitMapWin(CBitmap* aBackupBitmap) :iBackup(aBackupBitmap) {} sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: private: sl@0: CBitmap* iBackup; sl@0: }; sl@0: sl@0: sl@0: sl@0: class CTScreenModeScaling : public CTWsGraphicsBase sl@0: { sl@0: public: sl@0: CTScreenModeScaling(CTestStep* aStep); sl@0: ~CTScreenModeScaling(); sl@0: void ConstructL(); sl@0: void WindowTestsL(); sl@0: void SpriteTestL(); sl@0: void RotationTestsL(); sl@0: void TransparentTestsL(); sl@0: void AppScreenModeTestL(); sl@0: sl@0: protected: sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: sl@0: private: sl@0: void DoWindowTestsL(); sl@0: void TestTopClientWindowPositionAPIs(TPoint aPos,RWindowBase* aWin); sl@0: void TestChildWindowPositionAPIs(TPoint aPos,TPoint aParentPos,RWindowBase* aWin,RWindowBase* aParentWin); sl@0: void TestRect(); sl@0: void CompareRegionsL(const TRegion &aRegion1,const TRegion &aRegion2); sl@0: void TestGetInvalidRegionL(TRect& aRect); sl@0: void CopyAndCompareL(); sl@0: void PositionTestL(TPoint aPostion); sl@0: void BackedUpChildWindowTestL(TPoint aPostion); sl@0: void NextScreenModeTestL(TPoint aPos); sl@0: void GetInvalidRegionTestL(TPoint aPos); sl@0: void TestDifferentScales(TInt aLastMode); sl@0: void TestDifferentOrigin(TSizeMode &aMode,TPoint aOrigin); sl@0: void DoSpriteTestsL(); sl@0: void TestDifferentOriginAndScaleForSpritesL(TSizeMode &aMode,TPoint aOrigin); sl@0: void SetUpSpriteLC(RWsSprite &aSprite,RWsSession &aSession,RWindowTreeNode &aWindow,TInt aFlags=ESpriteNoShadows); sl@0: void DrawTransparentWindows(); sl@0: void TestDifferentOriginAndScaleForTranspWin(TSizeMode &aMode,TPoint aOrigin); sl@0: private: sl@0: CFbsBitmap iSpriteBitmap; sl@0: CBmpWin* iBitmapWin; sl@0: CFbsBitmap* iScreenBitmap; sl@0: CBasicWin *iTestWin; sl@0: CTBackedUpWin* iBackedUpWin; sl@0: CTBlankWindow* iBlankWin; sl@0: CTBlankWindow* iTestChildWin; sl@0: TInt iCurrentMode; sl@0: TSize iTestWinSize; sl@0: TPoint iCurrentScreenModeOrigin; sl@0: TSize iCurrentScreenModeScale; sl@0: CTBackedUpWin* iCheckWin; sl@0: CBitmap* iCheckBitmap; sl@0: CBitmap* iTransparencyBitmap; sl@0: CBitmap* iBackgroundBitmap; sl@0: CBitmap* iForegroundBitmap; sl@0: CBitMapWin* iTransWin; sl@0: CBitMapWin* iBackgroundWin; sl@0: TSize iWinSize; sl@0: TDisplayMode iDisplayMode; sl@0: }; sl@0: sl@0: class CTScreenModeScalingStep : public CTGraphicsStep sl@0: { sl@0: public: sl@0: CTScreenModeScalingStep(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual CTGraphicsBase* CreateTestL(); sl@0: }; sl@0: sl@0: _LIT(KTScreenModeScalingStep,"TScreenModeScaling"); sl@0: sl@0: #endif