mirror of
https://github.com/osukey/osukey.git
synced 2025-05-29 09:27:18 +09:00
Add test for disabled keycounter, don't discard change event values
This commit is contained in:
parent
1ce972dd5b
commit
3d344a076d
@ -47,21 +47,22 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
Key testKey = ((KeyCounterKeyboard)kc.Children.First()).Key;
|
Key testKey = ((KeyCounterKeyboard)kc.Children.First()).Key;
|
||||||
|
|
||||||
AddStep($"Press {testKey} key", () =>
|
void addPressKeyStep()
|
||||||
{
|
{
|
||||||
InputManager.PressKey(testKey);
|
AddStep($"Press {testKey} key", () =>
|
||||||
InputManager.ReleaseKey(testKey);
|
{
|
||||||
});
|
InputManager.PressKey(testKey);
|
||||||
|
InputManager.ReleaseKey(testKey);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
addPressKeyStep();
|
||||||
AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses == 1);
|
AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses == 1);
|
||||||
|
addPressKeyStep();
|
||||||
AddStep($"Press {testKey} key", () =>
|
|
||||||
{
|
|
||||||
InputManager.PressKey(testKey);
|
|
||||||
InputManager.ReleaseKey(testKey);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses == 2);
|
AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses == 2);
|
||||||
|
AddStep($"Disable counting", () => testCounter.IsCounting = false);
|
||||||
|
addPressKeyStep();
|
||||||
|
AddAssert($"Check {testKey} count has not changed", () => testCounter.CountPresses == 2);
|
||||||
|
|
||||||
Add(kc);
|
Add(kc);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,10 @@ namespace osu.Game.Screens.Play
|
|||||||
addGameplayComponents(GameplayClockContainer, Beatmap.Value);
|
addGameplayComponents(GameplayClockContainer, Beatmap.Value);
|
||||||
addOverlayComponents(GameplayClockContainer, Beatmap.Value);
|
addOverlayComponents(GameplayClockContainer, Beatmap.Value);
|
||||||
|
|
||||||
DrawableRuleset.HasReplayLoaded.BindValueChanged(_ => updatePauseOnFocusLostState(), true);
|
DrawableRuleset.HasReplayLoaded.BindValueChanged(e =>
|
||||||
|
{
|
||||||
|
updatePauseOnFocusLostState(e.NewValue, BreakOverlay.IsBreakTime.Value);
|
||||||
|
}, true);
|
||||||
|
|
||||||
// bind clock into components that require it
|
// bind clock into components that require it
|
||||||
DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);
|
DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);
|
||||||
@ -184,7 +187,7 @@ namespace osu.Game.Screens.Play
|
|||||||
foreach (var mod in Mods.Value.OfType<IApplicableToHealthProcessor>())
|
foreach (var mod in Mods.Value.OfType<IApplicableToHealthProcessor>())
|
||||||
mod.ApplyToHealthProcessor(HealthProcessor);
|
mod.ApplyToHealthProcessor(HealthProcessor);
|
||||||
|
|
||||||
BreakOverlay.IsBreakTime.BindValueChanged(_ => onBreakTimeChanged(), true);
|
BreakOverlay.IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addUnderlayComponents(Container target)
|
private void addUnderlayComponents(Container target)
|
||||||
@ -286,16 +289,16 @@ namespace osu.Game.Screens.Play
|
|||||||
HealthProcessor.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
|
HealthProcessor.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onBreakTimeChanged()
|
private void onBreakTimeChanged(ValueChangedEvent<bool> changeEvent)
|
||||||
{
|
{
|
||||||
updatePauseOnFocusLostState();
|
updatePauseOnFocusLostState(DrawableRuleset.HasReplayLoaded.Value, changeEvent.NewValue);
|
||||||
HUDOverlay.KeyCounter.IsCounting = !BreakOverlay.IsBreakTime.Value;
|
HUDOverlay.KeyCounter.IsCounting = !changeEvent.NewValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePauseOnFocusLostState() =>
|
private void updatePauseOnFocusLostState(bool replayLoaded, bool isBreakTime) =>
|
||||||
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
|
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
|
||||||
&& !DrawableRuleset.HasReplayLoaded.Value
|
&& !replayLoaded
|
||||||
&& !BreakOverlay.IsBreakTime.Value;
|
&& !isBreakTime;
|
||||||
|
|
||||||
private IBeatmap loadPlayableBeatmap()
|
private IBeatmap loadPlayableBeatmap()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user