1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 17:53:15 +08:00

Add failing test case for edge case

This commit is contained in:
Salman Ahmed 2024-07-10 11:51:49 +03:00
parent 002679ebb0
commit f0a7a3f856

View File

@ -23,7 +23,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
private DependencyProvidingContainer contentContainer = null!; private DependencyProvidingContainer contentContainer = null!;
private ScreenFooter screenFooter = null!; private ScreenFooter screenFooter = null!;
private TestModSelectOverlay overlay = null!; private TestModSelectOverlay modOverlay = null!;
[SetUp] [SetUp]
public void SetUp() => Schedule(() => public void SetUp() => Schedule(() =>
@ -39,7 +39,7 @@ namespace osu.Game.Tests.Visual.UserInterface
}, },
Children = new Drawable[] Children = new Drawable[]
{ {
overlay = new TestModSelectOverlay(), modOverlay = new TestModSelectOverlay(),
new PopoverContainer new PopoverContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -51,7 +51,7 @@ namespace osu.Game.Tests.Visual.UserInterface
screenFooter.SetButtons(new ScreenFooterButton[] screenFooter.SetButtons(new ScreenFooterButton[]
{ {
new ScreenFooterButtonMods(overlay) { Current = SelectedMods }, new ScreenFooterButtonMods(modOverlay) { Current = SelectedMods },
new ScreenFooterButtonRandom(), new ScreenFooterButtonRandom(),
new ScreenFooterButtonOptions(), new ScreenFooterButtonOptions(),
}); });
@ -178,6 +178,24 @@ namespace osu.Game.Tests.Visual.UserInterface
AddAssert("footer hidden", () => screenFooter.State.Value == Visibility.Hidden); AddAssert("footer hidden", () => screenFooter.State.Value == Visibility.Hidden);
} }
[Test]
public void TestLoadOverlayAfterFooterIsDisplayed()
{
TestShearedOverlayContainer externalOverlay = null!;
AddStep("show mod overlay", () => modOverlay.Show());
AddUntilStep("mod footer content shown", () => this.ChildrenOfType<ModSelectFooterContent>().SingleOrDefault()?.IsPresent, () => Is.True);
AddStep("add external overlay", () => contentContainer.Add(externalOverlay = new TestShearedOverlayContainer()));
AddUntilStep("wait for load", () => externalOverlay.IsLoaded);
AddAssert("mod footer content still shown", () => this.ChildrenOfType<ModSelectFooterContent>().SingleOrDefault()?.IsPresent, () => Is.True);
AddAssert("external overlay content not shown", () => this.ChildrenOfType<TestShearedOverlayContainer.TestFooterContent>().SingleOrDefault()?.IsPresent, () => Is.Not.True);
AddStep("hide mod overlay", () => modOverlay.Hide());
AddUntilStep("mod footer content hidden", () => this.ChildrenOfType<ModSelectFooterContent>().SingleOrDefault()?.IsPresent, () => Is.Not.True);
AddAssert("external overlay content still not shown", () => this.ChildrenOfType<TestShearedOverlayContainer.TestFooterContent>().SingleOrDefault()?.IsPresent, () => Is.Not.True);
}
private partial class TestModSelectOverlay : UserModSelectOverlay private partial class TestModSelectOverlay : UserModSelectOverlay
{ {
protected override bool ShowPresets => true; protected override bool ShowPresets => true;