Inheritance Hierarchy
DeltaEngine.Platforms TestWithMocksOrVisually
DeltaEngine.Scenes.Tests.Controls RadioDialogTests
Namespace: DeltaEngine.Scenes.Tests.Controls
Assembly: DeltaEngine.Scenes.Tests (in DeltaEngine.Scenes.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The RadioDialogTests type exposes the following members.
Constructors
Name | Description | |
---|---|---|
RadioDialogTests | Initializes a new instance of the RadioDialogTests class |
Methods
Properties
Name | Description | |
---|---|---|
IsMockResolver | (Inherited from TestWithMocksOrVisually.) |
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] public void RenderGrowingRadioDialog() { dialog.Start<Grow>(); dialog.Start<SetText>(); }
[Test, CloseAfterFirstFrame] public void ClickingRadioButtonSelectsIt() { if (mouse == null) return; // ncrunch: no coverage var buttons = dialog.Get<List<RadioButton>>(); Assert.IsFalse(buttons[1].State.IsSelected); PressAndReleaseMouse(Vector2D.One); Assert.IsFalse(buttons[1].State.IsSelected); PressAndReleaseMouse(new Vector2D(0.35f, 0.5f)); Assert.IsTrue(buttons[1].State.IsSelected); }
[Test, CloseAfterFirstFrame] public void ClickingOneRadioButtonCausesTheOthersToUnselect() { if (mouse == null) return; //ncrunch: no coverage var buttons = dialog.Get<List<RadioButton>>(); PressAndReleaseMouse(new Vector2D(0.35f, 0.5f)); Assert.IsTrue(buttons[1].State.IsSelected); PressAndReleaseMouse(new Vector2D(0.35f, 0.6f)); Assert.IsFalse(buttons[1].State.IsSelected); Assert.IsTrue(buttons[2].State.IsSelected); }
[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); }
[Test, CloseAfterFirstFrame] public void DisablingDialogDisablesAllButtons() { dialog.IsEnabled = false; var buttons = dialog.Get<List<RadioButton>>(); foreach (RadioButton button in buttons) Assert.IsFalse(button.IsEnabled); }
[Test, CloseAfterFirstFrame] public void ReEnableDialogEnablesAllButtons() { dialog.IsEnabled = false; dialog.IsEnabled = true; var buttons = dialog.Get<List<RadioButton>>(); foreach (RadioButton button in buttons) Assert.IsTrue(button.IsEnabled); }
[Test] public void RenderRadioDialogAttachedToMouse() { new Command(point => dialog.DrawArea = Rectangle.FromCenter(point, dialog.DrawArea.Size)). Add(new MouseMovementTrigger()); }
[Test, CloseAfterFirstFrame] public void SaveAndLoad() { var stream = BinaryDataExtensions.SaveToMemoryStream(dialog); var loadedDialog = (RadioDialog)stream.CreateFromMemoryStream(); Assert.AreEqual(3, loadedDialog.Buttons.Count); Assert.AreEqual(dialog.Buttons[1].DrawArea, loadedDialog.Buttons[1].DrawArea); Assert.AreEqual(dialog.Buttons[1].Text, loadedDialog.Buttons[1].Text); }
[Test] public void DrawLoadedRadioDialog() { var stream = BinaryDataExtensions.SaveToMemoryStream(dialog); dialog.IsActive = false; stream.CreateFromMemoryStream(); }
[Test] public void DrawLoadedRadioDialogAttachedToMouse() { var stream = BinaryDataExtensions.SaveToMemoryStream(dialog); dialog.IsActive = false; var loadedDialog = (RadioDialog)stream.CreateFromMemoryStream(); new Command(point => loadedDialog.DrawArea = Rectangle.FromCenter(point, loadedDialog.DrawArea.Size)).Add(new MouseMovementTrigger()); }
See Also