os/graphics/windowing/windowserver/test/tauto/TScreenModeScaling.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 // Definitions common for both scren mode positioning and scaling
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @test
    21  @internalComponent - Internal Symbian test code
    22 */
    23 
    24 #ifndef __TSCREENMODESCALING_H__
    25 #define __TSCREENMODESCALING_H__
    26 
    27 
    28 #include <e32std.h>
    29 #include <w32std.h>
    30 #include "../tlib/testbase.h"
    31 #include "AUTO.H"
    32 #include "TGraphicsHarness.h"
    33 
    34 _LIT(ScalingTestName,"Screen Mode Scaling");
    35 
    36 GLREF_C void ClearBitmap(CFbsBitmap* aBitMap);
    37 
    38 class CBasicWin : public CTWin
    39 	{
    40 public:
    41 	//Virtual Function from CTBaseWin
    42 	void Draw();
    43 	TInt iDrawn;
    44 	};
    45 
    46 class CBmpWin : public CTWin
    47 	{
    48 public:
    49 	inline CBmpWin(CFbsBitmap& aScreenBmp) :iScreenBmp(aScreenBmp) {}
    50 	//Virtual Function from CTBaseWin
    51 	void Draw();
    52 private:
    53 	CFbsBitmap& iScreenBmp;
    54 	};
    55 
    56 class CSpriteWin : public CTWin
    57 	{
    58 public:
    59 	inline CSpriteWin(CFbsBitmap& aSpriteBitmap) :iSpriteBitmap(aSpriteBitmap) {}
    60 	~CSpriteWin();
    61 	inline void SetState(TInt aState) {iState=aState;}
    62 	void UpdateState(TInt aState);
    63 	//Virtual Function from CTBaseWin
    64 	void Draw();
    65 private:
    66 	CFbsBitmap& iSpriteBitmap;
    67 	TInt iState;
    68 	};
    69 
    70 class CTestSpriteWin : public CTWin
    71 	{
    72 public:
    73 	inline CTestSpriteWin(CFbsBitmap& aSpriteBitmap) :iSpriteBitmap(aSpriteBitmap) {}
    74 	~CTestSpriteWin();
    75 	inline void SetOrigin(TPoint aOrigin) {iOrigin=aOrigin;}
    76 	void UpdateWin(TPoint aOrigin);
    77 	//Virtual Function from CTBaseWin
    78 	void Draw();
    79 private:
    80 	CFbsBitmap& iSpriteBitmap;
    81 	TPoint iOrigin;
    82 	};
    83 
    84 class CBitMapWin : public CTWin
    85 	{
    86 public:
    87 	inline CBitMapWin(CBitmap* aBackupBitmap) :iBackup(aBackupBitmap) {}
    88 	//Virtual Function from CTBaseWin
    89 	void Draw();
    90 private:
    91 	CBitmap* iBackup;
    92 	};
    93 
    94 
    95 
    96 class CTScreenModeScaling : public CTWsGraphicsBase
    97 	{
    98 public:
    99 	CTScreenModeScaling(CTestStep* aStep);
   100 	~CTScreenModeScaling();
   101 	void ConstructL();
   102 	void WindowTestsL();
   103 	void SpriteTestL();
   104 	void RotationTestsL();
   105 	void TransparentTestsL();
   106 	void AppScreenModeTestL();
   107 	
   108 protected:
   109 	virtual void RunTestCaseL(TInt aCurTestCase);
   110 
   111 private:
   112 	void DoWindowTestsL();
   113 	void TestTopClientWindowPositionAPIs(TPoint aPos,RWindowBase* aWin);
   114 	void TestChildWindowPositionAPIs(TPoint aPos,TPoint aParentPos,RWindowBase* aWin,RWindowBase* aParentWin);
   115 	void TestRect();
   116 	void CompareRegionsL(const TRegion &aRegion1,const TRegion &aRegion2);
   117 	void TestGetInvalidRegionL(TRect& aRect);
   118 	void CopyAndCompareL();
   119 	void PositionTestL(TPoint aPostion);
   120 	void BackedUpChildWindowTestL(TPoint aPostion);
   121 	void NextScreenModeTestL(TPoint aPos);
   122 	void GetInvalidRegionTestL(TPoint aPos);
   123 	void TestDifferentScales(TInt aLastMode);
   124 	void TestDifferentOrigin(TSizeMode &aMode,TPoint aOrigin);
   125 	void DoSpriteTestsL();
   126 	void TestDifferentOriginAndScaleForSpritesL(TSizeMode &aMode,TPoint aOrigin);
   127 	void SetUpSpriteLC(RWsSprite &aSprite,RWsSession &aSession,RWindowTreeNode &aWindow,TInt aFlags=ESpriteNoShadows);
   128 	void DrawTransparentWindows();
   129 	void TestDifferentOriginAndScaleForTranspWin(TSizeMode &aMode,TPoint aOrigin);
   130 private:
   131 	CFbsBitmap iSpriteBitmap;
   132 	CBmpWin* iBitmapWin;
   133 	CFbsBitmap* iScreenBitmap;
   134 	CBasicWin *iTestWin;
   135 	CTBackedUpWin* iBackedUpWin;
   136 	CTBlankWindow* iBlankWin;
   137 	CTBlankWindow* iTestChildWin;
   138 	TInt iCurrentMode;
   139 	TSize iTestWinSize;
   140 	TPoint iCurrentScreenModeOrigin;
   141 	TSize iCurrentScreenModeScale;
   142 	CTBackedUpWin* iCheckWin;
   143 	CBitmap* iCheckBitmap;
   144 	CBitmap* iTransparencyBitmap;
   145 	CBitmap* iBackgroundBitmap;
   146 	CBitmap* iForegroundBitmap;
   147 	CBitMapWin* iTransWin;
   148 	CBitMapWin* iBackgroundWin;
   149 	TSize iWinSize;
   150 	TDisplayMode iDisplayMode;
   151 	};
   152 
   153 class CTScreenModeScalingStep : public CTGraphicsStep
   154 	{
   155 public:
   156 	CTScreenModeScalingStep();
   157 protected:	
   158 	//from CTGraphicsStep
   159 	virtual CTGraphicsBase* CreateTestL();
   160 	};
   161 
   162 _LIT(KTScreenModeScalingStep,"TScreenModeScaling");
   163 
   164 #endif