os/graphics/windowing/windowserver/test/tman/TMAN.H
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tman/TMAN.H	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,149 @@
     1.4 +// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Header for window server auto test code
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <e32std.h>
    1.22 +#include <e32math.h>
    1.23 +#include "W32STD.H"
    1.24 +#include "../tlib/testbase.h"
    1.25 +
    1.26 +class TestClient;
    1.27 +
    1.28 +enum TestState
    1.29 +	{
    1.30 +	EInvalid,
    1.31 +	ENext,
    1.32 +	EContinue,
    1.33 +	EFinished
    1.34 +	};
    1.35 +
    1.36 +enum TAutoPanics
    1.37 +	{
    1.38 +	ETManPanicPcFailed,
    1.39 +	};
    1.40 +
    1.41 +enum TAutoLeaves
    1.42 +	{
    1.43 +	ETestFailed=1,
    1.44 +	};
    1.45 +
    1.46 +class LogWindow : public CTWin
    1.47 +	{
    1.48 +public:
    1.49 +	LogWindow();
    1.50 +	void ConstructL(CTWinBase &parent);
    1.51 +	void Draw();
    1.52 +	void LogTest(TDesC &aTitle,TInt aNum);
    1.53 +private:
    1.54 +	TBuf<0x40> iTestTitle;
    1.55 +	TInt iTitleHeight;
    1.56 +	};
    1.57 +
    1.58 +class CTestBase;
    1.59 +
    1.60 +class BorderWindow : public CTWin
    1.61 +	{
    1.62 +public:
    1.63 +	BorderWindow();
    1.64 +	void ConstructL(CTWinBase &parent);
    1.65 +	void Draw();
    1.66 +	};
    1.67 +
    1.68 +class TestWindow : public CTWin
    1.69 +	{
    1.70 +public:
    1.71 +	TestWindow();
    1.72 +	void Draw();
    1.73 +	void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
    1.74 +private:
    1.75 +	BorderWindow *iBorderWin;
    1.76 +	friend class CTestBase;
    1.77 +	};
    1.78 +
    1.79 +class TestDriver : public CActive
    1.80 +	{
    1.81 +public:
    1.82 +	TestDriver(TestClient *aClient);
    1.83 +	~TestDriver();
    1.84 +	void DoCancel();
    1.85 +	void RunL();
    1.86 +	void Request();
    1.87 +	void TestComplete();
    1.88 +	void DestroyTest();
    1.89 +	TestClient *Client();
    1.90 +public:
    1.91 +	CTestBase *iTest;
    1.92 +private:
    1.93 +	TInt iTestNum;
    1.94 +	TestClient *iClient;
    1.95 +	};
    1.96 +
    1.97 +class CTestBase : public CActive
    1.98 +	{
    1.99 +public:
   1.100 +	CTestBase(const TDesC &aTitle);
   1.101 +	~CTestBase();
   1.102 +	void DoCancel();
   1.103 +	void RunL();
   1.104 +	void Request();
   1.105 +	void TestL(TInt aCondition);
   1.106 +	void StartTest(TInt aNum, TestDriver *aDriver);
   1.107 +	void LogSubTest(const TDesC &aTitle,TInt aNum);
   1.108 +	void TestPanic(TThreadFunction aFunction, TAny *aPtr, TInt aExitReason, const TDesC &aCategory);
   1.109 +	void TestWsPanic(TThreadFunction aFunction, TAny *aPtr, TInt aExitReason);
   1.110 +	void TestWsPanic(TThreadFunction aFunction, TInt aInt, TInt aExitReason);
   1.111 +	void TriggerFail();
   1.112 +	void LogLeave(TInt aErr);
   1.113 +	void CheckRect(CTWin *aWin1,CTWin *aWin2,const TRect &aRect);
   1.114 +	void CompareWindows(TRect &aRect);
   1.115 +	void CompareWindows();
   1.116 +	void CheckBorder();
   1.117 +	void DrawTestBackground(TBool aInvertColours);
   1.118 +	inline TestDriver *Driver();
   1.119 +	virtual TestState DoTestL()=0;
   1.120 +	virtual void ConstructL()=0;
   1.121 +	TestClient *Client();
   1.122 +	void AbortL();
   1.123 +protected:
   1.124 +	TestDriver *iDriver;
   1.125 +	TAny *iBuf1;
   1.126 +	TAny *iBuf2;
   1.127 +private:
   1.128 +	TInt iTestNum;
   1.129 +	TInt iSubTestNum;
   1.130 +	TBuf<0x40> iTitle;
   1.131 +	TBuf<0x40> iSubTitle;
   1.132 +	TBool iFail;	// Used to trigger failures to test test code.
   1.133 +	};
   1.134 +
   1.135 +class TestClient : public CTClient
   1.136 +	{
   1.137 +public:
   1.138 +	TestClient();
   1.139 +	~TestClient();
   1.140 +	void ConstructL();
   1.141 +	void KeyL(const TKeyEvent &aKey,const TTime &aTime);
   1.142 +	void Shutdown();
   1.143 +	TestDriver *Driver();
   1.144 +private:
   1.145 +	TestDriver *iDriver;
   1.146 +	};
   1.147 +
   1.148 +GLREF_D CWindowGc *TheGc;
   1.149 +GLREF_C void TManPanic(TInt aPanic);
   1.150 +
   1.151 +inline TestDriver *CTestBase::Driver()
   1.152 +	{return(iDriver);}