From 24d06fa92d69ba69c69fa707a18b4153a60030a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 17:38:33 +0900 Subject: [PATCH 1/4] CheckBox -> Checkbox. --- osu.Game/Graphics/UserInterface/Nub.cs | 10 +++++----- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 12 ++++++------ osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 6 +++--- .../Graphics/UserInterface/OsuTabControlCheckBox.cs | 12 ++++++------ .../Screens/Select/BeatmapDetailAreaTabControl.cs | 6 +++--- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 06e3be5c15..e150c7dc07 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -12,7 +12,7 @@ using osu.Framework.Graphics.UserInterface; namespace osu.Game.Graphics.UserInterface { - public class Nub : CircularContainer, IStateful + public class Nub : CircularContainer, IStateful { public const float COLLAPSED_SIZE = 20; public const float EXPANDED_SIZE = 40; @@ -84,9 +84,9 @@ namespace osu.Game.Graphics.UserInterface } } - private CheckBoxState state; + private CheckboxState state; - public CheckBoxState State + public CheckboxState State { get { @@ -98,10 +98,10 @@ namespace osu.Game.Graphics.UserInterface switch (state) { - case CheckBoxState.Checked: + case CheckboxState.Checked: fill.FadeIn(200, EasingTypes.OutQuint); break; - case CheckBoxState.Unchecked: + case CheckboxState.Unchecked: fill.FadeTo(0.01f, 200, EasingTypes.OutQuint); //todo: remove once we figure why containers aren't drawing at all times break; } diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 2209c96689..fc44d80ea6 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -16,7 +16,7 @@ using OpenTK.Graphics; namespace osu.Game.Graphics.UserInterface { - public class OsuCheckbox : CheckBox + public class OsuCheckbox : Checkbox { private Bindable bindable; @@ -29,9 +29,9 @@ namespace osu.Game.Graphics.UserInterface bindable = value; if (bindable != null) { - bool state = State == CheckBoxState.Checked; + bool state = State == CheckboxState.Checked; if (state != bindable.Value) - State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; + State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked; bindable.ValueChanged += bindableValueChanged; } @@ -88,7 +88,7 @@ namespace osu.Game.Graphics.UserInterface private void bindableValueChanged(object sender, EventArgs e) { - State = bindable.Value ? CheckBoxState.Checked : CheckBoxState.Unchecked; + State = bindable.Value ? CheckboxState.Checked : CheckboxState.Unchecked; } protected override void Dispose(bool isDisposing) @@ -122,7 +122,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnChecked() { sampleChecked?.Play(); - nub.State = CheckBoxState.Checked; + nub.State = CheckboxState.Checked; if (bindable != null) bindable.Value = true; @@ -131,7 +131,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnUnchecked() { sampleUnchecked?.Play(); - nub.State = CheckBoxState.Unchecked; + nub.State = CheckboxState.Unchecked; if (bindable != null) bindable.Value = false; diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index b7d46cd409..078c8564d7 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -50,7 +50,7 @@ namespace osu.Game.Graphics.UserInterface nub = new Nub { Origin = Anchor.TopCentre, - State = CheckBoxState.Unchecked, + State = CheckboxState.Unchecked, Expanded = true, } }; @@ -94,13 +94,13 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - nub.State = CheckBoxState.Checked; + nub.State = CheckboxState.Checked; return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - nub.State = CheckBoxState.Unchecked; + nub.State = CheckboxState.Unchecked; return base.OnMouseUp(state, args); } diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs index f9d14f3b09..5914d0ba4c 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckBox.cs @@ -16,15 +16,15 @@ using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface { /// - /// A checkbox styled to be placed in line with an + /// A Checkbox styled to be placed in line with an /// - public class OsuTabControlCheckBox : CheckBox + public class OsuTabControlCheckbox : Checkbox { private readonly Box box; private readonly SpriteText text; private readonly TextAwesome icon; - public event EventHandler Action; + public event EventHandler Action; private Color4? accentColour; public Color4 AccentColour @@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface { accentColour = value; - if (State != CheckBoxState.Checked) + if (State != CheckboxState.Checked) { text.Colour = AccentColour; icon.Colour = AccentColour; @@ -84,7 +84,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnHoverLost(InputState state) { - if (State == CheckBoxState.Unchecked) + if (State == CheckboxState.Unchecked) fadeOut(); base.OnHoverLost(state); @@ -97,7 +97,7 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.Blue; } - public OsuTabControlCheckBox() + public OsuTabControlCheckbox() { AutoSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 9dc8de96d1..088346d91f 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -17,14 +17,14 @@ namespace osu.Game.Screens.Select public class BeatmapDetailAreaTabControl : Container { public static readonly float HEIGHT = 24; - private readonly OsuTabControlCheckBox modsCheckbox; + private readonly OsuTabControlCheckbox modsCheckbox; private readonly OsuTabControl tabs; public Action OnFilter; //passed the selected tab and if mods is checked private void invokeOnFilter() { - OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckBoxState.Checked); + OnFilter?.Invoke(tabs.SelectedItem, modsCheckbox.State == CheckboxState.Checked); } [BackgroundDependencyLoader] @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Select Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, }, - modsCheckbox = new OsuTabControlCheckBox + modsCheckbox = new OsuTabControlCheckbox { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, From 2b847aa2f46488e4933c869fdabd6552a93f7b88 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 17:55:07 +0900 Subject: [PATCH 2/4] Bring VisualTests up-to-date. --- osu-framework | 2 +- .../{BenchmarkTest.cs => VisualTests.cs} | 6 +-- osu.Desktop.Tests/osu.Desktop.Tests.csproj | 2 +- .../AutomatedVisualTestGame.cs | 16 +++++++ osu.Desktop.VisualTests/Benchmark.cs | 45 ------------------- osu.Desktop.VisualTests/Program.cs | 2 +- .../Tests/TestCaseBeatmapOptionsOverlay.cs | 2 +- .../Tests/TestCaseDialogOverlay.cs | 4 +- .../Tests/TestCaseHitObjects.cs | 29 +++++++----- .../Tests/TestCaseKeyCounter.cs | 26 ++++++++--- .../Tests/TestCaseLeaderboard.cs | 2 +- .../Tests/TestCaseModSelectOverlay.cs | 10 ++--- .../Tests/TestCaseMusicController.cs | 2 +- .../Tests/TestCaseNotificationManager.cs | 12 ++--- .../Tests/TestCasePauseOverlay.cs | 4 +- .../Tests/TestCasePlaySongSelect.cs | 13 ++---- .../Tests/TestCaseScoreCounter.cs | 10 ++--- .../Tests/TestCaseTaikoHitObjects.cs | 2 +- .../Tests/TestCaseTaikoPlayfield.cs | 14 +++--- .../osu.Desktop.VisualTests.csproj | 2 +- 20 files changed, 96 insertions(+), 109 deletions(-) rename osu.Desktop.Tests/{BenchmarkTest.cs => VisualTests.cs} (83%) create mode 100644 osu.Desktop.VisualTests/AutomatedVisualTestGame.cs delete mode 100644 osu.Desktop.VisualTests/Benchmark.cs diff --git a/osu-framework b/osu-framework index 415884e7e1..50b62716b1 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 415884e7e19f9062a4fac457a7ce19b566fa2ee7 +Subproject commit 50b62716b16359ce4f51110ef0d21169533ec76a diff --git a/osu.Desktop.Tests/BenchmarkTest.cs b/osu.Desktop.Tests/VisualTests.cs similarity index 83% rename from osu.Desktop.Tests/BenchmarkTest.cs rename to osu.Desktop.Tests/VisualTests.cs index 6d001655ec..6519dbe917 100644 --- a/osu.Desktop.Tests/BenchmarkTest.cs +++ b/osu.Desktop.Tests/VisualTests.cs @@ -13,10 +13,10 @@ using osu.Game.Modes.Taiko; namespace osu.Desktop.Tests { [TestFixture] - public class BenchmarkTest + public class VisualTests { [Test] - public void TestBenchmark() + public void TestVisualTests() { using (var host = new HeadlessGameHost()) { @@ -25,7 +25,7 @@ namespace osu.Desktop.Tests Ruleset.Register(new ManiaRuleset()); Ruleset.Register(new CatchRuleset()); - host.Run(new Benchmark()); + host.Run(new AutomatedVisualTestGame()); } } } diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index ad69994592..d1b20bd161 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -56,7 +56,7 @@ - + diff --git a/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs new file mode 100644 index 0000000000..0bce2ddc67 --- /dev/null +++ b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Testing; +using osu.Game; + +namespace osu.Desktop.VisualTests +{ + public class AutomatedVisualTestGame : OsuGameBase + { + public AutomatedVisualTestGame() + { + Add(new TestRunner(new TestBrowser())); + } + } +} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/Benchmark.cs b/osu.Desktop.VisualTests/Benchmark.cs deleted file mode 100644 index 884dff9f7a..0000000000 --- a/osu.Desktop.VisualTests/Benchmark.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using System; -using osu.Framework.Allocation; -using osu.Framework.Testing; -using osu.Game; - -namespace osu.Desktop.VisualTests -{ - public class Benchmark : OsuGameBase - { - private const double time_per_test = 200; - - [BackgroundDependencyLoader] - private void load() - { - Host.MaximumDrawHz = int.MaxValue; - Host.MaximumUpdateHz = int.MaxValue; - Host.MaximumInactiveHz = int.MaxValue; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - TestBrowser f = new TestBrowser(); - Add(f); - - Console.WriteLine($@"{Time}: Running {f.TestCount} tests for {time_per_test}ms each..."); - - for (int i = 1; i < f.TestCount; i++) - { - int loadableCase = i; - Scheduler.AddDelayed(delegate - { - f.LoadTest(loadableCase); - Console.WriteLine($@"{Time}: Switching to test #{loadableCase}"); - }, loadableCase * time_per_test); - } - - Scheduler.AddDelayed(Host.Exit, f.TestCount * time_per_test); - } - } -} diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index 6760852cf0..fe1cdfd7f0 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -27,7 +27,7 @@ namespace osu.Desktop.VisualTests Ruleset.Register(new CatchRuleset()); if (benchmark) - host.Run(new Benchmark()); + host.Run(new AutomatedVisualTestGame()); else host.Run(new VisualTestGame()); } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs index 3fc6ce10e7..7c211227c6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs @@ -26,7 +26,7 @@ namespace osu.Desktop.VisualTests.Tests Add(overlay); - AddButton(@"Toggle", overlay.ToggleVisibility); + AddStep(@"Toggle", overlay.ToggleVisibility); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs index 3ae5929ecc..90e214c3c9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs @@ -20,7 +20,7 @@ namespace osu.Desktop.VisualTests.Tests Add(overlay = new DialogOverlay()); - AddButton("dialog #1", () => overlay.Push(new PopupDialog + AddStep("dialog #1", () => overlay.Push(new PopupDialog { Icon = FontAwesome.fa_trash_o, HeaderText = @"Confirm deletion of", @@ -40,7 +40,7 @@ namespace osu.Desktop.VisualTests.Tests }, })); - AddButton("dialog #2", () => overlay.Push(new PopupDialog + AddStep("dialog #2", () => overlay.Push(new PopupDialog { Icon = FontAwesome.fa_gear, HeaderText = @"What do you want to do with", diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs index 8818240b2d..cb7a3e3f84 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs @@ -93,19 +93,28 @@ namespace osu.Desktop.VisualTests.Tests playbackSpeed.TriggerChange(); - AddButton(@"circles", () => load(HitObjectType.Circle)); - AddButton(@"slider", () => load(HitObjectType.Slider)); - AddButton(@"spinner", () => load(HitObjectType.Spinner)); + AddStep(@"circles", () => load(HitObjectType.Circle)); + AddStep(@"slider", () => load(HitObjectType.Slider)); + AddStep(@"spinner", () => load(HitObjectType.Spinner)); - AddToggle(@"auto", state => { auto = state; load(mode); }); + AddToggleStep(@"auto", state => { auto = state; load(mode); }); - ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" }); - ButtonsContainer.Add(new BasicSliderBar + Add(new Container { - Width = 150, - Height = 10, - SelectionColor = Color4.Orange, - Bindable = playbackSpeed + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new SpriteText { Text = "Playback Speed" }, + new BasicSliderBar + { + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + Bindable = playbackSpeed + } + } }); framedClock.ProcessFrame(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs index 051db489e9..3dba201f5d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using OpenTK.Input; using osu.Framework.Graphics.UserInterface; using osu.Framework.Configuration; +using osu.Framework.Graphics.Containers; using OpenTK; using OpenTK.Graphics; using osu.Framework.MathUtils; @@ -37,19 +38,30 @@ namespace osu.Desktop.VisualTests.Tests }; BindableInt bindable = new BindableInt { MinValue = 0, MaxValue = 200, Default = 50 }; bindable.ValueChanged += delegate { kc.FadeTime = bindable.Value; }; - AddButton("Add Random", () => + AddStep("Add Random", () => { Key key = (Key)((int)Key.A + RNG.Next(26)); kc.Add(new KeyCounterKeyboard(key)); }); - ButtonsContainer.Add(new SpriteText { Text = "FadeTime" }); - ButtonsContainer.Add(new TestSliderBar + + Add(new Container { - Width = 150, - Height = 10, - SelectionColor = Color4.Orange, - Bindable = bindable + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + AutoSizeAxes = Axes.Both, + Children = new Drawable[] + { + new SpriteText { Text = "FadeTime" }, + new TestSliderBar + { + Width = 150, + Height = 10, + SelectionColor = Color4.Orange, + Bindable = bindable + } + } }); + Add(kc); } private class TestSliderBar : SliderBar where T : struct diff --git a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs index c985375873..44e52c237e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs @@ -218,7 +218,7 @@ namespace osu.Desktop.VisualTests.Tests Size = new Vector2(550f, 450f), }); - AddButton(@"New Scores", newScores); + AddStep(@"New Scores", newScores); newScores(); } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs index 73f8ed6242..7677682ac8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs @@ -25,11 +25,11 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.BottomCentre, }); - AddButton("Toggle", modSelect.ToggleVisibility); - AddButton("osu!", () => modSelect.PlayMode.Value = PlayMode.Osu); - AddButton("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko); - AddButton("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch); - AddButton("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania); + AddStep("Toggle", modSelect.ToggleVisibility); + AddStep("osu!", () => modSelect.PlayMode.Value = PlayMode.Osu); + AddStep("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko); + AddStep("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch); + AddStep("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index 305aa24252..c0c17cd50e 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.Centre }; Add(mc); - AddToggle(@"Show", state => mc.State = state ? Visibility.Visible : Visibility.Hidden); + AddToggleStep(@"Show", state => mc.State = state ? Visibility.Visible : Visibility.Hidden); } } } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs index 990052012f..8972040b06 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseNotificationManager.cs @@ -30,13 +30,13 @@ namespace osu.Desktop.VisualTests.Tests Origin = Anchor.TopRight, }); - AddToggle(@"show", state => manager.State = state ? Visibility.Visible : Visibility.Hidden); + AddToggleStep(@"show", state => manager.State = state ? Visibility.Visible : Visibility.Hidden); - AddButton(@"simple #1", sendNotification1); - AddButton(@"simple #2", sendNotification2); - AddButton(@"progress #1", sendProgress1); - AddButton(@"progress #2", sendProgress2); - AddButton(@"barrage", () => sendBarrage()); + AddStep(@"simple #1", sendNotification1); + AddStep(@"simple #2", sendNotification2); + AddStep(@"progress #1", sendProgress1); + AddStep(@"progress #2", sendProgress2); + AddStep(@"barrage", () => sendBarrage()); } private void sendBarrage(int remaining = 100) diff --git a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs index 09e2dc38aa..ebf6e0c350 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs @@ -25,8 +25,8 @@ namespace osu.Desktop.VisualTests.Tests OnRetry = () => Logger.Log(@"Retry"), OnQuit = () => Logger.Log(@"Quit") }); - AddButton("Pause", pauseOverlay.Show); - AddButton("Add Retry", delegate + AddStep("Pause", pauseOverlay.Show); + AddStep("Add Retry", delegate { retryCount++; pauseOverlay.Retries = retryCount; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs index 16f7881dcd..aedab7e895 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs @@ -23,12 +23,10 @@ namespace osu.Desktop.VisualTests.Tests public override void Reset() { base.Reset(); - oldDb = Dependencies.Get(); if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); db = new BeatmapDatabase(storage); - Dependencies.Cache(db, true); var sets = new List(); @@ -40,19 +38,16 @@ namespace osu.Desktop.VisualTests.Tests Add(songSelect = new PlaySongSelect()); - AddButton(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); - AddButton(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); - AddButton(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; }); - AddButton(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); + AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); + AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); + AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; }); + AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); } protected override void Dispose(bool isDisposing) { if (oldDb != null) - { - Dependencies.Cache(oldDb, true); db = null; - } base.Dispose(isDisposing); } diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs index cca87cd12b..55fc969217 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs @@ -68,7 +68,7 @@ namespace osu.Desktop.VisualTests.Tests }; Add(starsLabel); - AddButton(@"Reset all", delegate + AddStep(@"Reset all", delegate { score.Current.Value = 0; comboCounter.Current.Value = 0; @@ -78,7 +78,7 @@ namespace osu.Desktop.VisualTests.Tests starsLabel.Text = stars.Count.ToString("0.00"); }); - AddButton(@"Hit! :D", delegate + AddStep(@"Hit! :D", delegate { score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current > 0 ? comboCounter.Current - 1 : 0) / 25.0); comboCounter.Increment(); @@ -86,20 +86,20 @@ namespace osu.Desktop.VisualTests.Tests accuracyCounter.SetFraction(numerator, denominator); }); - AddButton(@"miss...", delegate + AddStep(@"miss...", delegate { comboCounter.Current.Value = 0; denominator++; accuracyCounter.SetFraction(numerator, denominator); }); - AddButton(@"Alter stars", delegate + AddStep(@"Alter stars", delegate { stars.Count = RNG.NextSingle() * (stars.StarCount + 1); starsLabel.Text = stars.Count.ToString("0.00"); }); - AddButton(@"Stop counters", delegate + AddStep(@"Stop counters", delegate { score.StopRolling(); comboCounter.StopRolling(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs index e8e32ebf3d..4005c94b5a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs @@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - AddToggle("Kiai", b => + AddToggleStep("Kiai", b => { kiai = !kiai; Reset(); diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs index 223f9ce5f8..c0aa3af176 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs @@ -24,13 +24,13 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); - AddButton("Hit!", addHitJudgement); - AddButton("Miss :(", addMissJudgement); - AddButton("Swell", addSwell); - AddButton("Centre", () => addCentreHit(false)); - AddButton("Strong Centre", () => addCentreHit(true)); - AddButton("Rim", () => addRimHit(false)); - AddButton("Strong Rim", () => addRimHit(true)); + AddStep("Hit!", addHitJudgement); + AddStep("Miss :(", addMissJudgement); + AddStep("Swell", addSwell); + AddStep("Centre", () => addCentreHit(false)); + AddStep("Strong Centre", () => addCentreHit(true)); + AddStep("Rim", () => addRimHit(false)); + AddStep("Strong Rim", () => addRimHit(true)); Add(new Container { diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 9f3cd6b3c4..1baf322750 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -184,7 +184,7 @@ - + From 01538ed7d7c9bac1ec370132702c683e24069cab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 18:05:24 +0900 Subject: [PATCH 3/4] Fix nullref. --- osu.Desktop.VisualTests/AutomatedVisualTestGame.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs index 0bce2ddc67..b08588b29c 100644 --- a/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs +++ b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs @@ -8,8 +8,12 @@ namespace osu.Desktop.VisualTests { public class AutomatedVisualTestGame : OsuGameBase { - public AutomatedVisualTestGame() + protected override void LoadComplete() { + base.LoadComplete(); + + // Have to construct this here, rather than in the constructor, because + // we depend on some dependencies to be loaded within OsuGameBase.load(). Add(new TestRunner(new TestBrowser())); } } From 904efb291638160e22f349b04edfed1cc8e187f3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 31 Mar 2017 18:13:24 +0900 Subject: [PATCH 4/4] Update framework again. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 50b62716b1..bf6a3dc401 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 50b62716b16359ce4f51110ef0d21169533ec76a +Subproject commit bf6a3dc40176ee4f921012808070e014fc4a5779