os/graphics/windowing/windowserver/test/tman/TMAN.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
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Header for window server auto test code
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <e32std.h>
sl@0
    19
#include <e32math.h>
sl@0
    20
#include "W32STD.H"
sl@0
    21
#include "../tlib/testbase.h"
sl@0
    22
sl@0
    23
class TestClient;
sl@0
    24
sl@0
    25
enum TestState
sl@0
    26
	{
sl@0
    27
	EInvalid,
sl@0
    28
	ENext,
sl@0
    29
	EContinue,
sl@0
    30
	EFinished
sl@0
    31
	};
sl@0
    32
sl@0
    33
enum TAutoPanics
sl@0
    34
	{
sl@0
    35
	ETManPanicPcFailed,
sl@0
    36
	};
sl@0
    37
sl@0
    38
enum TAutoLeaves
sl@0
    39
	{
sl@0
    40
	ETestFailed=1,
sl@0
    41
	};
sl@0
    42
sl@0
    43
class LogWindow : public CTWin
sl@0
    44
	{
sl@0
    45
public:
sl@0
    46
	LogWindow();
sl@0
    47
	void ConstructL(CTWinBase &parent);
sl@0
    48
	void Draw();
sl@0
    49
	void LogTest(TDesC &aTitle,TInt aNum);
sl@0
    50
private:
sl@0
    51
	TBuf<0x40> iTestTitle;
sl@0
    52
	TInt iTitleHeight;
sl@0
    53
	};
sl@0
    54
sl@0
    55
class CTestBase;
sl@0
    56
sl@0
    57
class BorderWindow : public CTWin
sl@0
    58
	{
sl@0
    59
public:
sl@0
    60
	BorderWindow();
sl@0
    61
	void ConstructL(CTWinBase &parent);
sl@0
    62
	void Draw();
sl@0
    63
	};
sl@0
    64
sl@0
    65
class TestWindow : public CTWin
sl@0
    66
	{
sl@0
    67
public:
sl@0
    68
	TestWindow();
sl@0
    69
	void Draw();
sl@0
    70
	void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
sl@0
    71
private:
sl@0
    72
	BorderWindow *iBorderWin;
sl@0
    73
	friend class CTestBase;
sl@0
    74
	};
sl@0
    75
sl@0
    76
class TestDriver : public CActive
sl@0
    77
	{
sl@0
    78
public:
sl@0
    79
	TestDriver(TestClient *aClient);
sl@0
    80
	~TestDriver();
sl@0
    81
	void DoCancel();
sl@0
    82
	void RunL();
sl@0
    83
	void Request();
sl@0
    84
	void TestComplete();
sl@0
    85
	void DestroyTest();
sl@0
    86
	TestClient *Client();
sl@0
    87
public:
sl@0
    88
	CTestBase *iTest;
sl@0
    89
private:
sl@0
    90
	TInt iTestNum;
sl@0
    91
	TestClient *iClient;
sl@0
    92
	};
sl@0
    93
sl@0
    94
class CTestBase : public CActive
sl@0
    95
	{
sl@0
    96
public:
sl@0
    97
	CTestBase(const TDesC &aTitle);
sl@0
    98
	~CTestBase();
sl@0
    99
	void DoCancel();
sl@0
   100
	void RunL();
sl@0
   101
	void Request();
sl@0
   102
	void TestL(TInt aCondition);
sl@0
   103
	void StartTest(TInt aNum, TestDriver *aDriver);
sl@0
   104
	void LogSubTest(const TDesC &aTitle,TInt aNum);
sl@0
   105
	void TestPanic(TThreadFunction aFunction, TAny *aPtr, TInt aExitReason, const TDesC &aCategory);
sl@0
   106
	void TestWsPanic(TThreadFunction aFunction, TAny *aPtr, TInt aExitReason);
sl@0
   107
	void TestWsPanic(TThreadFunction aFunction, TInt aInt, TInt aExitReason);
sl@0
   108
	void TriggerFail();
sl@0
   109
	void LogLeave(TInt aErr);
sl@0
   110
	void CheckRect(CTWin *aWin1,CTWin *aWin2,const TRect &aRect);
sl@0
   111
	void CompareWindows(TRect &aRect);
sl@0
   112
	void CompareWindows();
sl@0
   113
	void CheckBorder();
sl@0
   114
	void DrawTestBackground(TBool aInvertColours);
sl@0
   115
	inline TestDriver *Driver();
sl@0
   116
	virtual TestState DoTestL()=0;
sl@0
   117
	virtual void ConstructL()=0;
sl@0
   118
	TestClient *Client();
sl@0
   119
	void AbortL();
sl@0
   120
protected:
sl@0
   121
	TestDriver *iDriver;
sl@0
   122
	TAny *iBuf1;
sl@0
   123
	TAny *iBuf2;
sl@0
   124
private:
sl@0
   125
	TInt iTestNum;
sl@0
   126
	TInt iSubTestNum;
sl@0
   127
	TBuf<0x40> iTitle;
sl@0
   128
	TBuf<0x40> iSubTitle;
sl@0
   129
	TBool iFail;	// Used to trigger failures to test test code.
sl@0
   130
	};
sl@0
   131
sl@0
   132
class TestClient : public CTClient
sl@0
   133
	{
sl@0
   134
public:
sl@0
   135
	TestClient();
sl@0
   136
	~TestClient();
sl@0
   137
	void ConstructL();
sl@0
   138
	void KeyL(const TKeyEvent &aKey,const TTime &aTime);
sl@0
   139
	void Shutdown();
sl@0
   140
	TestDriver *Driver();
sl@0
   141
private:
sl@0
   142
	TestDriver *iDriver;
sl@0
   143
	};
sl@0
   144
sl@0
   145
GLREF_D CWindowGc *TheGc;
sl@0
   146
GLREF_C void TManPanic(TInt aPanic);
sl@0
   147
sl@0
   148
inline TestDriver *CTestBase::Driver()
sl@0
   149
	{return(iDriver);}