mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
Separate Test cases by relevant rulesets
This commit is contained in:
parent
544d5d1d86
commit
81caa854e6
@ -0,0 +1,102 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||||
|
{
|
||||||
|
public partial class TestSceneOpenEditorTimestampInMania : EditorTestScene
|
||||||
|
{
|
||||||
|
protected override Ruleset CreateEditorRuleset() => new ManiaRuleset();
|
||||||
|
|
||||||
|
private void addStepClickLink(string timestamp, string step = "", bool displayTimestamp = true)
|
||||||
|
{
|
||||||
|
AddStep(displayTimestamp ? $"{step} {timestamp}" : step, () => Editor.HandleTimestamp(timestamp));
|
||||||
|
AddUntilStep("wait for seek", () => EditorClock.SeekingOrStopped.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addReset()
|
||||||
|
{
|
||||||
|
addStepClickLink("00:00:000", "reset", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool checkSnapAndSelectColumn(double startTime, IReadOnlyCollection<(int, int)>? columnPairs = null)
|
||||||
|
{
|
||||||
|
bool checkColumns = columnPairs != null
|
||||||
|
? EditorBeatmap.SelectedHitObjects.All(x => columnPairs.Any(col => isNoteAt(x, col.Item1, col.Item2)))
|
||||||
|
: !EditorBeatmap.SelectedHitObjects.Any();
|
||||||
|
|
||||||
|
return EditorClock.CurrentTime == startTime
|
||||||
|
&& EditorBeatmap.SelectedHitObjects.Count == (columnPairs?.Count ?? 0)
|
||||||
|
&& checkColumns;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isNoteAt(HitObject hitObject, double time, int column)
|
||||||
|
{
|
||||||
|
return hitObject is ManiaHitObject maniaHitObject
|
||||||
|
&& maniaHitObject.StartTime == time
|
||||||
|
&& maniaHitObject.Column == column;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNormalSelection()
|
||||||
|
{
|
||||||
|
addStepClickLink("00:05:920 (5920|3,6623|3,6857|2,7326|1)");
|
||||||
|
AddAssert("selected group", () => checkSnapAndSelectColumn(5_920, new List<(int, int)>
|
||||||
|
{ (5_920, 3), (6_623, 3), (6_857, 2), (7_326, 1) }
|
||||||
|
));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:42:716 (42716|3,43420|2,44123|0,44357|1,45295|1)");
|
||||||
|
AddAssert("selected ungrouped", () => checkSnapAndSelectColumn(42_716, new List<(int, int)>
|
||||||
|
{ (42_716, 3), (43_420, 2), (44_123, 0), (44_357, 1), (45_295, 1) }
|
||||||
|
));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
AddStep("add notes to row", () =>
|
||||||
|
{
|
||||||
|
if (EditorBeatmap.HitObjects.Any(x => x is ManiaHitObject m && m.StartTime == 11_545 && m.Column is 1 or 2 or 3))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ManiaHitObject first = (ManiaHitObject)EditorBeatmap.HitObjects.First(x => x is ManiaHitObject m && m.StartTime == 11_545 && m.Column == 0);
|
||||||
|
ManiaHitObject second = new Note { Column = 1, StartTime = first.StartTime };
|
||||||
|
ManiaHitObject third = new Note { Column = 2, StartTime = first.StartTime };
|
||||||
|
ManiaHitObject forth = new Note { Column = 3, StartTime = first.StartTime };
|
||||||
|
EditorBeatmap.AddRange(new[] { second, third, forth });
|
||||||
|
});
|
||||||
|
addStepClickLink("00:11:545 (11545|0,11545|1,11545|2,11545|3)");
|
||||||
|
AddAssert("selected in row", () => checkSnapAndSelectColumn(11_545, new List<(int, int)>
|
||||||
|
{ (11_545, 0), (11_545, 1), (11_545, 2), (11_545, 3) }
|
||||||
|
));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("01:36:623 (96623|1,97560|1,97677|1,97795|1,98966|1)");
|
||||||
|
AddAssert("selected in column", () => checkSnapAndSelectColumn(96_623, new List<(int, int)>
|
||||||
|
{ (96_623, 1), (97_560, 1), (97_677, 1), (97_795, 1), (98_966, 1) }
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUnusualSelection()
|
||||||
|
{
|
||||||
|
addStepClickLink("00:00:000 (0|1)", "invalid link");
|
||||||
|
AddAssert("snap to 1, select none", () => checkSnapAndSelectColumn(2_170));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:00:000 (0)", "std link");
|
||||||
|
AddAssert("snap and select 1", () => checkSnapAndSelectColumn(2_170, new List<(int, int)>
|
||||||
|
{ (2_170, 2) })
|
||||||
|
);
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
// TODO: discuss - this selects the first 2 objects on Stable, do we want that or is this fine?
|
||||||
|
addStepClickLink("00:00:000 (1,2)", "std link");
|
||||||
|
AddAssert("snap to 1, select none", () => checkSnapAndSelectColumn(2_170));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,110 @@
|
|||||||
|
// 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.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||||
|
{
|
||||||
|
public partial class TestSceneOpenEditorTimestampInOsu : EditorTestScene
|
||||||
|
{
|
||||||
|
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||||
|
|
||||||
|
private void addStepClickLink(string timestamp, string step = "", bool displayTimestamp = true)
|
||||||
|
{
|
||||||
|
AddStep(displayTimestamp ? $"{step} {timestamp}" : step, () => Editor.HandleTimestamp(timestamp));
|
||||||
|
AddUntilStep("wait for seek", () => EditorClock.SeekingOrStopped.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addReset()
|
||||||
|
{
|
||||||
|
addStepClickLink("00:00:000", "reset", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool checkSnapAndSelectCombo(double startTime, params int[] comboNumbers)
|
||||||
|
{
|
||||||
|
bool checkCombos = comboNumbers.Any()
|
||||||
|
? hasCombosInOrder(EditorBeatmap.SelectedHitObjects, comboNumbers)
|
||||||
|
: !EditorBeatmap.SelectedHitObjects.Any();
|
||||||
|
|
||||||
|
return EditorClock.CurrentTime == startTime
|
||||||
|
&& EditorBeatmap.SelectedHitObjects.Count == comboNumbers.Length
|
||||||
|
&& checkCombos;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool hasCombosInOrder(IEnumerable<HitObject> selected, params int[] comboNumbers)
|
||||||
|
{
|
||||||
|
List<HitObject> hitObjects = selected.ToList();
|
||||||
|
if (hitObjects.Count != comboNumbers.Length)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return !hitObjects.Select(x => (OsuHitObject)x)
|
||||||
|
.Where((x, i) => x.IndexInCurrentCombo + 1 != comboNumbers[i])
|
||||||
|
.Any();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNormalSelection()
|
||||||
|
{
|
||||||
|
addStepClickLink("00:02:170 (1,2,3)");
|
||||||
|
AddAssert("snap and select 1-2-3", () => checkSnapAndSelectCombo(2_170, 1, 2, 3));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:04:748 (2,3,4,1,2)");
|
||||||
|
AddAssert("snap and select 2-3-4-1-2", () => checkSnapAndSelectCombo(4_748, 2, 3, 4, 1, 2));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:02:170 (1,1,1)");
|
||||||
|
AddAssert("snap and select 1-1-1", () => checkSnapAndSelectCombo(2_170, 1, 1, 1));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:02:873 (2,2,2,2)");
|
||||||
|
AddAssert("snap and select 2-2-2-2", () => checkSnapAndSelectCombo(2_873, 2, 2, 2, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestUnusualSelection()
|
||||||
|
{
|
||||||
|
HitObject firstObject = null!;
|
||||||
|
|
||||||
|
addStepClickLink("00:00:000 (1,2,3)", "invalid offset");
|
||||||
|
AddAssert("snap to next, select 1-2-3", () =>
|
||||||
|
{
|
||||||
|
firstObject = EditorBeatmap.HitObjects.First();
|
||||||
|
return checkSnapAndSelectCombo(firstObject.StartTime, 1, 2, 3);
|
||||||
|
});
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:00:956 (2,3,4)", "invalid offset");
|
||||||
|
AddAssert("snap to next, select 2-3-4", () => checkSnapAndSelectCombo(firstObject.StartTime, 2, 3, 4));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:00:000 (0)", "invalid offset");
|
||||||
|
AddAssert("snap and select 1", () => checkSnapAndSelectCombo(firstObject.StartTime, 1));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:00:000 (1)", "invalid offset");
|
||||||
|
AddAssert("snap and select 1", () => checkSnapAndSelectCombo(firstObject.StartTime, 1));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:00:000 (2)", "invalid offset");
|
||||||
|
AddAssert("snap and select 1", () => checkSnapAndSelectCombo(firstObject.StartTime, 1));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:00:000 (2,3)", "invalid offset");
|
||||||
|
AddAssert("snap to 1, select 2-3", () => checkSnapAndSelectCombo(firstObject.StartTime, 2, 3));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:00:956 (956|1,956|2)", "mania link");
|
||||||
|
AddAssert("snap to next, select none", () => checkSnapAndSelectCombo(firstObject.StartTime));
|
||||||
|
|
||||||
|
addReset();
|
||||||
|
addStepClickLink("00:00:000 (0|1)", "mania link");
|
||||||
|
AddAssert("snap to 1, select none", () => checkSnapAndSelectCombo(firstObject.StartTime));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
@ -12,9 +11,6 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mania;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
@ -25,79 +21,39 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
public partial class TestSceneOpenEditorTimestamp : OsuGameTestScene
|
public partial class TestSceneOpenEditorTimestamp : OsuGameTestScene
|
||||||
{
|
{
|
||||||
protected Editor Editor => (Editor)Game.ScreenStack.CurrentScreen;
|
private Editor editor => (Editor)Game.ScreenStack.CurrentScreen;
|
||||||
protected EditorBeatmap EditorBeatmap => Editor.ChildrenOfType<EditorBeatmap>().Single();
|
private EditorBeatmap editorBeatmap => editor.ChildrenOfType<EditorBeatmap>().Single();
|
||||||
protected EditorClock EditorClock => Editor.ChildrenOfType<EditorClock>().Single();
|
private EditorClock editorClock => editor.ChildrenOfType<EditorClock>().Single();
|
||||||
|
|
||||||
protected void AddStepClickLink(string timestamp, string step = "", bool waitForSeek = true)
|
private void addStepClickLink(string timestamp, string step = "", bool waitForSeek = true)
|
||||||
{
|
{
|
||||||
AddStep($"{step} {timestamp}", () =>
|
AddStep($"{step} {timestamp}", () =>
|
||||||
Game.HandleLink(new LinkDetails(LinkAction.OpenEditorTimestamp, timestamp))
|
Game.HandleLink(new LinkDetails(LinkAction.OpenEditorTimestamp, timestamp))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (waitForSeek)
|
if (waitForSeek)
|
||||||
AddUntilStep("wait for seek", () => EditorClock.SeekingOrStopped.Value);
|
AddUntilStep("wait for seek", () => editorClock.SeekingOrStopped.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AddStepScreenModeTo(EditorScreenMode screenMode)
|
private void addStepScreenModeTo(EditorScreenMode screenMode)
|
||||||
{
|
{
|
||||||
AddStep("change screen to " + screenMode, () => Editor.Mode.Value = screenMode);
|
AddStep("change screen to " + screenMode, () => editor.Mode.Value = screenMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AssertOnScreenAt(EditorScreenMode screen, double time, string text = "stayed in")
|
private void assertOnScreenAt(EditorScreenMode screen, double time, string text = "stayed in")
|
||||||
{
|
{
|
||||||
AddAssert($"{text} {screen} at {time}", () =>
|
AddAssert($"{text} {screen} at {time}", () =>
|
||||||
Editor.Mode.Value == screen
|
editor.Mode.Value == screen
|
||||||
&& EditorClock.CurrentTime == time
|
&& editorClock.CurrentTime == time
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void AssertMovedScreenTo(EditorScreenMode screen, string text = "moved to")
|
private void assertMovedScreenTo(EditorScreenMode screen, string text = "moved to")
|
||||||
{
|
{
|
||||||
AddAssert($"{text} {screen}", () => Editor.Mode.Value == screen);
|
AddAssert($"{text} {screen}", () => editor.Mode.Value == screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool checkSnapAndSelectCombo(double startTime, params int[] comboNumbers)
|
private void setUpEditor(RulesetInfo ruleset)
|
||||||
{
|
|
||||||
bool checkCombos = comboNumbers.Any()
|
|
||||||
? hasCombosInOrder(EditorBeatmap.SelectedHitObjects, comboNumbers)
|
|
||||||
: !EditorBeatmap.SelectedHitObjects.Any();
|
|
||||||
|
|
||||||
return EditorClock.CurrentTime == startTime
|
|
||||||
&& EditorBeatmap.SelectedHitObjects.Count == comboNumbers.Length
|
|
||||||
&& checkCombos;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool hasCombosInOrder(IEnumerable<HitObject> selected, params int[] comboNumbers)
|
|
||||||
{
|
|
||||||
List<HitObject> hitObjects = selected.ToList();
|
|
||||||
if (hitObjects.Count != comboNumbers.Length)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return !hitObjects.Select(x => (IHasComboInformation)x)
|
|
||||||
.Where((combo, i) => combo.IndexInCurrentCombo + 1 != comboNumbers[i])
|
|
||||||
.Any();
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool checkSnapAndSelectColumn(double startTime, IReadOnlyCollection<(int, int)>? columnPairs = null)
|
|
||||||
{
|
|
||||||
bool checkColumns = columnPairs != null
|
|
||||||
? EditorBeatmap.SelectedHitObjects.All(x => columnPairs.Any(col => isNoteAt(x, col.Item1, col.Item2)))
|
|
||||||
: !EditorBeatmap.SelectedHitObjects.Any();
|
|
||||||
|
|
||||||
return EditorClock.CurrentTime == startTime
|
|
||||||
&& EditorBeatmap.SelectedHitObjects.Count == (columnPairs?.Count ?? 0)
|
|
||||||
&& checkColumns;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool isNoteAt(HitObject hitObject, double time, int column)
|
|
||||||
{
|
|
||||||
return hitObject is IHasColumn columnInfo
|
|
||||||
&& hitObject.StartTime == time
|
|
||||||
&& columnInfo.Column == column;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void SetUpEditor(RulesetInfo ruleset)
|
|
||||||
{
|
{
|
||||||
BeatmapSetInfo beatmapSet = null!;
|
BeatmapSetInfo beatmapSet = null!;
|
||||||
|
|
||||||
@ -118,7 +74,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
((PlaySongSelect)Game.ScreenStack.CurrentScreen)
|
((PlaySongSelect)Game.ScreenStack.CurrentScreen)
|
||||||
.Edit(beatmapSet.Beatmaps.Last(beatmap => beatmap.Ruleset.Name == ruleset.Name))
|
.Edit(beatmapSet.Beatmaps.Last(beatmap => beatmap.Ruleset.Name == ruleset.Name))
|
||||||
);
|
);
|
||||||
AddUntilStep("Wait for editor open", () => Editor.ReadyForUse);
|
AddUntilStep("Wait for editor open", () => editor.ReadyForUse);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -126,7 +82,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
{
|
{
|
||||||
RulesetInfo rulesetInfo = new OsuRuleset().RulesetInfo;
|
RulesetInfo rulesetInfo = new OsuRuleset().RulesetInfo;
|
||||||
|
|
||||||
AddStepClickLink("00:00:000", waitForSeek: false);
|
addStepClickLink("00:00:000", waitForSeek: false);
|
||||||
AddAssert("recieved 'must be in edit'", () =>
|
AddAssert("recieved 'must be in edit'", () =>
|
||||||
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.MustBeInEdit) == 1
|
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.MustBeInEdit) == 1
|
||||||
);
|
);
|
||||||
@ -134,20 +90,20 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo.Invoke());
|
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo.Invoke());
|
||||||
AddAssert("entered song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
AddAssert("entered song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (1)", waitForSeek: false);
|
addStepClickLink("00:00:000 (1)", waitForSeek: false);
|
||||||
AddAssert("recieved 'must be in edit'", () =>
|
AddAssert("recieved 'must be in edit'", () =>
|
||||||
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.MustBeInEdit) == 2
|
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.MustBeInEdit) == 2
|
||||||
);
|
);
|
||||||
|
|
||||||
SetUpEditor(rulesetInfo);
|
setUpEditor(rulesetInfo);
|
||||||
AddAssert("is editor Osu", () => EditorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
|
AddAssert("is editor Osu", () => editorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
|
||||||
|
|
||||||
AddStepClickLink("00:000", "invalid link", waitForSeek: false);
|
addStepClickLink("00:000", "invalid link", waitForSeek: false);
|
||||||
AddAssert("recieved 'failed to process'", () =>
|
AddAssert("recieved 'failed to process'", () =>
|
||||||
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.FailedToProcessTimestamp) == 1
|
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.FailedToProcessTimestamp) == 1
|
||||||
);
|
);
|
||||||
|
|
||||||
AddStepClickLink("50000:00:000", "too long link", waitForSeek: false);
|
addStepClickLink("50000:00:000", "too long link", waitForSeek: false);
|
||||||
AddAssert("recieved 'too long'", () =>
|
AddAssert("recieved 'too long'", () =>
|
||||||
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.TooLongTimestamp) == 1
|
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.TooLongTimestamp) == 1
|
||||||
);
|
);
|
||||||
@ -159,156 +115,45 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
const long long_link_value = 1_000 * 60 * 1_000;
|
const long long_link_value = 1_000 * 60 * 1_000;
|
||||||
RulesetInfo rulesetInfo = new OsuRuleset().RulesetInfo;
|
RulesetInfo rulesetInfo = new OsuRuleset().RulesetInfo;
|
||||||
|
|
||||||
SetUpEditor(rulesetInfo);
|
setUpEditor(rulesetInfo);
|
||||||
AddAssert("is editor Osu", () => EditorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
|
AddAssert("is editor Osu", () => editorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
|
||||||
|
|
||||||
AddStepClickLink("1000:00:000", "long link");
|
addStepClickLink("1000:00:000", "long link");
|
||||||
AddAssert("moved to end of track", () =>
|
AddAssert("moved to end of track", () =>
|
||||||
EditorClock.CurrentTime == long_link_value
|
editorClock.CurrentTime == long_link_value
|
||||||
|| (EditorClock.TrackLength < long_link_value && EditorClock.CurrentTime == EditorClock.TrackLength)
|
|| (editorClock.TrackLength < long_link_value && editorClock.CurrentTime == editorClock.TrackLength)
|
||||||
);
|
);
|
||||||
|
|
||||||
AddStepScreenModeTo(EditorScreenMode.SongSetup);
|
addStepScreenModeTo(EditorScreenMode.SongSetup);
|
||||||
AddStepClickLink("00:00:000");
|
addStepClickLink("00:00:000");
|
||||||
AssertOnScreenAt(EditorScreenMode.SongSetup, 0);
|
assertOnScreenAt(EditorScreenMode.SongSetup, 0);
|
||||||
|
|
||||||
AddStepClickLink("00:05:000 (0|0)");
|
addStepClickLink("00:05:000 (0|0)");
|
||||||
AssertMovedScreenTo(EditorScreenMode.Compose);
|
assertMovedScreenTo(EditorScreenMode.Compose);
|
||||||
|
|
||||||
AddStepScreenModeTo(EditorScreenMode.Design);
|
addStepScreenModeTo(EditorScreenMode.Design);
|
||||||
AddStepClickLink("00:10:000");
|
addStepClickLink("00:10:000");
|
||||||
AssertOnScreenAt(EditorScreenMode.Design, 10_000);
|
assertOnScreenAt(EditorScreenMode.Design, 10_000);
|
||||||
|
|
||||||
AddStepClickLink("00:15:000 (1)");
|
addStepClickLink("00:15:000 (1)");
|
||||||
AssertMovedScreenTo(EditorScreenMode.Compose);
|
assertMovedScreenTo(EditorScreenMode.Compose);
|
||||||
|
|
||||||
AddStepScreenModeTo(EditorScreenMode.Timing);
|
addStepScreenModeTo(EditorScreenMode.Timing);
|
||||||
AddStepClickLink("00:20:000");
|
addStepClickLink("00:20:000");
|
||||||
AssertOnScreenAt(EditorScreenMode.Timing, 20_000);
|
assertOnScreenAt(EditorScreenMode.Timing, 20_000);
|
||||||
|
|
||||||
AddStepClickLink("00:25:000 (0,1)");
|
addStepClickLink("00:25:000 (0,1)");
|
||||||
AssertMovedScreenTo(EditorScreenMode.Compose);
|
assertMovedScreenTo(EditorScreenMode.Compose);
|
||||||
|
|
||||||
AddStepScreenModeTo(EditorScreenMode.Verify);
|
addStepScreenModeTo(EditorScreenMode.Verify);
|
||||||
AddStepClickLink("00:30:000");
|
addStepClickLink("00:30:000");
|
||||||
AssertOnScreenAt(EditorScreenMode.Verify, 30_000);
|
assertOnScreenAt(EditorScreenMode.Verify, 30_000);
|
||||||
|
|
||||||
AddStepClickLink("00:35:000 (0,1)");
|
addStepClickLink("00:35:000 (0,1)");
|
||||||
AssertMovedScreenTo(EditorScreenMode.Compose);
|
assertMovedScreenTo(EditorScreenMode.Compose);
|
||||||
|
|
||||||
AddStepClickLink("00:00:000");
|
addStepClickLink("00:00:000");
|
||||||
AssertOnScreenAt(EditorScreenMode.Compose, 0);
|
assertOnScreenAt(EditorScreenMode.Compose, 0);
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestSelectionForOsu()
|
|
||||||
{
|
|
||||||
HitObject firstObject = null!;
|
|
||||||
RulesetInfo rulesetInfo = new OsuRuleset().RulesetInfo;
|
|
||||||
|
|
||||||
SetUpEditor(rulesetInfo);
|
|
||||||
AddAssert("is editor Osu", () => EditorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:956 (1,2,3)");
|
|
||||||
AddAssert("snap and select 1-2-3", () =>
|
|
||||||
{
|
|
||||||
firstObject = EditorBeatmap.HitObjects.First();
|
|
||||||
return checkSnapAndSelectCombo(firstObject.StartTime, 1, 2, 3);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStepClickLink("00:01:450 (2,3,4,1,2)");
|
|
||||||
AddAssert("snap and select 2-3-4-1-2", () => checkSnapAndSelectCombo(1_450, 2, 3, 4, 1, 2));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:956 (1,1,1)");
|
|
||||||
AddAssert("snap and select 1-1-1", () => checkSnapAndSelectCombo(firstObject.StartTime, 1, 1, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestUnusualSelectionForOsu()
|
|
||||||
{
|
|
||||||
HitObject firstObject = null!;
|
|
||||||
RulesetInfo rulesetInfo = new OsuRuleset().RulesetInfo;
|
|
||||||
|
|
||||||
SetUpEditor(rulesetInfo);
|
|
||||||
AddAssert("is editor Osu", () => EditorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (1,2,3)", "invalid offset");
|
|
||||||
AddAssert("snap to next, select 1-2-3", () =>
|
|
||||||
{
|
|
||||||
firstObject = EditorBeatmap.HitObjects.First();
|
|
||||||
return checkSnapAndSelectCombo(firstObject.StartTime, 1, 2, 3);
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:956 (2,3,4)", "invalid offset");
|
|
||||||
AddAssert("snap to next, select 2-3-4", () => checkSnapAndSelectCombo(firstObject.StartTime, 2, 3, 4));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (0)", "invalid offset");
|
|
||||||
AddAssert("snap and select 1", () => checkSnapAndSelectCombo(firstObject.StartTime, 1));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (1)", "invalid offset");
|
|
||||||
AddAssert("snap and select 1", () => checkSnapAndSelectCombo(firstObject.StartTime, 1));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (2)", "invalid offset");
|
|
||||||
AddAssert("snap and select 1", () => checkSnapAndSelectCombo(firstObject.StartTime, 1));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (2,3)", "invalid offset");
|
|
||||||
AddAssert("snap to 1, select 2-3", () => checkSnapAndSelectCombo(firstObject.StartTime, 2, 3));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:956 (956|1,956|2)", "mania link");
|
|
||||||
AddAssert("snap to next, select none", () => checkSnapAndSelectCombo(firstObject.StartTime));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (0|1)", "mania link");
|
|
||||||
AddAssert("snap to 1, select none", () => checkSnapAndSelectCombo(firstObject.StartTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestSelectionForMania()
|
|
||||||
{
|
|
||||||
RulesetInfo rulesetInfo = new ManiaRuleset().RulesetInfo;
|
|
||||||
|
|
||||||
SetUpEditor(rulesetInfo);
|
|
||||||
AddAssert("is editor Mania", () => EditorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
|
|
||||||
|
|
||||||
AddStepClickLink("00:11:010 (11010|1,11175|5,11258|3,11340|5,11505|1)");
|
|
||||||
AddAssert("selected group", () => checkSnapAndSelectColumn(11010, new List<(int, int)>
|
|
||||||
{ (11010, 1), (11175, 5), (11258, 3), (11340, 5), (11505, 1) }
|
|
||||||
));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:956 (956|1,956|6,1285|3,1780|4)");
|
|
||||||
AddAssert("selected ungrouped", () => checkSnapAndSelectColumn(956, new List<(int, int)>
|
|
||||||
{ (956, 1), (956, 6), (1285, 3), (1780, 4) }
|
|
||||||
));
|
|
||||||
|
|
||||||
AddStepClickLink("02:36:560 (156560|1,156560|4,156560|6)");
|
|
||||||
AddAssert("selected in row", () => checkSnapAndSelectColumn(156560, new List<(int, int)>
|
|
||||||
{ (156560, 1), (156560, 4), (156560, 6) }
|
|
||||||
));
|
|
||||||
|
|
||||||
AddStepClickLink("00:35:736 (35736|3,36395|3,36725|3,37384|3)");
|
|
||||||
AddAssert("selected in column", () => checkSnapAndSelectColumn(35736, new List<(int, int)>
|
|
||||||
{ (35736, 3), (36395, 3), (36725, 3), (37384, 3) }
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestUnusualSelectionForMania()
|
|
||||||
{
|
|
||||||
RulesetInfo rulesetInfo = new ManiaRuleset().RulesetInfo;
|
|
||||||
|
|
||||||
SetUpEditor(rulesetInfo);
|
|
||||||
AddAssert("is editor Mania", () => EditorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (0|1)", "invalid link");
|
|
||||||
AddAssert("snap to 1, select none", () => checkSnapAndSelectColumn(956));
|
|
||||||
|
|
||||||
AddStepClickLink("00:00:000 (0)", "std link");
|
|
||||||
AddAssert("snap and select 1", () => checkSnapAndSelectColumn(956, new List<(int, int)>
|
|
||||||
{ (956, 1) })
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO: discuss - this selects the first 2 objects on Stable, do we want that or is this fine?
|
|
||||||
AddStepClickLink("00:00:000 (1,2)", "std link");
|
|
||||||
AddAssert("snap to 1, select none", () => checkSnapAndSelectColumn(956));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user