os/graphics/windowing/windowserver/test/tauto/TALPHAWIN.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
sl@0
     2
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
// All rights reserved.
sl@0
     4
// This component and the accompanying materials are made available
sl@0
     5
// under the terms of "Eclipse Public License v1.0"
sl@0
     6
// which accompanies this distribution, and is available
sl@0
     7
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
//
sl@0
     9
// Initial Contributors:
sl@0
    10
// Nokia Corporation - initial contribution.
sl@0
    11
//
sl@0
    12
// Contributors:
sl@0
    13
//
sl@0
    14
// Description:
sl@0
    15
//
sl@0
    16
sl@0
    17
/**
sl@0
    18
 @file
sl@0
    19
 @test
sl@0
    20
 @internalComponent - Internal Symbian test code
sl@0
    21
*/
sl@0
    22
sl@0
    23
#ifndef __TALPHAWIN_H__
sl@0
    24
#define __TALPHAWIN_H__
sl@0
    25
sl@0
    26
#include "AUTO.H"
sl@0
    27
#include "TGraphicsHarness.h"
sl@0
    28
sl@0
    29
class CTDrawOpWin;
sl@0
    30
class CTAlphaWindow;
sl@0
    31
class CTAlphaRefWin;
sl@0
    32
sl@0
    33
class CTAlphaWin : public CTWsGraphicsBase
sl@0
    34
	{
sl@0
    35
public:
sl@0
    36
	CTAlphaWin(CTestStep* aStep);
sl@0
    37
	~CTAlphaWin();
sl@0
    38
	void ConstructL();
sl@0
    39
	void TestCondition();
sl@0
    40
	void TestConditionL();
sl@0
    41
protected:
sl@0
    42
//from 	CTGraphicsStep
sl@0
    43
	virtual void RunTestCaseL(TInt aCurTestCase);
sl@0
    44
private:
sl@0
    45
	void ConfigureDisplayModes(TDisplayMode aRequiredMode);
sl@0
    46
	// The blending test works as follows:
sl@0
    47
	// On the left, we have a window which draws using an opaque half-red colour
sl@0
    48
	// On the right, we have a window which blends using a semi-transparent full-red colour
sl@0
    49
	// The test compares left and right
sl@0
    50
	void TestSemiTransparentDrawingL();
sl@0
    51
	void TestTransparentDrawingL();
sl@0
    52
sl@0
    53
	// The transparent window tests work as follows:
sl@0
    54
	// On the left, we have transparent windows, on which we perform various various operations
sl@0
    55
	// On the right, we have a reference window, in which we draw what we think the windows on the left should look like
sl@0
    56
	// The test compares the right and the left
sl@0
    57
	void TestInitialConfiguration();
sl@0
    58
	void TestMove();
sl@0
    59
	void TestRedraw();
sl@0
    60
	void TestInvisible();
sl@0
    61
	void TestChildrenL();
sl@0
    62
	void TestAntiAliasedTextTransparentL();
sl@0
    63
	void CheckRectL(const TRect& rect1, const TRect& rect2, TSize aSize, TDisplayMode aRequiredMode, TInt aTolerance, const TDesC& aErrorMsg);
sl@0
    64
sl@0
    65
private:
sl@0
    66
	TFixedArray<CTAlphaWindow*,5> iTestWin;
sl@0
    67
	CTAlphaRefWin* iRefWin;
sl@0
    68
	};
sl@0
    69
sl@0
    70
class CTDrawOpWin : public CTWin
sl@0
    71
	{
sl@0
    72
public:
sl@0
    73
	static CTDrawOpWin* NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TRgb aDrawColour);
sl@0
    74
	CTDrawOpWin(CTAlphaWin* aTest, TRgb aDrawColour);
sl@0
    75
sl@0
    76
	//Virtual Function from CTBaseWin
sl@0
    77
	void Draw();
sl@0
    78
sl@0
    79
	void SetDrawOp(TInt aDrawOp);
sl@0
    80
private:
sl@0
    81
	CTAlphaWin* iTest;
sl@0
    82
	TRgb iDrawColour;
sl@0
    83
	TInt iDrawOp;
sl@0
    84
	};
sl@0
    85
sl@0
    86
sl@0
    87
class CTAlphaWindow : public CTWin
sl@0
    88
	{
sl@0
    89
	friend class CTAlphaRefWin;
sl@0
    90
public:
sl@0
    91
	inline CTAlphaWindow(CTAlphaWin* aTest) : iTest(aTest) {}
sl@0
    92
	~CTAlphaWindow();
sl@0
    93
	static CTAlphaWindow* NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TInt aDrawState);
sl@0
    94
sl@0
    95
	//Virtual Function from CTBaseWin
sl@0
    96
	void Draw();
sl@0
    97
sl@0
    98
	void SetDrawState(TInt aDrawState);
sl@0
    99
	TInt DrawState();
sl@0
   100
sl@0
   101
	void SetVisible(TBool aVisible);
sl@0
   102
	void CreateChildrenL(TInt aDepth);
sl@0
   103
	void DestroyChildren();
sl@0
   104
private:
sl@0
   105
	TInt iDrawState;
sl@0
   106
	CTAlphaWin* iTest;
sl@0
   107
	CTAlphaWindow* iChild1;
sl@0
   108
	CTAlphaWindow* iChild2;
sl@0
   109
	};
sl@0
   110
sl@0
   111
class CTAlphaRefWin : public CTWin
sl@0
   112
	{
sl@0
   113
	// This class is used to draw what we think things should look like, for comparison with what they actually look like
sl@0
   114
public:
sl@0
   115
	inline CTAlphaRefWin(TFixedArray<CTAlphaWindow*,5>& aAlphaWin);
sl@0
   116
	static CTAlphaRefWin* NewL(CTWinBase* aParent, TPoint aPos, TSize aSize, TFixedArray<CTAlphaWindow*,5>& aAlphaWin);
sl@0
   117
	void Draw();
sl@0
   118
private:
sl@0
   119
	void DrawWindow(CTAlphaWindow* aWindow, TPoint aOffset);
sl@0
   120
private:
sl@0
   121
	TFixedArray<CTAlphaWindow*,5>& iAlphaWin;
sl@0
   122
	};
sl@0
   123
sl@0
   124
class CTAlphaWinStep : public CTGraphicsStep
sl@0
   125
	{
sl@0
   126
public:
sl@0
   127
	CTAlphaWinStep();
sl@0
   128
protected:
sl@0
   129
	//from CTGraphicsStep
sl@0
   130
	virtual CTGraphicsBase* CreateTestL();
sl@0
   131
	};
sl@0
   132
sl@0
   133
_LIT(KTAlphaWinStep,"TAlphaWin");
sl@0
   134
sl@0
   135
sl@0
   136
#endif