mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
Rewrite test scene
This commit is contained in:
parent
a5f866d95c
commit
7046f64e7f
@ -1,13 +1,9 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
@ -17,34 +13,40 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
public class TestSceneTimelineHitObjectBlueprint : TimelineTestScene
|
public class TestSceneTimelineHitObjectBlueprint : TimelineTestScene
|
||||||
{
|
{
|
||||||
private Spinner spinner;
|
public override Drawable CreateTestComponent() => new TimelineBlueprintContainer(Composer);
|
||||||
|
|
||||||
public TestSceneTimelineHitObjectBlueprint()
|
|
||||||
{
|
|
||||||
spinner = new Spinner
|
|
||||||
{
|
|
||||||
Position = new Vector2(256, 256),
|
|
||||||
StartTime = -1000,
|
|
||||||
EndTime = 2000
|
|
||||||
};
|
|
||||||
|
|
||||||
spinner.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty { CircleSize = 2 });
|
|
||||||
}
|
|
||||||
|
|
||||||
public override Drawable CreateTestComponent() => new TimelineHitObjectBlueprint(spinner);
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDisallowZeroLengthSpinners()
|
public void TestDisallowZeroDurationObjects()
|
||||||
{
|
{
|
||||||
DragBar dragBar = this.ChildrenOfType<DragBar>().First();
|
DragBar dragBar;
|
||||||
Circle circle = this.ChildrenOfType<Circle>().First();
|
|
||||||
InputManager.MoveMouseTo(dragBar.ScreenSpaceDrawQuad.TopRight);
|
AddStep("add spinner", () =>
|
||||||
AddStep("drag dragbar to hit object", () =>
|
|
||||||
{
|
{
|
||||||
|
EditorBeatmap.Clear();
|
||||||
|
EditorBeatmap.Add(new Spinner
|
||||||
|
{
|
||||||
|
Position = new Vector2(256, 256),
|
||||||
|
StartTime = 150,
|
||||||
|
Duration = 500
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("hold down drag bar", () =>
|
||||||
|
{
|
||||||
|
// distinguishes between the actual drag bar and its "underlay shadow".
|
||||||
|
dragBar = this.ChildrenOfType<DragBar>().Single(bar => bar.HandlePositionalInput);
|
||||||
|
InputManager.MoveMouseTo(dragBar);
|
||||||
InputManager.PressButton(MouseButton.Left);
|
InputManager.PressButton(MouseButton.Left);
|
||||||
InputManager.MoveMouseTo(circle.ScreenSpaceDrawQuad.TopLeft);
|
});
|
||||||
|
|
||||||
|
AddStep("try to drag bar past start", () =>
|
||||||
|
{
|
||||||
|
var blueprint = this.ChildrenOfType<TimelineHitObjectBlueprint>().Single();
|
||||||
|
InputManager.MoveMouseTo(blueprint.SelectionQuad.TopLeft - new Vector2(100, 0));
|
||||||
InputManager.ReleaseButton(MouseButton.Left);
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddAssert("object has non-zero duration", () => EditorBeatmap.HitObjects.OfType<IHasDuration>().Single().Duration > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,22 +23,24 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
|
|
||||||
protected HitObjectComposer Composer { get; private set; }
|
protected HitObjectComposer Composer { get; private set; }
|
||||||
|
|
||||||
|
protected EditorBeatmap EditorBeatmap { get; private set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
Beatmap.Value = new WaveformTestBeatmap(audio);
|
Beatmap.Value = new WaveformTestBeatmap(audio);
|
||||||
|
|
||||||
var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
|
var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
|
||||||
var editorBeatmap = new EditorBeatmap(playable);
|
EditorBeatmap = new EditorBeatmap(playable);
|
||||||
|
|
||||||
Dependencies.Cache(editorBeatmap);
|
Dependencies.Cache(EditorBeatmap);
|
||||||
Dependencies.CacheAs<IBeatSnapProvider>(editorBeatmap);
|
Dependencies.CacheAs<IBeatSnapProvider>(EditorBeatmap);
|
||||||
|
|
||||||
Composer = playable.BeatmapInfo.Ruleset.CreateInstance().CreateHitObjectComposer().With(d => d.Alpha = 0);
|
Composer = playable.BeatmapInfo.Ruleset.CreateInstance().CreateHitObjectComposer().With(d => d.Alpha = 0);
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
editorBeatmap,
|
EditorBeatmap,
|
||||||
Composer,
|
Composer,
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user