1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 06:52:55 +08:00

Fix tests

This commit is contained in:
Bartłomiej Dach 2023-11-20 21:57:07 +09:00
parent b6215b2809
commit c16afeb347
No known key found for this signature in database

View File

@ -83,46 +83,42 @@ 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("received 'must be in edit'",
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.MustBeInEdit) == 1 () => Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.MustBeInEdit),
); () => Is.EqualTo(1));
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); AddUntilStep("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("received 'must be in edit'",
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.MustBeInEdit) == 2 () => Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.MustBeInEdit),
); () => Is.EqualTo(2));
setUpEditor(rulesetInfo); setUpEditor(rulesetInfo);
AddAssert("is editor Osu", () => editorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo)); AddAssert("ruleset is 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("received 'failed to process'",
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.FailedToProcessTimestamp) == 1 () => Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.FailedToProcessTimestamp),
); () => Is.EqualTo(1));
addStepClickLink("50000:00:000", "too long link", waitForSeek: false); addStepClickLink("50000:00:000", "too long link", waitForSeek: false);
AddAssert("recieved 'too long'", () => AddAssert("received 'failed to process'",
Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.TooLongTimestamp) == 1 () => Game.Notifications.AllNotifications.Count(x => x.Text == EditorStrings.FailedToProcessTimestamp),
); () => Is.EqualTo(2));
} }
[Test] [Test]
public void TestHandleCurrentScreenChanges() public void TestHandleCurrentScreenChanges()
{ {
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 osu! ruleset", () => editorBeatmap.BeatmapInfo.Ruleset.Equals(rulesetInfo));
addStepClickLink("1000:00:000", "long link"); addStepClickLink("100:00:000", "long link");
AddAssert("moved to end of track", () => AddUntilStep("moved to end of track", () => editorClock.CurrentTime, () => Is.EqualTo(editorClock.TrackLength));
editorClock.CurrentTime == long_link_value
|| (editorClock.TrackLength < long_link_value && editorClock.CurrentTime == editorClock.TrackLength)
);
addStepScreenModeTo(EditorScreenMode.SongSetup); addStepScreenModeTo(EditorScreenMode.SongSetup);
addStepClickLink("00:00:000"); addStepClickLink("00:00:000");