1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 11:27:44 +08:00
osu-lazer/osu.Game.Tests/Visual/Gameplay/TestSceneFailJudgement.cs

45 lines
1.4 KiB
C#
Raw Normal View History

2019-08-09 13:04:56 +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 System;
using System.Linq;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneFailJudgement : AllPlayersTestScene
{
protected override Player CreatePlayer(Ruleset ruleset)
{
Mods.Value = Array.Empty<Mod>();
2019-09-19 04:17:24 +08:00
return new FailPlayer();
2019-08-09 13:04:56 +08:00
}
protected override void AddCheckSteps()
{
AddUntilStep("wait for fail", () => Player.HasFailed);
AddUntilStep("wait for multiple judged objects", () => ((FailPlayer)Player).DrawableRuleset.Playfield.AllHitObjects.Count(h => h.AllJudged) > 1);
2019-09-06 15:51:30 +08:00
AddAssert("total judgements == 1", () => ((FailPlayer)Player).ScoreProcessor.JudgedHits == 1);
2019-08-09 13:04:56 +08:00
}
2019-09-19 04:17:24 +08:00
private class FailPlayer : TestPlayer
2019-08-09 13:04:56 +08:00
{
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
2019-09-19 04:17:24 +08:00
public FailPlayer()
: base(false, false)
2019-08-09 13:04:56 +08:00
{
}
protected override void LoadComplete()
{
base.LoadComplete();
ScoreProcessor.FailConditions += (_, __) => true;
}
}
}
}