os/graphics/graphicsdeviceinterface/screendriver/tsrc/tscdvdevorientation.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2004-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 //
    15 
    16 #if !defined(__TSCDVDEVORIENTATION_H__)
    17 #define __TSCDVDEVORIENTATION_H__
    18 
    19 #include "TGraphicsHarness.h"
    20 #include <graphics/surface.h>
    21 #include <pixelformats.h>
    22 #include <bitdrawsurface.h>
    23 
    24 
    25 LOCAL_D const TUint KPanicThreadHeapSize=0x4000;
    26 _LIT(KSCDVPanicCategory,"SCDV");
    27 
    28 //
    29 // Panic testing //
    30 //
    31 typedef TInt (*TPanicFunction)(TDeviceOrientation aOrientation, TDisplayMode aDisplayMode,TInt aScreenNo);
    32 
    33 struct SPanicParams
    34 	{
    35 	TPanicFunction functionName;
    36 	TDeviceOrientation* pointerDeviceOrientation;
    37 	TDisplayMode* pointerDisplayMode;
    38 	TInt* pointerScreenNo;
    39 	};
    40 
    41 enum TPanicExitReasons
    42 	{
    43 	EWsExitReasonBad=0x12345678,
    44 	EWsExitReasonFinished
    45 	};
    46 
    47 enum TAutoPanics
    48 	{
    49 	EAutoPanicTestFailed=0xBAADF00D,
    50 	EAutoPanicPanicFailed=0xF00DBAAD
    51 	};
    52 	
    53 class CPanicTest : public CBase
    54 	{
    55 public:
    56 	CPanicTest();
    57 	~CPanicTest();
    58 	TInt LaunchPanicThread(RThread &aThread, SPanicParams *aPtr);
    59 	TInt TestInvalidModePanicL(TPanicFunction aFunction, TScreenDriverPanic aExitReason,TDisplayMode* aPtr2, TDeviceOrientation* aPtr, TInt* aPtrScreenNo, TBool* aTestFinished = NULL);
    60 
    61 	TInt TestPanicL(SPanicParams *aPtr, TInt aExitReason, const TDesC &aCategory, TBool* aTestFinished=NULL);
    62 	TInt TestPanicL(TPanicFunction aFunction, TInt aExitReason, const TDesC &aCategory, TDisplayMode* aPtr2,TDeviceOrientation* aPtr, TInt* aPtrScreenNo, TBool* aTestFinished=NULL);
    63 	TInt iActualPanicCode;
    64 	TInt iThreadNumber;
    65 	};
    66 
    67 
    68 
    69 class CTDevOrientation: public CTGraphicsBase
    70 	{
    71 public:
    72 
    73 	CTDevOrientation(CTestStep *aTest, RArray<TInt> aArrayDispModes);
    74 	CTDevOrientation(CTestStep *aTest);
    75 	~CTDevOrientation();
    76 	void RunTestCaseL(TInt aCurTestCase);
    77 	
    78 	TBool GetSurfaceIdInterfaceL(const TInt& aScreenNo,const TDisplayMode& aDisplayMode, CFbsDrawDevice*& aDrawScreenDevice, MSurfaceId*& aSurfaceIdInterface );
    79 
    80 	TBool ChooseOrientationMode( MSurfaceId* aSurfaceIdInterface);
    81 	
    82     void TestValidButUnavailableOrientationL(MSurfaceId* aSurfaceIdInterface,TDisplayMode aDisplayMode);
    83 	void TestSetDeviceOrientationWithInvalidModeL(TDisplayMode aDisplayMode);
    84 	void TestGetSurfaceWithValidDispModeL( const MSurfaceId* aSurfaceIdInterface, const TDisplayMode& aDisplayMode, TInt aScreenNo);
    85 	void TestGetDeviceOrientation(MSurfaceId* aSurfaceIdInterface);
    86 	void TestDeviceOrientationSettingandGetting( MSurfaceId* aSurfaceIdInterface);
    87 	void TestHorizontalVerticalTwips(const CFbsDrawDevice* aDrawScreenDevice,  MSurfaceId* aSurfaceIdInterface, TDisplayMode aDisplayMode, TInt aScreenNo);
    88 	void TestSetDeviceOrientationWithValidMode(const CFbsDrawDevice* aDrawScreenDevice,  MSurfaceId* aSurfaceIdInterface, TDisplayMode aDisplayMode, TInt aScreenNo);
    89     void TestSetDisplayMode(CFbsDrawDevice* aDrawScreenDevice,MSurfaceId* aSurfaceIdInterface);
    90 
    91 
    92 private:
    93 	void ConstructL();
    94 	TBool ReqBppAndPixelFormat(TDisplayMode aDisplayMode, TInt& aBpp, TUint32& aPixelFormat);
    95 
    96 private:	
    97 	TSize iPhysSize;
    98     RArray<TDeviceOrientation> iArrayOrientation;
    99 	// handle to initiate the panic tests
   100 	CPanicTest *iPanicTest;
   101 	RArray<TInt> iArrayDispModesPerScreen;
   102 	TInt iCurrScreen;
   103 	};
   104 
   105   
   106 class CTDevOrientationStep : public CTGraphicsStep
   107 	{
   108 public:
   109 	CTDevOrientationStep();
   110 protected:	
   111 	//from CTGraphicsStep
   112 	virtual CTGraphicsBase* CreateTestL();
   113 	virtual void TestSetupL();
   114 	};
   115 
   116 _LIT(KTDevOrientationStep,"TDevOrientation");
   117 
   118 
   119 #endif