1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-25 17:49:57 +08:00

Add failing test

This commit is contained in:
Bartłomiej Dach
2025-12-19 12:05:36 +01:00
Unverified
parent 6de1f0cd4d
commit 32454caaa9
@@ -107,5 +107,63 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("slider is default", () => slider.Current.IsDefault);
}
[Test]
public void TestDisabled()
{
FormSliderBar<float> slider = null!;
AddStep("create content", () =>
{
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 0.5f,
Direction = FillDirection.Vertical,
Spacing = new Vector2(10),
Children = new Drawable[]
{
slider = new FormSliderBar<float>
{
Caption = "Slider",
Current = new BindableFloat
{
MinValue = 0,
MaxValue = 10,
Precision = 0.1f,
Default = 5f,
}
},
}
};
});
AddStep("set slider to 1", () => slider.Current.Value = 1);
AddStep("disable slider", () => slider.Current.Disabled = true);
AddStep("move mouse to nub", () => InputManager.MoveMouseTo(slider.ChildrenOfType<Circle>().Single()));
AddStep("double click nub", () =>
{
InputManager.Click(MouseButton.Left);
InputManager.Click(MouseButton.Left);
});
AddAssert("slider is still at 1", () => slider.Current.Value, () => Is.EqualTo(1));
AddStep("click on textbox part", () =>
{
InputManager.MoveMouseTo(slider.ChildrenOfType<FormTextBox.InnerTextBox>().Single());
InputManager.Click(MouseButton.Left);
});
AddAssert("no text selected", () => slider.ChildrenOfType<FormTextBox.InnerTextBox>().Single().SelectedText, () => Is.Empty);
AddStep("attempt to input text", () =>
{
InputManager.Key(Key.Number4);
InputManager.Key(Key.Enter);
});
AddAssert("slider is still at 1", () => slider.Current.Value, () => Is.EqualTo(1));
}
}
}