diff --git a/osu-framework b/osu-framework index cd2b351de3..b0909ce133 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit cd2b351de37f17b6d91d1fc062627208a09c3834 +Subproject commit b0909ce13389ba690bfc41232d2d39bdf175e896 diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs index e755924a15..e0a503bc76 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs @@ -12,10 +12,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Beatmap details in song select"; - public override void Reset() + public TestCaseBeatmapDetailArea() { - base.Reset(); - Add(new BeatmapDetailArea { Anchor = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs index df80ffdf53..903a26e7ea 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs @@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests private BeatmapDetails details; - public override void Reset() + public TestCaseBeatmapDetails() { - base.Reset(); - Add(details = new BeatmapDetails { RelativeSizeAxes = Axes.Both, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs index 7c211227c6..c9c1740856 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs @@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Beatmap options in song select"; - public override void Reset() + public TestCaseBeatmapOptionsOverlay() { - base.Reset(); - var overlay = new BeatmapOptionsOverlay(); overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, Color4.Purple, null, Key.Number1); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs b/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs index 658d2f92b1..f2dd454d65 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs @@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"breadcrumb > control"; - public override void Reset() + public TestCaseBreadcrumbs() { - base.Reset(); - BreadcrumbControl c; Add(c = new BreadcrumbControl { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs index 2663c952cf..751b979bad 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs @@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Testing chat api and overlay"; - public override void Reset() + public TestCaseChatDisplay() { - base.Reset(); - Add(new ChatOverlay { State = Visibility.Visible diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs index 808e9b5d19..aeb59e9cf3 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs @@ -23,10 +23,8 @@ namespace osu.Desktop.VisualTests.Tests private MyContextMenuContainer container; - public override void Reset() + public TestCaseContextMenu() { - base.Reset(); - Add(container = new MyContextMenuContainer { Size = new Vector2(200), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index 90e214c3c9..cfdb31e88d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -14,10 +14,8 @@ namespace osu.Desktop.VisualTests.Tests private DialogOverlay overlay; - public override void Reset() + public TestCaseDialogOverlay() { - base.Reset(); - Add(overlay = new DialogOverlay()); AddStep("dialog #1", () => overlay.Push(new PopupDialog diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs index 4cda14559f..6b68ffa260 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs @@ -16,9 +16,9 @@ namespace osu.Desktop.VisualTests.Tests private DirectOverlay direct; private RulesetDatabase rulesets; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); Add(direct = new DirectOverlay()); newBeatmaps(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs index 43a8069720..ddda4119bf 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs @@ -15,9 +15,9 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Select your favourite room"; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); DrawableRoom first; DrawableRoom second; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs index ebc9930f93..63ec06963c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs @@ -12,10 +12,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => "Tournament drawings"; - public override void Reset() + public TestCaseDrawings() { - base.Reset(); - Add(new Drawings { TeamList = new TestTeamList(), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs index e2cd2bf67b..00d7e8b5c8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs @@ -34,9 +34,9 @@ namespace osu.Desktop.VisualTests.Tests this.rulesets = rulesets; } - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); List objects = new List(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs index f653e2b9b4..0a5be88ef2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs @@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests private BarGraph graph; - public override void Reset() + public TestCaseGraph() { - base.Reset(); - Children = new[] { graph = new BarGraph diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 8c913ae95e..888c5cd67e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -29,6 +29,49 @@ namespace osu.Desktop.VisualTests.Tests var rateAdjustClock = new StopwatchClock(true); framedClock = new FramedClock(rateAdjustClock); playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; }; + + playbackSpeed.TriggerChange(); + + AddStep(@"circles", () => loadHitobjects(HitObjectType.Circle)); + AddStep(@"slider", () => loadHitobjects(HitObjectType.Slider)); + AddStep(@"spinner", () => loadHitobjects(HitObjectType.Spinner)); + + AddToggleStep(@"auto", state => { auto = state; loadHitobjects(mode); }); + + BasicSliderBar sliderBar; + Add(new Container + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new SpriteText { Text = "Playback Speed" }, + sliderBar = new BasicSliderBar + { + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + } + } + }); + + sliderBar.Current.BindTo(playbackSpeed); + + framedClock.ProcessFrame(); + + var clockAdjustContainer = new Container + { + RelativeSizeAxes = Axes.Both, + Clock = framedClock, + Children = new[] + { + playfieldContainer = new Container { RelativeSizeAxes = Axes.Both }, + approachContainer = new Container { RelativeSizeAxes = Axes.Both } + } + }; + + Add(clockAdjustContainer); } private HitObjectType mode = HitObjectType.Slider; @@ -37,7 +80,7 @@ namespace osu.Desktop.VisualTests.Tests private Container playfieldContainer; private Container approachContainer; - private void load(HitObjectType mode) + private void loadHitobjects(HitObjectType mode) { this.mode = mode; @@ -83,54 +126,6 @@ namespace osu.Desktop.VisualTests.Tests } } - public override void Reset() - { - base.Reset(); - - playbackSpeed.TriggerChange(); - - AddStep(@"circles", () => load(HitObjectType.Circle)); - AddStep(@"slider", () => load(HitObjectType.Slider)); - AddStep(@"spinner", () => load(HitObjectType.Spinner)); - - AddToggleStep(@"auto", state => { auto = state; load(mode); }); - - BasicSliderBar sliderBar; - Add(new Container - { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, - AutoSizeAxes = Axes.Both, - Children = new Drawable[] - { - new SpriteText { Text = "Playback Speed" }, - sliderBar = new BasicSliderBar - { - Width = 150, - Height = 10, - SelectionColor = Color4.Orange, - } - } - }); - - sliderBar.Current.BindTo(playbackSpeed); - - framedClock.ProcessFrame(); - - var clockAdjustContainer = new Container - { - RelativeSizeAxes = Axes.Both, - Clock = framedClock, - Children = new[] - { - playfieldContainer = new Container { RelativeSizeAxes = Axes.Both }, - approachContainer = new Container { RelativeSizeAxes = Axes.Both } - } - }; - - Add(clockAdjustContainer); - } - private int depth; private void add(DrawableOsuHitObject h) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index a28176b512..87a40a76ca 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -20,10 +20,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests key counter"; - public override void Reset() + public TestCaseKeyCounter() { - base.Reset(); - KeyCounterCollection kc = new KeyCounterCollection { Origin = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs index 39010baf91..c800cb63aa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs @@ -207,10 +207,8 @@ namespace osu.Desktop.VisualTests.Tests leaderboard.Scores = scores; } - public override void Reset() + public TestCaseLeaderboard() { - base.Reset(); - Add(leaderboard = new Leaderboard { Origin = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs index c66b0b4db4..30346e90c9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs @@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests { internal class TestCaseManiaHitObjects : TestCase { - public override void Reset() + public TestCaseManiaHitObjects() { - base.Reset(); - Add(new FillFlowContainer { Anchor = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs index 352b6cdc81..adaae91815 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs @@ -25,10 +25,8 @@ namespace osu.Desktop.VisualTests.Tests protected override double TimePerAction => 200; - public override void Reset() + public TestCaseManiaPlayfield() { - base.Reset(); - Action createPlayfield = (cols, pos) => { Clear(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index 0caa518a0b..bab471ed6a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Main menu button system"; - public override void Reset() + public TestCaseMenuButtonSystem() { - base.Reset(); - Add(new Box { ColourInfo = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke), diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs index 4de8b297eb..7c8e90aaf8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs @@ -16,10 +16,8 @@ namespace osu.Desktop.VisualTests.Tests private FailOverlay failOverlay; private int retryCount; - public override void Reset() + public TestCaseMenuOverlays() { - base.Reset(); - retryCount = 0; Add(pauseOverlay = new PauseContainer.PauseOverlay diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs index 3f3a9d82f5..e626a70e5f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMods.cs @@ -27,9 +27,9 @@ namespace osu.Desktop.VisualTests.Tests this.rulesets = rulesets; } - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); Add(modSelect = new ModSelectOverlay { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 5665bf859a..fe02e655e7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -18,12 +18,7 @@ namespace osu.Desktop.VisualTests.Tests public TestCaseMusicController() { Clock = new FramedClock(); - } - public override void Reset() - { - base.Reset(); - Clock.ProcessFrame(); mc = new MusicController { Origin = Anchor.Centre, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 8972040b06..6a50076b08 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -18,10 +18,8 @@ namespace osu.Desktop.VisualTests.Tests private NotificationManager manager; - public override void Reset() + public TestCaseNotificationManager() { - base.Reset(); - progressingNotifications.Clear(); Content.Add(manager = new NotificationManager diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs b/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs index 3cefb8a3d2..f2b4ed7918 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs @@ -15,9 +15,9 @@ namespace osu.Desktop.VisualTests.Tests public override string Description => @"Make it easier to see setting changes"; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); Add(new OnScreenDisplay()); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 35eb6d0ff9..a30d719a29 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -21,9 +21,8 @@ namespace osu.Desktop.VisualTests.Tests private RulesetDatabase rulesets; - public override void Reset() + public TestCasePlaySongSelect() { - base.Reset(); if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs index d922f3bb4b..69031eba0c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs @@ -33,53 +33,46 @@ namespace osu.Desktop.VisualTests.Tests this.db = db; } - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); WorkingBeatmap beatmap = null; - var beatmapInfo = db.Query().FirstOrDefault(b => b.RulesetID == 0); - if (beatmapInfo != null) - beatmap = db.GetWorkingBeatmap(beatmapInfo); + var objects = new List(); - if (beatmap?.Track == null) + int time = 1500; + for (int i = 0; i < 50; i++) { - var objects = new List(); - - int time = 1500; - for (int i = 0; i < 50; i++) + objects.Add(new HitCircle { - objects.Add(new HitCircle - { - StartTime = time, - Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : OsuPlayfield.BASE_SIZE.X, - i % 4 < 2 ? 0 : OsuPlayfield.BASE_SIZE.Y), - NewCombo = i % 4 == 0 - }); + StartTime = time, + Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : OsuPlayfield.BASE_SIZE.X, + i % 4 < 2 ? 0 : OsuPlayfield.BASE_SIZE.Y), + NewCombo = i % 4 == 0 + }); - time += 500; - } - - Beatmap b = new Beatmap - { - HitObjects = objects, - BeatmapInfo = new BeatmapInfo - { - Difficulty = new BeatmapDifficulty(), - Ruleset = rulesets.Query().First(), - Metadata = new BeatmapMetadata - { - Artist = @"Unknown", - Title = @"Sample Beatmap", - Author = @"peppy", - } - } - }; - - beatmap = new TestWorkingBeatmap(b); + time += 500; } + Beatmap b = new Beatmap + { + HitObjects = objects, + BeatmapInfo = new BeatmapInfo + { + Difficulty = new BeatmapDifficulty(), + Ruleset = rulesets.Query().First(), + Metadata = new BeatmapMetadata + { + Artist = @"Unknown", + Title = @"Sample Beatmap", + Author = @"peppy", + } + } + }; + + beatmap = new TestWorkingBeatmap(b); + Add(new Box { RelativeSizeAxes = Framework.Graphics.Axes.Both, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs index b2c211b7f0..923879b0f7 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs @@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests private ExampleContainer container; - public override void Reset() + public TestCaseReplaySettingsOverlay() { - base.Reset(); - Add(new ReplaySettingsOverlay() { Anchor = Anchor.TopRight, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs index f8c93e9a73..1cfc2fc664 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseResults.cs @@ -28,9 +28,9 @@ namespace osu.Desktop.VisualTests.Tests private WorkingBeatmap beatmap; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); if (beatmap == null) { @@ -39,8 +39,6 @@ namespace osu.Desktop.VisualTests.Tests beatmap = db.GetWorkingBeatmap(beatmapInfo); } - base.Reset(); - Add(new Results(new Score { TotalScore = 2845370, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs index beb664e7ff..00702f7ad0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs @@ -17,9 +17,9 @@ namespace osu.Desktop.VisualTests.Tests private RulesetDatabase rulesets; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); var room = new Room { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index 45ae82109f..e8fc2956b4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -15,10 +15,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests multiple counters"; - public override void Reset() + public TestCaseScoreCounter() { - base.Reset(); - int numerator = 0, denominator = 0; ScoreCounter score = new ScoreCounter(7) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs index 4ddc35eb84..3206b6fb88 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs @@ -28,10 +28,8 @@ namespace osu.Desktop.VisualTests.Tests private OsuSpriteText bottomLabel; private SpriteText topTime, bottomTime; - public override void Reset() + public TestCaseScrollingHitObjects() { - base.Reset(); - timeRangeBindable = new BindableDouble(2000) { MinValue = 200, diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs b/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs index 660085e558..2b2511c79b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs @@ -12,11 +12,14 @@ namespace osu.Desktop.VisualTests.Tests private SettingsOverlay settings; - public override void Reset() + public TestCaseSettings() { - base.Reset(); - Children = new[] { settings = new SettingsOverlay() }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); settings.ToggleVisibility(); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs index fb5be719c1..1f81226a8e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs @@ -10,9 +10,10 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Skip skip skippediskip"; - public override void Reset() + protected override void LoadComplete() { - base.Reset(); + base.LoadComplete(); + Add(new SkipButton(Clock.CurrentTime + 5000)); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs index eb7df96355..34209119bd 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs @@ -11,10 +11,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"social browser overlay"; - public override void Reset() + public TestCaseSocial() { - base.Reset(); - SocialOverlay s = new SocialOverlay { Users = new[] diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index e3c343f5f8..610fe947dc 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -20,10 +20,8 @@ namespace osu.Desktop.VisualTests.Tests private StopwatchClock clock; - public override void Reset() + public TestCaseSongProgress() { - base.Reset(); - clock = new StopwatchClock(true); Add(progress = new SongProgress diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs index 96933a15e7..c0c01a6daa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs @@ -14,10 +14,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Filter for song select"; - public override void Reset() + public TestCaseTabControl() { - base.Reset(); - OsuSpriteText text; OsuTabControl filter; Add(filter = new OsuTabControl diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index d769071bd9..d98e39ae7b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -16,10 +16,8 @@ namespace osu.Desktop.VisualTests.Tests private bool kiai; - public override void Reset() + public TestCaseTaikoHitObjects() { - base.Reset(); - AddToggleStep("Kiai", b => { kiai = !kiai; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 259d0267db..8543f727dd 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -29,10 +29,8 @@ namespace osu.Desktop.VisualTests.Tests private TaikoPlayfield playfield; private Container playfieldContainer; - public override void Reset() + public TestCaseTaikoPlayfield() { - base.Reset(); - AddStep("Hit!", addHitJudgement); AddStep("Miss :(", addMissJudgement); AddStep("DrumRoll", () => addDrumRoll(false)); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs index 7182ee7c06..2824c0416f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs @@ -16,10 +16,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Tests display of icons"; - public override void Reset() + public TestCaseTextAwesome() { - base.Reset(); - FillFlowContainer flow; Add(flow = new FillFlowContainer diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs index 2decb4c469..0c35a4b8aa 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs @@ -10,10 +10,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Mostly back button"; - public override void Reset() + public TestCaseTwoLayerButton() { - base.Reset(); - Add(new BackButton()); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs index 92d58c10c9..22cdf42f7d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs @@ -13,10 +13,8 @@ namespace osu.Desktop.VisualTests.Tests { public override string Description => @"Panels for displaying a user's status"; - public override void Reset() + public TestCaseUserPanel() { - base.Reset(); - UserPanel flyte; UserPanel peppy; Add(new FillFlowContainer diff --git a/osu.Game/Rulesets/UI/HitRenderer.cs b/osu.Game/Rulesets/UI/HitRenderer.cs index 00d678e11e..8fe1dd3e0a 100644 --- a/osu.Game/Rulesets/UI/HitRenderer.cs +++ b/osu.Game/Rulesets/UI/HitRenderer.cs @@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.UI // Check if the beatmap can be converted if (!converter.CanConvert(beatmap.Beatmap)) - throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can't be converted for the current ruleset."); + throw new BeatmapInvalidForRulesetException($"{nameof(Beatmap)} can not be converted for the current ruleset (converter: {converter})."); // Convert the beatmap Beatmap = converter.Convert(beatmap.Beatmap, isForCurrentRuleset); diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index ea7c465e4d..9d39008b65 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -17,8 +17,12 @@ namespace osu.Game.Screens.Play set { objects = value; - + const int granularity = 200; + Values = new int[granularity]; + + if (!objects.Any()) + return; var firstHit = objects.First().StartTime; var lastHit = (objects.Last() as IHasEndTime)?.EndTime ?? 0; @@ -28,8 +32,6 @@ namespace osu.Game.Screens.Play var interval = (lastHit - firstHit + 1) / granularity; - var values = new int[granularity]; - foreach (var h in objects) { IHasEndTime end = h as IHasEndTime; @@ -37,10 +39,8 @@ namespace osu.Game.Screens.Play int startRange = (int)((h.StartTime - firstHit) / interval); int endRange = (int)(((end?.EndTime > 0 ? end.EndTime : h.StartTime) - firstHit) / interval); for (int i = startRange; i <= endRange; i++) - values[i]++; + Values[i]++; } - - Values = values; } } } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index eda3cf39f6..90f18499bf 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -281,10 +281,13 @@ namespace osu.Game.Screens.Select { base.Dispose(isDisposing); - database.BeatmapSetAdded -= onBeatmapSetAdded; - database.BeatmapSetRemoved -= onBeatmapSetRemoved; + if (database != null) + { + database.BeatmapSetAdded -= onBeatmapSetAdded; + database.BeatmapSetRemoved -= onBeatmapSetRemoved; + } - initialAddSetsTask.Cancel(); + initialAddSetsTask?.Cancel(); } private void changeBackground(WorkingBeatmap beatmap)