Add failing test cases

This commit is contained in:
Salman Ahmed 2022-05-11 09:51:59 +03:00
parent e43ce28ada
commit f797514bce
2 changed files with 33 additions and 0 deletions

View File

@ -7,6 +7,7 @@
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
@ -66,6 +67,13 @@ public override void SetUpSteps()
});
}
[Test]
public void TestPopoverHasFocus()
{
clickDifficultyPiece(0);
velocityPopoverHasFocus();
}
[Test]
public void TestSingleSelection()
{
@ -133,6 +141,15 @@ private void clickDifficultyPiece(int objectIndex) => AddStep($"click {objectInd
InputManager.Click(MouseButton.Left);
});
private void velocityPopoverHasFocus() => AddUntilStep("velocity popover textbox focused", () =>
{
var popover = this.ChildrenOfType<DifficultyPointPiece.DifficultyEditPopover>().SingleOrDefault();
var slider = popover?.ChildrenOfType<IndeterminateSliderWithTextBoxInput<double>>().Single();
var textbox = slider?.ChildrenOfType<OsuTextBox>().Single();
return textbox?.HasFocus == true;
});
private void velocityPopoverHasSingleValue(double velocity) => AddUntilStep($"velocity popover has {velocity}", () =>
{
var popover = this.ChildrenOfType<DifficultyPointPiece.DifficultyEditPopover>().SingleOrDefault();

View File

@ -57,6 +57,13 @@ public override void SetUpSteps()
});
}
[Test]
public void TestPopoverHasFocus()
{
clickSamplePiece(0);
samplePopoverHasFocus();
}
[Test]
public void TestSingleSelection()
{
@ -181,6 +188,15 @@ private void clickSamplePiece(int objectIndex) => AddStep($"click {objectIndex.T
InputManager.Click(MouseButton.Left);
});
private void samplePopoverHasFocus() => AddUntilStep("sample popover textbox focused", () =>
{
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().SingleOrDefault();
var slider = popover?.ChildrenOfType<IndeterminateSliderWithTextBoxInput<int>>().Single();
var textbox = slider?.ChildrenOfType<OsuTextBox>().Single();
return textbox?.HasFocus == true;
});
private void samplePopoverHasSingleVolume(int volume) => AddUntilStep($"sample popover has volume {volume}", () =>
{
var popover = this.ChildrenOfType<SamplePointPiece.SampleEditPopover>().SingleOrDefault();