Mouse delta in UnityTests won't work

Hi all,

I’m writing automated UnityTests for the camera controls in our project. My camera controller reads out the mouse input like this:

var mouseDelta = Mouse.current.delta.ReadValue();

… which is working fine at runtime.

In my test code I try to simulate these inputs like this:

internal static IEnumerator MoveMouse(Vector2 pixelDelta)
{
   InputSystem.QueueDeltaStateEvent(Mouse.current.position, pixelDelta);
   yield return null;
}

I tried a ton of different variations, like setting absolute mouse positions or using InputSystem.QueueStateEvent, however Mouse.current.delta is always 0.00, 0.00.

I made sure Mouse.current is the same device, and I am also able to simulate mouseclicks. Just the delta won’t work for some reason.

Any ideas are highly appreciated!

I got it working using m_inputTestFixture.Set(m_mouseTestDevice.delta, delta);

See InputTestFixture.Set