mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 11:12:59 +08:00
Fix some tests not always waiting long enough for beatmap loading
These used to work because there was a huge blocking load operation, which is now more asynchronous. Note that the change made in `SongSelect` is not required, but defensive (feels it should have been doing this the whole time).
This commit is contained in:
parent
1776d38809
commit
def1abaeca
@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
() => Is.EqualTo(1));
|
() => Is.EqualTo(1));
|
||||||
|
|
||||||
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo?.Invoke());
|
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo?.Invoke());
|
||||||
AddUntilStep("entered song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
AddUntilStep("entered song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.BeatmapSetsLoaded);
|
||||||
|
|
||||||
addStepClickLink("00:00:000 (1)", waitForSeek: false);
|
addStepClickLink("00:00:000 (1)", waitForSeek: false);
|
||||||
AddUntilStep("received 'must be in edit'",
|
AddUntilStep("received 'must be in edit'",
|
||||||
@ -138,7 +138,7 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddUntilStep("Wait for song select", () =>
|
AddUntilStep("Wait for song select", () =>
|
||||||
Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet)
|
Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet)
|
||||||
&& Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect
|
&& Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect
|
||||||
&& songSelect.IsLoaded
|
&& songSelect.BeatmapSetsLoaded
|
||||||
);
|
);
|
||||||
AddStep("Switch ruleset", () => Game.Ruleset.Value = ruleset);
|
AddStep("Switch ruleset", () => Game.Ruleset.Value = ruleset);
|
||||||
AddStep("Open editor for ruleset", () =>
|
AddStep("Open editor for ruleset", () =>
|
||||||
|
@ -165,16 +165,19 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Solo]
|
||||||
public void TestEditorGameplayTestAlwaysUsesOriginalRuleset()
|
public void TestEditorGameplayTestAlwaysUsesOriginalRuleset()
|
||||||
{
|
{
|
||||||
prepareBeatmap();
|
prepareBeatmap();
|
||||||
|
|
||||||
AddStep("switch ruleset", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo);
|
AddStep("switch ruleset at song select", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo);
|
||||||
|
|
||||||
AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0)));
|
AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0)));
|
||||||
AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse);
|
|
||||||
AddStep("test gameplay", () => getEditor().TestGameplay());
|
|
||||||
|
|
||||||
|
AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse);
|
||||||
|
AddAssert("editor ruleset is osu!", () => Game.Ruleset.Value, () => Is.EqualTo(new OsuRuleset().RulesetInfo));
|
||||||
|
|
||||||
|
AddStep("test gameplay", () => getEditor().TestGameplay());
|
||||||
AddUntilStep("wait for player", () =>
|
AddUntilStep("wait for player", () =>
|
||||||
{
|
{
|
||||||
// notifications may fire at almost any inopportune time and cause annoying test failures.
|
// notifications may fire at almost any inopportune time and cause annoying test failures.
|
||||||
@ -183,8 +186,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
Game.CloseAllOverlays();
|
Game.CloseAllOverlays();
|
||||||
return Game.ScreenStack.CurrentScreen is EditorPlayer editorPlayer && editorPlayer.IsLoaded;
|
return Game.ScreenStack.CurrentScreen is EditorPlayer editorPlayer && editorPlayer.IsLoaded;
|
||||||
});
|
});
|
||||||
|
AddAssert("gameplay ruleset is osu!", () => Game.Ruleset.Value, () => Is.EqualTo(new OsuRuleset().RulesetInfo));
|
||||||
AddAssert("current ruleset is osu!", () => Game.Ruleset.Value.Equals(new OsuRuleset().RulesetInfo));
|
|
||||||
|
|
||||||
AddStep("exit to song select", () => Game.PerformFromScreen(_ => { }, typeof(PlaySongSelect).Yield()));
|
AddStep("exit to song select", () => Game.PerformFromScreen(_ => { }, typeof(PlaySongSelect).Yield()));
|
||||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
||||||
@ -352,7 +354,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddUntilStep("wait for song select",
|
AddUntilStep("wait for song select",
|
||||||
() => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet)
|
() => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet)
|
||||||
&& Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect
|
&& Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect
|
||||||
&& songSelect.IsLoaded);
|
&& songSelect.BeatmapSetsLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openEditor()
|
private void openEditor()
|
||||||
|
@ -193,7 +193,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
{
|
{
|
||||||
AddStep("present beatmap", () => Game.PresentBeatmap(getImport()));
|
AddStep("present beatmap", () => Game.PresentBeatmap(getImport()));
|
||||||
|
|
||||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.IsLoaded);
|
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.BeatmapSetsLoaded);
|
||||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.OnlineID, () => Is.EqualTo(getImport().OnlineID));
|
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.OnlineID, () => Is.EqualTo(getImport().OnlineID));
|
||||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value, () => Is.EqualTo(getImport().Beatmaps.First().Ruleset));
|
AddAssert("correct ruleset selected", () => Game.Ruleset.Value, () => Is.EqualTo(getImport().Beatmaps.First().Ruleset));
|
||||||
}
|
}
|
||||||
@ -203,7 +203,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
Predicate<BeatmapInfo> pred = b => b.OnlineID == importedID * 1024 + 2;
|
Predicate<BeatmapInfo> pred = b => b.OnlineID == importedID * 1024 + 2;
|
||||||
AddStep("present difficulty", () => Game.PresentBeatmap(getImport(), pred));
|
AddStep("present difficulty", () => Game.PresentBeatmap(getImport(), pred));
|
||||||
|
|
||||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.IsLoaded);
|
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.BeatmapSetsLoaded);
|
||||||
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID, () => Is.EqualTo(importedID * 1024 + 2));
|
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID, () => Is.EqualTo(importedID * 1024 + 2));
|
||||||
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.OnlineID, () => Is.EqualTo(expectedRulesetOnlineID ?? getImport().Beatmaps.First().Ruleset.OnlineID));
|
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.OnlineID, () => Is.EqualTo(expectedRulesetOnlineID ?? getImport().Beatmaps.First().Ruleset.OnlineID));
|
||||||
}
|
}
|
||||||
|
@ -1035,9 +1035,11 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestTouchScreenDetectionInGame()
|
public void TestTouchScreenDetectionInGame()
|
||||||
{
|
{
|
||||||
|
BeatmapSetInfo beatmapSet = null;
|
||||||
|
|
||||||
PushAndConfirm(() => new TestPlaySongSelect());
|
PushAndConfirm(() => new TestPlaySongSelect());
|
||||||
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
AddStep("import beatmap", () => beatmapSet = BeatmapImportHelper.LoadQuickOszIntoOsu(Game).GetResultSafely());
|
||||||
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
|
AddUntilStep("wait for selected", () => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet));
|
||||||
AddStep("select", () => InputManager.Key(Key.Enter));
|
AddStep("select", () => InputManager.Key(Key.Enter));
|
||||||
|
|
||||||
Player player = null;
|
Player player = null;
|
||||||
|
@ -428,7 +428,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
// Forced refetch is important here to guarantee correct invalidation across all difficulties.
|
// Forced refetch is important here to guarantee correct invalidation across all difficulties.
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo ?? beatmapInfoNoDebounce, true);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo ?? beatmapInfoNoDebounce, true);
|
||||||
this.Push(new EditorLoader());
|
|
||||||
|
FinaliseSelection(customStartAction: () => this.Push(new EditorLoader()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user