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