1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 15:53:21 +08:00

Update visual tests

This commit is contained in:
Lucas A 2020-03-16 21:48:28 +01:00
parent 1aacd1aaa2
commit 8c611a981f

View File

@ -103,6 +103,38 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("return value", () => config.Set<bool>(OsuSetting.KeyOverlay, keyCounterVisibleValue));
}
[Test]
public void TestChangeHealthValue()
{
void applyToHealthDisplays(double value)
{
if (hudOverlay == null) return;
hudOverlay.LowHealthDisplay.Current.Value = value;
hudOverlay.HealthDisplay.Current.Value = value;
}
createNew();
AddSliderStep("health value", 0, 1, 0.5, applyToHealthDisplays);
AddStep("enable low health display", () =>
{
config.Set(OsuSetting.FadePlayfieldWhenLowHealth, true);
hudOverlay.LowHealthDisplay.FinishTransforms(true);
});
AddAssert("low health display is visible", () => hudOverlay.LowHealthDisplay.IsPresent);
AddStep("set health to 30%", () => applyToHealthDisplays(0.3));
AddAssert("hud is not faded to red", () => !hudOverlay.LowHealthDisplay.Child.IsPresent);
AddStep("set health to < 10%", () => applyToHealthDisplays(0.1f));
AddAssert("hud is faded to red", () => hudOverlay.LowHealthDisplay.Child.IsPresent);
AddStep("disable low health display", () =>
{
config.Set(OsuSetting.FadePlayfieldWhenLowHealth, false);
hudOverlay.LowHealthDisplay.FinishTransforms(true);
});
AddAssert("low health display is not visible", () => !hudOverlay.LowHealthDisplay.IsPresent);
}
private void createNew(Action<HUDOverlay> action = null)
{
AddStep("create overlay", () =>