Add some basic testability of external colour setting

This commit is contained in:
Dean Herbert
2021-07-02 17:24:15 +09:00
parent 083e463afd
commit d67fc87dcb

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Testing; using osu.Framework.Testing;
@ -14,6 +15,8 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
public class TestSceneColourPicker : OsuTestScene public class TestSceneColourPicker : OsuTestScene
{ {
private readonly Bindable<Colour4> colour = new Bindable<Colour4>(Colour4.Aquamarine);
[SetUpSteps] [SetUpSteps]
public void SetUpSteps() public void SetUpSteps()
{ {
@ -42,7 +45,8 @@ namespace osu.Game.Tests.Visual.UserInterface
new OsuColourPicker new OsuColourPicker
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre,
Current = { BindTarget = colour },
} }
} }
}, },
@ -59,13 +63,18 @@ namespace osu.Game.Tests.Visual.UserInterface
new OsuColourPicker new OsuColourPicker
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre,
Current = { BindTarget = colour },
} }
} }
} }
} }
} }
}); });
AddStep("set green", () => colour.Value = Colour4.LimeGreen);
AddStep("set white", () => colour.Value = Colour4.White);
AddStep("set red", () => colour.Value = Colour4.Red);
} }
private class ColourProvidingContainer : Container private class ColourProvidingContainer : Container