InputPositionCorrectorTest.cs 954 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Linq;
  2. using NUnit.Framework;
  3. using UnityEngine;
  4. using UnityEngine.InputSystem;
  5. using UnityEngine.InputSystem.LowLevel;
  6. namespace Unity.RenderStreaming.RuntimeTest
  7. {
  8. class InputPositionCorrectorTest
  9. {
  10. void OnEvent(InputEventPtr ptr, InputDevice device)
  11. {
  12. }
  13. [Test]
  14. public void Invoke()
  15. {
  16. System.Action< InputEventPtr, InputDevice> onEvent = OnEvent;
  17. var corrector = new InputPositionCorrector(onEvent);
  18. Assert.That(corrector.inputRegion, Is.EqualTo(Rect.zero));
  19. Assert.That(corrector.outputRegion, Is.EqualTo(Rect.zero));
  20. var device = UnityEngine.InputSystem.InputSystem.devices.First(_ => _ is Pointer);
  21. var inputEvent = new InputEvent();
  22. unsafe
  23. {
  24. var ptr = InputEventPtr.From(&inputEvent);
  25. corrector.Invoke(ptr, device);
  26. }
  27. }
  28. }
  29. }