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

51 lines
1.5 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.
2018-10-25 17:48:11 +08:00
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
{
2018-11-06 17:06:13 +08:00
public abstract class SelectionBlueprintTestCase : OsuTestCase
2018-10-25 17:48:11 +08:00
{
2018-11-06 16:56:04 +08:00
private SelectionBlueprint blueprint;
2018-10-25 17:48:11 +08:00
protected override Container<Drawable> Content => content ?? base.Content;
private readonly Container content;
2018-11-06 17:06:13 +08:00
protected SelectionBlueprintTestCase()
2018-10-25 17:48:11 +08:00
{
base.Content.Add(content = new Container
{
Clock = new FramedClock(new StopwatchClock()),
RelativeSizeAxes = Axes.Both
});
}
[BackgroundDependencyLoader]
private void load()
{
blueprint = CreateBlueprint();
blueprint.Depth = float.MinValue;
2018-11-06 16:56:04 +08:00
blueprint.SelectionRequested += (_, __) => blueprint.Select();
2018-10-25 17:48:11 +08:00
Add(blueprint);
2018-11-06 16:56:04 +08:00
AddStep("Select", () => blueprint.Select());
AddStep("Deselect", () => blueprint.Deselect());
2018-10-25 17:48:11 +08:00
}
protected override bool OnClick(ClickEvent e)
{
2018-11-06 16:56:04 +08:00
blueprint.Deselect();
2018-10-25 17:48:11 +08:00
return true;
}
2018-11-07 14:04:48 +08:00
protected abstract SelectionBlueprint CreateBlueprint();
2018-10-25 17:48:11 +08:00
}
}