mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Add failing test coverage
This commit is contained in:
parent
04d133832f
commit
7e53df5226
@ -8,7 +8,9 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Rooms;
|
||||
@ -26,6 +28,7 @@ using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
@ -177,6 +180,30 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddAssert("ensure no submission", () => Player.SubmittedScore == null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEmptyFailStillImports()
|
||||
{
|
||||
prepareTestAPI(true);
|
||||
|
||||
createPlayerTest(true);
|
||||
|
||||
AddUntilStep("wait for token request", () => Player.TokenCreationRequested);
|
||||
|
||||
AddUntilStep("wait for fail", () => Player.GameplayState.HasFailed);
|
||||
AddUntilStep("wait for fail overlay", () => Player.FailOverlay.State.Value, () => Is.EqualTo(Visibility.Visible));
|
||||
|
||||
AddStep("attempt import", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(Player.ChildrenOfType<SaveFailedScoreButton>().Single());
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddUntilStep("wait for import to start", () => Player.ScoreImportStarted);
|
||||
AddStep("allow import", () => Player.AllowImportCompletion.Release());
|
||||
|
||||
AddUntilStep("import completed", () => Player.ImportedScore, () => Is.Not.Null);
|
||||
AddAssert("ensure no submission", () => Player.SubmittedScore, () => Is.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSubmissionOnFail()
|
||||
{
|
||||
@ -378,6 +405,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
public SemaphoreSlim AllowImportCompletion { get; }
|
||||
public Score ImportedScore { get; private set; }
|
||||
|
||||
public new FailOverlay FailOverlay => base.FailOverlay;
|
||||
|
||||
public FakeImportingPlayer(bool allowPause = true, bool showResults = true, bool pauseOnFocusLost = false)
|
||||
: base(allowPause, showResults, pauseOnFocusLost)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user