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.
|
|
|
|
|
2024-05-10 07:21:06 +08:00
|
|
|
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;
|
2022-12-03 01:44:21 +08:00
|
|
|
using osu.Game.Overlays;
|
|
|
|
using osu.Game.Overlays.Mods;
|
2024-05-16 09:36:14 +08:00
|
|
|
using osu.Game.Screens.Footer;
|
|
|
|
using osu.Game.Screens.SelectV2.Footer;
|
2022-12-01 18:57:50 +08:00
|
|
|
|
2024-05-16 09:36:14 +08:00
|
|
|
namespace osu.Game.Tests.Visual.UserInterface
|
2022-12-01 18:57:50 +08:00
|
|
|
{
|
2024-05-16 09:36:14 +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-03 01:44:21 +08:00
|
|
|
|
2022-12-01 18:57:50 +08:00
|
|
|
[SetUp]
|
|
|
|
public void SetUp() => Schedule(() =>
|
|
|
|
{
|
2022-12-03 01:44:21 +08:00
|
|
|
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
|
2022-12-03 01:44:21 +08:00
|
|
|
{
|
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-03 01:44:21 +08:00
|
|
|
},
|
2022-12-01 18:57:50 +08:00
|
|
|
};
|
2022-12-01 20:13:37 +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>
|
2024-05-10 07:21:06 +08:00
|
|
|
[Test]
|
2024-05-16 11:26:59 +08:00
|
|
|
public void TestButtonsIn()
|
2024-05-10 07:21:06 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
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-03 01:44:21 +08:00
|
|
|
}
|
2022-12-01 18:57:50 +08:00
|
|
|
}
|
|
|
|
}
|