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

Update visual tests and remove unessecary XMLDoc tag

This commit is contained in:
Lucas A 2020-04-01 15:12:31 +02:00
parent ab01111c36
commit 1562612f41
2 changed files with 26 additions and 5 deletions

View File

@ -1,7 +1,12 @@
// 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.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Screens.Play.HUD;
namespace osu.Game.Tests.Visual.Gameplay
@ -10,22 +15,39 @@ namespace osu.Game.Tests.Visual.Gameplay
{
private readonly FailingLayer layer;
[Resolved]
private OsuConfigManager config { get; set; }
public TestSceneFailingLayer()
{
Child = layer = new FailingLayer();
}
[Test]
public void TestLayerConfig()
{
AddStep("enable layer", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, true));
AddWaitStep("wait for transition to finish", 5);
AddAssert("layer is enabled", () => layer.IsPresent);
AddStep("disable layer", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, false));
AddWaitStep("wait for transition to finish", 5);
AddAssert("layer is disabled", () => !layer.IsPresent);
AddStep("restore layer enabling", () => config.Set(OsuSetting.FadePlayfieldWhenHealthLow, true));
}
[Test]
public void TestLayerFading()
{
AddSliderStep("current health", 0.0, 1.0, 1.0, val =>
{
layer.Current.Value = val;
});
AddSliderStep("current health", 0.0, 1.0, 1.0, val => layer.Current.Value = val);
var box = layer.ChildrenOfType<Box>().First();
AddStep("set health to 0.10", () => layer.Current.Value = 0.10);
AddWaitStep("wait for fade to finish", 5);
AddAssert("layer fade is visible", () => box.IsPresent);
AddStep("set health to 1", () => layer.Current.Value = 1f);
AddWaitStep("wait for fade to finish", 10);
AddAssert("layer fade is invisible", () => !box.IsPresent);
}
}
}

View File

@ -23,7 +23,6 @@ namespace osu.Game.Screens.Play.HUD
/// <summary>
/// Bind the tracked fields of <see cref="HealthProcessor"/> to this health display.
/// </summary>
/// <param name="processor"></param>
public void BindHealthProcessor(HealthProcessor processor)
{
Current.BindTo(processor.Health);