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