mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Fix button not transforming correctly in some cases
This commit is contained in:
@ -1,20 +1,44 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestSceneSwitchButton : OsuTestScene
|
||||
public class TestSceneSwitchButton : ManualInputManagerTestScene
|
||||
{
|
||||
public TestSceneSwitchButton()
|
||||
private SwitchButton switchButton;
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
{
|
||||
Child = new SwitchButton
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user