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: // Test pointer capture sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include "W32STD.H" sl@0: #include "../tlib/testbase.h" sl@0: #include "TMAN.H" sl@0: sl@0: enum TTestState sl@0: { sl@0: ECaptureDisabled, 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 TPointerCaptureTest; sl@0: sl@0: class CPcConnection : public CTClient sl@0: { sl@0: public: sl@0: CPcConnection(TPointerCaptureTest *aTest); sl@0: ~CPcConnection(); sl@0: virtual void ConstructL(); sl@0: protected: sl@0: TPointerCaptureTest *iTest; sl@0: }; sl@0: sl@0: class CPcWindowBase : public CTWin sl@0: { sl@0: public: sl@0: CPcWindowBase(TPointerCaptureTest *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: TPointerCaptureTest *iTest; sl@0: TRgb iBack; sl@0: }; sl@0: sl@0: class CPcWindowChild : public CPcWindowBase sl@0: { sl@0: public: sl@0: CPcWindowChild(TPointerCaptureTest *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(TPointerCaptureTest *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(TPointerCaptureTest *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(TPointerCaptureTest *aTest, CTClient *aClient); sl@0: void KeyL(const TKeyEvent &aKey,const TTime &aTime); sl@0: private: sl@0: TPointerCaptureTest *iTest; sl@0: }; sl@0: sl@0: class CPcWindowAltConnection : public CPcWindowBase sl@0: { sl@0: public: sl@0: CPcWindowAltConnection(TPointerCaptureTest *aTest); sl@0: void Draw(); sl@0: TPointerCheckRet PointerDown(); sl@0: TPointerCheckRet DragDrop(); sl@0: }; sl@0: sl@0: class TPointerCaptureTest : public CTestBase sl@0: { sl@0: private: sl@0: enum TDState {DDStateNull, DDStateGot, DDStateWaiting}; sl@0: public: sl@0: TPointerCaptureTest(); sl@0: ~TPointerCaptureTest(); sl@0: TestState DoTestL(); 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 doIncSubState(); sl@0: void IncSubState(TBool aNeedsDD=EFalse); sl@0: void GotDD(); sl@0: void StateChanged(); sl@0: void TestFailed(); sl@0: void NickFocusL(); sl@0: void SetCapture(TInt aCaptureFlags); sl@0: void RestartTest(); sl@0: private: sl@0: TInt doTestFailedL(); 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: public: sl@0: TBool iFailed; sl@0: }; sl@0: sl@0: GLDEF_C CTestBase *CreatePointerCaptureTest() sl@0: { sl@0: return(new(ELeave) TPointerCaptureTest()); sl@0: } sl@0: sl@0: // sl@0: // CMcConnection sl@0: sl@0: CPcConnection::CPcConnection(TPointerCaptureTest *aTest) : iTest(aTest) sl@0: { sl@0: } sl@0: sl@0: CPcConnection::~CPcConnection() sl@0: { sl@0: } sl@0: sl@0: void CPcConnection::ConstructL() sl@0: { sl@0: CTClient::ConstructL(); sl@0: iGroup=new(ELeave) CTWindowGroup(this); sl@0: iGroup->ConstructL(); sl@0: iGroup->GroupWin()->SetOrdinalPosition(0,1); sl@0: iGroup->GroupWin()->EnableReceiptOfFocus(EFalse); sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: // sl@0: // CPcWindow, base class // sl@0: // sl@0: sl@0: CPcWindowBase::CPcWindowBase(TPointerCaptureTest *aTest) : CTWin(), iTest(aTest) sl@0: { sl@0: } sl@0: sl@0: void CPcWindowBase::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc) sl@0: { sl@0: ConstructExtLD(*parent,pos,size); sl@0: iWin.SetBackgroundColor(iBack); sl@0: Activate(); sl@0: AssignGC(aGc); sl@0: } sl@0: sl@0: void CPcWindowBase::SetUpL(TPoint pos,TSize size,CTWinBase *parent) sl@0: { sl@0: SetUpL(pos,size,parent,*iTest->Client()->iGc); sl@0: } sl@0: sl@0: void CPcWindowBase::SubStateChanged() sl@0: { sl@0: iWin.Invalidate(); sl@0: Client()->iWs.Flush(); sl@0: } sl@0: sl@0: void CPcWindowBase::Draw(TDesC &aBuf) sl@0: { sl@0: iGc->Clear(); sl@0: iGc->SetPenColor(iBack.Gray4()>1 ? TRgb(0,0,0) : TRgb(255,255,255)); sl@0: iGc->DrawText(aBuf, TPoint(10,20)); sl@0: } sl@0: sl@0: void CPcWindowBase::PointerL(const TPointerEvent &pointer,const TTime &) sl@0: { sl@0: if (pointer.iType==TPointerEvent::EButton1Down && !iTest->iFailed) sl@0: { sl@0: if (iTest->SubState()==ERootWindow) // Root window click, must not be inside this window sl@0: { sl@0: if (TRect(Size()).Contains(pointer.iPosition)) sl@0: { sl@0: iTest->TestFailed(); sl@0: return; sl@0: } sl@0: } sl@0: TInt ret; sl@0: if ((ret=PointerDown())==EFailed) sl@0: iTest->TestFailed(); sl@0: else sl@0: iTest->IncSubState(ret==ENeedsDDEvent); sl@0: } sl@0: } sl@0: sl@0: void CPcWindowBase::DragDropL(const TPointerEvent &pointer,const TTime &) sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case ECaptureDisabled: sl@0: case ENormalCapture: sl@0: case ECaptureAllGroups: sl@0: case ENormalCaptureWithoutFocus: sl@0: iTest->TestFailed(); sl@0: break; sl@0: } sl@0: if (pointer.iType==TPointerEvent::EButton1Down && !iTest->iFailed) sl@0: { sl@0: if (DragDrop()==EFailed) sl@0: iTest->TestFailed(); sl@0: else sl@0: iTest->GotDD(); sl@0: } sl@0: } sl@0: // sl@0: sl@0: CPcWindowMain::CPcWindowMain(TPointerCaptureTest *aTest) : CPcWindowBase(aTest) sl@0: { sl@0: iBack=TRgb::Gray256(236); sl@0: } sl@0: sl@0: TPointerCheckRet CPcWindowMain::PointerDown() sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case ECaptureDisabled: sl@0: if (iTest->SubState()==EMainWindow) sl@0: return(EOkay); sl@0: break; sl@0: case ENormalCapture: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: case ERootWindow: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: case ECaptureAllGroups: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: case EOtherGroup: sl@0: case EOtherSession: sl@0: case ERootWindow: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: case EDragDropCapture: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: return(ENeedsDDEvent); sl@0: case ERootWindow: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: case EDragDropCaptureAllGroups: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: case EOtherGroup: sl@0: case EOtherSession: sl@0: return(ENeedsDDEvent); sl@0: case ERootWindow: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: case ENormalCaptureWithoutFocus: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: return(EFailed); sl@0: } sl@0: sl@0: TPointerCheckRet CPcWindowMain::DragDrop() sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case EDragDropCapture: sl@0: case EDragDropCaptureAllGroups: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: return(EFailed); sl@0: } sl@0: sl@0: void CPcWindowMain::Draw() sl@0: { sl@0: TBuf<0x40> buf; sl@0: if (iTest->State()==ECaptureDisabled) sl@0: { sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: buf.Copy(_L("Click on me")); sl@0: break; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: buf.Copy(_L("Click on me")); sl@0: break; sl@0: case EChildWindow: sl@0: case EOtherGroup: sl@0: case EOtherSession: sl@0: break; sl@0: case ERootWindow: sl@0: if (iTest->State()==ENormalCaptureWithoutFocus) sl@0: buf.Copy(_L("Click on the root window, then press ")); sl@0: else sl@0: buf.Copy(_L("Click on the root window")); sl@0: break; sl@0: } sl@0: } sl@0: CPcWindowBase::Draw(buf); sl@0: } sl@0: sl@0: void CPcWindowMain::WinKeyL(const TKeyEvent &aKey,const TTime &) sl@0: { sl@0: switch(aKey.iCode) sl@0: { sl@0: case EKeyEscape: sl@0: iTest->AbortTests(); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: // sl@0: sl@0: CPcWindowChild::CPcWindowChild(TPointerCaptureTest *aTest) : CPcWindowBase(aTest) sl@0: { sl@0: iBack=TRgb::Gray256(85); sl@0: } sl@0: sl@0: TPointerCheckRet CPcWindowChild::PointerDown() sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case ECaptureDisabled: sl@0: break; sl@0: default: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EChildWindow: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: } sl@0: return(EFailed); sl@0: } sl@0: sl@0: TPointerCheckRet CPcWindowChild::DragDrop() sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case EDragDropCapture: sl@0: case EDragDropCaptureAllGroups: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EChildWindow: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: return(EFailed); sl@0: } sl@0: sl@0: void CPcWindowChild::Draw() sl@0: { sl@0: TBuf<0x40> buf; sl@0: if (iTest->State()!=ECaptureDisabled) sl@0: { sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EChildWindow: sl@0: buf.Copy(_L("Click on me")); sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: } sl@0: CPcWindowBase::Draw(buf); sl@0: } sl@0: sl@0: // sl@0: sl@0: CPcWindowNickFocusGroup::CPcWindowNickFocusGroup(TPointerCaptureTest *aTest, CTClient *aClient) : CTWindowGroup(aClient), iTest(aTest) sl@0: { sl@0: } sl@0: sl@0: void CPcWindowNickFocusGroup::KeyL(const TKeyEvent &aKey,const TTime &) sl@0: { sl@0: if (aKey.iCode==EKeyEscape) sl@0: iTest->IncSubState(EFalse); sl@0: } sl@0: sl@0: // sl@0: sl@0: CPcWindowAltGroup::CPcWindowAltGroup(TPointerCaptureTest *aTest) : CPcWindowBase(aTest) sl@0: { sl@0: iBack=TRgb::Gray256(236); sl@0: } sl@0: sl@0: TPointerCheckRet CPcWindowAltGroup::PointerDown() sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case ECaptureDisabled: sl@0: if (iTest->SubState()==EChildWindow) sl@0: return(EOkay); sl@0: break; sl@0: case ENormalCapture: sl@0: case EDragDropCapture: sl@0: case ENormalCaptureWithoutFocus: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EOtherGroup: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: return(EFailed); sl@0: } sl@0: sl@0: TPointerCheckRet CPcWindowAltGroup::DragDrop() sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case EDragDropCapture: sl@0: case EDragDropCaptureAllGroups: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EOtherGroup: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: return(EFailed); sl@0: } sl@0: sl@0: void CPcWindowAltGroup::Draw() sl@0: { sl@0: TBuf<0x40> buf; sl@0: if (iTest->State()==ECaptureDisabled) sl@0: { sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EMainWindow: sl@0: break; sl@0: case EChildWindow: sl@0: buf.Copy(_L("Click on me")); sl@0: break; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EOtherGroup: sl@0: buf.Copy(_L("Click on me")); sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: } sl@0: CPcWindowBase::Draw(buf); sl@0: } sl@0: sl@0: // sl@0: sl@0: CPcWindowAltConnection::CPcWindowAltConnection(TPointerCaptureTest *aTest) : CPcWindowBase(aTest) sl@0: { sl@0: iBack=TRgb::Gray256(236); sl@0: } sl@0: sl@0: TPointerCheckRet CPcWindowAltConnection::PointerDown() sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case ECaptureDisabled: sl@0: if (iTest->SubState()==EChildWindow) sl@0: return(EOkay); sl@0: break; sl@0: case ENormalCapture: sl@0: case EDragDropCapture: sl@0: case ENormalCaptureWithoutFocus: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EOtherSession: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: return(EFailed); sl@0: } sl@0: sl@0: TPointerCheckRet CPcWindowAltConnection::DragDrop() sl@0: { sl@0: switch(iTest->State()) sl@0: { sl@0: case EDragDropCapture: sl@0: case EDragDropCaptureAllGroups: sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EOtherSession: sl@0: return(EOkay); sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: return(EFailed); sl@0: } sl@0: sl@0: void CPcWindowAltConnection::Draw() sl@0: { sl@0: TBuf<0x40> buf; sl@0: if (iTest->State()!=ECaptureDisabled) sl@0: { sl@0: switch(iTest->SubState()) sl@0: { sl@0: case EOtherSession: sl@0: buf.Copy(_L("Click on me")); sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: } sl@0: CPcWindowBase::Draw(buf); sl@0: } sl@0: sl@0: // sl@0: sl@0: TPointerCaptureTest::TPointerCaptureTest() : CTestBase(_L("Pointer Capture")) sl@0: {} sl@0: sl@0: TPointerCaptureTest::~TPointerCaptureTest() sl@0: { sl@0: delete iNickFocusBlankWin; sl@0: delete iNickFocusGroup; sl@0: delete iAltConnectionWin; sl@0: delete iAltConnection; sl@0: delete iChildWin; sl@0: delete iMainWin; sl@0: delete iMainGroup; sl@0: delete iAltGroupWin; sl@0: delete iAltGroup; sl@0: } sl@0: sl@0: void TPointerCaptureTest::TestFailed() sl@0: { sl@0: __ASSERT_DEBUG(iFailed==EFalse,TManPanic(ETManPanicPcFailed)); sl@0: iFailed=ETrue; sl@0: Client()->iGroup->GroupWin()->SetOrdinalPosition(0,10); // Put error dialog on top of test windows sl@0: TInt dRet=1; sl@0: TRAPD(err,dRet=doTestFailedL()); sl@0: Client()->iGroup->GroupWin()->SetOrdinalPosition(0,0); sl@0: switch(dRet) sl@0: { sl@0: case 0: sl@0: RestartTest(); sl@0: break; sl@0: case 1: sl@0: TRAP(err,TestL(EFalse)); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: TInt TPointerCaptureTest::doTestFailedL() sl@0: { sl@0: CTDialog *dialog=new(ELeave) CTDialog(); sl@0: dialog->SetTitle(_L("Pointer capture test failed")); sl@0: dialog->SetNumButtons(2); sl@0: dialog->SetButtonText(0,_L("Retest")); sl@0: dialog->SetButtonText(1,_L("Fail")); sl@0: dialog->ConstructLD(*Client()->iGroup,*Client()->iGc); sl@0: return dialog->Display(); sl@0: } sl@0: sl@0: TInt TPointerCaptureTest::State() const sl@0: { sl@0: return(iState); sl@0: } sl@0: sl@0: TInt TPointerCaptureTest::SubState() const sl@0: { sl@0: return(iSubState); sl@0: } sl@0: sl@0: void TPointerCaptureTest::doIncSubState() sl@0: { sl@0: iSubState++; sl@0: TInt max=0; sl@0: switch(iState) sl@0: { sl@0: case ECaptureDisabled: sl@0: max=ESubStates1; sl@0: break; sl@0: case ENormalCapture: sl@0: max=ESubStates2; sl@0: break; sl@0: case ECaptureAllGroups: sl@0: max=ESubStates3; sl@0: break; sl@0: case EDragDropCapture: sl@0: max=ESubStates4; sl@0: break; sl@0: case EDragDropCaptureAllGroups: sl@0: max=ESubStates5; sl@0: break; sl@0: case ENormalCaptureWithoutFocus: sl@0: max=ESubStates6; sl@0: break; sl@0: } sl@0: if (iSubState==max) sl@0: NextTest(); sl@0: StateChanged(); sl@0: } sl@0: sl@0: void TPointerCaptureTest::GotDD() sl@0: { sl@0: if (iDDState==DDStateWaiting) sl@0: doIncSubState(); sl@0: else sl@0: iDDState=DDStateGot; sl@0: } sl@0: sl@0: void TPointerCaptureTest::IncSubState(TBool aNeedsDD) sl@0: { sl@0: if (!aNeedsDD) sl@0: { sl@0: if (iDDState!=DDStateNull) sl@0: TestFailed(); sl@0: else sl@0: doIncSubState(); sl@0: } sl@0: else if (iDDState==DDStateGot) sl@0: doIncSubState(); sl@0: else sl@0: iDDState=DDStateWaiting; sl@0: } sl@0: sl@0: void TPointerCaptureTest::StateChanged() sl@0: { sl@0: iDDState=DDStateNull; sl@0: iChildWin->SubStateChanged(); sl@0: iMainWin->SubStateChanged(); sl@0: iAltGroupWin->SubStateChanged(); sl@0: iAltConnectionWin->SubStateChanged(); sl@0: } sl@0: sl@0: void TPointerCaptureTest::AbortTests() sl@0: { sl@0: iState=99; sl@0: Request(); sl@0: } sl@0: sl@0: void TPointerCaptureTest::NextTest() sl@0: { sl@0: iState++; sl@0: Request(); sl@0: } sl@0: sl@0: void TPointerCaptureTest::RestartTest() sl@0: { sl@0: Request(); sl@0: } sl@0: sl@0: void TPointerCaptureTest::ConstructL() sl@0: { sl@0: TSize size(Client()->iGroup->Size()); sl@0: TInt winWidth2=size.iWidth/2-EWinBorderSize*2; sl@0: TInt winWidth4=size.iWidth/4-EWinBorderSize*2; sl@0: TInt winHeight=size.iHeight/2-EWinBorderSize*2; sl@0: // sl@0: iMainGroup=new(ELeave) CTWindowGroup(Client()); sl@0: iMainGroup->ConstructL(); sl@0: iMainGroup->GroupWin()->SetOrdinalPosition(0,1); sl@0: iMainWin=new(ELeave) CPcWindowMain(this); sl@0: iMainWin->SetUpL(TPoint(EWinBorderSize,EWinBorderSize) ,TSize(winWidth2,winHeight) ,iMainGroup); sl@0: iMainGroup->SetCurrentWindow(iMainWin); sl@0: iChildWin=new(ELeave) CPcWindowChild(this); sl@0: iChildWin->SetUpL(TPoint(0,winHeight/2) ,TSize(winWidth2,winHeight/2) ,iMainWin); sl@0: // sl@0: iAltGroup=new(ELeave) CTWindowGroup(Client()); sl@0: iAltGroup->ConstructL(); sl@0: iAltGroup->GroupWin()->SetOrdinalPosition(0,1); sl@0: iAltGroup->GroupWin()->EnableReceiptOfFocus(EFalse); sl@0: iAltGroupWin=new(ELeave) CPcWindowAltGroup(this); sl@0: iAltGroupWin->SetUpL(TPoint(size.iWidth/2+EWinBorderSize,EWinBorderSize) ,TSize(winWidth4,winHeight) ,iAltGroup); sl@0: // sl@0: iAltConnection=new(ELeave) CPcConnection(this); sl@0: iAltConnection->ConstructL(); sl@0: iAltConnectionWin=new(ELeave) CPcWindowAltConnection(this); sl@0: iAltConnectionWin->SetUpL(TPoint(size.iWidth/4*3+EWinBorderSize,EWinBorderSize) ,TSize(winWidth4,winHeight),iAltConnection->iGroup,*iAltConnection->iGc); sl@0: } sl@0: sl@0: void TPointerCaptureTest::NickFocusL() sl@0: { sl@0: iNickFocusGroup=new(ELeave) CPcWindowNickFocusGroup(this,Client()); sl@0: iNickFocusGroup->ConstructL(); sl@0: iNickFocusGroup->GroupWin()->SetOrdinalPosition(0,2); sl@0: iNickFocusBlankWin=new(ELeave) CTBlankWindow(); sl@0: iNickFocusBlankWin->ConstructL(*iNickFocusGroup); sl@0: iNickFocusBlankWin->SetSize(TSize(1,1)); sl@0: iNickFocusBlankWin->Activate(); sl@0: } sl@0: sl@0: void TPointerCaptureTest::SetCapture(TInt aCaptureFlags) sl@0: { sl@0: iMainWin->Win()->SetPointerCapture(aCaptureFlags); sl@0: } sl@0: sl@0: TestState TPointerCaptureTest::DoTestL() sl@0: { sl@0: iSubState=0; sl@0: iFailed=EFalse; sl@0: StateChanged(); sl@0: switch(iState) sl@0: { sl@0: case ECaptureDisabled: sl@0: LogSubTest(_L("No capture"),1); sl@0: SetCapture(RWindowBase::TCaptureDisabled); sl@0: break; sl@0: case ENormalCapture: sl@0: LogSubTest(_L("Normal capture"),1); sl@0: SetCapture(RWindowBase::TCaptureEnabled); sl@0: break; sl@0: case ECaptureAllGroups: sl@0: LogSubTest(_L("All groups"),1); sl@0: SetCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); sl@0: break; sl@0: case EDragDropCapture: sl@0: LogSubTest(_L("Drag & Drop"),1); sl@0: SetCapture(RWindowBase::TCaptureDragDrop&~RWindowBase::TCaptureFlagAllGroups); sl@0: break; sl@0: case EDragDropCaptureAllGroups: sl@0: LogSubTest(_L("Drag & Drop All groups"),1); sl@0: SetCapture(RWindowBase::TCaptureDragDrop); sl@0: break; sl@0: case ENormalCaptureWithoutFocus: sl@0: LogSubTest(_L("Without focus"),1); sl@0: NickFocusL(); sl@0: SetCapture(RWindowBase::TCaptureEnabled); sl@0: break; sl@0: default: sl@0: return(EFinished); sl@0: } sl@0: return(EContinue); sl@0: }