From d06b3c898f60777262e68f0a45535abfaf4d8e1a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 2 May 2017 15:32:47 +0900 Subject: [PATCH] Update framework with new DI changes. --- osu-framework | 2 +- .../Beatmaps/IO/ImportBeatmapTest.cs | 36 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/osu-framework b/osu-framework index b25ed4291b..58c108309f 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit b25ed4291bb8a8a38faf404c68b3f97efc9d3413 +Subproject commit 58c108309f72462d8dc45aa488ab78cd6db08cf1 diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index b35f5901be..b39db30fe8 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -26,15 +26,15 @@ namespace osu.Game.Tests.Beatmaps.IO //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new HeadlessGameHost()) { - var osu = loadOsu(host); + loadOsu(host); var temp = prepareTempCopy(osz_path); Assert.IsTrue(File.Exists(temp)); - osu.Dependencies.Get().Import(temp); + host.Dependencies.Get().Import(temp); - ensureLoaded(osu); + ensureLoaded(host); Assert.IsFalse(File.Exists(temp)); } @@ -49,7 +49,7 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(host.IsPrimaryInstance); Assert.IsTrue(!client.IsPrimaryInstance); - var osu = loadOsu(host); + loadOsu(host); var temp = prepareTempCopy(osz_path); @@ -59,7 +59,7 @@ namespace osu.Game.Tests.Beatmaps.IO if (!importer.ImportAsync(temp).Wait(5000)) Assert.Fail(@"IPC took too long to send"); - ensureLoaded(osu); + ensureLoaded(host); Assert.IsFalse(File.Exists(temp)); } @@ -71,16 +71,16 @@ namespace osu.Game.Tests.Beatmaps.IO //unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. using (HeadlessGameHost host = new HeadlessGameHost()) { - var osu = loadOsu(host); + loadOsu(host); var temp = prepareTempCopy(osz_path); Assert.IsTrue(File.Exists(temp)); using (File.OpenRead(temp)) - osu.Dependencies.Get().Import(temp); + host.Dependencies.Get().Import(temp); - ensureLoaded(osu); + ensureLoaded(host); Assert.IsTrue(File.Exists(temp)); @@ -105,19 +105,19 @@ namespace osu.Game.Tests.Beatmaps.IO Thread.Sleep(1); //reset beatmap database (sqlite and storage backing) - osu.Dependencies.Get().Reset(); - osu.Dependencies.Get().Reset(); + host.Dependencies.Get().Reset(); + host.Dependencies.Get().Reset(); return osu; } - private void ensureLoaded(OsuGameBase osu, int timeout = 10000) + private void ensureLoaded(GameHost host, int timeout = 10000) { IEnumerable resultSets = null; Action waitAction = () => { - while (!(resultSets = osu.Dependencies.Get() + while (!(resultSets = host.Dependencies.Get() .Query().Where(s => s.OnlineBeatmapSetID == 241526)).Any()) Thread.Sleep(50); }; @@ -134,7 +134,7 @@ namespace osu.Game.Tests.Beatmaps.IO //if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. waitAction = () => { - while ((resultBeatmaps = osu.Dependencies.Get() + while ((resultBeatmaps = host.Dependencies.Get() .Query().Where(s => s.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0)).Count() != 12) Thread.Sleep(50); }; @@ -143,7 +143,7 @@ namespace osu.Game.Tests.Beatmaps.IO @"Beatmaps did not import to the database in allocated time"); //fetch children and check we can load from the post-storage path... - var set = osu.Dependencies.Get().GetChildren(resultSets.First()); + var set = host.Dependencies.Get().GetChildren(resultSets.First()); Assert.IsTrue(set.Beatmaps.Count == resultBeatmaps.Count(), $@"Incorrect database beatmap count post-import ({resultBeatmaps.Count()} but should be {set.Beatmaps.Count})."); @@ -153,16 +153,16 @@ namespace osu.Game.Tests.Beatmaps.IO Assert.IsTrue(set.Beatmaps.Count > 0); - var beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; + var beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 0))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; + beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 1))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; + beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 2))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); - beatmap = osu.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; + beatmap = host.Dependencies.Get().GetWorkingBeatmap(set.Beatmaps.First(b => b.RulesetID == 3))?.Beatmap; Assert.IsTrue(beatmap?.HitObjects.Count > 0); } }