mirror of
https://github.com/ppy/osu
synced 2024-12-27 09:23:15 +00:00
Add test coverage of score arriving on disk when exporting from results screen after play
This commit is contained in:
parent
0b5be51ee0
commit
2dace742a3
@ -21,9 +21,11 @@ using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
@ -147,6 +149,37 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddUntilStep("score in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) != null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReplayExport()
|
||||
{
|
||||
CreateTest();
|
||||
|
||||
AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
|
||||
|
||||
AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime()));
|
||||
|
||||
AddUntilStep("results displayed", () => (Player.GetChildScreen() as ResultsScreen)?.IsLoaded == true);
|
||||
AddUntilStep("score in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) != null));
|
||||
|
||||
AddUntilStep("wait for button clickable", () => ((OsuScreen)Player.GetChildScreen())
|
||||
.ChildrenOfType<ReplayDownloadButton>().FirstOrDefault()?
|
||||
.ChildrenOfType<OsuClickableContainer>()?.FirstOrDefault()?
|
||||
.Enabled.Value == true);
|
||||
|
||||
AddAssert("no export files", () => !LocalStorage.GetFiles("exports").Any());
|
||||
|
||||
AddStep("Export replay", () => InputManager.PressKey(Key.F2));
|
||||
|
||||
string? filePath = null;
|
||||
|
||||
AddUntilStep("wait for export file", () => filePath = LocalStorage.GetFiles("exports").SingleOrDefault(), () => Is.Not.Null);
|
||||
AddAssert("filesize is non-zero", () =>
|
||||
{
|
||||
using (var stream = LocalStorage.GetStream(filePath))
|
||||
return stream.Length;
|
||||
}, () => Is.Not.Zero);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestScoreStoredLocallyCustomRuleset()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user