1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TPNTCAP.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,200 @@
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 __TPNTCAP_H__
1.27 +#define __TPNTCAP_H__
1.28 +
1.29 +#include <e32std.h>
1.30 +#include <e32svr.h>
1.31 +#include <w32std.h>
1.32 +#include "../tlib/testbase.h"
1.33 +#include "AUTO.H"
1.34 +#include "TGraphicsHarness.h"
1.35 +
1.36 +enum TTestState
1.37 + {
1.38 + ECaptureDisabled=0,
1.39 + ENormalCapture,
1.40 + ECaptureAllGroups,
1.41 + EDragDropCapture,
1.42 + EDragDropCaptureAllGroups,
1.43 + ENormalCaptureWithoutFocus,
1.44 + };
1.45 +
1.46 +enum TTestSubState
1.47 + {
1.48 + EMainWindow,
1.49 + EChildWindow,
1.50 + EOtherGroup,
1.51 + EOtherSession,
1.52 + ERootWindow,
1.53 + };
1.54 +
1.55 +enum TPointerCheckRet
1.56 + {
1.57 + EFailed,
1.58 + EOkay,
1.59 + ENeedsDDEvent,
1.60 + };
1.61 +
1.62 +const TInt ESubStates1=2;
1.63 +const TInt ESubStates2=5;
1.64 +const TInt ESubStates3=5;
1.65 +const TInt ESubStates4=5;
1.66 +const TInt ESubStates5=5;
1.67 +const TInt ESubStates6=5;
1.68 +
1.69 +const TInt EWinBorderSize=10;
1.70 +
1.71 +class CPcWindowBase;
1.72 +class CTPointerCapture;
1.73 +
1.74 +class CPcConnection : public CTClient
1.75 + {
1.76 +public:
1.77 + CPcConnection(CTPointerCapture *aTest);
1.78 + ~CPcConnection();
1.79 + virtual void ConstructL();
1.80 +protected:
1.81 + CTPointerCapture *iTest;
1.82 + };
1.83 +
1.84 +class CPcWindowBase : public CTWin
1.85 + {
1.86 +public:
1.87 + CPcWindowBase(CTPointerCapture *aTest);
1.88 + void SetUpL(TPoint pos,TSize size,CTWinBase *parent);
1.89 + void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc);
1.90 + void Draw(TDesC &aBuf);
1.91 + void PointerL(const TPointerEvent &pointer,const TTime &);
1.92 + void DragDropL(const TPointerEvent &pointer,const TTime &);
1.93 + virtual TPointerCheckRet PointerDown()=0;
1.94 + virtual TPointerCheckRet DragDrop()=0;
1.95 + virtual void SubStateChanged();
1.96 +protected:
1.97 + CTPointerCapture *iTest;
1.98 + TRgb iBack;
1.99 + };
1.100 +
1.101 +class CPcWindowChild : public CPcWindowBase
1.102 + {
1.103 +public:
1.104 + CPcWindowChild(CTPointerCapture *aTest);
1.105 + void Draw();
1.106 + TPointerCheckRet PointerDown();
1.107 + TPointerCheckRet DragDrop();
1.108 + };
1.109 +
1.110 +class CPcWindowMain : public CPcWindowBase
1.111 + {
1.112 +public:
1.113 + CPcWindowMain(CTPointerCapture *aTest);
1.114 + void Draw();
1.115 + TPointerCheckRet PointerDown();
1.116 + TPointerCheckRet DragDrop();
1.117 + void WinKeyL(const TKeyEvent &aKey,const TTime &aTime);
1.118 + };
1.119 +
1.120 +class CPcWindowAltGroup : public CPcWindowBase
1.121 + {
1.122 +public:
1.123 + CPcWindowAltGroup(CTPointerCapture *aTest);
1.124 + void Draw();
1.125 + TPointerCheckRet PointerDown();
1.126 + TPointerCheckRet DragDrop();
1.127 + };
1.128 +
1.129 +class CPcWindowNickFocusGroup : public CTWindowGroup
1.130 + {
1.131 +public:
1.132 + CPcWindowNickFocusGroup(CTPointerCapture *aTest, CTClient *aClient);
1.133 + void KeyL(const TKeyEvent &aKey,const TTime &aTime);
1.134 +private:
1.135 + CTPointerCapture *iTest;
1.136 + };
1.137 +
1.138 +class CPcWindowAltConnection : public CPcWindowBase
1.139 + {
1.140 +public:
1.141 + CPcWindowAltConnection(CTPointerCapture *aTest);
1.142 + void Draw();
1.143 + TPointerCheckRet PointerDown();
1.144 + TPointerCheckRet DragDrop();
1.145 + };
1.146 +
1.147 +class CTPointerCapture : public CTWsGraphicsBase
1.148 + {
1.149 +private:
1.150 + enum TDState {DDStateNull, DDStateGot, DDStateWaiting};
1.151 +public:
1.152 + CTPointerCapture(CTestStep* aStep);
1.153 + ~CTPointerCapture();
1.154 + void ConstructL();
1.155 + void NextTest();
1.156 + void AbortTests();
1.157 + TInt State() const;
1.158 + TInt SubState() const;
1.159 + void doIncSubStateL();
1.160 + void IncSubStateL(TBool aNeedsDD=EFalse);
1.161 + void GotDDL();
1.162 + void StateChanged();
1.163 + void TestFailed();
1.164 + void NickFocusL();
1.165 + void SetCapture(TInt aCaptureFlags);
1.166 + inline TestClient* Client() {return TheClient;}
1.167 +protected:
1.168 +//from CTGraphicsStep
1.169 + virtual void RunTestCaseL(TInt aCurTestCase);
1.170 +private:
1.171 + TInt doTestFailedL();
1.172 + void SendEventsL();
1.173 +private:
1.174 + CPcConnection *iAltConnection;
1.175 + CTWindowGroup *iMainGroup;
1.176 + CTWindowGroup *iAltGroup;
1.177 + CPcWindowChild *iChildWin;
1.178 + CPcWindowMain *iMainWin;
1.179 + CPcWindowAltGroup *iAltGroupWin;
1.180 + CPcWindowAltConnection *iAltConnectionWin;
1.181 + CPcWindowNickFocusGroup *iNickFocusGroup;
1.182 + CTBlankWindow *iNickFocusBlankWin;
1.183 + //TInt iState;
1.184 + TInt iSubState;
1.185 + TDState iDDState;
1.186 + TSize iScreenSize;
1.187 +public:
1.188 + TBool iFailed;
1.189 + };
1.190 +
1.191 +class CTPointerCaptureStep : public CTGraphicsStep
1.192 + {
1.193 +public:
1.194 + CTPointerCaptureStep();
1.195 +protected:
1.196 + //from CTGraphicsStep
1.197 + virtual CTGraphicsBase* CreateTestL();
1.198 + };
1.199 +
1.200 +_LIT(KTPointerCaptureStep,"TPointerCapture");
1.201 +
1.202 +
1.203 +#endif