mirror of
https://github.com/osukey/osukey.git
synced 2025-07-22 19:00:05 +09:00
Add tests for key counter inside player heirarchy
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -23,11 +24,17 @@ namespace osu.Game.Tests.Visual
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ContinueCondition(Player player) => base.ContinueCondition(player) && ((ScoreAccessiblePlayer)player).ScoreProcessor.TotalScore > 0;
|
protected override void AddCheckSteps(Func<Player> player)
|
||||||
|
{
|
||||||
|
base.AddCheckSteps(player);
|
||||||
|
AddUntilStep(() => ((ScoreAccessiblePlayer)player()).ScoreProcessor.TotalScore > 0, "score above zero");
|
||||||
|
AddUntilStep(() => ((ScoreAccessiblePlayer)player()).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys");
|
||||||
|
}
|
||||||
|
|
||||||
private class ScoreAccessiblePlayer : Player
|
private class ScoreAccessiblePlayer : Player
|
||||||
{
|
{
|
||||||
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||||
|
public new HUDOverlay HUDOverlay => base.HUDOverlay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play
|
|||||||
protected ScoreProcessor ScoreProcessor;
|
protected ScoreProcessor ScoreProcessor;
|
||||||
protected RulesetContainer RulesetContainer;
|
protected RulesetContainer RulesetContainer;
|
||||||
|
|
||||||
private HUDOverlay hudOverlay;
|
protected HUDOverlay HUDOverlay;
|
||||||
private FailOverlay failOverlay;
|
private FailOverlay failOverlay;
|
||||||
|
|
||||||
private DrawableStoryboard storyboard;
|
private DrawableStoryboard storyboard;
|
||||||
@ -199,7 +199,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
Child = RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
Child = RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
||||||
},
|
},
|
||||||
hudOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
|
HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
|
||||||
{
|
{
|
||||||
Clock = Clock, // hud overlay doesn't want to use the audio clock directly
|
Clock = Clock, // hud overlay doesn't want to use the audio clock directly
|
||||||
ProcessCustomClock = false,
|
ProcessCustomClock = false,
|
||||||
@ -232,8 +232,8 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
hudOverlay.HoldToQuit.Action = performUserRequestedExit;
|
HUDOverlay.HoldToQuit.Action = performUserRequestedExit;
|
||||||
hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
|
HUDOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded);
|
||||||
|
|
||||||
RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused);
|
RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused);
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
Player p = null;
|
Player p = null;
|
||||||
AddStep(ruleset.RulesetInfo.Name, () => p = loadPlayerFor(ruleset));
|
AddStep(ruleset.RulesetInfo.Name, () => p = loadPlayerFor(ruleset));
|
||||||
AddUntilStep(() => ContinueCondition(p));
|
AddCheckSteps(() => p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
Player p = null;
|
Player p = null;
|
||||||
AddStep(r.Name, () => p = loadPlayerFor(r));
|
AddStep(r.Name, () => p = loadPlayerFor(r));
|
||||||
AddUntilStep(() => ContinueCondition(p));
|
AddCheckSteps(() => p);
|
||||||
|
|
||||||
AddUntilStep(() =>
|
AddUntilStep(() =>
|
||||||
{
|
{
|
||||||
@ -79,7 +79,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual bool ContinueCondition(Player player) => player.IsLoaded;
|
protected virtual void AddCheckSteps(Func<Player> player)
|
||||||
|
{
|
||||||
|
AddUntilStep(() => player().IsLoaded, "player loaded");
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo);
|
protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user