--- a/windowing/windowserver/test/tauto/TEvent.CPP Fri Sep 17 08:36:49 2010 +0300
+++ b/windowing/windowserver/test/tauto/TEvent.CPP Mon Oct 04 02:31:51 2010 +0300
@@ -908,14 +908,30 @@
iQueueClient->AddExpectedEvent(event);
}
-void CTEventTest::CalculatePointerEvent(TWsEvent& aEvent,TPointerEvent::TType aType, TPoint aPos)
+/* Populates the provided TWsEvent using the other parameters provided
+
+This is used to generate the events that will be compared to those received from Wserv
+
+@param aEvent Output, the event to be populated
+@param aType Input, the type of the event
+@param aPos Input, the position of the event
+@param aWindowHandle Input, the window handle where the event should be received ( or 0 to calculate this )
+ */
+void CTEventTest::CalculatePointerEvent(TWsEvent& aEvent,TPointerEvent::TType aType, TPoint aPos, TInt aWindowHandle)
{
#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
TAdvancedPointerEvent& ptrEvent=*aEvent.Pointer();
aEvent.SetType(EEventPointer);
ptrEvent.iParentPosition=aPos;
// SetHandle must be done after iParentPosition is set, but before iPosition is set.
- aEvent.SetHandle(reinterpret_cast<TInt>(iQueueClient->GetHandle(aPos)));
+ if(!aWindowHandle)
+ {
+ aEvent.SetHandle(reinterpret_cast<TInt>(iQueueClient->GetHandle(aPos)));
+ }
+ else
+ {
+ aEvent.SetHandle(aWindowHandle);
+ }
const TPoint3D point3D(aPos.iX, aPos.iY, 0);
const TInt pointerEventModifiers=0;
const TUint8 pointerNumber=0;
@@ -972,17 +988,25 @@
}
}
-void CTEventTest::AddExpectedPointerCapture(TPointerEvent::TType aType, TPoint aPos, TInt aHandle)
+void CTEventTest::AddExpectedPointerCapture(TPointerEvent::TType aType, TPoint aPos, TInt aWindowHandle)
{
TPckgBuf<TWsQTEvent> evtPkg;
- CalculatePointerCaptureEvent(evtPkg(),aType,aPos,aHandle);
+ CalculatePointerCaptureEvent(evtPkg(),aType,aPos,aWindowHandle);
iQueueClient->AddExpectedEvent(evtPkg());
}
-void CTEventTest::AddExpectedPointer(TPointerEvent::TType aType, TPoint aPos)
+/* Queues a TWsEvent which is populated using the other parameters provided
+
+This is used to generate the events that will be compared to those received from Wserv
+
+@param aType Input, the type of the event
+@param aPos Input, the position of the event
+@param aWindowHandle Input, the window handle where the event should be received ( or 0 to calculate this )
+ */
+void CTEventTest::AddExpectedPointer(TPointerEvent::TType aType, TPoint aPos, TInt aWindowHandle)
{
TPckgBuf<TWsQTEvent> evtPkg;
- CalculatePointerEvent(evtPkg(),aType,aPos);
+ CalculatePointerEvent(evtPkg(),aType,aPos,aWindowHandle);
iQueueClient->AddExpectedEvent(evtPkg());
if (iAddToClick)
{
@@ -1088,6 +1112,22 @@
iTest->SimulatePointerDownUp(EWinPositionX+aX,EWinPositionY+aY+iYOffset);
}
+/* Injects an event in to window server to emulate the event arriving from the pointing device driver
+
+@param aType Input, the event type
+@param aPoint Input, the event coordinates
+ */
+void CTEventTest::SimulatePointer(TRawEvent::TType aType, TPoint& aPoint)
+ {
+ SimulatePointer(aType, aPoint.iX, aPoint.iY);
+ }
+
+/* Injects an event in to window server to emulate the event arriving from the pointing device driver
+
+@param aType Input, the event type
+@param aX Input, the event x coordinate
+@param aY Input, the event y coordinate
+ */
void CTEventTest::SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY)
{
iTest->SimulatePointer(aType,aX,aY+iYOffset);
@@ -1216,7 +1256,12 @@
case 34:
SurfaceVisibilityChanged3_NextSetOfEventsL();
break;
-#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+ case 35:
+ // This test does not actually require QT_Effects code, so could be outside of the QT_Effect #ifdef
+ // BUT, this causes excessive complexity for the case numbers ( i.e. this could be, say 35 or 28 depending on the build )
+ SetPointerAcceptanceRegion_NextSetOfEventsL();
+ break;
+#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
default:
@@ -1874,6 +1919,196 @@
TheClient->iWs.Flush();
}
+/** Functional verification of SetPointerAcceptanceRegion API
+
+GRAPHICS-WSERV-0755, GRAPHICS-WSERV-0756, GRAPHICS-WSERV-0757, GRAPHICS-WSERV-0758
+
+Actions :-
+1) 0755 Set up two windows at the same coordinates, configure a pionter acceptance region for the
+ top most window
+2) 0756 Simulate events inside and outside of the acceptance region.
+3) 0757 Move the window and simulate events inside and outside of the acceptance region.
+4) 0758 Re-define the pointer acceptance region and simulate events inside and outside of the
+ acceptance region.
+
+ExpectedResults
+Pointer events inside the acceptance region get delivered to the topmost window, pointer events
+ outside get delivered to the window below.
+The pointer acceptance region moves with the window.
+*/
+void CTEventTest::SetPointerAcceptanceRegion_NextSetOfEventsL()
+ {
+#if defined(LOGGING)
+ TLogMessageText logMessageText;
+ _LIT(KSet,"SetPointerAcceptanceRegion: %d (last=4)");
+ logMessageText.Format(KSet,iEventSet);
+ INFO_PRINTF1(logMessageText);
+#endif
+
+ const TPoint newPos(iQueueClient->ChildTopLeft().iX + iQueueClient->ChildSize().iWidth,
+ iQueueClient->ChildTopLeft().iY + iQueueClient->ChildSize().iHeight);
+
+ switch(iEventSet++)
+ {
+ case 0:
+ {
+ // Create two top client windows of same group, same size and position
+ // Check that we can set up a pointer acceptance region
+ iVisWins1=new (ELeave) CTBlankWindow;
+ iVisWins2=new (ELeave) CTBlankWindow;
+ iVisWins1->ConstructL(*iQueueClient->iGroup);
+ iVisWins2->ConstructL(*iQueueClient->iGroup);
+ iVisWins1->SetColor(KRgbBlue);
+ iVisWins1->SetExt(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize());
+ iVisWins1->Activate();
+ iVisWins2->SetColor(KRgbGreen);
+ iVisWins2->SetExt(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize());
+
+ RRegion region;
+ // pointer region = quarter of window by the origin
+ region.AddRect(TRect(0,0,iQueueClient->ChildSize().iWidth>>1,iQueueClient->ChildSize().iHeight>>1));
+ CleanupClosePushL(region);
+ User::LeaveIfError(iVisWins2->BaseWin()->SetPointerAcceptanceRegion(region));
+
+ // pop region
+ CleanupStack::PopAndDestroy(1, ®ion);
+
+ // make sure this is in front
+ iVisWins2->Activate();
+ iQueueClient->iWs.Flush();
+ AddExpectedEvent(EEventFocusGained);
+ }
+ break;
+ case 1:
+ {
+ // middle of the acceptance region
+ TPoint p1( iQueueClient->ChildTopLeft().iX + iQueueClient->ChildSize().iWidth/4,
+ iQueueClient->ChildTopLeft().iY + iQueueClient->ChildSize().iHeight/4);
+ // opposite p1, out of the acceptance region
+ TPoint p2( iQueueClient->ChildTopLeft().iX + 3*iQueueClient->ChildSize().iWidth/4,
+ iQueueClient->ChildTopLeft().iY + 3*iQueueClient->ChildSize().iHeight/4);
+
+ SimulatePointer(TRawEvent::EButton1Down,p1);
+ SimulatePointer(TRawEvent::EButton1Up,p1);
+ SimulatePointer(TRawEvent::EButton1Down,p2);
+ SimulatePointer(TRawEvent::EButton1Up,p2);
+ iQueueClient->iWs.Flush();
+
+ p1-=iVisWins2->BaseWin()->AbsPosition();
+ p2-=iVisWins1->BaseWin()->AbsPosition();
+
+ AddExpectedPointer(TPointerEvent::EButton1Down,p1,(TInt)iVisWins2);
+ AddExpectedPointer(TPointerEvent::EButton1Up,p1,(TInt)iVisWins2);
+ AddExpectedPointer(TPointerEvent::EButton1Down,p2,(TInt)iVisWins1);
+ AddExpectedPointer(TPointerEvent::EButton1Up,p2,(TInt)iVisWins1);
+ }
+ break;
+
+ case 2:
+ {
+ // move the windows, check that the pointer region moves with it
+ iVisWins1->SetExtL(newPos,iQueueClient->ChildSize());
+ iVisWins2->SetExtL(newPos,iQueueClient->ChildSize());
+
+ // middle of the acceptance region
+ TPoint p1( newPos.iX + iQueueClient->ChildSize().iWidth/4,
+ newPos.iY + iQueueClient->ChildSize().iHeight/4);
+ // opposite p2, out of the acceptance region
+ TPoint p2( newPos.iX + 3*iQueueClient->ChildSize().iWidth/4,
+ newPos.iY + 3*iQueueClient->ChildSize().iHeight/4);
+
+ SimulatePointer(TRawEvent::EButton1Down,p1);
+ SimulatePointer(TRawEvent::EButton1Up,p1);
+ SimulatePointer(TRawEvent::EButton1Down,p2);
+ SimulatePointer(TRawEvent::EButton1Up,p2);
+ iQueueClient->iWs.Flush();
+
+ p1-=iVisWins2->BaseWin()->AbsPosition();
+ p2-=iVisWins1->BaseWin()->AbsPosition();
+
+ AddExpectedPointer(TPointerEvent::EButton1Down,p1,(TInt)iVisWins2);
+ AddExpectedPointer(TPointerEvent::EButton1Up,p1,(TInt)iVisWins2);
+ AddExpectedPointer(TPointerEvent::EButton1Down,p2,(TInt)iVisWins1);
+ AddExpectedPointer(TPointerEvent::EButton1Up,p2,(TInt)iVisWins1);
+ }
+ break;
+
+ case 3:
+ {
+ // re-set the pointer region
+ RRegion region;
+ // pointer region = quarter of window opposite the origin
+ region.AddRect(TRect( iQueueClient->ChildSize().iWidth>>1,iQueueClient->ChildSize().iHeight>>1,
+ iQueueClient->ChildSize().iWidth,iQueueClient->ChildSize().iHeight));
+ CleanupClosePushL(region);
+ User::LeaveIfError(iVisWins2->BaseWin()->SetPointerAcceptanceRegion(region));
+
+ // pop region
+ CleanupStack::PopAndDestroy(1, ®ion);
+
+ // opposite p1, out of the acceptance region
+ TPoint p1( newPos.iX + iQueueClient->ChildSize().iWidth/4,
+ newPos.iY + iQueueClient->ChildSize().iHeight/4);
+ // middle of the acceptance region
+ TPoint p2( newPos.iX + 3*iQueueClient->ChildSize().iWidth/4,
+ newPos.iY + 3*iQueueClient->ChildSize().iHeight/4);
+
+ SimulatePointer(TRawEvent::EButton1Down,p1);
+ SimulatePointer(TRawEvent::EButton1Up,p1);
+ SimulatePointer(TRawEvent::EButton1Down,p2);
+ SimulatePointer(TRawEvent::EButton1Up,p2);
+ iQueueClient->iWs.Flush();
+
+ p1-=iVisWins2->BaseWin()->AbsPosition();
+ p2-=iVisWins1->BaseWin()->AbsPosition();
+
+ AddExpectedPointer(TPointerEvent::EButton1Down,p1,(TInt)iVisWins1);
+ AddExpectedPointer(TPointerEvent::EButton1Up,p1,(TInt)iVisWins1);
+ AddExpectedPointer(TPointerEvent::EButton1Down,p2,(TInt)iVisWins2);
+ AddExpectedPointer(TPointerEvent::EButton1Up,p2,(TInt)iVisWins2);
+ }
+ break;
+
+ case 4:
+ {
+ // re-set the pointer region to empty
+ RRegion region;
+ CleanupClosePushL(region);
+ User::LeaveIfError(iVisWins2->BaseWin()->SetPointerAcceptanceRegion(region));
+ CleanupStack::PopAndDestroy(1, ®ion);
+
+ TPoint p1( newPos.iX + iQueueClient->ChildSize().iWidth/4,
+ newPos.iY + iQueueClient->ChildSize().iHeight/4);
+ TPoint p2( newPos.iX + 3*iQueueClient->ChildSize().iWidth/4,
+ newPos.iY + 3*iQueueClient->ChildSize().iHeight/4);
+
+ SimulatePointer(TRawEvent::EButton1Down,p1);
+ SimulatePointer(TRawEvent::EButton1Up,p1);
+ SimulatePointer(TRawEvent::EButton1Down,p2);
+ SimulatePointer(TRawEvent::EButton1Up,p2);
+ iQueueClient->iWs.Flush();
+
+ p1-=iVisWins2->BaseWin()->AbsPosition();
+ p2-=iVisWins1->BaseWin()->AbsPosition();
+
+ AddExpectedPointer(TPointerEvent::EButton1Down,p1,(TInt)iVisWins1);
+ AddExpectedPointer(TPointerEvent::EButton1Up,p1,(TInt)iVisWins1);
+ AddExpectedPointer(TPointerEvent::EButton1Down,p2,(TInt)iVisWins1);
+ AddExpectedPointer(TPointerEvent::EButton1Up,p2,(TInt)iVisWins1);
+ }
+ break;
+
+ default:
+ delete iVisWins1;
+ delete iVisWins2;
+ iVisWins1=NULL;
+ iVisWins2=NULL;
+ CActiveScheduler::Stop();
+ break;
+ }
+ TheClient->iWs.Flush();
+ }
+
void CTEventTest::InvisibleWindow_NextSetOfEvents()
{
switch(iEventSet++)
@@ -6996,8 +7231,9 @@
_LIT(KTest34,"Transparent Surface Visibility Changed Events 3");
#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
- _LIT(KTest35A,"Initialize Queue Size without inactive queue");
- _LIT(KTest35B,"Initialize Queue Size with inactive queue");
+ _LIT(KTest35,"SetPointerAcceptanceRegion");
+ _LIT(KTest36A,"Initialize Queue Size without inactive queue");
+ _LIT(KTest36B,"Initialize Queue Size with inactive queue");
if (!TestBase()->ConfigurationSupportsPointerEventTesting())
{
@@ -7760,9 +7996,31 @@
iTest->LogSubTest(KTest34);
RunTestsL();
break;
+/**
+@SYMTestCaseID GRAPHICS-WSERV-0755, GRAPHICS-WSERV-0756, GRAPHICS-WSERV-0757, GRAPHICS-WSERV-0758
+@SYMDEF ou1cimx1#553048
+@SYMTestCaseDesc Functional verification of SetPointerAcceptanceRegion API
+
+@SYMTestPriority 2
+@SYMPrerequisites
+
+@SYMTestActions 0755 Set up two windows at the same coordinates, configure a pionter acceptance region for the top most window
+ 0756 Simulate events inside and outside of the acceptance region.
+ 0757 Move the window and simulate events inside and outside of the acceptance region.
+ 0758 Re-define the pointer acceptance region and simulate events inside and outside of the acceptance region.
+@SYMTestExpectedResults Pointer events inside the acceptance region get delivered to the topmost window, pointer events outside
+ get delivered to the window below.
+ The pointer acceptance region moves with the window.
+*/
+ case 35:
+ ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0755, 0756, 0757, 0758"));
+ iTest->LogSubTest(KTest35);
+ RunTestsL();
+ break;
+
#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
-
+
/**
@SYMTestCaseID GRAPHICS-WSERV-0559
@SYMDEF INC140850
@@ -7775,20 +8033,20 @@
*/
#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
- case 28:
+ case 29:
#else
#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
- case 35:
+ case 36:
#else
- case 32:
+ case 31:
#endif
#endif
// This test was moved to be the last test in the test suite, because it sometimes leaves events in the event queue,
//it can affect the results of other tests. This test case should be the last test in the test suite.
((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0484"));
- iTest->LogSubTest(KTest35A);
+ iTest->LogSubTest(KTest36A);
InitializeQueueSizeTestL(EFalse);
- iTest->LogSubTest(KTest35B);
+ iTest->LogSubTest(KTest36B);
InitializeQueueSizeTestL(ETrue);
break;