InputDeviceExtensionTest.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using NUnit.Framework;
  2. using UnityEngine.InputSystem;
  3. using UnityEngine.InputSystem.Layouts;
  4. using Unity.RenderStreaming.InputSystem;
  5. using Assert = NUnit.Framework.Assert;
  6. namespace Unity.RenderStreaming.RuntimeTest
  7. {
  8. using InputSystem = UnityEngine.InputSystem.InputSystem;
  9. class InputDeviceExtensionTest
  10. {
  11. [Test]
  12. public void SetDescription()
  13. {
  14. var device = InputSystem.AddDevice<Mouse>();
  15. InputDeviceDescription empty;
  16. InputDeviceDescription origin = device.description;
  17. device.SetDescription(empty);
  18. Assert.That(device.description, Is.EqualTo(empty));
  19. device.SetDescription(origin);
  20. Assert.That(device.description, Is.EqualTo(origin));
  21. }
  22. [Test]
  23. public void SetParticipantId()
  24. {
  25. var device = InputSystem.AddDevice<Mouse>();
  26. int participantId = 0;
  27. int origin = device.GetParticipantId();
  28. device.SetParticipantId(participantId);
  29. Assert.That(device.GetParticipantId(), Is.EqualTo(participantId));
  30. device.SetParticipantId(origin);
  31. Assert.That(device.GetParticipantId(), Is.EqualTo(origin));
  32. }
  33. [Test]
  34. public void SetDeviceFlags()
  35. {
  36. var device = InputSystem.AddDevice<Mouse>();
  37. int deviceFlags = 0;
  38. int origin = device.GetDeviceFlags();
  39. device.SetDeviceFlags(deviceFlags);
  40. Assert.That(device.GetDeviceFlags(), Is.EqualTo(deviceFlags));
  41. device.SetDeviceFlags(origin);
  42. Assert.That(device.GetDeviceFlags(), Is.EqualTo(origin));
  43. }
  44. }
  45. }