public IEnumerator HighlightObjectNotShown() { // Given a snappable property with a snapzone highlight deactivated parameter active. DynamicRuntimeConfiguration testRuntimeConfiguration = new DynamicRuntimeConfiguration(); testRuntimeConfiguration.SetAvailableModes(new List <IMode> { new Mode("Test", new WhitelistTypeRule <IOptional>(), new Dictionary <string, object> { { "ShowSnapzoneHighlightObject", false } }), }); RuntimeConfigurator.Configuration = testRuntimeConfiguration; SnappablePropertyMock mockedProperty = CreateSnappablePropertyMock(); SnapZoneProperty snapZoneProperty = CreateSnapZoneProperty(); SnapZone zone = snapZoneProperty.SnapZone; mockedProperty.SetSnapZone(snapZoneProperty); yield return(null); SnappedCondition condition = new SnappedCondition(mockedProperty, snapZoneProperty); condition.Configure(RuntimeConfigurator.Configuration.Modes.CurrentMode); yield return(null); condition.Update(); // When activated condition.LifeCycle.Activate(); while (condition.LifeCycle.Stage != Stage.Active) { yield return(null); condition.Update(); } // Then the highlight is still inactive. Assert.IsFalse(snapZoneProperty.SnapZone.ShowHighlightObject); }
public IEnumerator HighlightColorCanBeChanged() { // Given a snappable property with a highlight color changed DynamicRuntimeConfiguration testRuntimeConfiguration = new DynamicRuntimeConfiguration(); testRuntimeConfiguration.SetAvailableModes(new List <IMode> { new Mode("Test", new WhitelistTypeRule <IOptional>(), new Dictionary <string, object> { { "HighlightColor", Color.yellow } }), }); RuntimeConfigurator.Configuration = testRuntimeConfiguration; SnappablePropertyMock mockedProperty = CreateSnappablePropertyMock(); SnapZoneProperty snapZoneProperty = CreateSnapZoneProperty(); SnapZone zone = snapZoneProperty.SnapZone; mockedProperty.SetSnapZone(snapZoneProperty); yield return(null); SnappedCondition condition = new SnappedCondition(mockedProperty, snapZoneProperty); condition.Configure(RuntimeConfigurator.Configuration.Modes.CurrentMode); yield return(null); condition.Update(); // When activated condition.LifeCycle.Activate(); while (condition.LifeCycle.Stage != Stage.Active) { yield return(null); condition.Update(); } // Then the highlight color changed properly Assert.AreEqual(Color.yellow, snapZoneProperty.SnapZone.ShownHighlightObjectColor); }
public IEnumerator HoverMeshShown() { // Given a snappable property with an AlwaysShowSnapzoneHighlight parameter set to false. DynamicRuntimeConfiguration testRuntimeConfiguration = new DynamicRuntimeConfiguration(); testRuntimeConfiguration.SetAvailableModes(new List <IMode> { new Mode("Test", new WhitelistTypeRule <IOptional>(), new Dictionary <string, object> { { "ShowSnapzoneHoverMeshes", true } }), }); RuntimeConfigurator.Configuration = testRuntimeConfiguration; SnappablePropertyMock mockedProperty = CreateSnappablePropertyMock(); SnapZoneProperty snapZoneProperty = CreateSnapZoneProperty(); SnapZone zone = snapZoneProperty.SnapZone; mockedProperty.SetSnapZone(snapZoneProperty); yield return(null); SnappedCondition condition = new SnappedCondition(mockedProperty, snapZoneProperty); condition.Configure(RuntimeConfigurator.Configuration.Modes.CurrentMode); // When activated condition.LifeCycle.Activate(); while (condition.LifeCycle.Stage != Stage.Active) { yield return(null); condition.Update(); } // Then the highlightAlwaysActive variable should be false Assert.IsTrue(snapZoneProperty.SnapZone.showInteractableHoverMeshes); }