1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 18:14:30 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestSceneScreenFooter.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

96 lines
2.9 KiB
C#
Raw Normal View History

2022-12-01 18:57:50 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
2022-12-01 18:57:50 +08:00
using NUnit.Framework;
using osu.Framework.Graphics;
2023-09-04 12:49:29 +08:00
using osu.Framework.Graphics.Cursor;
2022-12-01 23:29:52 +08:00
using osu.Framework.Testing;
using osu.Game.Overlays;
using osu.Game.Overlays.Mods;
using osu.Game.Screens.Footer;
using osu.Game.Screens.SelectV2.Footer;
2022-12-01 18:57:50 +08:00
namespace osu.Game.Tests.Visual.UserInterface
2022-12-01 18:57:50 +08:00
{
public partial class TestSceneScreenFooter : OsuManualInputManagerTestScene
2022-12-01 18:57:50 +08:00
{
2024-05-16 11:26:59 +08:00
private ScreenFooter screenFooter = null!;
private TestModSelectOverlay overlay = null!;
2022-12-01 18:57:50 +08:00
[SetUp]
public void SetUp() => Schedule(() =>
{
Children = new Drawable[]
2022-12-01 18:57:50 +08:00
{
2024-05-16 11:26:59 +08:00
overlay = new TestModSelectOverlay
{
Padding = new MarginPadding
{
Bottom = ScreenFooter.HEIGHT
}
},
2023-09-04 12:49:29 +08:00
new PopoverContainer
{
2023-09-04 12:49:29 +08:00
RelativeSizeAxes = Axes.Both,
2024-05-16 11:26:59 +08:00
Child = screenFooter = new ScreenFooter(),
},
2022-12-01 18:57:50 +08:00
};
2024-05-16 11:26:59 +08:00
screenFooter.SetButtons(new ScreenFooterButton[]
2022-12-01 23:29:52 +08:00
{
2024-05-16 11:26:59 +08:00
new ScreenFooterButtonMods(overlay) { Current = SelectedMods },
new ScreenFooterButtonRandom(),
new ScreenFooterButtonOptions(),
2022-12-01 23:29:52 +08:00
});
2022-12-01 18:57:50 +08:00
});
2023-09-05 15:44:22 +08:00
[SetUpSteps]
public void SetUpSteps()
{
2024-05-16 11:26:59 +08:00
AddStep("show footer", () => screenFooter.Show());
2023-09-05 15:44:22 +08:00
}
2024-05-16 11:26:59 +08:00
/// <summary>
/// Transition when moving from a screen with no buttons to a screen with buttons.
/// </summary>
[Test]
2024-05-16 11:26:59 +08:00
public void TestButtonsIn()
{
}
2024-05-16 11:26:59 +08:00
/// <summary>
/// Transition when moving from a screen with buttons to a screen with no buttons.
/// </summary>
2023-09-05 15:44:22 +08:00
[Test]
2024-05-16 11:26:59 +08:00
public void TestButtonsOut()
2023-09-05 15:44:22 +08:00
{
2024-05-16 11:26:59 +08:00
AddStep("clear buttons", () => screenFooter.SetButtons(Array.Empty<ScreenFooterButton>()));
2023-09-05 15:44:22 +08:00
}
2024-05-16 11:26:59 +08:00
/// <summary>
/// Transition when moving from a screen with buttons to a screen with buttons.
/// </summary>
2022-12-01 18:57:50 +08:00
[Test]
2024-05-16 11:26:59 +08:00
public void TestReplaceButtons()
2022-12-01 18:57:50 +08:00
{
2024-05-16 11:26:59 +08:00
AddStep("replace buttons", () => screenFooter.SetButtons(new[]
2022-12-01 23:29:52 +08:00
{
2024-05-16 11:26:59 +08:00
new ScreenFooterButton { Text = "One", Action = () => { } },
new ScreenFooterButton { Text = "Two", Action = () => { } },
new ScreenFooterButton { Text = "Three", Action = () => { } },
}));
2022-12-01 23:29:52 +08:00
}
2024-05-16 11:26:59 +08:00
private partial class TestModSelectOverlay : UserModSelectOverlay
2022-12-01 23:29:52 +08:00
{
2024-05-16 11:26:59 +08:00
protected override bool ShowPresets => true;
2024-05-16 12:20:55 +08:00
public TestModSelectOverlay()
: base(OverlayColourScheme.Aquamarine)
{
}
}
2022-12-01 18:57:50 +08:00
}
}