public IEnumerator ContentProtection()
        {
            var disp = ActiveLoader.GetLoadedSubsystem <XRDisplaySubsystem>();

            Assert.IsTrue(disp != null);
            yield return(new WaitForEndOfFrame());

            bool oldContentState = disp.contentProtectionEnabled;

            disp.contentProtectionEnabled = !oldContentState;

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            bool newContentState = disp.contentProtectionEnabled;

            Assert.IsTrue(oldContentState != newContentState);
            disp.contentProtectionEnabled = oldContentState;

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            newContentState = disp.contentProtectionEnabled;
            Assert.IsTrue(oldContentState == newContentState);
        }
Exemplo n.º 2
0
        public void TestGestureSubsystem()
        {
            Assert.IsNotNull(ActiveLoader);
            XRGestureSubsystem gestureSub = ActiveLoader.GetLoadedSubsystem <XRGestureSubsystem>();

            Assert.IsNotNull(gestureSub);
        }
        public IEnumerator TestInputSubsystem()
        {
            yield return(new WaitForSeconds(1));

            Assert.IsNotNull(ActiveLoader);
            XRInputSubsystem inputSub = ActiveLoader.GetLoadedSubsystem <XRInputSubsystem>();

            Assert.IsNotNull(inputSub);
        }
        public IEnumerator FocusPoint()
        {
            var disp = ActiveLoader.GetLoadedSubsystem <XRDisplaySubsystem>();

            Assert.IsTrue(disp != null);
            yield return(new WaitForEndOfFrame());

            disp.SetFocusPlane(Vector3.forward, Vector3.up, Vector3.right);
            yield return(new WaitForEndOfFrame());
        }
        public IEnumerator DisplayOpaque()
        {
            var disp = ActiveLoader.GetLoadedSubsystem <XRDisplaySubsystem>();

            Assert.IsTrue(disp != null);
            yield return(new WaitForEndOfFrame());

            // Will fail if not on a HMD but shouldn't be run off machine anyway.
            Assert.IsTrue(disp.displayOpaque);
        }
Exemplo n.º 6
0
        XRAnchorStore GetAnchorStore()
        {
            XRAnchorSubsystem rpsub = ActiveLoader.GetLoadedSubsystem <XRAnchorSubsystem>();

            Assert.NotNull(rpsub);

            var store = rpsub.TryGetAnchorStoreAsync().Result;

            Assert.NotNull(store);
            return(store);
        }
        public IEnumerator TestFloorTrackingOriginMode()
        {
            yield return(new WaitForSeconds(1));

            XRInputSubsystem inputSub = ActiveLoader.GetLoadedSubsystem <XRInputSubsystem>();

            if (inputSub.GetTrackingOriginMode() == TrackingOriginModeFlags.Floor)
            {
                List <Vector3> boundaryPoints = new List <Vector3>();
                inputSub.TryGetBoundaryPoints(boundaryPoints);
                Assert.IsFalse(boundaryPoints.Count == 0);
            }
        }
        public IEnumerator ReprojectionMode()
        {
            var disp = ActiveLoader.GetLoadedSubsystem <XRDisplaySubsystem>();

            Assert.IsTrue(disp != null);

            XRDisplaySubsystem.ReprojectionMode oldContentState = disp.reprojectionMode;
            XRDisplaySubsystem.ReprojectionMode newContentState = oldContentState;

            switch (oldContentState)
            {
            case XRDisplaySubsystem.ReprojectionMode.Unspecified:
                newContentState = XRDisplaySubsystem.ReprojectionMode.OrientationOnly;
                break;

            case XRDisplaySubsystem.ReprojectionMode.OrientationOnly:
                newContentState = XRDisplaySubsystem.ReprojectionMode.PositionAndOrientation;
                break;

            case XRDisplaySubsystem.ReprojectionMode.PositionAndOrientation:
                newContentState = XRDisplaySubsystem.ReprojectionMode.None;
                break;

            case XRDisplaySubsystem.ReprojectionMode.None:
                newContentState = XRDisplaySubsystem.ReprojectionMode.OrientationOnly;
                break;
            }

            disp.reprojectionMode = newContentState;

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            var currentContentState = disp.reprojectionMode;

            Assert.IsTrue(currentContentState == oldContentState || currentContentState == newContentState);
            newContentState       = oldContentState;
            disp.reprojectionMode = newContentState;

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            yield return(new WaitForEndOfFrame());

            newContentState = disp.reprojectionMode;
            Assert.IsTrue(oldContentState == newContentState);
        }
