using System; using System.Numerics; using NUnit.Framework; using UnityEngine.InputSystem; namespace UnitySDKPlayTests { public partial class MLInputs { public partial class ControllerTests { private MagicLeapInputs mlInputs; private MagicLeapInputs.ControllerActions controllerActions; /// /// A [Setup] method will execute BEFORE each and every test in this class. They're useful /// for preparing a scene state with certain components that will be needed by the tests. /// [SetUp] public void MLControlSetup() { mlInputs = new MagicLeapInputs(); mlInputs.Enable(); controllerActions = new MagicLeapInputs.ControllerActions(mlInputs); } /// /// A [TearDown] method will execute AFTER each and every test in this class. They're useful /// for cleanup, where you don't want something leftover from one test to possibly affect the next. /// May be unnecessary if you only have one test. /// [TearDown] public void MLControlTearDown() { mlInputs.Dispose(); } [Test] public void MLInput_ControllerActions() { try { controllerActions.Position.ReadValue(); controllerActions.Velocity.ReadValue(); controllerActions.AngularVelocity.ReadValue(); controllerActions.Acceleration.ReadValue(); controllerActions.AngularAcceleration.ReadValue(); controllerActions.Rotation.ReadValue(); controllerActions.Menu.IsPressed(); controllerActions.Trigger.ReadValue(); InputActionPhase phase = controllerActions.TriggerHold.phase; controllerActions.Bumper.IsPressed(); controllerActions.TouchpadPosition.ReadValue(); controllerActions.TouchpadForce.ReadValue(); } catch (Exception e) { Assert.Fail(e.Message); } } } } }