From 81e842f6b4bab33100c8f79eae63c6ab41155730 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Dec 2019 19:48:48 +0900 Subject: [PATCH 1/4] Fix waveform test beatmap accessing zip archive across multiple threads --- .../Editor/TestSceneEditorComposeTimeline.cs | 14 +++----- osu.Game.Tests/WaveformTestBeatmap.cs | 32 +++++++++++-------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/osu.Game.Tests/Visual/Editor/TestSceneEditorComposeTimeline.cs b/osu.Game.Tests/Visual/Editor/TestSceneEditorComposeTimeline.cs index e618256c03..ed6bc5fe0c 100644 --- a/osu.Game.Tests/Visual/Editor/TestSceneEditorComposeTimeline.cs +++ b/osu.Game.Tests/Visual/Editor/TestSceneEditorComposeTimeline.cs @@ -68,8 +68,11 @@ namespace osu.Game.Tests.Visual.Editor { private readonly Drawable marker; - private readonly IBindable beatmap = new Bindable(); - private IAdjustableClock adjustableClock; + [Resolved] + private IBindable beatmap { get; set; } + + [Resolved] + private IAdjustableClock adjustableClock { get; set; } public AudioVisualiser() { @@ -91,13 +94,6 @@ namespace osu.Game.Tests.Visual.Editor }; } - [BackgroundDependencyLoader] - private void load(IAdjustableClock adjustableClock, IBindable beatmap) - { - this.adjustableClock = adjustableClock; - this.beatmap.BindTo(beatmap); - } - protected override void Update() { base.Update(); diff --git a/osu.Game.Tests/WaveformTestBeatmap.cs b/osu.Game.Tests/WaveformTestBeatmap.cs index 0d16a78f75..59f322e24c 100644 --- a/osu.Game.Tests/WaveformTestBeatmap.cs +++ b/osu.Game.Tests/WaveformTestBeatmap.cs @@ -20,23 +20,21 @@ namespace osu.Game.Tests /// public class WaveformTestBeatmap : WorkingBeatmap { - private readonly ZipArchiveReader reader; - private readonly Stream stream; private readonly ITrackStore trackStore; + private Stream getStream() => TestResources.GetTestBeatmapStream(); + + private ZipArchiveReader getZipReader() => new ZipArchiveReader(getStream()); + public WaveformTestBeatmap(AudioManager audioManager) : base(new BeatmapInfo(), audioManager) { - stream = TestResources.GetTestBeatmapStream(); - reader = new ZipArchiveReader(stream); - trackStore = audioManager.GetTrackStore(reader); + trackStore = audioManager.GetTrackStore(getZipReader()); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - stream?.Dispose(); - reader?.Dispose(); trackStore?.Dispose(); } @@ -50,15 +48,23 @@ namespace osu.Game.Tests protected override Track GetTrack() => trackStore.Get(firstAudioFile); - private string firstAudioFile => reader.Filenames.First(f => f.EndsWith(".mp3")); - - private Stream getBeatmapStream() => reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu"))); + private string firstAudioFile + { + get + { + using (var reader = getZipReader()) + return reader.Filenames.First(f => f.EndsWith(".mp3")); + } + } private Beatmap createTestBeatmap() { - using (var beatmapStream = getBeatmapStream()) - using (var beatmapReader = new LineBufferedReader(beatmapStream)) - return Decoder.GetDecoder(beatmapReader).Decode(beatmapReader); + using (var reader = getZipReader()) + { + using (var beatmapStream = reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu")))) + using (var beatmapReader = new LineBufferedReader(beatmapStream)) + return Decoder.GetDecoder(beatmapReader).Decode(beatmapReader); + } } } } From 351e826120093ea0fb383f37237b361d4debd741 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 16 Dec 2019 15:28:18 +0800 Subject: [PATCH 2/4] Upgrade project targets to netcoreapp3.1 --- .../CatchRuleset__Tests_.xml | 4 +-- .../ManiaRuleset__Tests_.xml | 4 +-- .../runConfigurations/OsuRuleset__Tests_.xml | 4 +-- .../TaikoRuleset__Tests_.xml | 4 +-- .../.idea/runConfigurations/Tournament.xml | 4 +-- .../runConfigurations/Tournament__Tests_.xml | 4 +-- .../.idea/runConfigurations/osu_.xml | 4 +-- .../.idea/runConfigurations/osu___Tests_.xml | 4 +-- .vscode/launch.json | 32 +++++++++---------- .vscode/tasks.json | 2 +- README.md | 4 +-- osu.Desktop/osu.Desktop.csproj | 2 +- .../osu.Game.Rulesets.Catch.Tests.csproj | 2 +- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- .../osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- .../osu.Game.Tournament.Tests.csproj | 2 +- 18 files changed, 42 insertions(+), 42 deletions(-) diff --git a/.idea/.idea.osu.Desktop/.idea/runConfigurations/CatchRuleset__Tests_.xml b/.idea/.idea.osu.Desktop/.idea/runConfigurations/CatchRuleset__Tests_.xml index 5372b6f28a..a4154623b6 100644 --- a/.idea/.idea.osu.Desktop/.idea/runConfigurations/CatchRuleset__Tests_.xml +++ b/.idea/.idea.osu.Desktop/.idea/runConfigurations/CatchRuleset__Tests_.xml @@ -1,6 +1,6 @@ -