Exemplo n.º 9
0
        bool CheckThereAreNoAnchors()
        {
            XRAnchorSubsystem rpsub = ActiveLoader.GetLoadedSubsystem <XRAnchorSubsystem>();

            Assert.NotNull(rpsub);

            TrackableChanges <XRAnchor>?currentRps = rpsub.GetChanges(Allocator.Temp);

            bool hasNoAnchors = (currentRps == null) ? false :
                                currentRps?.added.Length == 0 &&
                                currentRps?.removed.Length == 0 &&
                                currentRps?.updated.Length == 0;

            return(hasNoAnchors);
        }
        public IEnumerator TestBoundaryIsAtGround()
        {
            yield return(new WaitForSeconds(1));

            XRInputSubsystem inputSub = ActiveLoader.GetLoadedSubsystem <XRInputSubsystem>();

            if (inputSub.GetTrackingOriginMode() == TrackingOriginModeFlags.Floor)
            {
                List <Vector3> boundaryPoints = new List <Vector3>();
                inputSub.TryGetBoundaryPoints(boundaryPoints);
                for (int i = 0; i < boundaryPoints.Count; i++)
                {
                    Assert.That(boundaryPoints[i].y, Is.EqualTo(0.0f).Within(1).Ulps);
                }
            }
        }
Exemplo n.º 11
0
        bool CheckAnchorUpdateState(TrackableId id, UpdateState updateState)
        {
            XRAnchorSubsystem rpsub = ActiveLoader.GetLoadedSubsystem <XRAnchorSubsystem>();

            Assert.NotNull(rpsub);

            TrackableChanges <XRAnchor>?currentRps = rpsub.GetChanges(Allocator.Temp);

            Assert.IsNotNull(currentRps);

            XRAnchor?   rp        = null;
            TrackableId idToCheck = defaultId;

            switch (updateState)
            {
            case UpdateState.Added:
                Assert.AreNotEqual(0, currentRps?.added.Length ?? 0);
                rp        = currentRps?.added[0] ?? null;
                idToCheck = rp?.trackableId ?? defaultId;
                break;

            case UpdateState.Updated:
                Assert.AreNotEqual(0, currentRps?.updated.Length ?? 0);
                rp        = currentRps?.updated[0] ?? null;
                idToCheck = rp?.trackableId ?? defaultId;
                break;

            case UpdateState.Removed:
                Assert.AreNotEqual(0, currentRps?.removed.Length ?? 0);
                idToCheck = currentRps?.removed[0] ?? defaultId;
                break;

            case UpdateState.None:
            default:
                return(false);
            }


            return(idToCheck == id);
        }
Exemplo n.º 12
0
        IEnumerator RemoveAndCheckAnchor(TrackableId id, Action <TrackableId> callback)
        {
            XRAnchorSubsystem rpsub = ActiveLoader.GetLoadedSubsystem <XRAnchorSubsystem>();

            Assert.NotNull(rpsub);

            rpsub.TryRemoveAnchor(id);

            yield return(null);

            TrackableChanges <XRAnchor>?currentRps = rpsub.GetChanges(Allocator.Temp);

            Assert.IsNotNull(currentRps);
            Assert.AreNotEqual(0, currentRps?.removed.Length ?? 0);

            TrackableId?rpRemoved = currentRps?.removed[0] ?? null;

            if (callback != null)
            {
                callback.Invoke(rpRemoved ?? defaultId);
            }
        }
Exemplo n.º 13
0
        IEnumerator AddAndCheckAnchor(Action <TrackableId> callback)
        {
            XRAnchorSubsystem rpsub = ActiveLoader.GetLoadedSubsystem <XRAnchorSubsystem>();

            Assert.NotNull(rpsub);

            XRAnchor rp;
            bool     ret = rpsub.TryAddAnchor(defaultPose, out rp);

            Assert.IsTrue(ret);
            Assert.AreNotEqual(defaultId, rp.trackableId);

            yield return(null);

            TrackableChanges <XRAnchor>?currentRps = rpsub.GetChanges(Allocator.Temp);

            Assert.IsNotNull(currentRps);
            Assert.AreNotEqual(0, currentRps?.added.Length ?? 0);

            if (callback != null)
            {
                callback.Invoke(currentRps?.added[0].trackableId ?? defaultId);
            }
        }