From 829fb2605b132c89d74f0c010111607a5d09b906 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Feb 2017 17:47:11 +0900 Subject: [PATCH 1/4] Fix visualtest regression. --- osu.Game/Screens/Menu/ButtonSystem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index a76cdbe99b..6d720569df 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -119,11 +119,11 @@ namespace osu.Game.Screens.Menu buttonFlow.Add(buttonsTopLevel); } - [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuGame game) + [BackgroundDependencyLoader(true)] + private void load(AudioManager audio, OsuGame game = null) { sampleOsuClick = audio.Sample.Get(@"Menu/menuhit"); - toolbar = game.Toolbar; + toolbar = game?.Toolbar; } protected override void LoadComplete() From e0b75175359cf076fccfc4b8d9c7cbf54b892201 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Feb 2017 19:24:53 +0900 Subject: [PATCH 2/4] Add desktop unit tests project. --- osu.Desktop.Tests/BenchmarkTest.cs | 33 +++++ osu.Desktop.Tests/app.config | 11 ++ osu.Desktop.Tests/osu.Desktop.Tests.csproj | 115 ++++++++++++++++++ osu.Desktop.Tests/packages.config | 8 ++ osu.Desktop.VisualTests/Benchmark.cs | 56 +++++++++ osu.Desktop.VisualTests/Program.cs | 7 +- osu.Desktop.VisualTests/VisualTestGame.cs | 1 - osu.Desktop.VisualTests/app.config | 16 +++ .../osu.Desktop.VisualTests.csproj | 4 +- osu.Desktop.VisualTests/packages.config | 23 ++-- osu.sln | 7 ++ 11 files changed, 265 insertions(+), 16 deletions(-) create mode 100644 osu.Desktop.Tests/BenchmarkTest.cs create mode 100644 osu.Desktop.Tests/app.config create mode 100644 osu.Desktop.Tests/osu.Desktop.Tests.csproj create mode 100644 osu.Desktop.Tests/packages.config create mode 100644 osu.Desktop.VisualTests/Benchmark.cs create mode 100644 osu.Desktop.VisualTests/app.config diff --git a/osu.Desktop.Tests/BenchmarkTest.cs b/osu.Desktop.Tests/BenchmarkTest.cs new file mode 100644 index 0000000000..c55b98aa57 --- /dev/null +++ b/osu.Desktop.Tests/BenchmarkTest.cs @@ -0,0 +1,33 @@ +// 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; +using osu.Game.Modes; +using osu.Game.Modes.Catch; +using osu.Game.Modes.Mania; +using osu.Game.Modes.Osu; +using osu.Game.Modes.Taiko; + +namespace osu.Desktop.Tests +{ + [TestFixture] + public class BenchmarkTest + { + [Test] + public void TestBenchmark() + { + using (var host = new HeadlessGameHost()) + { + Ruleset.Register(new OsuRuleset()); + Ruleset.Register(new TaikoRuleset()); + Ruleset.Register(new ManiaRuleset()); + Ruleset.Register(new CatchRuleset()); + + host.Add(new Benchmark()); + host.Run(); + } + } + } +} diff --git a/osu.Desktop.Tests/app.config b/osu.Desktop.Tests/app.config new file mode 100644 index 0000000000..44ccc4b77a --- /dev/null +++ b/osu.Desktop.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.Tests/osu.Desktop.Tests.csproj b/osu.Desktop.Tests/osu.Desktop.Tests.csproj new file mode 100644 index 0000000000..8a6581ccab --- /dev/null +++ b/osu.Desktop.Tests/osu.Desktop.Tests.csproj @@ -0,0 +1,115 @@ + + + + + Debug + AnyCPU + {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D} + Library + Properties + osu.Desktop.Tests + osu.Desktop.Tests + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + ..\packages\NUnit.3.5.0\lib\net45\nunit.framework.dll + True + + + False + $(SolutionDir)\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll + + + + $(SolutionDir)\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + + + $(SolutionDir)\packages\SQLiteNetExtensions.1.3.0\lib\portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1\SQLiteNetExtensions.dll + + + $(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll + + + $(SolutionDir)\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll + + + $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1339\lib\net45\OpenTK.dll + + + + + + + + {65DC628F-A640-4111-AB35-3A5652BC1E17} + osu.Framework.Desktop + + + {C76BF5B3-985E-4D39-95FE-97C9C879B83A} + osu.Framework + + + {d9a367c9-4c1a-489f-9b05-a0cea2b53b58} + osu.Game.Resources + + + {69051C69-12AE-4E7D-A3E6-460D2E282312} + osu.Desktop.VisualTests + + + {58F6C80C-1253-4A0E-A465-B8C85EBEADF3} + osu.Game.Modes.Catch + + + {48F4582B-7687-4621-9CBE-5C24197CB536} + osu.Game.Modes.Mania + + + {C92A607B-1FDD-4954-9F92-03FF547D9080} + osu.Game.Modes.Osu + + + {F167E17A-7DE6-4AF5-B920-A5112296C695} + osu.Game.Modes.Taiko + + + {0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D} + osu.Game + + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.Tests/packages.config b/osu.Desktop.Tests/packages.config new file mode 100644 index 0000000000..05b53c019c --- /dev/null +++ b/osu.Desktop.Tests/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.VisualTests/Benchmark.cs b/osu.Desktop.VisualTests/Benchmark.cs new file mode 100644 index 0000000000..506788e93c --- /dev/null +++ b/osu.Desktop.VisualTests/Benchmark.cs @@ -0,0 +1,56 @@ +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Desktop.Platform; +using osu.Framework.GameModes.Testing; +using osu.Game; +using osu.Game.Modes; +using osu.Game.Modes.Catch; +using osu.Game.Modes.Mania; +using osu.Game.Modes.Osu; +using osu.Game.Modes.Taiko; + +namespace osu.Desktop.VisualTests +{ + public class Benchmark : OsuGameBase + { + private double timePerTest = 200; + + [BackgroundDependencyLoader] + private void load(BaseGame game) + { + 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 {timePerTest}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 * timePerTest); + } + + Scheduler.AddDelayed(Host.Exit, f.TestCount * timePerTest); + } + } +} diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index df54297812..b89c6bcf4d 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -18,6 +18,8 @@ namespace osu.Desktop.VisualTests [STAThread] public static void Main(string[] args) { + bool benchmark = args.Length > 0 && args[0] == @"-benchmark"; + using (BasicGameHost host = Host.GetSuitableHost(@"osu")) { Ruleset.Register(new OsuRuleset()); @@ -25,7 +27,10 @@ namespace osu.Desktop.VisualTests Ruleset.Register(new ManiaRuleset()); Ruleset.Register(new CatchRuleset()); - host.Add(new VisualTestGame()); + if (benchmark) + host.Add(new Benchmark()); + else + host.Add(new VisualTestGame()); host.Run(); } } diff --git a/osu.Desktop.VisualTests/VisualTestGame.cs b/osu.Desktop.VisualTests/VisualTestGame.cs index 7489559c98..952de4ab26 100644 --- a/osu.Desktop.VisualTests/VisualTestGame.cs +++ b/osu.Desktop.VisualTests/VisualTestGame.cs @@ -10,7 +10,6 @@ using osu.Framework.Desktop.Platform; using System.Reflection; using System.IO; using System.Collections.Generic; -using SQLiteNetExtensions.Extensions; using osu.Framework.Allocation; namespace osu.Desktop.VisualTests diff --git a/osu.Desktop.VisualTests/app.config b/osu.Desktop.VisualTests/app.config new file mode 100644 index 0000000000..9bad888bf3 --- /dev/null +++ b/osu.Desktop.VisualTests/app.config @@ -0,0 +1,16 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj index 69df007013..c2215ec9ec 100644 --- a/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj +++ b/osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj @@ -100,13 +100,12 @@ $(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1339\lib\net45\OpenTK.dll - - osu.licenseheader + @@ -172,6 +171,7 @@ + diff --git a/osu.Desktop.VisualTests/packages.config b/osu.Desktop.VisualTests/packages.config index f39a585e49..75affafd35 100644 --- a/osu.Desktop.VisualTests/packages.config +++ b/osu.Desktop.VisualTests/packages.config @@ -1,13 +1,12 @@ - - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/osu.sln b/osu.sln index f3736c16c0..588cabf6b6 100644 --- a/osu.sln +++ b/osu.sln @@ -29,6 +29,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Modes.Taiko", "osu EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Game.Modes.Mania", "osu.Game.Modes.Mania\osu.Game.Modes.Mania.csproj", "{48F4582B-7687-4621-9CBE-5C24197CB536}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "osu.Desktop.Tests", "osu.Desktop.Tests\osu.Desktop.Tests.csproj", "{230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -79,6 +81,10 @@ Global {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 + {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 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -95,6 +101,7 @@ Global {58F6C80C-1253-4A0E-A465-B8C85EBEADF3} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {F167E17A-7DE6-4AF5-B920-A5112296C695} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} {48F4582B-7687-4621-9CBE-5C24197CB536} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} + {230AC4F3-7783-49FB-9AEC-B83CDA3B9F3D} = {0D37A2AD-80A4-464F-A1DE-1560B70F1CE3} EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 From becb65f702c2c1ed33ec963983d2f9969083fdf6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Feb 2017 19:25:04 +0900 Subject: [PATCH 3/4] Fix ParallaxContainer breaking with no mouse state present. --- osu.Game/Graphics/Containers/ParallaxContainer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index c5e53e14a5..fe3601a5f2 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -45,7 +45,8 @@ namespace osu.Game.Graphics.Containers { base.Update(); - content.MoveTo((ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2) * ParallaxAmount, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); + Vector2 offset = input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2; + content.MoveTo(offset * ParallaxAmount, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); content.Scale = new Vector2(1 + ParallaxAmount); firstUpdate = false; From 4f7069520adacbc2b37ff57e5efab7be93479392 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 9 Feb 2017 19:25:10 +0900 Subject: [PATCH 4/4] Framework bump. --- osu-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu-framework b/osu-framework index 21fd81a848..6cea2e68db 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 21fd81a84860cf6854026458ac82905b6248f41d +Subproject commit 6cea2e68db09a9bf92e56960e3f26ba42a52e1cd