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 __TPNTCAP_H__ sl@0: #define __TPNTCAP_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "../tlib/testbase.h" sl@0: #include "AUTO.H" sl@0: #include "TGraphicsHarness.h" sl@0: sl@0: enum TTestState sl@0: { sl@0: ECaptureDisabled=0, sl@0: ENormalCapture, sl@0: ECaptureAllGroups, sl@0: EDragDropCapture, sl@0: EDragDropCaptureAllGroups, sl@0: ENormalCaptureWithoutFocus, sl@0: }; sl@0: sl@0: enum TTestSubState sl@0: { sl@0: EMainWindow, sl@0: EChildWindow, sl@0: EOtherGroup, sl@0: EOtherSession, sl@0: ERootWindow, sl@0: }; sl@0: sl@0: enum TPointerCheckRet sl@0: { sl@0: EFailed, sl@0: EOkay, sl@0: ENeedsDDEvent, sl@0: }; sl@0: sl@0: const TInt ESubStates1=2; sl@0: const TInt ESubStates2=5; sl@0: const TInt ESubStates3=5; sl@0: const TInt ESubStates4=5; sl@0: const TInt ESubStates5=5; sl@0: const TInt ESubStates6=5; sl@0: sl@0: const TInt EWinBorderSize=10; sl@0: sl@0: class CPcWindowBase; sl@0: class CTPointerCapture; sl@0: sl@0: class CPcConnection : public CTClient sl@0: { sl@0: public: sl@0: CPcConnection(CTPointerCapture *aTest); sl@0: ~CPcConnection(); sl@0: virtual void ConstructL(); sl@0: protected: sl@0: CTPointerCapture *iTest; sl@0: }; sl@0: sl@0: class CPcWindowBase : public CTWin sl@0: { sl@0: public: sl@0: CPcWindowBase(CTPointerCapture *aTest); sl@0: void SetUpL(TPoint pos,TSize size,CTWinBase *parent); sl@0: void SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc); sl@0: void Draw(TDesC &aBuf); sl@0: void PointerL(const TPointerEvent &pointer,const TTime &); sl@0: void DragDropL(const TPointerEvent &pointer,const TTime &); sl@0: virtual TPointerCheckRet PointerDown()=0; sl@0: virtual TPointerCheckRet DragDrop()=0; sl@0: virtual void SubStateChanged(); sl@0: protected: sl@0: CTPointerCapture *iTest; sl@0: TRgb iBack; sl@0: }; sl@0: sl@0: class CPcWindowChild : public CPcWindowBase sl@0: { sl@0: public: sl@0: CPcWindowChild(CTPointerCapture *aTest); sl@0: void Draw(); sl@0: TPointerCheckRet PointerDown(); sl@0: TPointerCheckRet DragDrop(); sl@0: }; sl@0: sl@0: class CPcWindowMain : public CPcWindowBase sl@0: { sl@0: public: sl@0: CPcWindowMain(CTPointerCapture *aTest); sl@0: void Draw(); sl@0: TPointerCheckRet PointerDown(); sl@0: TPointerCheckRet DragDrop(); sl@0: void WinKeyL(const TKeyEvent &aKey,const TTime &aTime); sl@0: }; sl@0: sl@0: class CPcWindowAltGroup : public CPcWindowBase sl@0: { sl@0: public: sl@0: CPcWindowAltGroup(CTPointerCapture *aTest); sl@0: void Draw(); sl@0: TPointerCheckRet PointerDown(); sl@0: TPointerCheckRet DragDrop(); sl@0: }; sl@0: sl@0: class CPcWindowNickFocusGroup : public CTWindowGroup sl@0: { sl@0: public: sl@0: CPcWindowNickFocusGroup(CTPointerCapture *aTest, CTClient *aClient); sl@0: void KeyL(const TKeyEvent &aKey,const TTime &aTime); sl@0: private: sl@0: CTPointerCapture *iTest; sl@0: }; sl@0: sl@0: class CPcWindowAltConnection : public CPcWindowBase sl@0: { sl@0: public: sl@0: CPcWindowAltConnection(CTPointerCapture *aTest); sl@0: void Draw(); sl@0: TPointerCheckRet PointerDown(); sl@0: TPointerCheckRet DragDrop(); sl@0: }; sl@0: sl@0: class CTPointerCapture : public CTWsGraphicsBase sl@0: { sl@0: private: sl@0: enum TDState {DDStateNull, DDStateGot, DDStateWaiting}; sl@0: public: sl@0: CTPointerCapture(CTestStep* aStep); sl@0: ~CTPointerCapture(); sl@0: void ConstructL(); sl@0: void NextTest(); sl@0: void AbortTests(); sl@0: TInt State() const; sl@0: TInt SubState() const; sl@0: void doIncSubStateL(); sl@0: void IncSubStateL(TBool aNeedsDD=EFalse); sl@0: void GotDDL(); sl@0: void StateChanged(); sl@0: void TestFailed(); sl@0: void NickFocusL(); sl@0: void SetCapture(TInt aCaptureFlags); sl@0: inline TestClient* Client() {return TheClient;} sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual void RunTestCaseL(TInt aCurTestCase); sl@0: private: sl@0: TInt doTestFailedL(); sl@0: void SendEventsL(); sl@0: private: sl@0: CPcConnection *iAltConnection; sl@0: CTWindowGroup *iMainGroup; sl@0: CTWindowGroup *iAltGroup; sl@0: CPcWindowChild *iChildWin; sl@0: CPcWindowMain *iMainWin; sl@0: CPcWindowAltGroup *iAltGroupWin; sl@0: CPcWindowAltConnection *iAltConnectionWin; sl@0: CPcWindowNickFocusGroup *iNickFocusGroup; sl@0: CTBlankWindow *iNickFocusBlankWin; sl@0: //TInt iState; sl@0: TInt iSubState; sl@0: TDState iDDState; sl@0: TSize iScreenSize; sl@0: public: sl@0: TBool iFailed; sl@0: }; sl@0: sl@0: class CTPointerCaptureStep : public CTGraphicsStep sl@0: { sl@0: public: sl@0: CTPointerCaptureStep(); sl@0: protected: sl@0: //from CTGraphicsStep sl@0: virtual CTGraphicsBase* CreateTestL(); sl@0: }; sl@0: sl@0: _LIT(KTPointerCaptureStep,"TPointerCapture"); sl@0: sl@0: sl@0: #endif