mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 16:06:06 +08:00
Fix test scene
This commit is contained in:
parent
ee6ea08cf8
commit
ecd7ce4b98
@ -4,15 +4,17 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.EntityFrameworkCore.Internal;
|
using Microsoft.EntityFrameworkCore.Internal;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Beatmaps
|
namespace osu.Game.Tests.Beatmaps
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[HeadlessTest]
|
||||||
public class EditorBeatmapTest
|
public class TestSceneEditorBeatmap : EditorClockTestScene
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tests that the addition event is correctly invoked after a hitobject is added.
|
/// Tests that the addition event is correctly invoked after a hitobject is added.
|
||||||
@ -55,13 +57,19 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
public void TestInitialHitObjectStartTimeChangeEvent()
|
public void TestInitialHitObjectStartTimeChangeEvent()
|
||||||
{
|
{
|
||||||
var hitCircle = new HitCircle();
|
var hitCircle = new HitCircle();
|
||||||
var editorBeatmap = new EditorBeatmap(new OsuBeatmap { HitObjects = { hitCircle } });
|
|
||||||
|
|
||||||
HitObject changedObject = null;
|
HitObject changedObject = null;
|
||||||
editorBeatmap.HitObjectUpdated += h => changedObject = h;
|
|
||||||
|
|
||||||
hitCircle.StartTime = 1000;
|
AddStep("add beatmap", () =>
|
||||||
Assert.That(changedObject, Is.EqualTo(hitCircle));
|
{
|
||||||
|
EditorBeatmap editorBeatmap;
|
||||||
|
|
||||||
|
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap { HitObjects = { hitCircle } });
|
||||||
|
editorBeatmap.HitObjectUpdated += h => changedObject = h;
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("change start time", () => hitCircle.StartTime = 1000);
|
||||||
|
AddAssert("received change event", () => changedObject == hitCircle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -71,18 +79,22 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestAddedHitObjectStartTimeChangeEvent()
|
public void TestAddedHitObjectStartTimeChangeEvent()
|
||||||
{
|
{
|
||||||
var editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
EditorBeatmap editorBeatmap = null;
|
||||||
|
|
||||||
HitObject changedObject = null;
|
HitObject changedObject = null;
|
||||||
editorBeatmap.HitObjectUpdated += h => changedObject = h;
|
|
||||||
|
AddStep("add beatmap", () =>
|
||||||
|
{
|
||||||
|
Child = editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||||
|
editorBeatmap.HitObjectUpdated += h => changedObject = h;
|
||||||
|
});
|
||||||
|
|
||||||
var hitCircle = new HitCircle();
|
var hitCircle = new HitCircle();
|
||||||
|
|
||||||
editorBeatmap.Add(hitCircle);
|
AddStep("add object", () => editorBeatmap.Add(hitCircle));
|
||||||
Assert.That(changedObject, Is.Null);
|
AddAssert("event not received", () => changedObject == null);
|
||||||
|
|
||||||
hitCircle.StartTime = 1000;
|
AddStep("change start time", () => hitCircle.StartTime = 1000);
|
||||||
Assert.That(changedObject, Is.EqualTo(hitCircle));
|
AddAssert("event received", () => changedObject == hitCircle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
Loading…
Reference in New Issue
Block a user