Namespace: DeltaEngine.Scenes.Controls
Assembly: DeltaEngine.Scenes (in DeltaEngine.Scenes.dll) Version: 1.1.1.0 (1.1.1)
Tests: DeltaEngine.Scenes.Tests.Controls.ScrollbarTests
Tests: DeltaEngine.Scenes.Tests.Controls.ButtonTests
Tests: DeltaEngine.Scenes.Tests.Controls.InteractiveButtonTests
Tests: DeltaEngine.Scenes.Tests.Controls.RadioButtonTests
Tests: DeltaEngine.Scenes.Tests.Controls.RadioDialogTests
Tests: DeltaEngine.Scenes.Tests.Controls.SliderTests
Tests: DeltaEngine.Scenes.Tests.Controls.TextBoxTests
3 unit tests call DeltaEngine.Scenes.Controls.Control.IsEnabled
3 unit tests call DeltaEngine.Scenes.Controls.Control.IsEnabled
3 unit tests call DeltaEngine.Scenes.Controls.Control.IsEnabled
2 unit tests call DeltaEngine.Scenes.Controls.Control.IsEnabled
5 unit tests call DeltaEngine.Scenes.Controls.Control.IsEnabled
3 unit tests call DeltaEngine.Scenes.Controls.Control.IsEnabled
5 unit tests call DeltaEngine.Scenes.Controls.Control.IsEnabled
Assembly: DeltaEngine.Scenes (in DeltaEngine.Scenes.dll) Version: 1.1.1.0 (1.1.1)
Syntax
Property Value
Type: BooleanRemarks
Remarks
Remarks
Remarks
Remarks
Remarks
Remarks
Examples
[Test, CloseAfterFirstFrame] public void DefaultsToEnabled() { Assert.IsTrue(scrollbar.IsEnabled); Assert.AreEqual(Color.Gray, scrollbar.Color); Assert.AreEqual(Color.LightGray, scrollbar.Pointer.Color); }
[Test, CloseAfterFirstFrame] public void DisablingScrollbarDisablesPointer() { scrollbar.IsEnabled = false; Assert.IsFalse(scrollbar.IsEnabled); Assert.IsFalse(scrollbar.Pointer.IsEnabled); }
[Test] public void RenderDisabledScrollbar() { scrollbar.IsEnabled = false; AdvanceTimeAndUpdateEntities(); Assert.AreEqual(Color.DarkGray, scrollbar.Color); Assert.AreEqual(Color.Gray, scrollbar.Pointer.Color); }
Examples
[Test] public void RenderOneButtonEnablingAndDisablingAnother() { var button2 = new Button(Rectangle.FromCenter(0.5f, 0.3f, 0.2f, 0.1f)); button2.Clicked += () => button.IsEnabled = !button.IsEnabled; }
[Test, CloseAfterFirstFrame] public void DefaultsToEnabled() { Assert.IsTrue(button.IsEnabled); }
[Test, CloseAfterFirstFrame] public void DisabledControlDoesNotRespondToClick() { if (!IsMockResolver) return; //ncrunch: no coverage button.IsEnabled = false; bool clicked = false; button.Clicked += () => clicked = true; PressAndReleaseMouse(new Vector2D(0.53f, 0.52f), new Vector2D(0.53f, 0.52f)); Assert.IsFalse(clicked); Assert.IsFalse(button.State.IsInside); Assert.AreEqual(Vector2D.Zero, button.State.RelativePointerPosition); }
Examples
[Test, ApproveFirstFrameScreenshot] public void RenderDisabledInteractiveButton() { button.IsEnabled = false; }
[Test, CloseAfterFirstFrame] public void DefaultsToEnabled() { Assert.IsTrue(button.IsEnabled); }
[Test, CloseAfterFirstFrame] public void BeginningClickDoesNothingIfDisabled() { button.IsEnabled = false; SetMouseState(State.Pressing, Vector2D.Half); Assert.AreEqual(BaseSize.Width, button.Size.Width, 0.05f); }
Examples
[Test, ApproveFirstFrameScreenshot] public void RenderThreeRadioButtonsWithTheMiddleDisabled() { new RadioButton(Top, "Hello"); new RadioButton(Bottom, "Hey"); centerButton.IsEnabled = false; AdvanceTimeAndUpdateEntities(); Assert.AreEqual(Color.DarkGray, centerButton.Color); }
[Test, CloseAfterFirstFrame] public void DefaultsToEnabled() { Assert.IsTrue(centerButton.IsEnabled); Assert.AreEqual(Color.Gray, centerButton.Color); }
Examples
[Test] public void RenderRadioDialogWithThreeButtonsWithTheMiddleDisabled() { var buttons = dialog.Get<List<RadioButton>>(); buttons[1].IsEnabled = false; AdvanceTimeAndUpdateEntities(); Assert.AreEqual(Color.Gray, buttons[0].Color); Assert.AreEqual(Color.DarkGray, buttons[1].Color); }
[Test, CloseAfterFirstFrame] public void ClickingRadioButtonDoesNotSelectItIfDisabled() { var buttons = dialog.Get<List<RadioButton>>(); buttons[1].IsEnabled = false; PressAndReleaseMouse(new Vector2D(0.35f, 0.5f)); Assert.IsFalse(buttons[1].State.IsSelected); }
[Test, CloseAfterFirstFrame] public void ClickingDisabledRadioButtonDoesNotCauseTheOthersToUnselect() { if (mouse == null) return; //ncrunch: no coverage var buttons = dialog.Get<List<RadioButton>>(); buttons[2].IsEnabled = false; PressAndReleaseMouse(new Vector2D(0.35f, 0.5f)); PressAndReleaseMouse(new Vector2D(0.35f, 0.6f)); Assert.IsTrue(buttons[1].State.IsSelected); Assert.IsFalse(buttons[2].State.IsSelected); }
Examples
[Test, CloseAfterFirstFrame] public void DefaultProperties() { Assert.IsTrue(slider.IsEnabled); Assert.AreEqual(Color.Gray, slider.Color); Assert.AreEqual(Color.LightGray, slider.Pointer.Color); Assert.AreEqual(0, slider.MinValue); Assert.AreEqual(100, slider.Value); Assert.AreEqual(100, slider.MaxValue); }
[Test, CloseAfterFirstFrame] public void DisablingSliderDisablesPointer() { slider.IsEnabled = false; Assert.IsFalse(slider.IsEnabled); Assert.IsFalse(slider.Pointer.IsEnabled); }
[Test] public void RenderDisabledSlider() { slider.IsEnabled = false; AdvanceTimeAndUpdateEntities(); Assert.AreEqual(Color.DarkGray, slider.Color); Assert.AreEqual(Color.Gray, slider.Pointer.Color); }
Examples
[Test, CloseAfterFirstFrame] public void DefaultsToEnabled() { Assert.IsTrue(topTextBox.IsEnabled); }
[Test, ApproveFirstFrameScreenshot] public void RenderOneEnabledAndOneDisabledTextBox() { bottomTextBox.IsEnabled = false; AdvanceTimeAndUpdateEntities(); Assert.AreEqual(Color.Gray, topTextBox.Color); Assert.AreEqual(Color.DarkGray, bottomTextBox.Color); }
[Test, CloseAfterFirstFrame] public void ClickingTextBoxDoesNotGivesItFocusIfItIsDisabled() { topTextBox.IsEnabled = false; PressAndReleaseMouse(Top.Center); Assert.IsFalse(topTextBox.State.HasFocus); }
See Also