From 162e183b36721e0aa3520dd80db1ebc19fbe7f7c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jan 2017 16:01:49 +0900 Subject: [PATCH 1/6] Fix some nullrefs when running visualtests with no maps loaded. --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 4 +++- osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs | 3 ++- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 ++ osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 4 ++-- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 9e3ad1bbc8..3be8c83299 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -29,7 +29,9 @@ namespace osu.Desktop.VisualTests.Tests [BackgroundDependencyLoader] private void load(BeatmapDatabase db) { - beatmap = db.GetWorkingBeatmap(db.Query().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault()); + var beatmapInfo = db.Query().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault(); + if (beatmapInfo != null) + beatmap = db.GetWorkingBeatmap(beatmapInfo); } public override void Reset() diff --git a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs index e90829873f..f8cec43f14 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs @@ -18,7 +18,8 @@ namespace osu.Game.Beatmaps.Drawables [BackgroundDependencyLoader] private void load(OsuGameBase game) { - Texture = working.Background; + if (working.Background != null) + Texture = working.Background; } } } diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 9184607398..a898465610 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -30,6 +30,8 @@ namespace osu.Game.Beatmaps { if (background != null) return background; + if (BeatmapInfo.Metadata?.BackgroundFile == null) return null; + try { using (var reader = GetReader()) diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 7ce71acf3e..58f39013a8 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -56,8 +56,8 @@ namespace osu.Game.Modes.Objects.Drawables [BackgroundDependencyLoader] private void load(AudioManager audio) { - string hitType = (HitObject.Sample.Type == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower(); - string sampleSet = HitObject.Sample.Set.ToString().ToLower(); + string hitType = ((HitObject.Sample?.Type ?? SampleType.None) == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower(); + string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower(); sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}"); } From 4aa2834082bd5d8a034749317d734176980a60a5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jan 2017 17:02:11 +0900 Subject: [PATCH 2/6] Fix TestCasePlaySongSelect not working on consecutive executions. --- osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index adfa2556a0..0e45d58774 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -41,7 +41,11 @@ namespace osu.Desktop.VisualTests.Tests protected override void Dispose(bool isDisposing) { if (oldDb != null) + { Dependencies.Cache(oldDb, true); + db = null; + } + base.Dispose(isDisposing); } From c07001b566dbec4c9642841c615211253a1d49be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jan 2017 17:12:31 +0900 Subject: [PATCH 3/6] Fix TestCasePlayer not working on consecutive executions (clock being set where it isn't necessary). --- osu.Desktop.VisualTests/Tests/TestCasePlayer.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index 3be8c83299..b55d341100 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -38,12 +38,8 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - //ensure we are at offset 0 - Clock = new FramedClock(); - - if (beatmap == null) + if (beatmap?.Track == null) { - var objects = new List(); int time = 1500; From 7ee6a50404aee10aefe8250a156fa3ae3054933f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jan 2017 17:22:31 +0900 Subject: [PATCH 4/6] Fix checkbox design regressions. --- osu.Game/Overlays/Options/CheckBoxOption.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Options/CheckBoxOption.cs b/osu.Game/Overlays/Options/CheckBoxOption.cs index 310d33580d..cc1af1e3c9 100644 --- a/osu.Game/Overlays/Options/CheckBoxOption.cs +++ b/osu.Game/Overlays/Options/CheckBoxOption.cs @@ -168,14 +168,17 @@ namespace osu.Game.Overlays.Options private void load(OsuColour colours) { Colour = idleColour = colours.Pink; + glowingColour = colours.PinkLighter; EdgeEffect = new EdgeEffect { - Colour = glowingColour = colours.PinkDarker, + Colour = colours.PinkDarker, Type = EdgeEffectType.Glow, Radius = 10, Roundness = 8, }; + + FadeGlowTo(0); } public bool Glowing From a2501cc81de4aa45bbf687a72acafaf071e8e42a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jan 2017 18:09:45 +0900 Subject: [PATCH 5/6] Fix TestCaseHitObjects not working at all due to state being set before load is complete. --- osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs | 1 - osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 59ef75a909..18d8dcc814 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -49,7 +49,6 @@ namespace osu.Desktop.VisualTests.Tests DrawableHitCircle d = new DrawableHitCircle(h) { Anchor = Anchor.Centre, - Origin = Anchor.Centre, Depth = i, State = ArmedState.Hit, Judgement = new OsuJudgementInfo { Result = HitResult.Hit } diff --git a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs index 58f39013a8..f2dc7268ac 100644 --- a/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Modes/Objects/Drawables/DrawableHitObject.cs @@ -43,8 +43,8 @@ namespace osu.Game.Modes.Objects.Drawables state = value; UpdateState(state); - - Expire(); + if (IsLoaded) + Expire(); if (State == ArmedState.Hit) PlaySample(); From d4e30f65db194d5293ef85141683f06040414764 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jan 2017 18:12:02 +0900 Subject: [PATCH 6/6] Adjust timing of TestCaseHitObjects a bit. --- osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 18d8dcc814..d6112d7024 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -42,7 +42,7 @@ namespace osu.Desktop.VisualTests.Tests { var h = new HitCircle { - StartTime = Clock.CurrentTime + 1000 + i * 80, + StartTime = Clock.CurrentTime + 600 + i * 80, Position = new Vector2((i - count / 2) * 14), };