906 event.ErrorMessage()->iErrorCategory=aCategory; |
906 event.ErrorMessage()->iErrorCategory=aCategory; |
907 event.ErrorMessage()->iError=aError; |
907 event.ErrorMessage()->iError=aError; |
908 iQueueClient->AddExpectedEvent(event); |
908 iQueueClient->AddExpectedEvent(event); |
909 } |
909 } |
910 |
910 |
911 void CTEventTest::CalculatePointerEvent(TWsEvent& aEvent,TPointerEvent::TType aType, TPoint aPos) |
911 /* Populates the provided TWsEvent using the other parameters provided |
|
912 |
|
913 This is used to generate the events that will be compared to those received from Wserv |
|
914 |
|
915 @param aEvent Output, the event to be populated |
|
916 @param aType Input, the type of the event |
|
917 @param aPos Input, the position of the event |
|
918 @param aWindowHandle Input, the window handle where the event should be received ( or 0 to calculate this ) |
|
919 */ |
|
920 void CTEventTest::CalculatePointerEvent(TWsEvent& aEvent,TPointerEvent::TType aType, TPoint aPos, TInt aWindowHandle) |
912 { |
921 { |
913 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
922 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
914 TAdvancedPointerEvent& ptrEvent=*aEvent.Pointer(); |
923 TAdvancedPointerEvent& ptrEvent=*aEvent.Pointer(); |
915 aEvent.SetType(EEventPointer); |
924 aEvent.SetType(EEventPointer); |
916 ptrEvent.iParentPosition=aPos; |
925 ptrEvent.iParentPosition=aPos; |
917 // SetHandle must be done after iParentPosition is set, but before iPosition is set. |
926 // SetHandle must be done after iParentPosition is set, but before iPosition is set. |
918 aEvent.SetHandle(reinterpret_cast<TInt>(iQueueClient->GetHandle(aPos))); |
927 if(!aWindowHandle) |
|
928 { |
|
929 aEvent.SetHandle(reinterpret_cast<TInt>(iQueueClient->GetHandle(aPos))); |
|
930 } |
|
931 else |
|
932 { |
|
933 aEvent.SetHandle(aWindowHandle); |
|
934 } |
919 const TPoint3D point3D(aPos.iX, aPos.iY, 0); |
935 const TPoint3D point3D(aPos.iX, aPos.iY, 0); |
920 const TInt pointerEventModifiers=0; |
936 const TInt pointerEventModifiers=0; |
921 const TUint8 pointerNumber=0; |
937 const TUint8 pointerNumber=0; |
922 aEvent.InitAdvancedPointerEvent(aType,pointerEventModifiers,point3D,pointerNumber); |
938 aEvent.InitAdvancedPointerEvent(aType,pointerEventModifiers,point3D,pointerNumber); |
923 #else |
939 #else |
970 { |
986 { |
971 ptrEvent.iPosition=aPos; |
987 ptrEvent.iPosition=aPos; |
972 } |
988 } |
973 } |
989 } |
974 |
990 |
975 void CTEventTest::AddExpectedPointerCapture(TPointerEvent::TType aType, TPoint aPos, TInt aHandle) |
991 void CTEventTest::AddExpectedPointerCapture(TPointerEvent::TType aType, TPoint aPos, TInt aWindowHandle) |
976 { |
992 { |
977 TPckgBuf<TWsQTEvent> evtPkg; |
993 TPckgBuf<TWsQTEvent> evtPkg; |
978 CalculatePointerCaptureEvent(evtPkg(),aType,aPos,aHandle); |
994 CalculatePointerCaptureEvent(evtPkg(),aType,aPos,aWindowHandle); |
979 iQueueClient->AddExpectedEvent(evtPkg()); |
995 iQueueClient->AddExpectedEvent(evtPkg()); |
980 } |
996 } |
981 |
997 |
982 void CTEventTest::AddExpectedPointer(TPointerEvent::TType aType, TPoint aPos) |
998 /* Queues a TWsEvent which is populated using the other parameters provided |
|
999 |
|
1000 This is used to generate the events that will be compared to those received from Wserv |
|
1001 |
|
1002 @param aType Input, the type of the event |
|
1003 @param aPos Input, the position of the event |
|
1004 @param aWindowHandle Input, the window handle where the event should be received ( or 0 to calculate this ) |
|
1005 */ |
|
1006 void CTEventTest::AddExpectedPointer(TPointerEvent::TType aType, TPoint aPos, TInt aWindowHandle) |
983 { |
1007 { |
984 TPckgBuf<TWsQTEvent> evtPkg; |
1008 TPckgBuf<TWsQTEvent> evtPkg; |
985 CalculatePointerEvent(evtPkg(),aType,aPos); |
1009 CalculatePointerEvent(evtPkg(),aType,aPos,aWindowHandle); |
986 iQueueClient->AddExpectedEvent(evtPkg()); |
1010 iQueueClient->AddExpectedEvent(evtPkg()); |
987 if (iAddToClick) |
1011 if (iAddToClick) |
988 { |
1012 { |
989 evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY); |
1013 evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY); |
990 iClick.CommandReply(EClickEventAdd,evtPkg); |
1014 iClick.CommandReply(EClickEventAdd,evtPkg); |
1871 CActiveScheduler::Stop(); |
1916 CActiveScheduler::Stop(); |
1872 break; |
1917 break; |
1873 } |
1918 } |
1874 TheClient->iWs.Flush(); |
1919 TheClient->iWs.Flush(); |
1875 } |
1920 } |
|
1921 |
|
1922 /** Functional verification of SetPointerAcceptanceRegion API |
|
1923 |
|
1924 GRAPHICS-WSERV-0755, GRAPHICS-WSERV-0756, GRAPHICS-WSERV-0757, GRAPHICS-WSERV-0758 |
|
1925 |
|
1926 Actions :- |
|
1927 1) 0755 Set up two windows at the same coordinates, configure a pionter acceptance region for the |
|
1928 top most window |
|
1929 2) 0756 Simulate events inside and outside of the acceptance region. |
|
1930 3) 0757 Move the window and simulate events inside and outside of the acceptance region. |
|
1931 4) 0758 Re-define the pointer acceptance region and simulate events inside and outside of the |
|
1932 acceptance region. |
|
1933 |
|
1934 ExpectedResults |
|
1935 Pointer events inside the acceptance region get delivered to the topmost window, pointer events |
|
1936 outside get delivered to the window below. |
|
1937 The pointer acceptance region moves with the window. |
|
1938 */ |
|
1939 void CTEventTest::SetPointerAcceptanceRegion_NextSetOfEventsL() |
|
1940 { |
|
1941 #if defined(LOGGING) |
|
1942 TLogMessageText logMessageText; |
|
1943 _LIT(KSet,"SetPointerAcceptanceRegion: %d (last=4)"); |
|
1944 logMessageText.Format(KSet,iEventSet); |
|
1945 INFO_PRINTF1(logMessageText); |
|
1946 #endif |
|
1947 |
|
1948 const TPoint newPos(iQueueClient->ChildTopLeft().iX + iQueueClient->ChildSize().iWidth, |
|
1949 iQueueClient->ChildTopLeft().iY + iQueueClient->ChildSize().iHeight); |
|
1950 |
|
1951 switch(iEventSet++) |
|
1952 { |
|
1953 case 0: |
|
1954 { |
|
1955 // Create two top client windows of same group, same size and position |
|
1956 // Check that we can set up a pointer acceptance region |
|
1957 iVisWins1=new (ELeave) CTBlankWindow; |
|
1958 iVisWins2=new (ELeave) CTBlankWindow; |
|
1959 iVisWins1->ConstructL(*iQueueClient->iGroup); |
|
1960 iVisWins2->ConstructL(*iQueueClient->iGroup); |
|
1961 iVisWins1->SetColor(KRgbBlue); |
|
1962 iVisWins1->SetExt(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize()); |
|
1963 iVisWins1->Activate(); |
|
1964 iVisWins2->SetColor(KRgbGreen); |
|
1965 iVisWins2->SetExt(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize()); |
|
1966 |
|
1967 RRegion region; |
|
1968 // pointer region = quarter of window by the origin |
|
1969 region.AddRect(TRect(0,0,iQueueClient->ChildSize().iWidth>>1,iQueueClient->ChildSize().iHeight>>1)); |
|
1970 CleanupClosePushL(region); |
|
1971 User::LeaveIfError(iVisWins2->BaseWin()->SetPointerAcceptanceRegion(region)); |
|
1972 |
|
1973 // pop region |
|
1974 CleanupStack::PopAndDestroy(1, ®ion); |
|
1975 |
|
1976 // make sure this is in front |
|
1977 iVisWins2->Activate(); |
|
1978 iQueueClient->iWs.Flush(); |
|
1979 AddExpectedEvent(EEventFocusGained); |
|
1980 } |
|
1981 break; |
|
1982 case 1: |
|
1983 { |
|
1984 // middle of the acceptance region |
|
1985 TPoint p1( iQueueClient->ChildTopLeft().iX + iQueueClient->ChildSize().iWidth/4, |
|
1986 iQueueClient->ChildTopLeft().iY + iQueueClient->ChildSize().iHeight/4); |
|
1987 // opposite p1, out of the acceptance region |
|
1988 TPoint p2( iQueueClient->ChildTopLeft().iX + 3*iQueueClient->ChildSize().iWidth/4, |
|
1989 iQueueClient->ChildTopLeft().iY + 3*iQueueClient->ChildSize().iHeight/4); |
|
1990 |
|
1991 SimulatePointer(TRawEvent::EButton1Down,p1); |
|
1992 SimulatePointer(TRawEvent::EButton1Up,p1); |
|
1993 SimulatePointer(TRawEvent::EButton1Down,p2); |
|
1994 SimulatePointer(TRawEvent::EButton1Up,p2); |
|
1995 iQueueClient->iWs.Flush(); |
|
1996 |
|
1997 p1-=iVisWins2->BaseWin()->AbsPosition(); |
|
1998 p2-=iVisWins1->BaseWin()->AbsPosition(); |
|
1999 |
|
2000 AddExpectedPointer(TPointerEvent::EButton1Down,p1,(TInt)iVisWins2); |
|
2001 AddExpectedPointer(TPointerEvent::EButton1Up,p1,(TInt)iVisWins2); |
|
2002 AddExpectedPointer(TPointerEvent::EButton1Down,p2,(TInt)iVisWins1); |
|
2003 AddExpectedPointer(TPointerEvent::EButton1Up,p2,(TInt)iVisWins1); |
|
2004 } |
|
2005 break; |
|
2006 |
|
2007 case 2: |
|
2008 { |
|
2009 // move the windows, check that the pointer region moves with it |
|
2010 iVisWins1->SetExtL(newPos,iQueueClient->ChildSize()); |
|
2011 iVisWins2->SetExtL(newPos,iQueueClient->ChildSize()); |
|
2012 |
|
2013 // middle of the acceptance region |
|
2014 TPoint p1( newPos.iX + iQueueClient->ChildSize().iWidth/4, |
|
2015 newPos.iY + iQueueClient->ChildSize().iHeight/4); |
|
2016 // opposite p2, out of the acceptance region |
|
2017 TPoint p2( newPos.iX + 3*iQueueClient->ChildSize().iWidth/4, |
|
2018 newPos.iY + 3*iQueueClient->ChildSize().iHeight/4); |
|
2019 |
|
2020 SimulatePointer(TRawEvent::EButton1Down,p1); |
|
2021 SimulatePointer(TRawEvent::EButton1Up,p1); |
|
2022 SimulatePointer(TRawEvent::EButton1Down,p2); |
|
2023 SimulatePointer(TRawEvent::EButton1Up,p2); |
|
2024 iQueueClient->iWs.Flush(); |
|
2025 |
|
2026 p1-=iVisWins2->BaseWin()->AbsPosition(); |
|
2027 p2-=iVisWins1->BaseWin()->AbsPosition(); |
|
2028 |
|
2029 AddExpectedPointer(TPointerEvent::EButton1Down,p1,(TInt)iVisWins2); |
|
2030 AddExpectedPointer(TPointerEvent::EButton1Up,p1,(TInt)iVisWins2); |
|
2031 AddExpectedPointer(TPointerEvent::EButton1Down,p2,(TInt)iVisWins1); |
|
2032 AddExpectedPointer(TPointerEvent::EButton1Up,p2,(TInt)iVisWins1); |
|
2033 } |
|
2034 break; |
|
2035 |
|
2036 case 3: |
|
2037 { |
|
2038 // re-set the pointer region |
|
2039 RRegion region; |
|
2040 // pointer region = quarter of window opposite the origin |
|
2041 region.AddRect(TRect( iQueueClient->ChildSize().iWidth>>1,iQueueClient->ChildSize().iHeight>>1, |
|
2042 iQueueClient->ChildSize().iWidth,iQueueClient->ChildSize().iHeight)); |
|
2043 CleanupClosePushL(region); |
|
2044 User::LeaveIfError(iVisWins2->BaseWin()->SetPointerAcceptanceRegion(region)); |
|
2045 |
|
2046 // pop region |
|
2047 CleanupStack::PopAndDestroy(1, ®ion); |
|
2048 |
|
2049 // opposite p1, out of the acceptance region |
|
2050 TPoint p1( newPos.iX + iQueueClient->ChildSize().iWidth/4, |
|
2051 newPos.iY + iQueueClient->ChildSize().iHeight/4); |
|
2052 // middle of the acceptance region |
|
2053 TPoint p2( newPos.iX + 3*iQueueClient->ChildSize().iWidth/4, |
|
2054 newPos.iY + 3*iQueueClient->ChildSize().iHeight/4); |
|
2055 |
|
2056 SimulatePointer(TRawEvent::EButton1Down,p1); |
|
2057 SimulatePointer(TRawEvent::EButton1Up,p1); |
|
2058 SimulatePointer(TRawEvent::EButton1Down,p2); |
|
2059 SimulatePointer(TRawEvent::EButton1Up,p2); |
|
2060 iQueueClient->iWs.Flush(); |
|
2061 |
|
2062 p1-=iVisWins2->BaseWin()->AbsPosition(); |
|
2063 p2-=iVisWins1->BaseWin()->AbsPosition(); |
|
2064 |
|
2065 AddExpectedPointer(TPointerEvent::EButton1Down,p1,(TInt)iVisWins1); |
|
2066 AddExpectedPointer(TPointerEvent::EButton1Up,p1,(TInt)iVisWins1); |
|
2067 AddExpectedPointer(TPointerEvent::EButton1Down,p2,(TInt)iVisWins2); |
|
2068 AddExpectedPointer(TPointerEvent::EButton1Up,p2,(TInt)iVisWins2); |
|
2069 } |
|
2070 break; |
|
2071 |
|
2072 case 4: |
|
2073 { |
|
2074 // re-set the pointer region to empty |
|
2075 RRegion region; |
|
2076 CleanupClosePushL(region); |
|
2077 User::LeaveIfError(iVisWins2->BaseWin()->SetPointerAcceptanceRegion(region)); |
|
2078 CleanupStack::PopAndDestroy(1, ®ion); |
|
2079 |
|
2080 TPoint p1( newPos.iX + iQueueClient->ChildSize().iWidth/4, |
|
2081 newPos.iY + iQueueClient->ChildSize().iHeight/4); |
|
2082 TPoint p2( newPos.iX + 3*iQueueClient->ChildSize().iWidth/4, |
|
2083 newPos.iY + 3*iQueueClient->ChildSize().iHeight/4); |
|
2084 |
|
2085 SimulatePointer(TRawEvent::EButton1Down,p1); |
|
2086 SimulatePointer(TRawEvent::EButton1Up,p1); |
|
2087 SimulatePointer(TRawEvent::EButton1Down,p2); |
|
2088 SimulatePointer(TRawEvent::EButton1Up,p2); |
|
2089 iQueueClient->iWs.Flush(); |
|
2090 |
|
2091 p1-=iVisWins2->BaseWin()->AbsPosition(); |
|
2092 p2-=iVisWins1->BaseWin()->AbsPosition(); |
|
2093 |
|
2094 AddExpectedPointer(TPointerEvent::EButton1Down,p1,(TInt)iVisWins1); |
|
2095 AddExpectedPointer(TPointerEvent::EButton1Up,p1,(TInt)iVisWins1); |
|
2096 AddExpectedPointer(TPointerEvent::EButton1Down,p2,(TInt)iVisWins1); |
|
2097 AddExpectedPointer(TPointerEvent::EButton1Up,p2,(TInt)iVisWins1); |
|
2098 } |
|
2099 break; |
|
2100 |
|
2101 default: |
|
2102 delete iVisWins1; |
|
2103 delete iVisWins2; |
|
2104 iVisWins1=NULL; |
|
2105 iVisWins2=NULL; |
|
2106 CActiveScheduler::Stop(); |
|
2107 break; |
|
2108 } |
|
2109 TheClient->iWs.Flush(); |
|
2110 } |
1876 |
2111 |
1877 void CTEventTest::InvisibleWindow_NextSetOfEvents() |
2112 void CTEventTest::InvisibleWindow_NextSetOfEvents() |
1878 { |
2113 { |
1879 switch(iEventSet++) |
2114 switch(iEventSet++) |
1880 { |
2115 { |