os/graphics/graphicsdeviceinterface/directgdi/test/tdirectgdiresource.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 // Copyright (c) 2007-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 /**
    17  @file
    18  @internalComponent 
    19  @test
    20 */
    21 
    22 #ifndef TDIRECTGDIRESOURCE_H
    23 #define TDIRECTGDIRESOURCE_H
    24 
    25 
    26 #include "tdirectgdi_test_step_base.h"
    27 #include <bitmaptransforms.h> 
    28 
    29 class RDirectGdiDrawableSource;
    30 
    31 _LIT(KBitmapRotatorSemaphore, "CTBitmapRotator_Sempaphore");
    32 
    33 /**
    34 This class contains all the test cases related to DirectGDI DrawResource() APIs.
    35 
    36 @internalComponent
    37 @test
    38 */
    39 class CTDirectGdiResource : public CTDirectGdiStepBase, public CActive
    40 	{
    41 public:
    42 	CTDirectGdiResource();
    43 	~CTDirectGdiResource();
    44 	
    45 protected:
    46 	// From CActive
    47 	void RunL();
    48 	void DoCancel();
    49 	
    50 private:
    51 	void TestDrawResource_ImageAsDrawableL();
    52 	void TestDrawResource_PosL();
    53 	void TestDrawResource_DestRectL();
    54 	void TestDrawResource_DestRectSrcRectL();
    55 
    56 	void TestDrawResource_NullHandleL();
    57 	void TestDrawResource_InvalidParameterL();
    58 	void TestDrawResource_NonZeroOriginL();
    59 
    60 	void TestDrawTargetAsSourceL();
    61 	void TestShareEGLImageBetweenSourcesL();	
    62 	void TestDrawResourceSourceNotCreatedL();
    63 	
    64 	virtual TVerdict doTestStepPreambleL();
    65 	virtual TVerdict doTestStepL();
    66 	virtual TVerdict doTestStepPostambleL();
    67 	// from CTDirectGdiStepBase
    68 	void RunTestsL();
    69 	
    70 	void CreateCommonResourceL();
    71 	void DestroyCommonResource();
    72 	void SaveOutput(const TDesC& aName);
    73 
    74 	void DrawTestPattern1(const TPoint&);
    75 	void DrawTestPattern1(const TRect&, const TDrawableSourceAndEquivRotatedBmps&, const TDrawableSourceAndEquivRotatedBmps&);
    76 	void DrawTestPattern2(const TRect&, const TDrawableSourceAndEquivRotatedBmps&, const TDrawableSourceAndEquivRotatedBmps&);
    77 	void DrawTestPattern1(const TRect&, const TRect* = NULL);
    78 	void DrawTestPattern2(const TRect&, const TRect* = NULL);
    79 	void DrawTestPattern3(const TRect&, const TRect* = NULL);
    80 
    81 	void DoDrawTestL();
    82 	TBool SourceResourceHasAlpha() const;
    83 	TBool OneTimeTestEnabled() const;
    84 
    85 private:
    86 	TBool iUseWriteAlpha;
    87 	TBool iEnableClipRegion;
    88 	RRegion iClip;
    89 	TDrawableSourceAndEquivRotatedBmps iImgSrc;
    90 	TDrawableSourceAndEquivRotatedBmps iDwbSrc[2];
    91 	TSize iImgSz;
    92 	CBitmapRotator* iBitmapRotator;	
    93 	
    94 	enum TActiveState
    95 		{
    96 		EStartup,
    97 		ERotatingBitmap90,
    98 		ERotatingBitmap180,
    99 		ERotatingBitmap270,
   100 		EDone
   101 		};
   102 	
   103 	TActiveState iCurrentState;
   104 	};		
   105 	
   106 _LIT(KTDirectGdiResourceStep,"TDirectGDIResource");
   107 
   108 #endif // TDIRECTGDIRESOURCE_H