1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TALPHAWIN.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,136 @@
1.4 +
1.5 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of "Eclipse Public License v1.0"
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +/**
1.21 + @file
1.22 + @test
1.23 + @internalComponent - Internal Symbian test code
1.24 +*/
1.25 +
1.26 +#ifndef __TALPHAWIN_H__
1.27 +#define __TALPHAWIN_H__
1.28 +
1.29 +#include "AUTO.H"
1.30 +#include "TGraphicsHarness.h"
1.31 +
1.32 +class CTDrawOpWin;
1.33 +class CTAlphaWindow;
1.34 +class CTAlphaRefWin;
1.35 +
1.36 +class CTAlphaWin : public CTWsGraphicsBase
1.37 + {
1.38 +public:
1.39 + CTAlphaWin(CTestStep* aStep);
1.40 + ~CTAlphaWin();
1.41 + void ConstructL();
1.42 + void TestCondition();
1.43 + void TestConditionL();
1.44 +protected:
1.45 +//from CTGraphicsStep
1.46 + virtual void RunTestCaseL(TInt aCurTestCase);
1.47 +private:
1.48 + void ConfigureDisplayModes(TDisplayMode aRequiredMode);
1.49 + // The blending test works as follows:
1.50 + // On the left, we have a window which draws using an opaque half-red colour
1.51 + // On the right, we have a window which blends using a semi-transparent full-red colour
1.52 + // The test compares left and right
1.53 + void TestSemiTransparentDrawingL();
1.54 + void TestTransparentDrawingL();
1.55 +
1.56 + // The transparent window tests work as follows:
1.57 + // On the left, we have transparent windows, on which we perform various various operations
1.58 + // On the right, we have a reference window, in which we draw what we think the windows on the left should look like
1.59 + // The test compares the right and the left
1.60 + void TestInitialConfiguration();
1.61 + void TestMove();
1.62 + void TestRedraw();
1.63 + void TestInvisible();
1.64 + void TestChildrenL();
1.65 + void TestAntiAliasedTextTransparentL();
1.66 + void CheckRectL(const TRect& rect1, const TRect& rect2, TSize aSize, TDisplayMode aRequiredMode, TInt aTolerance, const TDesC& aErrorMsg);
1.67 +
1.68 +private:
1.69 + TFixedArray<CTAlphaWindow*,5> iTestWin;
1.70 + CTAlphaRefWin* iRefWin;
1.71 + };
1.72 +
1.73 +class CTDrawOpWin : public CTWin
1.74 + {
1.75 +public:
1.76 + static CTDrawOpWin* NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TRgb aDrawColour);
1.77 + CTDrawOpWin(CTAlphaWin* aTest, TRgb aDrawColour);
1.78 +
1.79 + //Virtual Function from CTBaseWin
1.80 + void Draw();
1.81 +
1.82 + void SetDrawOp(TInt aDrawOp);
1.83 +private:
1.84 + CTAlphaWin* iTest;
1.85 + TRgb iDrawColour;
1.86 + TInt iDrawOp;
1.87 + };
1.88 +
1.89 +
1.90 +class CTAlphaWindow : public CTWin
1.91 + {
1.92 + friend class CTAlphaRefWin;
1.93 +public:
1.94 + inline CTAlphaWindow(CTAlphaWin* aTest) : iTest(aTest) {}
1.95 + ~CTAlphaWindow();
1.96 + static CTAlphaWindow* NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TInt aDrawState);
1.97 +
1.98 + //Virtual Function from CTBaseWin
1.99 + void Draw();
1.100 +
1.101 + void SetDrawState(TInt aDrawState);
1.102 + TInt DrawState();
1.103 +
1.104 + void SetVisible(TBool aVisible);
1.105 + void CreateChildrenL(TInt aDepth);
1.106 + void DestroyChildren();
1.107 +private:
1.108 + TInt iDrawState;
1.109 + CTAlphaWin* iTest;
1.110 + CTAlphaWindow* iChild1;
1.111 + CTAlphaWindow* iChild2;
1.112 + };
1.113 +
1.114 +class CTAlphaRefWin : public CTWin
1.115 + {
1.116 + // This class is used to draw what we think things should look like, for comparison with what they actually look like
1.117 +public:
1.118 + inline CTAlphaRefWin(TFixedArray<CTAlphaWindow*,5>& aAlphaWin);
1.119 + static CTAlphaRefWin* NewL(CTWinBase* aParent, TPoint aPos, TSize aSize, TFixedArray<CTAlphaWindow*,5>& aAlphaWin);
1.120 + void Draw();
1.121 +private:
1.122 + void DrawWindow(CTAlphaWindow* aWindow, TPoint aOffset);
1.123 +private:
1.124 + TFixedArray<CTAlphaWindow*,5>& iAlphaWin;
1.125 + };
1.126 +
1.127 +class CTAlphaWinStep : public CTGraphicsStep
1.128 + {
1.129 +public:
1.130 + CTAlphaWinStep();
1.131 +protected:
1.132 + //from CTGraphicsStep
1.133 + virtual CTGraphicsBase* CreateTestL();
1.134 + };
1.135 +
1.136 +_LIT(KTAlphaWinStep,"TAlphaWin");
1.137 +
1.138 +
1.139 +#endif