1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:20:04 +08:00

Merge branch 'master' into all-ruleset-encoders

This commit is contained in:
Dean Herbert 2020-04-24 11:32:48 +09:00 committed by GitHub
commit 131f011239
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 43 additions and 36 deletions

View File

@ -5,7 +5,7 @@ using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit;
namespace osu.Game.Tests.Editor
namespace osu.Game.Tests.Editing
{
[TestFixture]
public class EditorChangeHandlerTest

View File

@ -17,7 +17,7 @@ using osu.Game.Screens.Edit;
using osuTK;
using Decoder = osu.Game.Beatmaps.Formats.Decoder;
namespace osu.Game.Tests.Editor
namespace osu.Game.Tests.Editing
{
[TestFixture]
public class LegacyEditorBeatmapPatcherTest

View File

@ -14,7 +14,7 @@ using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Screens.Edit;
using osu.Game.Tests.Visual;
namespace osu.Game.Tests.Editor
namespace osu.Game.Tests.Editing
{
[HeadlessTest]
public class TestSceneHitObjectComposerDistanceSnapping : EditorClockTestScene

View File

@ -14,7 +14,7 @@ using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneBeatDivisorControl : OsuManualInputManagerTestScene
{

View File

@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneComposeScreen : EditorClockTestScene

View File

@ -13,7 +13,7 @@ using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneDistanceSnapGrid : EditorClockTestScene
{

View File

@ -4,33 +4,27 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneEditorChangeStates : ScreenTestScene
public class TestSceneEditorChangeStates : EditorTestScene
{
public TestSceneEditorChangeStates()
: base(new OsuRuleset())
{
}
private EditorBeatmap editorBeatmap;
private TestEditor editor;
public override void SetUpSteps()
{
base.SetUpSteps();
AddStep("load editor", () =>
{
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
LoadScreen(editor = new TestEditor());
});
AddUntilStep("wait for editor to load", () => editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true
&& editor.ChildrenOfType<TimelineArea>().FirstOrDefault()?.IsLoaded == true);
AddStep("get beatmap", () => editorBeatmap = editor.ChildrenOfType<EditorBeatmap>().Single());
AddStep("get beatmap", () => editorBeatmap = Editor.ChildrenOfType<EditorBeatmap>().Single());
}
[Test]
@ -158,11 +152,13 @@ namespace osu.Game.Tests.Visual.Editor
AddAssert("no hitobject added", () => addedObject == null);
}
private void addUndoSteps() => AddStep("undo", () => editor.Undo());
private void addUndoSteps() => AddStep("undo", () => ((TestEditor)Editor).Undo());
private void addRedoSteps() => AddStep("redo", () => editor.Redo());
private void addRedoSteps() => AddStep("redo", () => ((TestEditor)Editor).Redo());
private class TestEditor : Screens.Edit.Editor
protected override Editor CreateEditor() => new TestEditor();
private class TestEditor : Editor
{
public new void Undo() => base.Undo();

View File

@ -7,7 +7,7 @@ using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Edit.Components.RadioButtons;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneEditorComposeRadioButtons : OsuTestScene

View File

@ -10,7 +10,7 @@ using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Edit.Components.Menus;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneEditorMenuBar : OsuTestScene

View File

@ -13,7 +13,7 @@ using osu.Game.Rulesets.Osu.Objects;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneEditorSeekSnapping : EditorClockTestScene

View File

@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osuTK;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneEditorSummaryTimeline : EditorClockTestScene

View File

@ -20,7 +20,7 @@ using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneHitObjectComposer : EditorClockTestScene

View File

@ -9,7 +9,7 @@ using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Components;
using osuTK;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestScenePlaybackControl : OsuTestScene

View File

@ -7,7 +7,7 @@ using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneTimelineBlueprintContainer : TimelineTestScene

View File

@ -8,7 +8,7 @@ using osu.Game.Screens.Edit.Compose.Components;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneTimelineTickDisplay : TimelineTestScene

View File

@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Timing;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneTimingScreen : EditorClockTestScene

View File

@ -14,7 +14,7 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Osu;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneWaveform : OsuTestScene

View File

@ -15,7 +15,7 @@ using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
public class TestSceneZoomableScrollContainer : OsuManualInputManagerTestScene
{

View File

@ -18,7 +18,7 @@ using osu.Game.Screens.Edit.Compose.Components.Timeline;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tests.Visual.Editor
namespace osu.Game.Tests.Visual.Editing
{
public abstract class TimelineTestScene : EditorClockTestScene
{

View File

@ -23,6 +23,7 @@ namespace osu.Game.Tests.Beatmaps
HitObjects = baseBeatmap.HitObjects;
BeatmapInfo.Ruleset = ruleset;
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
BeatmapInfo.BeatmapSet.Beatmaps = new List<BeatmapInfo> { BeatmapInfo };
BeatmapInfo.BeatmapSet.OnlineInfo = new BeatmapSetOnlineInfo

View File

@ -3,9 +3,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components.Timeline;
namespace osu.Game.Tests.Visual
{
@ -13,6 +17,8 @@ namespace osu.Game.Tests.Visual
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Editor), typeof(EditorScreen) };
protected Editor Editor { get; private set; }
private readonly Ruleset ruleset;
protected EditorTestScene(Ruleset ruleset)
@ -30,7 +36,11 @@ namespace osu.Game.Tests.Visual
{
base.SetUpSteps();
AddStep("Load editor", () => LoadScreen(new Editor()));
AddStep("load editor", () => LoadScreen(Editor = CreateEditor()));
AddUntilStep("wait for editor to load", () => Editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true
&& Editor.ChildrenOfType<TimelineArea>().FirstOrDefault()?.IsLoaded == true);
}
protected virtual Editor CreateEditor() => new Editor();
}
}