mirror of
https://github.com/osukey/osukey.git
synced 2025-05-09 23:57:18 +09:00
Add better test coverage of SettingsPanel
This commit is contained in:
parent
c191b38125
commit
4b975ca10d
@ -4,6 +4,7 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Settings
|
namespace osu.Game.Tests.Visual.Settings
|
||||||
@ -11,27 +12,39 @@ namespace osu.Game.Tests.Visual.Settings
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneSettingsPanel : OsuTestScene
|
public class TestSceneSettingsPanel : OsuTestScene
|
||||||
{
|
{
|
||||||
private readonly SettingsPanel settings;
|
private SettingsPanel settings;
|
||||||
private readonly DialogOverlay dialogOverlay;
|
private DialogOverlay dialogOverlay;
|
||||||
|
|
||||||
public TestSceneSettingsPanel()
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
{
|
{
|
||||||
settings = new SettingsOverlay
|
AddStep("create settings", () =>
|
||||||
{
|
{
|
||||||
State = { Value = Visibility.Visible }
|
settings?.Expire();
|
||||||
};
|
|
||||||
Add(dialogOverlay = new DialogOverlay
|
Add(settings = new SettingsOverlay
|
||||||
{
|
{
|
||||||
Depth = -1
|
State = { Value = Visibility.Visible }
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void ToggleVisibility()
|
||||||
|
{
|
||||||
|
AddWaitStep("wait some", 5);
|
||||||
|
AddToggleStep("toggle editor visibility", visible => settings.ToggleVisibility());
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Dependencies.Cache(dialogOverlay);
|
Add(dialogOverlay = new DialogOverlay
|
||||||
|
{
|
||||||
|
Depth = -1
|
||||||
|
});
|
||||||
|
|
||||||
Add(settings);
|
Dependencies.Cache(dialogOverlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user