mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Add placement mask testcase
This commit is contained in:
parent
2b141a2bc1
commit
2f42112d87
@ -0,0 +1,19 @@
|
|||||||
|
// 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.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Masks.HitCircle;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
|
{
|
||||||
|
public class TestCaseHitCirclePlacementMask : HitObjectPlacementMaskTestCase
|
||||||
|
{
|
||||||
|
protected override DrawableHitObject CreateHitObject(HitObject hitObject) => new DrawableHitCircle((HitCircle)hitObject);
|
||||||
|
protected override PlacementMask CreateMask() => new HitCirclePlacementMask();
|
||||||
|
}
|
||||||
|
}
|
63
osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs
Normal file
63
osu.Game/Tests/Visual/HitObjectPlacementMaskTestCase.cs
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// 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.Timing;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Screens.Edit.Screens.Compose;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
[Cached(Type = typeof(IPlacementHandler))]
|
||||||
|
public abstract class HitObjectPlacementMaskTestCase : OsuTestCase, IPlacementHandler
|
||||||
|
{
|
||||||
|
private readonly Container hitObjectContainer;
|
||||||
|
private PlacementMask currentMask;
|
||||||
|
|
||||||
|
protected HitObjectPlacementMaskTestCase()
|
||||||
|
{
|
||||||
|
Add(hitObjectContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Clock = new FramedClock(new StopwatchClock())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Add(currentMask = CreateMask());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
{
|
||||||
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
dependencies.CacheAs<IAdjustableClock>(new StopwatchClock());
|
||||||
|
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BeginPlacement(HitObject hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndPlacement(HitObject hitObject)
|
||||||
|
{
|
||||||
|
hitObjectContainer.Add(CreateHitObject(hitObject));
|
||||||
|
|
||||||
|
Remove(currentMask);
|
||||||
|
Add(currentMask = CreateMask());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Delete(HitObject hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract DrawableHitObject CreateHitObject(HitObject hitObject);
|
||||||
|
protected abstract PlacementMask CreateMask();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user