Fix ruleset unit test

This commit is contained in:
jkh675 2024-08-04 22:37:54 +08:00
parent b32d97b4c0
commit 2720bcf285
5 changed files with 32 additions and 4 deletions

View File

@ -10,6 +10,7 @@
using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Database;
using osu.Game.Graphics.Cursor;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Beatmaps;
@ -52,6 +53,7 @@ public void SetUpSteps()
(typeof(EditorBeatmap), editorBeatmap),
(typeof(IBeatSnapProvider), editorBeatmap),
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
(typeof(OsuContextMenuContainer), new OsuContextMenuContainer()),
},
Children = new Drawable[]
{

View File

@ -3,6 +3,7 @@
#nullable disable
using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
@ -11,6 +12,7 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Graphics.Cursor;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Edit;
@ -37,7 +39,14 @@ public void Setup() => Schedule(() =>
BeatDivisor.Value = 8;
EditorClock.Seek(0);
Child = composer = new TestComposer { RelativeSizeAxes = Axes.Both };
Child = new DependencyProvidingContainer
{
CachedDependencies = new (Type, object)[]
{
(typeof(OsuContextMenuContainer), new OsuContextMenuContainer()),
},
Child = composer = new TestComposer { RelativeSizeAxes = Axes.Both },
};
});
[Test]

View File

@ -16,6 +16,7 @@
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Cursor;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Beatmaps;
@ -79,6 +80,7 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
{
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs(composer.DistanceSnapProvider);
dependencies.Cache(new OsuContextMenuContainer());
return dependencies;
}

View File

@ -1,10 +1,12 @@
// 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 System;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Cursor;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Taiko.Beatmaps;
using osu.Game.Rulesets.Taiko.Edit;
@ -22,7 +24,14 @@ public void Setup() => Schedule(() =>
BeatDivisor.Value = 8;
EditorClock.Seek(0);
Child = new TestComposer { RelativeSizeAxes = Axes.Both };
Child = new DependencyProvidingContainer
{
CachedDependencies = new (Type, object)[]
{
(typeof(OsuContextMenuContainer), new OsuContextMenuContainer()),
},
Child = new TestComposer { RelativeSizeAxes = Axes.Both },
};
});
[Test]

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 System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
@ -10,6 +11,7 @@
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Cursor;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
@ -52,9 +54,13 @@ public TestSceneHitObjectComposerDistanceSnapping()
[SetUp]
public void Setup() => Schedule(() =>
{
Children = new Drawable[]
Child = new DependencyProvidingContainer
{
composer = new TestHitObjectComposer()
CachedDependencies = new (Type, object)[]
{
(typeof(OsuContextMenuContainer), new OsuContextMenuContainer()),
},
Child = composer = new TestHitObjectComposer(),
};
BeatDivisor.Value = 1;