diff --git a/.vscode/launch.json b/.vscode/launch.json index b3b86da42f..f1083179b8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,34 +1,22 @@ { "version": "0.2.0", - "configurations": [ - { - "name": "VisualTests (debug)", + "configurations": [{ + "name": "osu! (VisualTests)", "windows": { "type": "clr" }, "type": "mono", "request": "launch", - "program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Debug/osu!.exe", + "program": "${workspaceRoot}/osu.Desktop/bin/Debug/osu!.exe", + "args": [ + "--tests" + ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build (Debug)", "runtimeExecutable": null, "env": {}, "console": "internalConsole" }, - { - "name": "VisualTests (release)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/osu.Desktop.VisualTests/bin/Release/osu!.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, { "name": "osu! (debug)", "windows": { diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b0fd5fbb0d..3db43ca9bb 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,35 +2,41 @@ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", - "problemMatcher": "$msCompile", - "isShellCommand": true, "command": "msbuild", + "type": "shell", "suppressTaskName": true, - "showOutput": "silent", "args": [ "/property:GenerateFullPaths=true", "/property:DebugType=portable", + "/verbosity:minimal", "/m" //parallel compiling support. ], - "tasks": [ - { + "tasks": [{ "taskName": "Build (Debug)", - "isBuildCommand": true + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [ + "$msCompile" + ] }, { "taskName": "Build (Release)", "args": [ "/property:Configuration=Release" + ], + "problemMatcher": [ + "$msCompile" ] }, - { - "taskName": "Clean All", - "dependsOn": ["Clean (Debug)", "Clean (Release)"] - }, { "taskName": "Clean (Debug)", "args": [ "/target:Clean" + ], + "problemMatcher": [ + "$msCompile" ] }, { @@ -38,6 +44,19 @@ "args": [ "/target:Clean", "/property:Configuration=Release" + ], + "problemMatcher": [ + "$msCompile" + ] + }, + { + "taskName": "Clean All", + "dependsOn": [ + "Clean (Debug)", + "Clean (Release)" + ], + "problemMatcher": [ + "$msCompile" ] } ] diff --git a/osu-framework b/osu-framework index 96daf2053a..9ae8979ef7 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 96daf2053a8a19fe221fef2557674ca5bee808fb +Subproject commit 9ae8979ef7ef0968c90cdbce40a04969d43633c7 diff --git a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs b/osu.Desktop.Tests/Beatmaps/TestWorkingBeatmap.cs similarity index 91% rename from osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs rename to osu.Desktop.Tests/Beatmaps/TestWorkingBeatmap.cs index b45574b761..084cfab309 100644 --- a/osu.Desktop.VisualTests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Desktop.Tests/Beatmaps/TestWorkingBeatmap.cs @@ -5,7 +5,7 @@ using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; -namespace osu.Desktop.VisualTests.Beatmaps +namespace osu.Desktop.Tests.Beatmaps { public class TestWorkingBeatmap : WorkingBeatmap { diff --git a/osu.Desktop.VisualTests/Platform/TestStorage.cs b/osu.Desktop.Tests/Platform/TestStorage.cs similarity index 91% rename from osu.Desktop.VisualTests/Platform/TestStorage.cs rename to osu.Desktop.Tests/Platform/TestStorage.cs index f711ddac24..39e4d8049f 100644 --- a/osu.Desktop.VisualTests/Platform/TestStorage.cs +++ b/osu.Desktop.Tests/Platform/TestStorage.cs @@ -8,7 +8,7 @@ using SQLite.Net.Interop; using SQLite.Net.Platform.Generic; using SQLite.Net.Platform.Win32; -namespace osu.Desktop.VisualTests.Platform +namespace osu.Desktop.Tests.Platform { public class TestStorage : DesktopStorage { diff --git a/osu.Desktop.Tests/Visual/OsuTestCase.cs b/osu.Desktop.Tests/Visual/OsuTestCase.cs new file mode 100644 index 0000000000..e54f7dbeb5 --- /dev/null +++ b/osu.Desktop.Tests/Visual/OsuTestCase.cs @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Framework.Desktop.Platform; +using osu.Framework.Testing; +using osu.Game; + +namespace osu.Desktop.Tests.Visual +{ + [TestFixture] + public abstract class OsuTestCase : TestCase + { + [Test] + public override void RunTest() + { + using (var host = new HeadlessGameHost()) + host.Run(new OsuTestCaseTestRunner(this)); + } + + public class OsuTestCaseTestRunner : OsuGameBase + { + private readonly OsuTestCase testCase; + + public OsuTestCaseTestRunner(OsuTestCase testCase) + { + this.testCase = testCase; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + Add(new TestCaseTestRunner.TestRunner(testCase)); + } + } + } +} diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs b/osu.Desktop.Tests/Visual/TestCaseBeatSyncedContainer.cs similarity index 96% rename from osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs rename to osu.Desktop.Tests/Visual/TestCaseBeatSyncedContainer.cs index 50d1df9964..130a034133 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatSyncedContainer.cs +++ b/osu.Desktop.Tests/Visual/TestCaseBeatSyncedContainer.cs @@ -1,24 +1,23 @@ // 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.Framework.Graphics; -using osu.Framework.Timing; -using osu.Game.Overlays; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics.Containers; -using osu.Framework.Audio.Track; -using osu.Game.Beatmaps.ControlPoints; -using osu.Framework.Graphics.Shapes; -using OpenTK.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Framework.Lists; using System; +using osu.Framework.Audio.Track; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Lists; +using osu.Framework.Timing; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics.Containers; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using OpenTK.Graphics; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseBeatSyncedContainer : TestCase + internal class TestCaseBeatSyncedContainer : OsuTestCase { public override string Description => @"Tests beat synced containers."; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs b/osu.Desktop.Tests/Visual/TestCaseBeatmapDetailArea.cs similarity index 78% rename from osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs rename to osu.Desktop.Tests/Visual/TestCaseBeatmapDetailArea.cs index e0a503bc76..23b4ece4ec 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetailArea.cs +++ b/osu.Desktop.Tests/Visual/TestCaseBeatmapDetailArea.cs @@ -1,14 +1,15 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; +using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Testing; using osu.Game.Screens.Select; +using OpenTK; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseBeatmapDetailArea : TestCase + [TestFixture] + internal class TestCaseBeatmapDetailArea : OsuTestCase { public override string Description => @"Beatmap details in song select"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs b/osu.Desktop.Tests/Visual/TestCaseBeatmapDetails.cs similarity index 92% rename from osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs rename to osu.Desktop.Tests/Visual/TestCaseBeatmapDetails.cs index 111bc03377..11a15cf56f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapDetails.cs +++ b/osu.Desktop.Tests/Visual/TestCaseBeatmapDetails.cs @@ -1,15 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; -using osu.Framework.Testing; -using osu.Game.Screens.Select; using System.Linq; +using osu.Framework.Graphics; using osu.Game.Beatmaps; +using osu.Game.Screens.Select; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseBeatmapDetails : TestCase + internal class TestCaseBeatmapDetails : OsuTestCase { public override string Description => "BeatmapDetails tab of BeatmapDetailArea"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs b/osu.Desktop.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs similarity index 86% rename from osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs rename to osu.Desktop.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs index c9c1740856..3265f8ec76 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Desktop.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs @@ -1,15 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Graphics; -using OpenTK.Input; -using osu.Framework.Testing; using osu.Game.Graphics; using osu.Game.Screens.Select.Options; +using OpenTK.Graphics; +using OpenTK.Input; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseBeatmapOptionsOverlay : TestCase + internal class TestCaseBeatmapOptionsOverlay : OsuTestCase { public override string Description => @"Beatmap options in song select"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs b/osu.Desktop.Tests/Visual/TestCaseBreadcrumbs.cs similarity index 86% rename from osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs rename to osu.Desktop.Tests/Visual/TestCaseBreadcrumbs.cs index f2dd454d65..10e0c784ab 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseBreadcrumbs.cs +++ b/osu.Desktop.Tests/Visual/TestCaseBreadcrumbs.cs @@ -1,13 +1,12 @@ // 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.Graphics.UserInterface; using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseBreadcrumbs : TestCase + internal class TestCaseBreadcrumbs : OsuTestCase { public override string Description => @"breadcrumb > control"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs b/osu.Desktop.Tests/Visual/TestCaseChatDisplay.cs similarity index 77% rename from osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs rename to osu.Desktop.Tests/Visual/TestCaseChatDisplay.cs index 751b979bad..ae051a1e40 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseChatDisplay.cs +++ b/osu.Desktop.Tests/Visual/TestCaseChatDisplay.cs @@ -1,13 +1,12 @@ // 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.Framework.Graphics.Containers; using osu.Game.Overlays; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseChatDisplay : TestCase + internal class TestCaseChatDisplay : OsuTestCase { public override string Description => @"Testing chat api and overlay"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs b/osu.Desktop.Tests/Visual/TestCaseContextMenu.cs similarity index 94% rename from osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs rename to osu.Desktop.Tests/Visual/TestCaseContextMenu.cs index 0b4e8a5799..f0894f794a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseContextMenu.cs +++ b/osu.Desktop.Tests/Visual/TestCaseContextMenu.cs @@ -1,19 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseContextMenu : TestCase + internal class TestCaseContextMenu : OsuTestCase { public override string Description => @"Menu visible on right click"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs b/osu.Desktop.Tests/Visual/TestCaseDialogOverlay.cs similarity index 92% rename from osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs rename to osu.Desktop.Tests/Visual/TestCaseDialogOverlay.cs index 6924817827..df15350453 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs +++ b/osu.Desktop.Tests/Visual/TestCaseDialogOverlay.cs @@ -1,14 +1,13 @@ // 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.Graphics; using osu.Game.Overlays; using osu.Game.Overlays.Dialog; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseDialogOverlay : TestCase + internal class TestCaseDialogOverlay : OsuTestCase { public override string Description => @"Display dialogs"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs b/osu.Desktop.Tests/Visual/TestCaseDirect.cs similarity index 96% rename from osu.Desktop.VisualTests/Tests/TestCaseDirect.cs rename to osu.Desktop.Tests/Visual/TestCaseDirect.cs index 4a5ff1b576..b78ea02767 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDirect.cs +++ b/osu.Desktop.Tests/Visual/TestCaseDirect.cs @@ -3,14 +3,13 @@ using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Rulesets; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - public class TestCaseDirect : TestCase + public class TestCaseDirect : OsuTestCase { public override string Description => @"osu!direct overlay"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs b/osu.Desktop.Tests/Visual/TestCaseDrawableRoom.cs similarity index 95% rename from osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs rename to osu.Desktop.Tests/Visual/TestCaseDrawableRoom.cs index 38cf03d60e..04d551afe4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs +++ b/osu.Desktop.Tests/Visual/TestCaseDrawableRoom.cs @@ -1,19 +1,18 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics; -using osu.Framework.Testing; -using osu.Game.Screens.Multiplayer; -using osu.Game.Online.Multiplayer; -using osu.Game.Users; using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; +using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; +using osu.Game.Screens.Multiplayer; +using osu.Game.Users; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseDrawableRoom : TestCase + internal class TestCaseDrawableRoom : OsuTestCase { public override string Description => @"Select your favourite room"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs b/osu.Desktop.Tests/Visual/TestCaseDrawings.cs similarity index 92% rename from osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs rename to osu.Desktop.Tests/Visual/TestCaseDrawings.cs index 63ec06963c..81fd8cad03 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs +++ b/osu.Desktop.Tests/Visual/TestCaseDrawings.cs @@ -2,13 +2,12 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Framework.Testing; using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament.Teams; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseDrawings : TestCase + internal class TestCaseDrawings : OsuTestCase { public override string Description => "Tournament drawings"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs b/osu.Desktop.Tests/Visual/TestCaseGamefield.cs similarity index 93% rename from osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs rename to osu.Desktop.Tests/Visual/TestCaseGamefield.cs index 0b08065241..9d61c9ab0c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGamefield.cs +++ b/osu.Desktop.Tests/Visual/TestCaseGamefield.cs @@ -1,28 +1,27 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; +using System.Collections.Generic; +using osu.Desktop.Tests.Beatmaps; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; -using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.Taiko.UI; -using System.Collections.Generic; -using osu.Desktop.VisualTests.Beatmaps; -using osu.Framework.Allocation; -using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets; +using OpenTK; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseGamefield : TestCase + internal class TestCaseGamefield : OsuTestCase { private RulesetStore rulesets; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs b/osu.Desktop.Tests/Visual/TestCaseGraph.cs similarity index 90% rename from osu.Desktop.VisualTests/Tests/TestCaseGraph.cs rename to osu.Desktop.Tests/Visual/TestCaseGraph.cs index d969decaa5..13342d1ff1 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseGraph.cs +++ b/osu.Desktop.Tests/Visual/TestCaseGraph.cs @@ -1,15 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using osu.Framework.Graphics; -using osu.Framework.Testing; -using osu.Game.Graphics.UserInterface; using System.Linq; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; +using OpenTK; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseGraph : TestCase + internal class TestCaseGraph : OsuTestCase { public override string Description => "graph"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs b/osu.Desktop.Tests/Visual/TestCaseHitObjects.cs similarity index 94% rename from osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs rename to osu.Desktop.Tests/Visual/TestCaseHitObjects.cs index 33841cae90..df5f9f65b8 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseHitObjects.cs +++ b/osu.Desktop.Tests/Visual/TestCaseHitObjects.cs @@ -1,24 +1,23 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; +using System.Collections.Generic; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Judgements; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using System.Collections.Generic; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseHitObjects : TestCase + internal class TestCaseHitObjects : OsuTestCase { private readonly FramedClock framedClock; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs b/osu.Desktop.Tests/Visual/TestCaseKeyCounter.cs similarity index 93% rename from osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs rename to osu.Desktop.Tests/Visual/TestCaseKeyCounter.cs index f65dbe7a64..efb662d3b9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseKeyCounter.cs +++ b/osu.Desktop.Tests/Visual/TestCaseKeyCounter.cs @@ -1,22 +1,21 @@ // 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.Framework.Graphics; -using OpenTK.Input; -using osu.Framework.Graphics.UserInterface; using osu.Framework.Configuration; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using OpenTK; -using OpenTK.Graphics; -using osu.Framework.MathUtils; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.UserInterface; +using osu.Framework.MathUtils; using osu.Game.Screens.Play; +using OpenTK; +using OpenTK.Graphics; +using OpenTK.Input; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseKeyCounter : TestCase + internal class TestCaseKeyCounter : OsuTestCase { public override string Description => @"Tests key counter"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs b/osu.Desktop.Tests/Visual/TestCaseLeaderboard.cs similarity index 95% rename from osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs rename to osu.Desktop.Tests/Visual/TestCaseLeaderboard.cs index 12d01ecc79..5f8ee8795c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseLeaderboard.cs +++ b/osu.Desktop.Tests/Visual/TestCaseLeaderboard.cs @@ -1,18 +1,17 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Framework.Graphics; -using osu.Framework.Testing; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; +using OpenTK; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseLeaderboard : TestCase + internal class TestCaseLeaderboard : OsuTestCase { public override string Description => @"From song select"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs b/osu.Desktop.Tests/Visual/TestCaseManiaHitObjects.cs similarity index 93% rename from osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs rename to osu.Desktop.Tests/Visual/TestCaseManiaHitObjects.cs index 30346e90c9..7dcc48c778 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaHitObjects.cs +++ b/osu.Desktop.Tests/Visual/TestCaseManiaHitObjects.cs @@ -3,15 +3,14 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Testing; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; -using OpenTK.Graphics; using OpenTK; +using OpenTK.Graphics; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseManiaHitObjects : TestCase + internal class TestCaseManiaHitObjects : OsuTestCase { public TestCaseManiaHitObjects() { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs b/osu.Desktop.Tests/Visual/TestCaseManiaPlayfield.cs similarity index 95% rename from osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs rename to osu.Desktop.Tests/Visual/TestCaseManiaPlayfield.cs index adaae91815..ed0e5d81e9 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseManiaPlayfield.cs +++ b/osu.Desktop.Tests/Visual/TestCaseManiaPlayfield.cs @@ -1,25 +1,24 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input; -using osu.Framework.Testing; -using osu.Framework.Graphics; -using osu.Game.Rulesets.Mania.UI; using System; -using OpenTK; -using osu.Game.Rulesets.Mania.Objects.Drawables; -using osu.Game.Rulesets.Mania.Objects; -using osu.Framework.Configuration; -using OpenTK.Input; -using osu.Framework.Timing; -using osu.Framework.Extensions.IEnumerableExtensions; using System.Linq; +using osu.Framework.Configuration; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Graphics; +using osu.Framework.Input; +using osu.Framework.Timing; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Timing; +using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Timing; +using OpenTK; +using OpenTK.Input; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseManiaPlayfield : TestCase + internal class TestCaseManiaPlayfield : OsuTestCase { public override string Description => @"Mania playfield"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs b/osu.Desktop.Tests/Visual/TestCaseMedalOverlay.cs similarity index 82% rename from osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs rename to osu.Desktop.Tests/Visual/TestCaseMedalOverlay.cs index 1533f2141e..747f2190b0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs +++ b/osu.Desktop.Tests/Visual/TestCaseMedalOverlay.cs @@ -1,13 +1,12 @@ // 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.Overlays; using osu.Game.Users; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseMedalOverlay : TestCase + internal class TestCaseMedalOverlay : OsuTestCase { public override string Description => @"medal get!"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.Tests/Visual/TestCaseMenuButtonSystem.cs similarity index 81% rename from osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs rename to osu.Desktop.Tests/Visual/TestCaseMenuButtonSystem.cs index ea2f0464c4..3c7ee343bb 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.Tests/Visual/TestCaseMenuButtonSystem.cs @@ -1,15 +1,14 @@ // 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.Framework.Graphics.Colour; +using osu.Framework.Graphics.Shapes; using osu.Game.Screens.Menu; using OpenTK.Graphics; -using osu.Framework.Graphics.Shapes; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseMenuButtonSystem : TestCase + internal class TestCaseMenuButtonSystem : OsuTestCase { public override string Description => @"Main menu button system"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs b/osu.Desktop.Tests/Visual/TestCaseMenuOverlays.cs similarity index 90% rename from osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs rename to osu.Desktop.Tests/Visual/TestCaseMenuOverlays.cs index 0187c0e629..1f4ad9d3da 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuOverlays.cs +++ b/osu.Desktop.Tests/Visual/TestCaseMenuOverlays.cs @@ -3,12 +3,11 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Logging; -using osu.Framework.Testing; using osu.Game.Screens.Play; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseMenuOverlays : TestCase + internal class TestCaseMenuOverlays : OsuTestCase { public override string Description => @"Tests pause and fail overlays"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs b/osu.Desktop.Tests/Visual/TestCaseMods.cs similarity index 90% rename from osu.Desktop.VisualTests/Tests/TestCaseMods.cs rename to osu.Desktop.Tests/Visual/TestCaseMods.cs index 1604be603a..f48030067d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMods.cs +++ b/osu.Desktop.Tests/Visual/TestCaseMods.cs @@ -4,14 +4,13 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays.Mods; -using osu.Framework.Testing; using osu.Game.Rulesets; using osu.Game.Screens.Play.HUD; using OpenTK; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseMods : TestCase + internal class TestCaseMods : OsuTestCase { public override string Description => @"Mod select overlay and in-game display"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.Tests/Visual/TestCaseMusicController.cs similarity index 88% rename from osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs rename to osu.Desktop.Tests/Visual/TestCaseMusicController.cs index 292e31de75..8d71527a21 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.Tests/Visual/TestCaseMusicController.cs @@ -5,15 +5,14 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game; using osu.Game.Beatmaps; using osu.Game.Overlays; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseMusicController : TestCase + internal class TestCaseMusicController : OsuTestCase { public override string Description => @"Tests music controller ui."; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseNotificationOverlay.cs b/osu.Desktop.Tests/Visual/TestCaseNotificationOverlay.cs similarity index 93% rename from osu.Desktop.VisualTests/Tests/TestCaseNotificationOverlay.cs rename to osu.Desktop.Tests/Visual/TestCaseNotificationOverlay.cs index 3b9c251670..b9e492593f 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseNotificationOverlay.cs +++ b/osu.Desktop.Tests/Visual/TestCaseNotificationOverlay.cs @@ -2,17 +2,18 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; using osu.Framework.Graphics; -using osu.Framework.Testing; +using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; using osu.Game.Overlays; -using System.Linq; using osu.Game.Overlays.Notifications; -using osu.Framework.Graphics.Containers; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseNotificationOverlay : TestCase + [TestFixture] + internal class TestCaseNotificationOverlay : OsuTestCase { public override string Description => @"I handle notifications"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs b/osu.Desktop.Tests/Visual/TestCaseOnScreenDisplay.cs similarity index 88% rename from osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs rename to osu.Desktop.Tests/Visual/TestCaseOnScreenDisplay.cs index f2b4ed7918..0b7a822e1d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseOnScreenDisplay.cs +++ b/osu.Desktop.Tests/Visual/TestCaseOnScreenDisplay.cs @@ -3,12 +3,11 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; -using osu.Framework.Testing; using osu.Game.Overlays; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseOnScreenDisplay : TestCase + internal class TestCaseOnScreenDisplay : OsuTestCase { private FrameworkConfigManager config; private Bindable frameSyncMode; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs b/osu.Desktop.Tests/Visual/TestCasePlaySongSelect.cs similarity index 93% rename from osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs rename to osu.Desktop.Tests/Visual/TestCasePlaySongSelect.cs index 51c78ff442..379100b543 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlaySongSelect.cs +++ b/osu.Desktop.Tests/Visual/TestCasePlaySongSelect.cs @@ -2,8 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Desktop.VisualTests.Platform; -using osu.Framework.Testing; +using osu.Desktop.Tests.Platform; using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Database; @@ -11,9 +10,9 @@ using osu.Game.Rulesets; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Filter; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCasePlaySongSelect : TestCase + internal class TestCasePlaySongSelect : OsuTestCase { private readonly BeatmapManager manager; diff --git a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs b/osu.Desktop.Tests/Visual/TestCasePlayer.cs similarity index 90% rename from osu.Desktop.VisualTests/Tests/TestCasePlayer.cs rename to osu.Desktop.Tests/Visual/TestCasePlayer.cs index f38cabd618..f5d02d3f2b 100644 --- a/osu.Desktop.VisualTests/Tests/TestCasePlayer.cs +++ b/osu.Desktop.Tests/Visual/TestCasePlayer.cs @@ -2,22 +2,21 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using osu.Desktop.Tests.Beatmaps; using osu.Framework.Allocation; -using osu.Framework.Testing; +using osu.Framework.Graphics.Shapes; using osu.Game.Beatmaps; -using OpenTK; +using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; -using osu.Game.Screens.Play; -using OpenTK.Graphics; -using osu.Desktop.VisualTests.Beatmaps; using osu.Game.Rulesets.Osu.UI; -using osu.Framework.Graphics.Shapes; -using osu.Game.Rulesets; +using osu.Game.Screens.Play; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCasePlayer : TestCase + internal class TestCasePlayer : OsuTestCase { protected Player Player; private RulesetStore rulesets; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs b/osu.Desktop.Tests/Visual/TestCaseReplay.cs similarity index 90% rename from osu.Desktop.VisualTests/Tests/TestCaseReplay.cs rename to osu.Desktop.Tests/Visual/TestCaseReplay.cs index e00a912278..9b2f59e444 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplay.cs +++ b/osu.Desktop.Tests/Visual/TestCaseReplay.cs @@ -6,7 +6,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Screens.Play; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { internal class TestCaseReplay : TestCasePlayer { diff --git a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs b/osu.Desktop.Tests/Visual/TestCaseReplaySettingsOverlay.cs similarity index 88% rename from osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs rename to osu.Desktop.Tests/Visual/TestCaseReplaySettingsOverlay.cs index 00a9774067..ab865dcab0 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseReplaySettingsOverlay.cs +++ b/osu.Desktop.Tests/Visual/TestCaseReplaySettingsOverlay.cs @@ -2,14 +2,13 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; using osu.Game.Screens.Play.ReplaySettings; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseReplaySettingsOverlay : TestCase + internal class TestCaseReplaySettingsOverlay : OsuTestCase { public override string Description => @"Settings visible in replay/auto"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs b/osu.Desktop.Tests/Visual/TestCaseResults.cs similarity index 90% rename from osu.Desktop.VisualTests/Tests/TestCaseResults.cs rename to osu.Desktop.Tests/Visual/TestCaseResults.cs index 288fff346f..a0622b302a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseResults.cs +++ b/osu.Desktop.Tests/Visual/TestCaseResults.cs @@ -4,15 +4,14 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Users; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseResults : TestCase + internal class TestCaseResults : OsuTestCase { private BeatmapManager beatmaps; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs b/osu.Desktop.Tests/Visual/TestCaseRoomInspector.cs similarity index 95% rename from osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs rename to osu.Desktop.Tests/Visual/TestCaseRoomInspector.cs index 043f072b25..db557baed2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs +++ b/osu.Desktop.Tests/Visual/TestCaseRoomInspector.cs @@ -1,18 +1,17 @@ // 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.Framework.Graphics; -using osu.Game.Screens.Multiplayer; -using osu.Game.Online.Multiplayer; -using osu.Game.Users; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Beatmaps; +using osu.Game.Online.Multiplayer; using osu.Game.Rulesets; +using osu.Game.Screens.Multiplayer; +using osu.Game.Users; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseRoomInspector : TestCase + internal class TestCaseRoomInspector : OsuTestCase { public override string Description => @"from the multiplayer lobby"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs b/osu.Desktop.Tests/Visual/TestCaseScoreCounter.cs similarity index 93% rename from osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs rename to osu.Desktop.Tests/Visual/TestCaseScoreCounter.cs index fc29e8481e..ac96deb209 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScoreCounter.cs +++ b/osu.Desktop.Tests/Visual/TestCaseScoreCounter.cs @@ -1,17 +1,16 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.MathUtils; -using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; +using OpenTK; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseScoreCounter : TestCase + internal class TestCaseScoreCounter : OsuTestCase { public override string Description => @"Tests multiple counters"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs b/osu.Desktop.Tests/Visual/TestCaseScrollingHitObjects.cs similarity index 95% rename from osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs rename to osu.Desktop.Tests/Visual/TestCaseScrollingHitObjects.cs index 43f30a96b0..efc129a678 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseScrollingHitObjects.cs +++ b/osu.Desktop.Tests/Visual/TestCaseScrollingHitObjects.cs @@ -1,23 +1,22 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; -using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Timing; +using OpenTK; +using OpenTK.Graphics; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - public class TestCaseScrollingHitObjects : TestCase + public class TestCaseScrollingHitObjects : OsuTestCase { public override string Description => "SpeedAdjustmentContainer/DrawableTimingSection"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs b/osu.Desktop.Tests/Visual/TestCaseSettings.cs similarity index 80% rename from osu.Desktop.VisualTests/Tests/TestCaseSettings.cs rename to osu.Desktop.Tests/Visual/TestCaseSettings.cs index 3d21f0e3b1..7b35009aef 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSettings.cs +++ b/osu.Desktop.Tests/Visual/TestCaseSettings.cs @@ -1,12 +1,11 @@ // 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.Overlays; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseSettings : TestCase + internal class TestCaseSettings : OsuTestCase { public override string Description => @"Tests the settings overlay"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs b/osu.Desktop.Tests/Visual/TestCaseSkipButton.cs similarity index 75% rename from osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs rename to osu.Desktop.Tests/Visual/TestCaseSkipButton.cs index 1f81226a8e..0e73314850 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSkipButton.cs +++ b/osu.Desktop.Tests/Visual/TestCaseSkipButton.cs @@ -1,12 +1,11 @@ // 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.Screens.Play; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseSkipButton : TestCase + internal class TestCaseSkipButton : OsuTestCase { public override string Description => @"Skip skip skippediskip"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs b/osu.Desktop.Tests/Visual/TestCaseSocial.cs similarity index 94% rename from osu.Desktop.VisualTests/Tests/TestCaseSocial.cs rename to osu.Desktop.Tests/Visual/TestCaseSocial.cs index 34209119bd..da60c82cea 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSocial.cs +++ b/osu.Desktop.Tests/Visual/TestCaseSocial.cs @@ -1,13 +1,12 @@ // 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.Overlays; using osu.Game.Users; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - public class TestCaseSocial : TestCase + public class TestCaseSocial : OsuTestCase { public override string Description => @"social browser overlay"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.Tests/Visual/TestCaseSongProgress.cs similarity index 91% rename from osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs rename to osu.Desktop.Tests/Visual/TestCaseSongProgress.cs index 3368224be1..fceb773ae6 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.Tests/Visual/TestCaseSongProgress.cs @@ -4,14 +4,13 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Framework.MathUtils; -using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Rulesets.Objects; using osu.Game.Screens.Play; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseSongProgress : TestCase + internal class TestCaseSongProgress : OsuTestCase { public override string Description => @"With fake data"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs b/osu.Desktop.Tests/Visual/TestCaseTabControl.cs similarity index 88% rename from osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs rename to osu.Desktop.Tests/Visual/TestCaseTabControl.cs index c0c01a6daa..4bdea2615d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTabControl.cs +++ b/osu.Desktop.Tests/Visual/TestCaseTabControl.cs @@ -2,15 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using OpenTK; -using osu.Framework.Testing; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; +using OpenTK; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - public class TestCaseTabControl : TestCase + public class TestCaseTabControl : OsuTestCase { public override string Description => @"Filter for song select"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs b/osu.Desktop.Tests/Visual/TestCaseTaikoPlayfield.cs similarity index 95% rename from osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs rename to osu.Desktop.Tests/Visual/TestCaseTaikoPlayfield.cs index 717538ff89..45be9e800d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Desktop.Tests/Visual/TestCaseTaikoPlayfield.cs @@ -1,24 +1,23 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; +using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; -using osu.Framework.Testing; using osu.Framework.Timing; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Taiko.Judgements; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.UI; -using System; +using OpenTK; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseTaikoPlayfield : TestCase + internal class TestCaseTaikoPlayfield : OsuTestCase { private const double default_duration = 1000; private const float scroll_time = 1000; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs b/osu.Desktop.Tests/Visual/TestCaseTextAwesome.cs similarity index 88% rename from osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs rename to osu.Desktop.Tests/Visual/TestCaseTextAwesome.cs index 504b59f007..b98c0f700d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTextAwesome.cs +++ b/osu.Desktop.Tests/Visual/TestCaseTextAwesome.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using osu.Framework.Testing; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.MathUtils; @@ -10,9 +9,9 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseTextAwesome : TestCase + internal class TestCaseTextAwesome : OsuTestCase { public override string Description => @"Tests display of icons"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs b/osu.Desktop.Tests/Visual/TestCaseTwoLayerButton.cs similarity index 72% rename from osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs rename to osu.Desktop.Tests/Visual/TestCaseTwoLayerButton.cs index 0c35a4b8aa..ac641d75a2 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseTwoLayerButton.cs +++ b/osu.Desktop.Tests/Visual/TestCaseTwoLayerButton.cs @@ -1,12 +1,11 @@ // 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.Graphics.UserInterface; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseTwoLayerButton : TestCase + internal class TestCaseTwoLayerButton : OsuTestCase { public override string Description => @"Mostly back button"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs b/osu.Desktop.Tests/Visual/TestCaseUserPanel.cs similarity index 92% rename from osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs rename to osu.Desktop.Tests/Visual/TestCaseUserPanel.cs index 22cdf42f7d..b42fd3136d 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserPanel.cs +++ b/osu.Desktop.Tests/Visual/TestCaseUserPanel.cs @@ -1,15 +1,14 @@ // 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.Framework.Graphics; -using osu.Game.Users; using osu.Framework.Graphics.Containers; +using osu.Game.Users; using OpenTK; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseUserPanel : TestCase + internal class TestCaseUserPanel : OsuTestCase { public override string Description => @"Panels for displaying a user's status"; diff --git a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs b/osu.Desktop.Tests/Visual/TestCaseUserProfile.cs similarity index 92% rename from osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs rename to osu.Desktop.Tests/Visual/TestCaseUserProfile.cs index d7a2c8e47d..e5955441dc 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseUserProfile.cs +++ b/osu.Desktop.Tests/Visual/TestCaseUserProfile.cs @@ -3,13 +3,12 @@ using System; using System.Linq; -using osu.Framework.Testing; using osu.Game.Overlays; using osu.Game.Users; -namespace osu.Desktop.VisualTests.Tests +namespace osu.Desktop.Tests.Visual { - internal class TestCaseUserProfile : TestCase + internal class TestCaseUserProfile : OsuTestCase { public override string Description => "Tests user's profile page."; diff --git a/osu.Desktop.Tests/VisualTests.cs b/osu.Desktop.Tests/VisualTests.cs deleted file mode 100644 index 6ef924e873..0000000000 --- a/osu.Desktop.Tests/VisualTests.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2007-2017 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using NUnit.Framework; -using osu.Desktop.VisualTests; -using osu.Framework.Desktop.Platform; - -namespace osu.Desktop.Tests -{ - [TestFixture] - public class VisualTests - { - [Test] - public void TestVisualTests() - { - using (var host = new HeadlessGameHost()) - { - host.Run(new AutomatedVisualTestGame()); - } - } - } -} diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj index f940e4be9e..aa862498d1 100644 --- a/osu.Desktop.Tests/osu.Desktop.Tests.csproj +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -41,6 +41,10 @@ $(SolutionDir)\packages\NUnit.3.7.1\lib\net45\nunit.framework.dll True + + $(SolutionDir)\packages\ppy.OpenTK.3.0\lib\net45\OpenTK.dll + True + False $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll @@ -55,15 +59,66 @@ $(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {65DC628F-A640-4111-AB35-3A5652BC1E17} osu.Framework.Desktop + + {007b2356-ab6f-4bd9-96d5-116fc2dce69a} + osu.Framework.Testing + {C76BF5B3-985E-4D39-95FE-97C9C879B83A} osu.Framework @@ -72,10 +127,6 @@ {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} osu.Game.Resources - - {69051C69-12AE-4E7D-A3E6-460D2E282312} - osu.Desktop.VisualTests - {58F6C80C-1253-4A0E-A465-B8C85EBEADF3} osu.Game.Rulesets.Catch diff --git a/osu.Desktop.Tests/packages.config b/osu.Desktop.Tests/packages.config index 7bd35a3abe..ed487e5cd5 100644 --- a/osu.Desktop.Tests/packages.config +++ b/osu.Desktop.Tests/packages.config @@ -6,6 +6,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste + diff --git a/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs b/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs deleted file mode 100644 index b08588b29c..0000000000 --- a/osu.Desktop.VisualTests/AutomatedVisualTestGame.cs +++ /dev/null @@ -1,20 +0,0 @@ -// 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 - { - 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())); - } - } -} \ No newline at end of file diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index 03d1588b78..62465c69d2 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Desktop; using osu.Framework.Platform; +using osu.Framework.VisualTests; namespace osu.Desktop.VisualTests { diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index 5c5bcd9e21..7655f6a59d 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Platform; -using osu.Framework.Testing; +using osu.Framework.VisualTests; using osu.Game; using osu.Game.Screens.Backgrounds; diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 515fa4347d..8bba59207f 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -1,4 +1,4 @@ - + {69051C69-12AE-4E7D-A3E6-460D2E282312} @@ -185,54 +185,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -257,4 +211,4 @@ - \ No newline at end of file + diff --git a/osu.Desktop/OsuTestBrowser.cs b/osu.Desktop/OsuTestBrowser.cs new file mode 100644 index 0000000000..50af9bd317 --- /dev/null +++ b/osu.Desktop/OsuTestBrowser.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Platform; +using osu.Framework.Testing; +using osu.Game; +using osu.Game.Screens.Backgrounds; + +namespace osu.Desktop +{ + internal class OsuTestBrowser : OsuGameBase + { + protected override void LoadComplete() + { + base.LoadComplete(); + + LoadComponentAsync(new BackgroundScreenDefault { Depth = 10 }, AddInternal); + + // Have to construct this here, rather than in the constructor, because + // we depend on some dependencies to be loaded within OsuGameBase.load(). + Add(new TestBrowser()); + } + + public override void SetHost(GameHost host) + { + base.SetHost(host); + + host.UpdateThread.InactiveHz = host.UpdateThread.ActiveHz; + host.DrawThread.InactiveHz = host.DrawThread.ActiveHz; + host.InputThread.InactiveHz = host.InputThread.ActiveHz; + + host.Window.CursorState |= CursorState.Hidden; + } + } +} \ No newline at end of file diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 3b63239525..1fab92e020 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using System.Linq; using osu.Framework.Desktop; using osu.Framework.Desktop.Platform; using osu.Game.IPC; @@ -33,7 +34,16 @@ namespace osu.Desktop } else { - host.Run(new OsuGameDesktop(args)); + switch (args.FirstOrDefault() ?? string.Empty) + { + case "--tests": + host.Run(new OsuTestBrowser()); + break; + default: + host.Run(new OsuGameDesktop(args)); + break; + } + } return 0; } diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 82fbefec7a..8ffa6b62f7 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -90,6 +90,20 @@ Properties\app.manifest + + true + bin\Debug\ + DEBUG + true + 0 + true + full + AnyCPU + false + 6 + prompt + AllRules.ruleset + $(SolutionDir)\packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.dll @@ -195,6 +209,10 @@ {65dc628f-a640-4111-ab35-3a5652bc1e17} osu.Framework.Desktop + + {007B2356-AB6F-4BD9-96D5-116FC2DCE69A} + osu.Framework.Testing + {c76bf5b3-985e-4d39-95fe-97c9c879b83a} osu.Framework @@ -203,6 +221,10 @@ {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} osu.Game.Resources + + {230ac4f3-7783-49fb-9aec-b83cda3b9f3d} + osu.Desktop.Tests + {c92a607b-1fdd-4954-9f92-03ff547d9080} osu.Game.Rulesets.Osu @@ -226,6 +248,7 @@ + diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index ee29f970bb..dc13329bde 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -84,6 +84,8 @@ namespace osu.Game.Rulesets.Catch } } + public override Mod GetAutoplayMod() => new ModAutoplay(); + public override string Description => "osu!catch"; public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_fruits_o }; diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 0349427784..a8a89a57e0 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -105,6 +105,8 @@ namespace osu.Game.Rulesets.Mania } } + public override Mod GetAutoplayMod() => new ModAutoplay(); + public override string Description => "osu!mania"; public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_mania_o }; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index da32b49262..9a1971d791 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -105,6 +105,8 @@ namespace osu.Game.Rulesets.Osu } } + public override Mod GetAutoplayMod() => new OsuModAutoplay(); + public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_osu_o }; public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => new OsuDifficultyCalculator(beatmap); diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 27b4cffbaf..83db9b35af 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -84,6 +84,8 @@ namespace osu.Game.Rulesets.Taiko } } + public override Mod GetAutoplayMod() => new TaikoModAutoplay(); + public override string Description => "osu!taiko"; public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_taiko_o }; diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 0885fb05e5..bd53a80555 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -60,6 +60,8 @@ namespace osu.Game.Beatmaps { public override IEnumerable GetModsFor(ModType type) => new Mod[] { }; + public override Mod GetAutoplayMod() => new ModAutoplay(); + public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) { throw new NotImplementedException(); diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 42fff0f258..447daca75e 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -10,6 +10,9 @@ using System.Linq; namespace osu.Game.Graphics.UserInterface { + /// + /// A textbox which holds focus eagerly. + /// public class FocusedTextBox : OsuTextBox { protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255); diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index f39cdf5d24..ee5d3baf66 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -8,9 +8,6 @@ using OpenTK.Input; namespace osu.Game.Graphics.UserInterface { - /// - /// A textbox which holds focus eagerly. - /// public class SearchTextBox : FocusedTextBox { protected virtual bool AllowCommit => false; @@ -46,10 +43,16 @@ namespace osu.Game.Graphics.UserInterface case Key.Up: case Key.Down: return false; + } + } + + if (!AllowCommit) + { + switch (args.Key) + { case Key.KeypadEnter: case Key.Enter: - if (!AllowCommit) return false; - break; + return false; } } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index c5a9155da5..b3be36a983 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -19,6 +19,8 @@ namespace osu.Game.Rulesets public abstract IEnumerable GetModsFor(ModType type); + public abstract Mod GetAutoplayMod(); + /// /// Attempt to create a hit renderer for a beatmap /// diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index d215385ece..6e79d2b427 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens } } - private readonly Bindable ruleset = new Bindable(); + protected readonly Bindable Ruleset = new Bindable(); private SampleChannel sampleExit; @@ -64,7 +64,7 @@ namespace osu.Game.Screens } if (osuGame != null) - ruleset.BindTo(osuGame.Ruleset); + Ruleset.BindTo(osuGame.Ruleset); sampleExit = audio.Sample.Get(@"UI/melodic-1"); } @@ -77,7 +77,7 @@ namespace osu.Game.Screens { // we only want to apply these restrictions when we are inside a screen stack. // the use case for not applying is in visual/unit tests. - ruleset.Disabled = !AllowBeatmapRulesetChange; + Ruleset.Disabled = !AllowBeatmapRulesetChange; Beatmap.Disabled = !AllowBeatmapRulesetChange; } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 84261d509e..39128eb85e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -4,7 +4,6 @@ using OpenTK; using osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -111,13 +110,7 @@ namespace osu.Game.Screens.Play return; } - Track track = Beatmap.Value.Track; - - if (track != null) - adjustableSourceClock = track; - - adjustableSourceClock = (IAdjustableClock)track ?? new StopwatchClock(); - + adjustableSourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock(); decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; var firstObjectTime = HitRenderer.Objects.First().StartTime; diff --git a/osu.Game/Screens/Select/EditSongSelect.cs b/osu.Game/Screens/Select/EditSongSelect.cs index 1a9d37f069..907c080729 100644 --- a/osu.Game/Screens/Select/EditSongSelect.cs +++ b/osu.Game/Screens/Select/EditSongSelect.cs @@ -1,12 +1,14 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Input; + namespace osu.Game.Screens.Select { public class EditSongSelect : SongSelect { protected override bool ShowFooter => false; - protected override void OnSelected() => Exit(); + protected override void OnSelected(InputState state) => Exit(); } } diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index 282cd06126..2d3b198478 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -1,10 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Input; + namespace osu.Game.Screens.Select { public class MatchSongSelect : SongSelect { - protected override void OnSelected() => Exit(); + protected override void OnSelected(InputState state) => Exit(); } } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index e393caf931..662e1d55a2 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -1,10 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -20,6 +22,7 @@ namespace osu.Game.Screens.Select private OsuScreen player; private readonly ModSelectOverlay modSelect; private readonly BeatmapDetailArea beatmapDetails; + private bool removeAutoModOnResume; public PlaySongSelect() { @@ -71,6 +74,13 @@ namespace osu.Game.Screens.Select { player = null; + if (removeAutoModOnResume) + { + var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType(); + modSelect.SelectedMods.Value = modSelect.SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray(); + removeAutoModOnResume = false; + } + Beatmap.Value.Track.Looping = true; base.OnResuming(last); @@ -100,10 +110,23 @@ namespace osu.Game.Screens.Select return false; } - protected override void OnSelected() + protected override void OnSelected(InputState state) { if (player != null) return; + if (state?.Keyboard.ControlPressed == true) + { + var auto = Ruleset.Value.CreateInstance().GetAutoplayMod(); + var autoType = auto.GetType(); + + var mods = modSelect.SelectedMods.Value; + if (mods.All(m => m.GetType() != autoType)) + { + modSelect.SelectedMods.Value = mods.Concat(new[] { auto }); + removeAutoModOnResume = true; + } + } + Beatmap.Value.Track.Looping = false; Beatmap.Disabled = true; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 217baccf58..8f545240c8 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -9,7 +9,6 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; @@ -19,7 +18,6 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays; -using osu.Game.Rulesets; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Select.Options; @@ -27,7 +25,6 @@ namespace osu.Game.Screens.Select { public abstract class SongSelect : OsuScreen { - private readonly Bindable ruleset = new Bindable(); private BeatmapManager manager; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(); @@ -109,7 +106,7 @@ namespace osu.Game.Screens.Select Origin = Anchor.CentreRight, SelectionChanged = carouselSelectionChanged, BeatmapsChanged = carouselBeatmapsLoaded, - StartRequested = carouselRaisedStart, + StartRequested = () => carouselRaisedStart(), }); Add(FilterControl = new FilterControl { @@ -151,7 +148,7 @@ namespace osu.Game.Screens.Select Add(Footer = new Footer { OnBack = Exit, - OnStart = carouselRaisedStart, + OnStart = () => carouselRaisedStart(), }); FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay()); @@ -173,7 +170,7 @@ namespace osu.Game.Screens.Select manager = beatmaps; if (osu != null) - ruleset.BindTo(osu.Ruleset); + Ruleset.BindTo(osu.Ruleset); manager.BeatmapSetAdded += onBeatmapSetAdded; manager.BeatmapSetRemoved += onBeatmapSetRemoved; @@ -201,7 +198,7 @@ namespace osu.Game.Screens.Select carousel.SelectNext(); } - private void carouselRaisedStart() + private void carouselRaisedStart(InputState state = null) { // if we have a pending filter operation, we want to run it now. // it could change selection (ie. if the ruleset has been changed). @@ -214,7 +211,7 @@ namespace osu.Game.Screens.Select selectionChangedDebounce = null; } - OnSelected(); + OnSelected(state); } private ScheduledDelegate selectionChangedDebounce; @@ -256,7 +253,7 @@ namespace osu.Game.Screens.Select } else { - ruleset.Value = beatmap.Ruleset; + Ruleset.Value = beatmap.Ruleset; if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID) sampleChangeDifficulty.Play(); @@ -278,7 +275,7 @@ namespace osu.Game.Screens.Select carousel.SelectNextRandom(); } - protected abstract void OnSelected(); + protected abstract void OnSelected(InputState state); private void filterChanged(FilterCriteria criteria, bool debounce = true) { @@ -406,7 +403,7 @@ namespace osu.Game.Screens.Select { case Key.KeypadEnter: case Key.Enter: - carouselRaisedStart(); + carouselRaisedStart(state); return true; case Key.Delete: if (state.Keyboard.ShiftPressed) diff --git a/osu.sln b/osu.sln index 317cfe7da4..3799c890b9 100644 --- a/osu.sln +++ b/osu.sln @@ -17,8 +17,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Framework", "Framework", "{ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Framework.Desktop", "osu-framework\osu.Framework.Desktop\osu.Framework.Desktop.csproj", "{65DC628F-A640-4111-AB35-3A5652BC1E17}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.VisualTests", "osu.Desktop.VisualTests\osu.Desktop.VisualTests.csproj", "{69051C69-12AE-4E7D-A3E6-460D2E282312}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Tests", "osu.Game.Tests\osu.Game.Tests.csproj", "{54377672-20B1-40AF-8087-5CF73BF3953A}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Rulesets.Osu", "osu.Game.Rulesets.Osu\osu.Game.Rulesets.Osu.csproj", "{C92A607B-1FDD-4954-9F92-03FF547D9080}" @@ -43,62 +41,84 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU + VisualTests|Any CPU = VisualTests|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Debug|Any CPU.Build.0 = Debug|Any CPU {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.ActiveCfg = Release|Any CPU {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.Release|Any CPU.Build.0 = Release|Any CPU + {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.VisualTests|Any CPU.ActiveCfg = VisualTests|Any CPU + {2A66DD92-ADB1-4994-89E2-C94E04ACDA0D}.VisualTests|Any CPU.Build.0 = VisualTests|Any CPU {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Debug|Any CPU.Build.0 = Debug|Any CPU {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.ActiveCfg = Release|Any CPU {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.Release|Any CPU.Build.0 = Release|Any CPU + {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {C76BF5B3-985E-4D39-95FE-97C9C879B83A}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Debug|Any CPU.Build.0 = Debug|Any CPU {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Release|Any CPU.ActiveCfg = Release|Any CPU {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.Release|Any CPU.Build.0 = Release|Any CPU + {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Debug|Any CPU.Build.0 = Debug|Any CPU {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Release|Any CPU.ActiveCfg = Release|Any CPU {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.Release|Any CPU.Build.0 = Release|Any CPU + {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {65DC628F-A640-4111-AB35-3A5652BC1E17}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {65DC628F-A640-4111-AB35-3A5652BC1E17}.Debug|Any CPU.Build.0 = Debug|Any CPU {65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.ActiveCfg = Release|Any CPU {65DC628F-A640-4111-AB35-3A5652BC1E17}.Release|Any CPU.Build.0 = Release|Any CPU - {69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {69051C69-12AE-4E7D-A3E6-460D2E282312}.Debug|Any CPU.Build.0 = Debug|Any CPU - {69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.ActiveCfg = Release|Any CPU - {69051C69-12AE-4E7D-A3E6-460D2E282312}.Release|Any CPU.Build.0 = Release|Any CPU + {65DC628F-A640-4111-AB35-3A5652BC1E17}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {65DC628F-A640-4111-AB35-3A5652BC1E17}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {54377672-20B1-40AF-8087-5CF73BF3953A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {54377672-20B1-40AF-8087-5CF73BF3953A}.Debug|Any CPU.Build.0 = Debug|Any CPU {54377672-20B1-40AF-8087-5CF73BF3953A}.Release|Any CPU.ActiveCfg = Release|Any CPU {54377672-20B1-40AF-8087-5CF73BF3953A}.Release|Any CPU.Build.0 = Release|Any CPU + {54377672-20B1-40AF-8087-5CF73BF3953A}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {54377672-20B1-40AF-8087-5CF73BF3953A}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {C92A607B-1FDD-4954-9F92-03FF547D9080}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {C92A607B-1FDD-4954-9F92-03FF547D9080}.Debug|Any CPU.Build.0 = Debug|Any CPU {C92A607B-1FDD-4954-9F92-03FF547D9080}.Release|Any CPU.ActiveCfg = Release|Any CPU {C92A607B-1FDD-4954-9F92-03FF547D9080}.Release|Any CPU.Build.0 = Release|Any CPU + {C92A607B-1FDD-4954-9F92-03FF547D9080}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {C92A607B-1FDD-4954-9F92-03FF547D9080}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {58F6C80C-1253-4A0E-A465-B8C85EBEADF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {58F6C80C-1253-4A0E-A465-B8C85EBEADF3}.Debug|Any CPU.Build.0 = Debug|Any CPU {58F6C80C-1253-4A0E-A465-B8C85EBEADF3}.Release|Any CPU.ActiveCfg = Release|Any CPU {58F6C80C-1253-4A0E-A465-B8C85EBEADF3}.Release|Any CPU.Build.0 = Release|Any CPU + {58F6C80C-1253-4A0E-A465-B8C85EBEADF3}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {58F6C80C-1253-4A0E-A465-B8C85EBEADF3}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {F167E17A-7DE6-4AF5-B920-A5112296C695}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F167E17A-7DE6-4AF5-B920-A5112296C695}.Debug|Any CPU.Build.0 = Debug|Any CPU {F167E17A-7DE6-4AF5-B920-A5112296C695}.Release|Any CPU.ActiveCfg = Release|Any CPU {F167E17A-7DE6-4AF5-B920-A5112296C695}.Release|Any CPU.Build.0 = Release|Any CPU + {F167E17A-7DE6-4AF5-B920-A5112296C695}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {F167E17A-7DE6-4AF5-B920-A5112296C695}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {48F4582B-7687-4621-9CBE-5C24197CB536}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {48F4582B-7687-4621-9CBE-5C24197CB536}.Debug|Any CPU.Build.0 = Debug|Any CPU {48F4582B-7687-4621-9CBE-5C24197CB536}.Release|Any CPU.ActiveCfg = Release|Any CPU {48F4582B-7687-4621-9CBE-5C24197CB536}.Release|Any CPU.Build.0 = Release|Any CPU + {48F4582B-7687-4621-9CBE-5C24197CB536}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {48F4582B-7687-4621-9CBE-5C24197CB536}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.Release|Any CPU.Build.0 = Release|Any CPU + {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}.VisualTests|Any CPU.Build.0 = Debug|Any CPU {BAEA2F74-0315-4667-84E0-ACAC0B4BF785}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {BAEA2F74-0315-4667-84E0-ACAC0B4BF785}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BAEA2F74-0315-4667-84E0-ACAC0B4BF785}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU {007B2356-AB6F-4BD9-96D5-116FC2DCE69A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {007B2356-AB6F-4BD9-96D5-116FC2DCE69A}.Debug|Any CPU.Build.0 = Debug|Any CPU {007B2356-AB6F-4BD9-96D5-116FC2DCE69A}.Release|Any CPU.ActiveCfg = Release|Any CPU {007B2356-AB6F-4BD9-96D5-116FC2DCE69A}.Release|Any CPU.Build.0 = Release|Any CPU + {007B2356-AB6F-4BD9-96D5-116FC2DCE69A}.VisualTests|Any CPU.ActiveCfg = Debug|Any CPU + {007B2356-AB6F-4BD9-96D5-116FC2DCE69A}.VisualTests|Any CPU.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -109,7 +129,6 @@ Global {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {D9A367C9-4C1A-489F-9B05-A0CEA2B53B58} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {65DC628F-A640-4111-AB35-3A5652BC1E17} = {7A75DFA2-DE65-4458-98AF-26AF96FFD6DC} - {69051C69-12AE-4E7D-A3E6-460D2E282312} = {80683232-505E-41EA-A37C-2CFCF1C88C57} {54377672-20B1-40AF-8087-5CF73BF3953A} = {80683232-505E-41EA-A37C-2CFCF1C88C57} {C92A607B-1FDD-4954-9F92-03FF547D9080} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {58F6C80C-1253-4A0E-A465-B8C85EBEADF3} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3}