1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Add test coverage of song bar crash

This commit is contained in:
Dean Herbert 2023-08-20 17:57:45 +09:00
parent 8561d809b0
commit 5009fd3794

View File

@ -2,27 +2,34 @@
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Tests.Visual;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Tests.Components
{
[TestFixture]
public partial class TestSceneSongBar : OsuTestScene
public partial class TestSceneSongBar : TournamentTestScene
{
[Cached]
private readonly LadderInfo ladder = new LadderInfo();
private SongBar songBar = null!;
[SetUpSteps]
public void SetUpSteps()
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("setup picks bans", () =>
{
Ladder.CurrentMatch.Value!.PicksBans.Add(new BeatmapChoice
{
BeatmapID = CreateSampleBeatmap().OnlineID,
Team = TeamColour.Red,
Type = ChoiceType.Pick,
});
});
AddStep("create bar", () => Child = songBar = new SongBar
{
RelativeSizeAxes = Axes.X,
@ -38,12 +45,14 @@ namespace osu.Game.Tournament.Tests.Components
AddStep("set beatmap", () =>
{
var beatmap = CreateAPIBeatmap(Ruleset.Value);
beatmap.CircleSize = 3.4f;
beatmap.ApproachRate = 6.8f;
beatmap.OverallDifficulty = 5.5f;
beatmap.StarRating = 4.56f;
beatmap.Length = 123456;
beatmap.BPM = 133;
beatmap.OnlineID = CreateSampleBeatmap().OnlineID;
songBar.Beatmap = new TournamentBeatmap(beatmap);
});