@@ -163,6 +163,7 @@ public IEnumerator MouseActions_CanDriveUI()
163163 // Reset initial selection
164164 leftChildReceiver . Reset ( ) ;
165165
166+ Assert . That ( eventSystem . IsPointerOverGameObject ( ) , Is . False ) ;
166167 // Move mouse over left child.
167168 InputSystem . QueueStateEvent ( mouse , new MouseState { position = new Vector2 ( 100 , 100 ) } ) ;
168169 InputSystem . Update ( ) ;
@@ -172,6 +173,7 @@ public IEnumerator MouseActions_CanDriveUI()
172173 Assert . That ( leftChildReceiver . events [ 0 ] . type , Is . EqualTo ( EventType . Enter ) ) ;
173174 leftChildReceiver . Reset ( ) ;
174175 Assert . That ( rightChildReceiver . events , Is . Empty ) ;
176+ Assert . That ( eventSystem . IsPointerOverGameObject ( ) , Is . True ) ;
175177
176178 // Check basic down/up
177179 InputSystem . QueueStateEvent ( mouse , new MouseState { position = new Vector2 ( 100 , 100 ) , buttons = 1 << ( int ) MouseButton . Left } ) ;
@@ -248,6 +250,7 @@ public IEnumerator MouseActions_CanDriveUI()
248250 Assert . That ( rightChildReceiver . events , Has . Count . EqualTo ( 1 ) ) ;
249251 Assert . That ( rightChildReceiver . events [ 0 ] . type , Is . EqualTo ( EventType . Scroll ) ) ;
250252 rightChildReceiver . Reset ( ) ;
253+ Assert . That ( eventSystem . IsPointerOverGameObject ( ) , Is . True ) ;
251254 }
252255
253256 unsafe void SetTouchState ( TouchscreenState state , int index , TouchState touch )
@@ -311,6 +314,11 @@ public IEnumerator TouchActions_CanDriveUIAndDistinguishMultipleTouches()
311314 leftChildReceiver . Reset ( ) ;
312315 Assert . That ( rightChildReceiver . events , Is . Empty ) ;
313316
317+ Assert . That ( eventSystem . IsPointerOverGameObject ( ) , Is . False ) ;
318+ Assert . That ( eventSystem . IsPointerOverGameObject ( 1 ) , Is . True ) ;
319+ Assert . That ( eventSystem . IsPointerOverGameObject ( 2 ) , Is . False ) ;
320+ Assert . That ( eventSystem . IsPointerOverGameObject ( 3 ) , Is . False ) ;
321+
314322 InputSystem . QueueDeltaStateEvent ( touchScreen . touches [ 0 ] , new TouchState ( )
315323 {
316324 touchId = 1 ,
@@ -344,6 +352,11 @@ public IEnumerator TouchActions_CanDriveUIAndDistinguishMultipleTouches()
344352 rightChildReceiver . Reset ( ) ;
345353 Assert . That ( leftChildReceiver . events , Is . Empty ) ;
346354
355+ Assert . That ( eventSystem . IsPointerOverGameObject ( ) , Is . False ) ;
356+ Assert . That ( eventSystem . IsPointerOverGameObject ( 1 ) , Is . True ) ;
357+ Assert . That ( eventSystem . IsPointerOverGameObject ( 2 ) , Is . True ) ;
358+ Assert . That ( eventSystem . IsPointerOverGameObject ( 3 ) , Is . False ) ;
359+
347360 InputSystem . QueueDeltaStateEvent ( touchScreen . touches [ 1 ] , new TouchState ( )
348361 {
349362 touchId = 2 ,
@@ -392,6 +405,11 @@ public IEnumerator TouchActions_CanDriveUIAndDistinguishMultipleTouches()
392405 leftChildReceiver . Reset ( ) ;
393406 Assert . That ( rightChildReceiver . events , Is . Empty ) ;
394407
408+ Assert . That ( eventSystem . IsPointerOverGameObject ( ) , Is . False ) ;
409+ Assert . That ( eventSystem . IsPointerOverGameObject ( 1 ) , Is . True ) ;
410+ Assert . That ( eventSystem . IsPointerOverGameObject ( 2 ) , Is . True ) ;
411+ Assert . That ( eventSystem . IsPointerOverGameObject ( 3 ) , Is . False ) ;
412+
395413 // release right button
396414 // NOTE: The UI behavior is a bit funky here, as it cannot properly handle selection state for multiple
397415 // objects. As a result, only releasing the left button will receive a click in this setup.
@@ -420,6 +438,11 @@ public IEnumerator TouchActions_CanDriveUIAndDistinguishMultipleTouches()
420438 Assert . That ( ( rightChildReceiver . events [ 0 ] . data as PointerEventData ) . button , Is . EqualTo ( PointerEventData . InputButton . Left ) ) ;
421439 rightChildReceiver . Reset ( ) ;
422440 Assert . That ( leftChildReceiver . events , Is . Empty ) ;
441+
442+ Assert . That ( eventSystem . IsPointerOverGameObject ( ) , Is . False ) ;
443+ Assert . That ( eventSystem . IsPointerOverGameObject ( 1 ) , Is . True ) ;
444+ Assert . That ( eventSystem . IsPointerOverGameObject ( 2 ) , Is . True ) ;
445+ Assert . That ( eventSystem . IsPointerOverGameObject ( 3 ) , Is . False ) ;
423446 }
424447
425448 [ UnityTest ]
0 commit comments