mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Make selection blueprints a bit more testable
This commit is contained in:
@ -1,10 +1,8 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
|
||||
@ -12,8 +10,6 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public abstract class SelectionBlueprintTestScene : OsuTestScene
|
||||
{
|
||||
private SelectionBlueprint blueprint;
|
||||
|
||||
protected override Container<Drawable> Content => content ?? base.Content;
|
||||
private readonly Container content;
|
||||
|
||||
@ -26,23 +22,13 @@ namespace osu.Game.Tests.Visual
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
protected void AddBlueprint(SelectionBlueprint blueprint)
|
||||
{
|
||||
blueprint = CreateBlueprint();
|
||||
blueprint.Depth = float.MinValue;
|
||||
blueprint.SelectionRequested += (_, __) => blueprint.Select();
|
||||
|
||||
Add(blueprint);
|
||||
|
||||
AddStep("Select", () => blueprint.Select());
|
||||
AddStep("Deselect", () => blueprint.Deselect());
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
blueprint.Deselect();
|
||||
return true;
|
||||
Add(blueprint.With(d =>
|
||||
{
|
||||
d.Depth = float.MinValue;
|
||||
d.Select();
|
||||
}));
|
||||
}
|
||||
|
||||
protected abstract SelectionBlueprint CreateBlueprint();
|
||||
|
Reference in New Issue
Block a user