sl@0: sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #ifndef __TALPHAWIN_H__ sl@0: #define __TALPHAWIN_H__ sl@0: sl@0: #include "AUTO.H" sl@0: #include "TGraphicsHarness.h" sl@0: sl@0: class CTDrawOpWin; sl@0: class CTAlphaWindow; sl@0: class CTAlphaRefWin; sl@0: sl@0: class CTAlphaWin : public CTWsGraphicsBase sl@0: { sl@0: public: sl@0: CTAlphaWin(CTestStep* aStep); sl@0: ~CTAlphaWin(); sl@0: void ConstructL(); sl@0: void TestCondition(); sl@0: void TestConditionL(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: private: sl@0: void ConfigureDisplayModes(TDisplayMode aRequiredMode); sl@0: // The blending test works as follows: sl@0: // On the left, we have a window which draws using an opaque half-red colour sl@0: // On the right, we have a window which blends using a semi-transparent full-red colour sl@0: // The test compares left and right sl@0: void TestSemiTransparentDrawingL(); sl@0: void TestTransparentDrawingL(); sl@0: sl@0: // The transparent window tests work as follows: sl@0: // On the left, we have transparent windows, on which we perform various various operations sl@0: // 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: // The test compares the right and the left sl@0: void TestInitialConfiguration(); sl@0: void TestMove(); sl@0: void TestRedraw(); sl@0: void TestInvisible(); sl@0: void TestChildrenL(); sl@0: void TestAntiAliasedTextTransparentL(); sl@0: void CheckRectL(const TRect& rect1, const TRect& rect2, TSize aSize, TDisplayMode aRequiredMode, TInt aTolerance, const TDesC& aErrorMsg); sl@0: sl@0: private: sl@0: TFixedArray iTestWin; sl@0: CTAlphaRefWin* iRefWin; sl@0: }; sl@0: sl@0: class CTDrawOpWin : public CTWin sl@0: { sl@0: public: sl@0: static CTDrawOpWin* NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TRgb aDrawColour); sl@0: CTDrawOpWin(CTAlphaWin* aTest, TRgb aDrawColour); sl@0: sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: sl@0: void SetDrawOp(TInt aDrawOp); sl@0: private: sl@0: CTAlphaWin* iTest; sl@0: TRgb iDrawColour; sl@0: TInt iDrawOp; sl@0: }; sl@0: sl@0: sl@0: class CTAlphaWindow : public CTWin sl@0: { sl@0: friend class CTAlphaRefWin; sl@0: public: sl@0: inline CTAlphaWindow(CTAlphaWin* aTest) : iTest(aTest) {} sl@0: ~CTAlphaWindow(); sl@0: static CTAlphaWindow* NewL(CTAlphaWin* aTest, CTWinBase* aParent, TPoint aPos, TSize aSize, TInt aDrawState); sl@0: sl@0: //Virtual Function from CTBaseWin sl@0: void Draw(); sl@0: sl@0: void SetDrawState(TInt aDrawState); sl@0: TInt DrawState(); sl@0: sl@0: void SetVisible(TBool aVisible); sl@0: void CreateChildrenL(TInt aDepth); sl@0: void DestroyChildren(); sl@0: private: sl@0: TInt iDrawState; sl@0: CTAlphaWin* iTest; sl@0: CTAlphaWindow* iChild1; sl@0: CTAlphaWindow* iChild2; sl@0: }; sl@0: sl@0: class CTAlphaRefWin : public CTWin sl@0: { sl@0: // This class is used to draw what we think things should look like, for comparison with what they actually look like sl@0: public: sl@0: inline CTAlphaRefWin(TFixedArray& aAlphaWin); sl@0: static CTAlphaRefWin* NewL(CTWinBase* aParent, TPoint aPos, TSize aSize, TFixedArray& aAlphaWin); sl@0: void Draw(); sl@0: private: sl@0: void DrawWindow(CTAlphaWindow* aWindow, TPoint aOffset); sl@0: private: sl@0: TFixedArray& iAlphaWin; sl@0: }; sl@0: sl@0: class CTAlphaWinStep : public CTGraphicsStep sl@0: { sl@0: public: sl@0: CTAlphaWinStep(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual CTGraphicsBase* CreateTestL(); sl@0: }; sl@0: sl@0: _LIT(KTAlphaWinStep,"TAlphaWin"); sl@0: sl@0: sl@0: #endif