1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 18:23:04 +08:00

Add base song select components test scene

This commit is contained in:
Joseph Madamba 2024-08-12 20:01:42 -07:00
parent 6840f4bca4
commit 46d41cb590
3 changed files with 48 additions and 5 deletions

View File

@ -17,7 +17,6 @@ using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens;
using osu.Game.Screens.Footer;
using osu.Game.Screens.Menu;
using osu.Game.Screens.SelectV2;
using osu.Game.Screens.SelectV2.Footer;
using osuTK.Input;
@ -63,8 +62,8 @@ namespace osu.Game.Tests.Visual.SongSelect
{
base.SetUpSteps();
AddStep("load screen", () => Stack.Push(new SongSelectV2()));
AddUntilStep("wait for load", () => Stack.CurrentScreen is SongSelectV2 songSelect && songSelect.IsLoaded);
AddStep("load screen", () => Stack.Push(new Screens.SelectV2.SongSelectV2()));
AddUntilStep("wait for load", () => Stack.CurrentScreen is Screens.SelectV2.SongSelectV2 songSelect && songSelect.IsLoaded);
}
#region Footer

View File

@ -5,7 +5,6 @@ using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Screens.Menu;
using osu.Game.Screens.SelectV2;
using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelect
@ -17,7 +16,7 @@ namespace osu.Game.Tests.Visual.SongSelect
base.SetUpSteps();
AddStep("press enter", () => InputManager.Key(Key.Enter));
AddWaitStep("wait", 5);
PushAndConfirm(() => new SongSelectV2());
PushAndConfirm(() => new Screens.SelectV2.SongSelectV2());
}
[Test]

View File

@ -0,0 +1,45 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.SongSelectV2
{
public abstract partial class SongSelectComponentsTestScene : OsuTestScene
{
[Cached]
protected readonly OverlayColourProvider ColourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
/// <summary>
/// The beatmap. Can be local/online depending on the context.
/// </summary>
[Cached(typeof(IBindable<IBeatmapInfo?>))]
protected readonly Bindable<IBeatmapInfo?> BeatmapInfo = new Bindable<IBeatmapInfo?>();
protected override void LoadComplete()
{
base.LoadComplete();
// mimics song select's `WorkingBeatmap` binding
Beatmap.BindValueChanged(b =>
{
BeatmapInfo.Value = b.NewValue.BeatmapInfo;
});
}
[SetUpSteps]
public virtual void SetUpSteps()
{
AddStep("reset dependencies", () =>
{
Beatmap.SetDefault();
SelectedMods.SetDefault();
BeatmapInfo.Value = null;
});
}
}
}