1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:03:08 +08:00

Fix up/improve test scene

This commit is contained in:
smoogipoo 2020-04-14 15:24:34 +09:00
parent b8b334ca27
commit 59728ffebd

View File

@ -20,7 +20,12 @@ namespace osu.Game.Tests.Visual.Gameplay
[SetUpSteps] [SetUpSteps]
public void SetUpSteps() public void SetUpSteps()
{ {
AddStep("create layer", () => Child = layer = new FailingLayer()); AddStep("create layer", () =>
{
Child = layer = new FailingLayer();
layer.BindHealthProcessor(new DrainingHealthProcessor(1));
});
AddStep("enable layer", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, true)); AddStep("enable layer", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, true));
AddUntilStep("layer is visible", () => layer.IsPresent); AddUntilStep("layer is visible", () => layer.IsPresent);
} }
@ -44,6 +49,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestLayerDisabledViaConfig() public void TestLayerDisabledViaConfig()
{ {
AddStep("disable layer", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, false)); AddStep("disable layer", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, false));
AddStep("set health to 0.10", () => layer.Current.Value = 0.1);
AddUntilStep("layer is not visible", () => !layer.IsPresent); AddUntilStep("layer is not visible", () => !layer.IsPresent);
} }
@ -51,6 +57,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestLayerVisibilityWithAccumulatingProcessor() public void TestLayerVisibilityWithAccumulatingProcessor()
{ {
AddStep("bind accumulating processor", () => layer.BindHealthProcessor(new AccumulatingHealthProcessor(1))); AddStep("bind accumulating processor", () => layer.BindHealthProcessor(new AccumulatingHealthProcessor(1)));
AddStep("set health to 0.10", () => layer.Current.Value = 0.1);
AddUntilStep("layer is not visible", () => !layer.IsPresent); AddUntilStep("layer is not visible", () => !layer.IsPresent);
} }
@ -58,6 +65,7 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestLayerVisibilityWithDrainingProcessor() public void TestLayerVisibilityWithDrainingProcessor()
{ {
AddStep("bind accumulating processor", () => layer.BindHealthProcessor(new DrainingHealthProcessor(1))); AddStep("bind accumulating processor", () => layer.BindHealthProcessor(new DrainingHealthProcessor(1)));
AddStep("set health to 0.10", () => layer.Current.Value = 0.1);
AddWaitStep("wait for potential fade", 10); AddWaitStep("wait for potential fade", 10);
AddAssert("layer is still visible", () => layer.IsPresent); AddAssert("layer is still visible", () => layer.IsPresent);
} }