mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 18:07:28 +08:00
Merge branch 'master' into catch-relax-no-cursor
This commit is contained in:
commit
f42340eabe
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -187,18 +188,22 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestInputDoesntWorkWhenHUDHidden()
|
public void TestInputDoesntWorkWhenHUDHidden()
|
||||||
{
|
{
|
||||||
SongProgressBar getSongProgress() => hudOverlay.ChildrenOfType<SongProgressBar>().Single();
|
SongProgressBar? getSongProgress() => hudOverlay.ChildrenOfType<SongProgressBar>().SingleOrDefault();
|
||||||
|
|
||||||
bool seeked = false;
|
bool seeked = false;
|
||||||
|
|
||||||
createNew();
|
createNew();
|
||||||
|
|
||||||
|
AddUntilStep("wait for song progress", () => getSongProgress() != null);
|
||||||
|
|
||||||
AddStep("bind seek", () =>
|
AddStep("bind seek", () =>
|
||||||
{
|
{
|
||||||
seeked = false;
|
seeked = false;
|
||||||
|
|
||||||
var progress = getSongProgress();
|
var progress = getSongProgress();
|
||||||
|
|
||||||
|
Debug.Assert(progress != null);
|
||||||
|
|
||||||
progress.ShowHandle = true;
|
progress.ShowHandle = true;
|
||||||
progress.OnSeek += _ => seeked = true;
|
progress.OnSeek += _ => seeked = true;
|
||||||
});
|
});
|
||||||
|
@ -107,7 +107,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
||||||
|
|
||||||
AddAssert("state is available", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
checkState(DownloadState.NotDownloaded);
|
||||||
|
|
||||||
AddStep("click button", () =>
|
AddStep("click button", () =>
|
||||||
{
|
{
|
||||||
@ -133,7 +133,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
||||||
|
|
||||||
AddAssert("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
checkState(DownloadState.NotDownloaded);
|
||||||
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
||||||
|
|
||||||
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
checkState(DownloadState.NotDownloaded);
|
||||||
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,17 +174,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
||||||
|
checkState(DownloadState.NotDownloaded);
|
||||||
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
|
||||||
|
|
||||||
AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true)));
|
AddStep("import score", () => imported = scoreManager.Import(getScoreInfo(true)));
|
||||||
|
|
||||||
AddUntilStep("state is available", () => downloadButton.State.Value == DownloadState.LocallyAvailable);
|
checkState(DownloadState.LocallyAvailable);
|
||||||
AddAssert("button is enabled", () => downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
AddAssert("button is enabled", () => downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||||
|
|
||||||
AddStep("delete score", () => scoreManager.Delete(imported.Value));
|
AddStep("delete score", () => scoreManager.Delete(imported.Value));
|
||||||
|
|
||||||
AddUntilStep("state is not downloaded", () => downloadButton.State.Value == DownloadState.NotDownloaded);
|
checkState(DownloadState.NotDownloaded);
|
||||||
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,10 +201,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
AddUntilStep("wait for load", () => downloadButton.IsLoaded);
|
||||||
|
|
||||||
AddAssert("state is unknown", () => downloadButton.State.Value == DownloadState.Unknown);
|
checkState(DownloadState.Unknown);
|
||||||
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
AddAssert("button is not enabled", () => !downloadButton.ChildrenOfType<DownloadButton>().First().Enabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkState(DownloadState expectedState) =>
|
||||||
|
AddUntilStep($"state is {expectedState}", () => downloadButton.State.Value, () => Is.EqualTo(expectedState));
|
||||||
|
|
||||||
private ScoreInfo getScoreInfo(bool replayAvailable, bool hasOnlineId = true) => new ScoreInfo
|
private ScoreInfo getScoreInfo(bool replayAvailable, bool hasOnlineId = true) => new ScoreInfo
|
||||||
{
|
{
|
||||||
OnlineID = hasOnlineId ? online_score_id : 0,
|
OnlineID = hasOnlineId ? online_score_id : 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user