mirror of
https://github.com/ppy/osu.git
synced 2024-11-17 20:13:22 +08:00
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
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;
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
{
|
|
public abstract class SelectionBlueprintTestCase : OsuTestCase
|
|
{
|
|
private SelectionBlueprint blueprint;
|
|
|
|
protected override Container<Drawable> Content => content ?? base.Content;
|
|
private readonly Container content;
|
|
|
|
protected SelectionBlueprintTestCase()
|
|
{
|
|
base.Content.Add(content = new Container
|
|
{
|
|
Clock = new FramedClock(new StopwatchClock()),
|
|
RelativeSizeAxes = Axes.Both
|
|
});
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load()
|
|
{
|
|
base.Content.Add(blueprint = CreateBlueprint());
|
|
blueprint.SelectionRequested += (_, __) => blueprint.Select();
|
|
|
|
AddStep("Select", () => blueprint.Select());
|
|
AddStep("Deselect", () => blueprint.Deselect());
|
|
}
|
|
|
|
protected override bool OnClick(ClickEvent e)
|
|
{
|
|
blueprint.Deselect();
|
|
return true;
|
|
}
|
|
|
|
protected abstract SelectionBlueprint CreateBlueprint();
|
|
}
|
|
}
|