1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-14 12:47:21 +08:00

Fix unit test

This commit is contained in:
jkh675 2024-08-04 21:12:09 +08:00
parent 2145368d17
commit 38dacfeaa2
3 changed files with 24 additions and 7 deletions

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Cursor;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu;
@ -52,6 +53,7 @@ namespace osu.Game.Tests.Visual.Editing
(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.Collections.Generic;
using System.Linq;
using NUnit.Framework;
@ -12,6 +13,7 @@ using osu.Framework.Graphics.Cursor;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Cursor;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools;
using osu.Game.Rulesets.Objects;
@ -70,13 +72,21 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("Create composer", () =>
{
Child = editorBeatmapContainer = new EditorBeatmapContainer(Beatmap.Value)
Child = new DependencyProvidingContainer
{
Child = hitObjectComposer = new OsuHitObjectComposer(new OsuRuleset())
RelativeSizeAxes = Axes.Both,
CachedDependencies = new (Type, object)[]
{
// force the composer to fully overlap the playfield area by setting a 4:3 aspect ratio.
FillMode = FillMode.Fit,
FillAspectRatio = 4 / 3f
(typeof(OsuContextMenuContainer), new OsuContextMenuContainer())
},
Child = editorBeatmapContainer = new EditorBeatmapContainer(Beatmap.Value)
{
Child = hitObjectComposer = new OsuHitObjectComposer(new OsuRuleset())
{
// force the composer to fully overlap the playfield area by setting a 4:3 aspect ratio.
FillMode = FillMode.Fit,
FillAspectRatio = 4 / 3f
}
}
};
});

View File

@ -16,6 +16,7 @@ using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osu.Game.Storyboards;
using osuTK;
@ -51,7 +52,7 @@ namespace osu.Game.Tests.Visual.Editing
Composer.Alpha = 0;
Add(new OsuContextMenuContainer
var contextMenuContainer = new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
@ -75,7 +76,11 @@ namespace osu.Game.Tests.Visual.Editing
Origin = Anchor.Centre,
}
}
});
};
Dependencies.Cache(contextMenuContainer);
Add(contextMenuContainer);
}
[SetUpSteps]