Merge pull request #13823 from ekrctb/catch-editor-tests

Add some tests for catch editor blueprints
This commit is contained in:
Dan Balasescu
2021-07-13 08:27:41 +09:00
committed by GitHub
9 changed files with 347 additions and 8 deletions

View File

@ -17,11 +17,11 @@ namespace osu.Game.Tests.Visual
public abstract class PlacementBlueprintTestScene : OsuManualInputManagerTestScene, IPlacementHandler
{
protected readonly Container HitObjectContainer;
private PlacementBlueprint currentBlueprint;
protected PlacementBlueprint CurrentBlueprint { get; private set; }
protected PlacementBlueprintTestScene()
{
Add(HitObjectContainer = CreateHitObjectContainer().With(c => c.Clock = new FramedClock(new StopwatchClock())));
base.Content.Add(HitObjectContainer = CreateHitObjectContainer().With(c => c.Clock = new FramedClock(new StopwatchClock())));
}
[BackgroundDependencyLoader]
@ -63,9 +63,9 @@ namespace osu.Game.Tests.Visual
protected void ResetPlacement()
{
if (currentBlueprint != null)
Remove(currentBlueprint);
Add(currentBlueprint = CreateBlueprint());
if (CurrentBlueprint != null)
Remove(CurrentBlueprint);
Add(CurrentBlueprint = CreateBlueprint());
}
public void Delete(HitObject hitObject)
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual
{
base.Update();
currentBlueprint.UpdateTimeAndPosition(SnapForBlueprint(currentBlueprint));
CurrentBlueprint.UpdateTimeAndPosition(SnapForBlueprint(CurrentBlueprint));
}
protected virtual SnapResult SnapForBlueprint(PlacementBlueprint blueprint) =>

View File

@ -1,6 +1,7 @@
// 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 JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Timing;
@ -23,7 +24,7 @@ namespace osu.Game.Tests.Visual
});
}
protected void AddBlueprint(HitObjectSelectionBlueprint blueprint, DrawableHitObject drawableObject)
protected void AddBlueprint(HitObjectSelectionBlueprint blueprint, [CanBeNull] DrawableHitObject drawableObject = null)
{
Add(blueprint.With(d =>
{