mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Implement incompatibility-displaying variant of mod panel
This commit is contained in:
@ -1,14 +1,17 @@
|
||||
// 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 System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
@ -38,5 +41,41 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIncompatibilityDisplay()
|
||||
{
|
||||
IncompatibilityDisplayingModPanel panel = null;
|
||||
|
||||
AddStep("create panel with DT", () => Child = panel = new IncompatibilityDisplayingModPanel(new OsuModDoubleTime())
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.None,
|
||||
Width = 300
|
||||
});
|
||||
|
||||
clickPanel();
|
||||
AddAssert("panel active", () => panel.Active.Value);
|
||||
|
||||
clickPanel();
|
||||
AddAssert("panel not active", () => !panel.Active.Value);
|
||||
|
||||
AddStep("set incompatible mod", () => SelectedMods.Value = new[] { new OsuModHalfTime() });
|
||||
|
||||
clickPanel();
|
||||
AddAssert("panel not active", () => !panel.Active.Value);
|
||||
|
||||
AddStep("reset mods", () => SelectedMods.Value = Array.Empty<Mod>());
|
||||
|
||||
clickPanel();
|
||||
AddAssert("panel active", () => panel.Active.Value);
|
||||
|
||||
void clickPanel() => AddStep("click panel", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(panel);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user