1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-21 18:02:55 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestSceneSwitchButton.cs

47 lines
1.4 KiB
C#
Raw Normal View History

// 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.
2022-06-17 15:37:17 +08:00
#nullable disable
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
2019-09-25 16:53:08 +08:00
using osu.Game.Graphics.UserInterfaceV2;
using osuTK.Input;
namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneSwitchButton : OsuManualInputManagerTestScene
{
private SwitchButton switchButton;
[SetUp]
public void Setup() => Schedule(() =>
{
Child = switchButton = new SwitchButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
});
[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());
}
}
}