2022-02-27 22:31:34 +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 NUnit.Framework;
|
|
|
|
using osu.Framework.Graphics;
|
2023-08-01 13:56:02 +08:00
|
|
|
using osu.Framework.Testing;
|
2022-02-27 22:31:34 +08:00
|
|
|
using osu.Game.Beatmaps.Legacy;
|
|
|
|
using osu.Game.Tournament.Components;
|
2022-02-28 10:59:10 +08:00
|
|
|
using osu.Game.Tournament.Models;
|
2022-02-27 22:31:34 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Tests.Components
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2023-08-20 16:57:45 +08:00
|
|
|
public partial class TestSceneSongBar : TournamentTestScene
|
2022-02-27 22:31:34 +08:00
|
|
|
{
|
2023-08-01 13:56:02 +08:00
|
|
|
private SongBar songBar = null!;
|
2023-08-21 15:10:48 +08:00
|
|
|
private TournamentBeatmap ladderBeatmap = null!;
|
2022-02-27 22:31:34 +08:00
|
|
|
|
2023-08-01 13:56:02 +08:00
|
|
|
[SetUpSteps]
|
2023-08-20 16:57:45 +08:00
|
|
|
public override void SetUpSteps()
|
2023-08-01 13:56:02 +08:00
|
|
|
{
|
2023-08-20 16:57:45 +08:00
|
|
|
base.SetUpSteps();
|
|
|
|
|
|
|
|
AddStep("setup picks bans", () =>
|
|
|
|
{
|
2023-08-21 15:10:48 +08:00
|
|
|
ladderBeatmap = CreateSampleBeatmap();
|
2023-08-20 16:57:45 +08:00
|
|
|
Ladder.CurrentMatch.Value!.PicksBans.Add(new BeatmapChoice
|
|
|
|
{
|
2023-08-21 15:10:48 +08:00
|
|
|
BeatmapID = ladderBeatmap.OnlineID,
|
2023-08-20 16:57:45 +08:00
|
|
|
Team = TeamColour.Red,
|
|
|
|
Type = ChoiceType.Pick,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2022-02-27 22:31:34 +08:00
|
|
|
AddStep("create bar", () => Child = songBar = new SongBar
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre
|
|
|
|
});
|
|
|
|
AddUntilStep("wait for loaded", () => songBar.IsLoaded);
|
2023-08-01 13:56:02 +08:00
|
|
|
}
|
2022-02-27 22:31:34 +08:00
|
|
|
|
2023-08-01 13:56:02 +08:00
|
|
|
[Test]
|
|
|
|
public void TestSongBar()
|
|
|
|
{
|
2022-02-27 22:31:34 +08:00
|
|
|
AddStep("set beatmap", () =>
|
|
|
|
{
|
|
|
|
var beatmap = CreateAPIBeatmap(Ruleset.Value);
|
2023-08-20 16:57:45 +08:00
|
|
|
|
2022-02-27 22:31:34 +08:00
|
|
|
beatmap.CircleSize = 3.4f;
|
|
|
|
beatmap.ApproachRate = 6.8f;
|
|
|
|
beatmap.OverallDifficulty = 5.5f;
|
|
|
|
beatmap.StarRating = 4.56f;
|
|
|
|
beatmap.Length = 123456;
|
|
|
|
beatmap.BPM = 133;
|
2023-08-21 15:10:48 +08:00
|
|
|
beatmap.OnlineID = ladderBeatmap.OnlineID;
|
2022-02-27 22:31:34 +08:00
|
|
|
|
2022-06-18 06:34:09 +08:00
|
|
|
songBar.Beatmap = new TournamentBeatmap(beatmap);
|
2022-02-27 22:31:34 +08:00
|
|
|
});
|
2023-08-31 18:03:56 +08:00
|
|
|
|
2022-02-27 22:31:34 +08:00
|
|
|
AddStep("set mods to HR", () => songBar.Mods = LegacyMods.HardRock);
|
|
|
|
AddStep("set mods to DT", () => songBar.Mods = LegacyMods.DoubleTime);
|
|
|
|
AddStep("unset mods", () => songBar.Mods = LegacyMods.None);
|
2023-08-31 18:03:56 +08:00
|
|
|
|
|
|
|
AddToggleStep("toggle expanded", expanded => songBar.Expanded = expanded);
|
|
|
|
|
|
|
|
AddStep("set null beatmap", () => songBar.Beatmap = null);
|
2022-02-27 22:31:34 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|