2019-09-20 10:19:43 +00:00
|
|
|
// 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.
|
|
|
|
|
2019-09-25 08:42:27 +00:00
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Bindables;
|
2019-09-20 10:19:43 +00:00
|
|
|
using osu.Framework.Graphics;
|
2019-09-25 08:53:08 +00:00
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
2019-09-25 08:42:27 +00:00
|
|
|
using osuTK.Input;
|
2019-09-20 10:19:43 +00:00
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.UserInterface
|
|
|
|
{
|
2020-03-23 01:01:33 +00:00
|
|
|
public class TestSceneSwitchButton : OsuManualInputManagerTestScene
|
2019-09-20 10:19:43 +00:00
|
|
|
{
|
2019-09-25 08:42:27 +00:00
|
|
|
private SwitchButton switchButton;
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
public void Setup() => Schedule(() =>
|
2019-09-20 10:19:43 +00:00
|
|
|
{
|
2019-09-25 08:42:27 +00:00
|
|
|
Child = switchButton = new SwitchButton
|
2019-09-20 10:19:43 +00:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
};
|
2019-09-25 08:42:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestChangeThroughInput()
|
|
|
|
{
|
|
|
|
AddStep("move to switch button", () => InputManager.MoveMouseTo(switchButton));
|
|
|
|
AddStep("click on", () => InputManager.Click(MouseButton.Left));
|
|
|
|
AddStep("click off", () => InputManager.Click(MouseButton.Left));
|
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestChangeThroughBindable()
|
|
|
|
{
|
|
|
|
BindableBool bindable = null;
|
|
|
|
|
|
|
|
AddStep("bind bindable", () => switchButton.Current.BindTo(bindable = new BindableBool()));
|
|
|
|
AddStep("toggle bindable", () => bindable.Toggle());
|
|
|
|
AddStep("toggle bindable", () => bindable.Toggle());
|
2019-09-20 10:19:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|