Skip to content

Commit

Permalink
Add test coverage of song bar crash
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Aug 21, 2023
1 parent 8561d80 commit 5009fd3
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions osu.Game.Tournament.Tests/Components/TestSceneSongBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -38,12 +45,14 @@ public void TestSongBar()
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);
});
Expand Down

0 comments on commit 5009fd3

Please sign in to comment.