os/graphics/graphicsdeviceinterface/directgdi/test/tdirectgdiresource.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
/**
sl@0
    17
 @file
sl@0
    18
 @internalComponent 
sl@0
    19
 @test
sl@0
    20
*/
sl@0
    21
sl@0
    22
#ifndef TDIRECTGDIRESOURCE_H
sl@0
    23
#define TDIRECTGDIRESOURCE_H
sl@0
    24
sl@0
    25
sl@0
    26
#include "tdirectgdi_test_step_base.h"
sl@0
    27
#include <bitmaptransforms.h> 
sl@0
    28
sl@0
    29
class RDirectGdiDrawableSource;
sl@0
    30
sl@0
    31
_LIT(KBitmapRotatorSemaphore, "CTBitmapRotator_Sempaphore");
sl@0
    32
sl@0
    33
/**
sl@0
    34
This class contains all the test cases related to DirectGDI DrawResource() APIs.
sl@0
    35
sl@0
    36
@internalComponent
sl@0
    37
@test
sl@0
    38
*/
sl@0
    39
class CTDirectGdiResource : public CTDirectGdiStepBase, public CActive
sl@0
    40
	{
sl@0
    41
public:
sl@0
    42
	CTDirectGdiResource();
sl@0
    43
	~CTDirectGdiResource();
sl@0
    44
	
sl@0
    45
protected:
sl@0
    46
	// From CActive
sl@0
    47
	void RunL();
sl@0
    48
	void DoCancel();
sl@0
    49
	
sl@0
    50
private:
sl@0
    51
	void TestDrawResource_ImageAsDrawableL();
sl@0
    52
	void TestDrawResource_PosL();
sl@0
    53
	void TestDrawResource_DestRectL();
sl@0
    54
	void TestDrawResource_DestRectSrcRectL();
sl@0
    55
sl@0
    56
	void TestDrawResource_NullHandleL();
sl@0
    57
	void TestDrawResource_InvalidParameterL();
sl@0
    58
	void TestDrawResource_NonZeroOriginL();
sl@0
    59
sl@0
    60
	void TestDrawTargetAsSourceL();
sl@0
    61
	void TestShareEGLImageBetweenSourcesL();	
sl@0
    62
	void TestDrawResourceSourceNotCreatedL();
sl@0
    63
	
sl@0
    64
	virtual TVerdict doTestStepPreambleL();
sl@0
    65
	virtual TVerdict doTestStepL();
sl@0
    66
	virtual TVerdict doTestStepPostambleL();
sl@0
    67
	// from CTDirectGdiStepBase
sl@0
    68
	void RunTestsL();
sl@0
    69
	
sl@0
    70
	void CreateCommonResourceL();
sl@0
    71
	void DestroyCommonResource();
sl@0
    72
	void SaveOutput(const TDesC& aName);
sl@0
    73
sl@0
    74
	void DrawTestPattern1(const TPoint&);
sl@0
    75
	void DrawTestPattern1(const TRect&, const TDrawableSourceAndEquivRotatedBmps&, const TDrawableSourceAndEquivRotatedBmps&);
sl@0
    76
	void DrawTestPattern2(const TRect&, const TDrawableSourceAndEquivRotatedBmps&, const TDrawableSourceAndEquivRotatedBmps&);
sl@0
    77
	void DrawTestPattern1(const TRect&, const TRect* = NULL);
sl@0
    78
	void DrawTestPattern2(const TRect&, const TRect* = NULL);
sl@0
    79
	void DrawTestPattern3(const TRect&, const TRect* = NULL);
sl@0
    80
sl@0
    81
	void DoDrawTestL();
sl@0
    82
	TBool SourceResourceHasAlpha() const;
sl@0
    83
	TBool OneTimeTestEnabled() const;
sl@0
    84
sl@0
    85
private:
sl@0
    86
	TBool iUseWriteAlpha;
sl@0
    87
	TBool iEnableClipRegion;
sl@0
    88
	RRegion iClip;
sl@0
    89
	TDrawableSourceAndEquivRotatedBmps iImgSrc;
sl@0
    90
	TDrawableSourceAndEquivRotatedBmps iDwbSrc[2];
sl@0
    91
	TSize iImgSz;
sl@0
    92
	CBitmapRotator* iBitmapRotator;	
sl@0
    93
	
sl@0
    94
	enum TActiveState
sl@0
    95
		{
sl@0
    96
		EStartup,
sl@0
    97
		ERotatingBitmap90,
sl@0
    98
		ERotatingBitmap180,
sl@0
    99
		ERotatingBitmap270,
sl@0
   100
		EDone
sl@0
   101
		};
sl@0
   102
	
sl@0
   103
	TActiveState iCurrentState;
sl@0
   104
	};		
sl@0
   105
	
sl@0
   106
_LIT(KTDirectGdiResourceStep,"TDirectGDIResource");
sl@0
   107
sl@0
   108
#endif // TDIRECTGDIRESOURCE_H