1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 04:02:57 +08:00

Add missing test coverage of score import process being tracked correctly

This commit is contained in:
Dean Herbert 2021-11-06 16:45:27 +09:00
parent 2881ce0f5a
commit b8fb22b769

View File

@ -11,6 +11,7 @@ using osu.Game.Users;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Testing;
using osu.Game.Database;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
@ -113,6 +114,36 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
}
[Resolved]
private ScoreManager scoreManager { get; set; }
[Test]
public void TestScoreImportThenDelete()
{
ILive<ScoreInfo> imported = null;
AddStep("create button without replay", () =>
{
Child = downloadButton = new TestReplayDownloadButton(getScoreInfo(false))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
});
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true)).Result);
AddUntilStep("state is available", () => downloadButton.State.Value == DownloadState.LocallyAvailable);
AddStep("delete score", () => scoreManager.Delete(imported.Value));
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
}
[Test]
public void CreateButtonWithNoScore()
{