diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index b410fbd8b..0c5eae395 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -1,2 +1,4 @@
# Normalize all the line endings
7a598af5b92ef76e9a542170befd89ba2556a97c
+# Enabled NRT globally
+ba1385330cc501f34937e08257e586c84e35d772
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 36e156c2a..1059d5d52 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -31,10 +31,10 @@ jobs:
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/inspectcode
- key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu-framework.sln*', '.editorconfig', '.globalconfig') }}
+ key: inspectcode-${{ hashFiles('.config/dotnet-tools.json', '.github/workflows/ci.yml', 'osu-framework.sln*', 'osu-framework*.slnf', '.editorconfig', '.globalconfig', 'CodeAnalysis/*', '**/*.csproj', '**/*.props') }}
- name: Dotnet code style
- run: dotnet build -c Debug -warnaserror build/Desktop.proj -p:EnforceCodeStyleInBuild=true
+ run: dotnet build -c Debug -warnaserror osu-framework.Desktop.slnf -p:EnforceCodeStyleInBuild=true
- name: CodeFileSanity
run: |
@@ -78,20 +78,11 @@ jobs:
with:
dotnet-version: "6.0.x"
- # FIXME: libavformat is not included in Ubuntu. Let's fix that.
- # https://github.com/ppy/osu-framework/issues/4349
- # Remove this once https://github.com/actions/virtual-environments/issues/3306 has been resolved.
- - name: Install libavformat-dev
- if: ${{matrix.os.fullname == 'ubuntu-latest'}}
- run: |
- sudo apt-get update && \
- sudo apt-get -y install libavformat-dev
-
- name: Compile
- run: dotnet build -c Debug -warnaserror build/Desktop.proj
+ run: dotnet build -c Debug -warnaserror osu-framework.Desktop.slnf
- name: Test
- run: dotnet test $pwd/*.Tests/bin/Debug/*/*.Tests.dll --settings $pwd/build/vstestconfig.runsettings --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
+ run: dotnet test $pwd/**/*.Tests/bin/Debug/*/*.Tests.dll --settings $pwd/build/vstestconfig.runsettings --logger "trx;LogFileName=TestResults-${{matrix.os.prettyname}}-${{matrix.threadingMode}}.trx"
shell: pwsh
# Attempt to upload results even if test fails.
diff --git a/.gitignore b/.gitignore
index 47d05197a..9e77922eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -335,4 +335,6 @@ fabric.properties
# inspectcode
inspectcodereport.xml
-inspectcode
\ No newline at end of file
+inspectcode
+
+.idea/.idea.osu-framework.Desktop/.idea/misc.xml
\ No newline at end of file
diff --git a/.idea/.idea.osu-framework.Desktop/.idea/misc.xml b/.idea/.idea.osu-framework.Desktop/.idea/misc.xml
deleted file mode 100644
index 4e1d56f4d..000000000
--- a/.idea/.idea.osu-framework.Desktop/.idea/misc.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/CodeAnalysis/BannedSymbols.txt b/CodeAnalysis/BannedSymbols.txt
index d0f8b84ff..5da0fb36c 100644
--- a/CodeAnalysis/BannedSymbols.txt
+++ b/CodeAnalysis/BannedSymbols.txt
@@ -5,4 +5,8 @@ T:System.IComparable;Don't use non-generic IComparable. Use generic version inst
M:System.Enum.HasFlag(System.Enum);Use osu.Framework.Extensions.EnumExtensions.HasFlagFast() instead.
F:System.UriKind.RelativeOrAbsolute;Incompatible results when run on mono (see https://www.mono-project.com/docs/faq/known-issues/urikind-relativeorabsolute/). Use Validation.TryParseUri(string, out Uri?) instead.
M:System.Threading.Tasks.Task.Wait();Don't use Task.Wait. Use Task.WaitSafely() to ensure we avoid deadlocks.
+M:System.Guid.#ctor;Probably meaning to use Guid.NewGuid() instead. If actually wanting empty, use Guid.Empty.
P:System.Threading.Tasks.Task`1.Result;Don't use Task.Result. Use Task.GetResultSafely() to ensure we avoid deadlocks.
+M:System.Threading.ManualResetEventSlim.Wait();Specify a timeout to avoid waiting forever.
+M:System.String.ToLower();string.ToLower() changes behaviour depending on CultureInfo.CurrentCulture. Use string.ToLowerInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture or use LocalisableString.
+M:System.String.ToUpper();string.ToUpper() changes behaviour depending on CultureInfo.CurrentCulture. Use string.ToUpperInvariant() instead. If wanting culture-sensitive behaviour, explicitly provide CultureInfo.CurrentCulture or use LocalisableString.
diff --git a/Directory.Build.props b/Directory.Build.props
index 949100ad3..c683a4edf 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,8 +1,9 @@
- 8.0
+ 9.0
true
+ enable
diff --git a/SampleGame.Android/SampleGameActivity.cs b/SampleGame.Android/SampleGameActivity.cs
index 737761bbc..bdb800d5d 100644
--- a/SampleGame.Android/SampleGameActivity.cs
+++ b/SampleGame.Android/SampleGameActivity.cs
@@ -7,7 +7,7 @@ using osu.Framework.Android;
namespace SampleGame.Android
{
- [Activity(ConfigurationChanges = DEFAULT_CONFIG_CHANGES, LaunchMode = DEFAULT_LAUNCH_MODE, MainLauncher = true)]
+ [Activity(ConfigurationChanges = DEFAULT_CONFIG_CHANGES, Exported = true, LaunchMode = DEFAULT_LAUNCH_MODE, MainLauncher = true)]
public class SampleGameActivity : AndroidGameActivity
{
protected override Game CreateGame() => new SampleGameGame();
diff --git a/SampleGame.Desktop/Program.cs b/SampleGame.Desktop/Program.cs
index 4756edbaa..4abb66826 100644
--- a/SampleGame.Desktop/Program.cs
+++ b/SampleGame.Desktop/Program.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using osu.Framework;
using osu.Framework.Platform;
diff --git a/SampleGame.iOS/AppDelegate.cs b/SampleGame.iOS/AppDelegate.cs
index 1a23fbd0d..b61109ea7 100644
--- a/SampleGame.iOS/AppDelegate.cs
+++ b/SampleGame.iOS/AppDelegate.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using Foundation;
using osu.Framework;
using osu.Framework.iOS;
diff --git a/SampleGame.iOS/Application.cs b/SampleGame.iOS/Application.cs
index 1a7820095..5e3c85fbc 100644
--- a/SampleGame.iOS/Application.cs
+++ b/SampleGame.iOS/Application.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.iOS;
using UIKit;
diff --git a/SampleGame/SampleGameGame.cs b/SampleGame/SampleGameGame.cs
index 3b97ebaee..a090d0972 100644
--- a/SampleGame/SampleGameGame.cs
+++ b/SampleGame/SampleGameGame.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework;
using osu.Framework.Graphics;
using osuTK;
diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml
index 99b47b44d..90fe8769c 100644
--- a/appveyor_deploy.yml
+++ b/appveyor_deploy.yml
@@ -1,10 +1,50 @@
clone_depth: 1
version: '{build}'
-image: Visual Studio 2022
test: off
skip_non_tags: true
-build_script:
- - cmd: PowerShell -Version 2.0 .\build.ps1 -Target DeployFrameworkDesktop
+
+environment:
+ matrix:
+ - job_name: framework-desktop
+ job_group: framework-base
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
+ - job_name: framework-xamarin
+ job_group: framework-base
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
+ - job_name: templates
+ job_depends_on: framework-base
+ APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
+
+nuget:
+ project_feed: true
+
+for:
+ -
+ matrix:
+ only:
+ - job_name: framework-desktop
+ build_script:
+ - cmd: PowerShell -Version 2.0 .\build.ps1 -Target DeployFrameworkDesktop
+ -
+ matrix:
+ only:
+ - job_name: framework-xamarin
+ build_script:
+ - cmd: PowerShell -Version 2.0 .\build.ps1 -Target DeployFrameworkXamarin
+ -
+ matrix:
+ only:
+ - job_name: templates
+ build_script:
+ - cmd: dotnet remove osu.Framework.Templates\templates\template-empty\TemplateGame.Game\TemplateGame.Game.csproj reference osu.Framework\osu.Framework.csproj
+ - cmd: dotnet add osu.Framework.Templates\templates\template-empty\TemplateGame.Game\TemplateGame.Game.csproj package ppy.osu.Framework -v %APPVEYOR_REPO_TAG_NAME%
+ - cmd: dotnet remove osu.Framework.Templates\templates\template-flappy\FlappyDon.Game\FlappyDon.Game.csproj reference osu.Framework\osu.Framework.csproj
+ - cmd: dotnet add osu.Framework.Templates\templates\template-flappy\FlappyDon.Game\FlappyDon.Game.csproj package ppy.osu.Framework -v %APPVEYOR_REPO_TAG_NAME%
+
+ # Can't use `dotnet add` for legacy Xamarin projects. String-replacement happens inside build.cake instead.
+
+ - cmd: PowerShell -Version 2.0 .\build.ps1 -Target DeployFrameworkTemplates
+
deploy:
- provider: Environment
name: nuget
diff --git a/appveyor_xamarin_deploy.yml b/appveyor_xamarin_deploy.yml
deleted file mode 100644
index ceb5aa32a..000000000
--- a/appveyor_xamarin_deploy.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-clone_depth: 1
-version: '{build}'
-image: Visual Studio 2019
-test: off
-skip_non_tags: true
-build_script:
- - cmd: PowerShell -Version 2.0 .\build.ps1 -Target DeployFrameworkXamarin
-deploy:
- - provider: Environment
- name: nuget
- - provider: Environment
- name: github
diff --git a/build/Desktop.proj b/build/Desktop.proj
deleted file mode 100644
index c063e033d..000000000
--- a/build/Desktop.proj
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/build/build.cake b/build/build.cake
index a43211210..7b8ccb7a6 100644
--- a/build/build.cake
+++ b/build/build.cake
@@ -1,4 +1,6 @@
using System.Threading;
+using System.Text.RegularExpressions;
+#addin "nuget:?package=Cake.FileHelpers&version=3.2.1"
#addin "nuget:?package=CodeFileSanity&version=0.0.36"
#tool "nuget:?package=Python&version=3.7.2"
var pythonPath = GetFiles("./tools/python.*/tools/python.exe").First();
@@ -17,7 +19,6 @@ var tempDirectory = new DirectoryPath("temp");
var artifactsDirectory = rootDirectory.Combine("artifacts");
var sln = rootDirectory.CombineWithFilePath("osu-framework.sln");
-var desktopBuilds = rootDirectory.CombineWithFilePath("build/Desktop.proj");
var desktopSlnf = rootDirectory.CombineWithFilePath("osu-framework.Desktop.slnf");
var frameworkProject = rootDirectory.CombineWithFilePath("osu.Framework/osu.Framework.csproj");
var iosFrameworkProject = rootDirectory.CombineWithFilePath("osu.Framework.iOS/osu.Framework.iOS.csproj");
@@ -82,7 +83,7 @@ Task("RunHttpBin")
Task("Compile")
.Does(() => {
- DotNetCoreBuild(desktopBuilds.FullPath, new DotNetCoreBuildSettings {
+ DotNetCoreBuild(desktopSlnf.FullPath, new DotNetCoreBuildSettings {
Configuration = configuration,
Verbosity = DotNetCoreVerbosity.Minimal,
});
@@ -187,7 +188,21 @@ Task("PackNativeLibs")
});
Task("PackTemplate")
- .Does(() => {
+ .Does(ctx => {
+ ctx.ReplaceRegexInFiles(
+ $"{rootDirectory.FullPath}/osu.Framework.Templates/**/*.iOS.csproj",
+ "^.*osu.Framework.csproj.*$",
+ $" ",
+ RegexOptions.Multiline
+ );
+
+ ctx.ReplaceRegexInFiles(
+ $"{rootDirectory.FullPath}/osu.Framework.Templates/**/*.iOS.csproj",
+ "^.*osu.Framework.iOS.csproj.*$",
+ $" ",
+ RegexOptions.Multiline
+ );
+
DotNetCorePack(templateProject.FullPath, new DotNetCorePackSettings{
OutputDirectory = artifactsDirectory,
Configuration = configuration,
@@ -227,6 +242,11 @@ Task("DeployFrameworkDesktop")
.IsDependentOn("Clean")
.IsDependentOn("DetermineAppveyorDeployProperties")
.IsDependentOn("PackFramework")
+ .IsDependentOn("Publish");
+
+Task("DeployFrameworkTemplates")
+ .IsDependentOn("Clean")
+ .IsDependentOn("DetermineAppveyorDeployProperties")
.IsDependentOn("PackTemplate")
.IsDependentOn("Publish");
diff --git a/osu-framework.Android.slnf b/osu-framework.Android.slnf
index 4e47ddd73..d3287f7d9 100644
--- a/osu-framework.Android.slnf
+++ b/osu-framework.Android.slnf
@@ -7,7 +7,10 @@
"osu.Framework.Android\\osu.Framework.Android.csproj",
"osu.Framework.NativeLibs\\osu.Framework.NativeLibs.csproj",
"osu.Framework.Tests.Android\\osu.Framework.Tests.Android.csproj",
- "osu.Framework\\osu.Framework.csproj"
+ "osu.Framework\\osu.Framework.csproj",
+
+ "osu.Framework.Templates\\templates\\template-empty\\TemplateGame.Game\\TemplateGame.Game.csproj",
+ "osu.Framework.Templates\\templates\\template-flappy\\FlappyDon.Game\\FlappyDon.Game.csproj"
]
}
}
\ No newline at end of file
diff --git a/osu-framework.Desktop.slnf b/osu-framework.Desktop.slnf
index 36bcf0064..db2006841 100644
--- a/osu-framework.Desktop.slnf
+++ b/osu-framework.Desktop.slnf
@@ -7,7 +7,16 @@
"osu.Framework.NativeLibs\\osu.Framework.NativeLibs.csproj",
"osu.Framework.Tests\\osu.Framework.Tests.csproj",
"osu.Framework\\osu.Framework.csproj",
- "osu.Framework.Benchmarks\\osu.Framework.Benchmarks.csproj"
+ "osu.Framework.Benchmarks\\osu.Framework.Benchmarks.csproj",
+
+ "osu.Framework.Templates\\templates\\template-empty\\TemplateGame.Game\\TemplateGame.Game.csproj",
+ "osu.Framework.Templates\\templates\\template-empty\\TemplateGame.Desktop\\TemplateGame.Desktop.csproj",
+ "osu.Framework.Templates\\templates\\template-empty\\TemplateGame.Game.Tests\\TemplateGame.Game.Tests.csproj",
+ "osu.Framework.Templates\\templates\\template-empty\\TemplateGame.Resources\\TemplateGame.Resources.csproj",
+ "osu.Framework.Templates\\templates\\template-flappy\\FlappyDon.Game\\FlappyDon.Game.csproj",
+ "osu.Framework.Templates\\templates\\template-flappy\\FlappyDon.Desktop\\FlappyDon.Desktop.csproj",
+ "osu.Framework.Templates\\templates\\template-flappy\\FlappyDon.Game.Tests\\FlappyDon.Game.Tests.csproj",
+ "osu.Framework.Templates\\templates\\template-flappy\\FlappyDon.Resources\\FlappyDon.Resources.csproj"
]
}
}
\ No newline at end of file
diff --git a/osu-framework.iOS.slnf b/osu-framework.iOS.slnf
index b148cae00..41da6f3d5 100644
--- a/osu-framework.iOS.slnf
+++ b/osu-framework.iOS.slnf
@@ -7,7 +7,12 @@
"osu.Framework.iOS\\osu.Framework.iOS.csproj",
"osu.Framework.NativeLibs\\osu.Framework.NativeLibs.csproj",
"osu.Framework.Tests.iOS\\osu.Framework.Tests.iOS.csproj",
- "osu.Framework\\osu.Framework.csproj"
+ "osu.Framework\\osu.Framework.csproj",
+
+ "osu.Framework.Templates\\templates\\template-empty\\TemplateGame.Game\\TemplateGame.Game.csproj",
+ "osu.Framework.Templates\\templates\\template-empty\\TemplateGame.iOS\\TemplateGame.iOS.csproj",
+ "osu.Framework.Templates\\templates\\template-flappy\\FlappyDon.Game\\FlappyDon.Game.csproj",
+ "osu.Framework.Templates\\templates\\template-flappy\\FlappyDon.iOS\\FlappyDon.iOS.csproj"
]
}
}
\ No newline at end of file
diff --git a/osu-framework.sln b/osu-framework.sln
index f683399b0..03c0abd8b 100644
--- a/osu-framework.sln
+++ b/osu-framework.sln
@@ -227,6 +227,108 @@ Global
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Release|iPhone.ActiveCfg = Release|iPhone
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
+ {48783186-230D-4048-A97A-E4F1DF43BF5C}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
+ {48783186-230D-4048-A97A-E4F1DF43BF5C}.Debug|iPhone.ActiveCfg = Debug|iPhone
+ {48783186-230D-4048-A97A-E4F1DF43BF5C}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
+ {48783186-230D-4048-A97A-E4F1DF43BF5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {48783186-230D-4048-A97A-E4F1DF43BF5C}.Release|iPhone.ActiveCfg = Release|iPhone
+ {48783186-230D-4048-A97A-E4F1DF43BF5C}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Release|iPhone.Build.0 = Release|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {6BEB95A6-0673-4AF5-892E-9146FF8B0948}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Release|iPhone.Build.0 = Release|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Release|iPhone.Build.0 = Release|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {55AB973D-ECA0-422B-B367-24BC47DA081B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Release|iPhone.Build.0 = Release|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {FC0A9040-7BAF-4524-B398-8C7A1C7DDEE9}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Release|iPhone.Build.0 = Release|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {7809CB42-8FED-4BB7-8C68-7638357B94A6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Release|iPhone.Build.0 = Release|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {4C728441-4C3D-4AE4-9C0F-EA91E2C70965}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Release|iPhone.Build.0 = Release|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {0309CF11-621A-4F23-8FBA-A583303A8531}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Release|iPhone.Build.0 = Release|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {9E4B69EE-34E6-47CF-8346-2A66D1714FCD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/osu-framework.sln.DotSettings b/osu-framework.sln.DotSettings
index af8804c37..7071a978c 100644
--- a/osu-framework.sln.DotSettings
+++ b/osu-framework.sln.DotSettings
@@ -8,11 +8,15 @@
ExplicitlyExcluded
SOLUTION
WARNING
+ WARNING
+ WARNING
WARNING
WARNING
HINT
HINT
WARNING
+ WARNING
+ WARNING
WARNING
True
WARNING
@@ -120,6 +124,7 @@
WARNING
WARNING
WARNING
+ HINT
WARNING
WARNING
WARNING
@@ -133,6 +138,8 @@
HINT
HINT
WARNING
+ HINT
+ HINT
WARNING
HINT
WARNING
@@ -143,6 +150,7 @@
DO_NOT_SHOW
DO_NOT_SHOW
DO_NOT_SHOW
+ WARNING
WARNING
WARNING
WARNING
@@ -261,6 +269,7 @@
Explicit
ExpressionBody
BlockBody
+ ExplicitlyTyped
True
NEXT_LINE
True
@@ -792,6 +801,16 @@ See the LICENCE file in the repository root for full licence text.
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
True
True
True
diff --git a/osu.Framework.Android/AndroidGameActivity.cs b/osu.Framework.Android/AndroidGameActivity.cs
index dac8c61bc..35dc044d0 100644
--- a/osu.Framework.Android/AndroidGameActivity.cs
+++ b/osu.Framework.Android/AndroidGameActivity.cs
@@ -10,12 +10,12 @@ using Android.Runtime;
using Android.Views;
using ManagedBass;
using osu.Framework.Bindables;
-using Debug = System.Diagnostics.Debug;
+using osu.Framework.Extensions.ObjectExtensions;
namespace osu.Framework.Android
{
// since `ActivityAttribute` can't be inherited, the below is only provided as an illustrative example of how to setup an activity for best compatibility.
- [Activity(ConfigurationChanges = DEFAULT_CONFIG_CHANGES, LaunchMode = DEFAULT_LAUNCH_MODE, MainLauncher = true)]
+ [Activity(ConfigurationChanges = DEFAULT_CONFIG_CHANGES, Exported = true, LaunchMode = DEFAULT_LAUNCH_MODE, MainLauncher = true)]
public abstract class AndroidGameActivity : Activity
{
protected const ConfigChanges DEFAULT_CONFIG_CHANGES = ConfigChanges.Keyboard
@@ -43,23 +43,18 @@ namespace osu.Framework.Android
public SystemUiFlags UIVisibilityFlags
{
#pragma warning disable 618 // SystemUiVisibility is deprecated
- get
- {
- Debug.Assert(Window != null);
- return (SystemUiFlags)Window.DecorView.SystemUiVisibility;
- }
+ get => (SystemUiFlags)Window.AsNonNull().DecorView.SystemUiVisibility;
set
{
- Debug.Assert(Window != null);
systemUiFlags = value;
- Window.DecorView.SystemUiVisibility = (StatusBarVisibility)value;
+ Window.AsNonNull().DecorView.SystemUiVisibility = (StatusBarVisibility)value;
#pragma warning restore 618
}
}
private SystemUiFlags systemUiFlags;
- private AndroidGameView gameView;
+ private AndroidGameView gameView = null!;
public override void OnTrimMemory([GeneratedEnum] TrimMemory level)
{
@@ -67,7 +62,7 @@ namespace osu.Framework.Android
gameView.Host?.Collect();
}
- protected override void OnCreate(Bundle savedInstanceState)
+ protected override void OnCreate(Bundle? savedInstanceState)
{
// The default current directory on android is '/'.
// On some devices '/' maps to the app data directory. On others it maps to the root of the internal storage.
@@ -80,11 +75,9 @@ namespace osu.Framework.Android
UIVisibilityFlags = SystemUiFlags.LayoutFlags | SystemUiFlags.ImmersiveSticky | SystemUiFlags.HideNavigation | SystemUiFlags.Fullscreen;
- Debug.Assert(Window != null);
-
// Firing up the on-screen keyboard (eg: interacting with textboxes) may cause the UI visibility flags to be altered thus showing the navigation bar and potentially the status bar
// This sets back the UI flags to hidden once the interaction with the on-screen keyboard has finished.
- Window.DecorView.SystemUiVisibilityChange += (_, e) =>
+ Window.AsNonNull().DecorView.SystemUiVisibilityChange += (_, e) =>
{
if ((SystemUiFlags)e.Visibility != systemUiFlags)
{
@@ -94,8 +87,7 @@ namespace osu.Framework.Android
if (OperatingSystem.IsAndroidVersionAtLeast(28))
{
- Debug.Assert(Window.Attributes != null);
- Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
+ Window.AsNonNull().Attributes.AsNonNull().LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
}
gameView.HostStarted += host =>
@@ -105,9 +97,9 @@ namespace osu.Framework.Android
RunOnUiThread(() =>
{
if (!allow.NewValue)
- Window.AddFlags(WindowManagerFlags.KeepScreenOn);
+ Window?.AddFlags(WindowManagerFlags.KeepScreenOn);
else
- Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
+ Window?.ClearFlags(WindowManagerFlags.KeepScreenOn);
});
}, true);
};
@@ -142,17 +134,17 @@ namespace osu.Framework.Android
// On some devices and keyboard combinations the OnKeyDown event does not propagate the key event to the view.
// Here it is done manually to ensure that the keys actually land in the view.
- public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
+ public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent? e)
{
return gameView.OnKeyDown(keyCode, e);
}
- public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent e)
+ public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent? e)
{
return gameView.OnKeyUp(keyCode, e);
}
- public override bool OnKeyLongPress([GeneratedEnum] Keycode keyCode, KeyEvent e)
+ public override bool OnKeyLongPress([GeneratedEnum] Keycode keyCode, KeyEvent? e)
{
return gameView.OnKeyLongPress(keyCode, e);
}
diff --git a/osu.Framework.Android/AndroidGameHost.cs b/osu.Framework.Android/AndroidGameHost.cs
index c4a4013f4..d69ee6277 100644
--- a/osu.Framework.Android/AndroidGameHost.cs
+++ b/osu.Framework.Android/AndroidGameHost.cs
@@ -9,6 +9,7 @@ using osu.Framework.Android.Graphics.Textures;
using osu.Framework.Android.Graphics.Video;
using osu.Framework.Android.Input;
using osu.Framework.Configuration;
+using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Video;
using osu.Framework.Input;
@@ -63,7 +64,7 @@ namespace osu.Framework.Android
public override IEnumerable UserStoragePaths => new[]
{
// not null as internal "external storage" is always available.
- Application.Context.GetExternalFilesDir(string.Empty)!.ToString(),
+ Application.Context.GetExternalFilesDir(string.Empty).AsNonNull().ToString(),
};
public override bool OpenFileExternally(string filename) => false;
diff --git a/osu.Framework.Android/AndroidGameView.cs b/osu.Framework.Android/AndroidGameView.cs
index 5b56a3cff..06b4d804d 100644
--- a/osu.Framework.Android/AndroidGameView.cs
+++ b/osu.Framework.Android/AndroidGameView.cs
@@ -14,19 +14,19 @@ using Android.Views.InputMethods;
using osu.Framework.Android.Input;
using osu.Framework.Logging;
using osu.Framework.Bindables;
+using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Platform;
using osuTK.Graphics;
-using Debug = System.Diagnostics.Debug;
namespace osu.Framework.Android
{
public class AndroidGameView : osuTK.Android.AndroidGameView
{
- public AndroidGameHost Host { get; private set; }
+ public AndroidGameHost? Host { get; private set; }
- public AndroidGameActivity Activity { get; }
+ public AndroidGameActivity Activity { get; } = null!;
public BindableSafeArea SafeAreaPadding { get; } = new BindableSafeArea();
@@ -61,7 +61,14 @@ namespace osu.Framework.Android
}
}
- private readonly Game game;
+ private readonly Game game = null!;
+
+ private InputMethodManager? inputMethodManager;
+
+ ///
+ /// Whether is active.
+ ///
+ private bool textInputActive;
public AndroidGameView(AndroidGameActivity activity, Game game)
: base(activity)
@@ -93,6 +100,11 @@ namespace osu.Framework.Android
// this needs to happen in the constructor
Focusable = true;
FocusableInTouchMode = true;
+
+ // disable ugly green border when view is focused via hardware keyboard/mouse.
+ DefaultFocusHighlightEnabled = false;
+
+ inputMethodManager = Activity.GetSystemService(Context.InputMethodService) as InputMethodManager;
}
protected override void CreateFrameBuffer()
@@ -115,8 +127,10 @@ namespace osu.Framework.Android
return false;
}
- public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent e)
+ public override bool OnKeyDown([GeneratedEnum] Keycode keyCode, KeyEvent? e)
{
+ if (e == null) return base.OnKeyDown(keyCode, e);
+
switch (keyCode)
{
// Do not consume Volume keys, so the system can handle them
@@ -127,18 +141,29 @@ namespace osu.Framework.Android
default:
KeyDown?.Invoke(keyCode, e);
+
+ // Releasing backspace on a physical keyboard when text input is active will not send a key up event.
+ // Manually send one to prevent the key from getting stuck.
+ // This does mean that key repeat is handled by the OS, instead of by the usual `InputManager` handling.
+ if (keyCode == Keycode.Del && e.IsFromSource(InputSourceType.Keyboard) && textInputActive)
+ KeyUp?.Invoke(Keycode.Del, new KeyEvent(e.DownTime, e.EventTime, KeyEventActions.Up, Keycode.Del, 0, e.MetaState, e.DeviceId, e.ScanCode, e.Flags, e.Source));
+
return true;
}
}
- public override bool OnKeyLongPress([GeneratedEnum] Keycode keyCode, KeyEvent e)
+ public override bool OnKeyLongPress([GeneratedEnum] Keycode keyCode, KeyEvent? e)
{
+ if (e == null) return base.OnKeyLongPress(keyCode, e);
+
KeyLongPress?.Invoke(keyCode, e);
return true;
}
- public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent e)
+ public override bool OnKeyUp([GeneratedEnum] Keycode keyCode, KeyEvent? e)
{
+ if (e == null) return base.OnKeyUp(keyCode, e);
+
KeyUp?.Invoke(keyCode, e);
return true;
}
@@ -187,13 +212,11 @@ namespace osu.Framework.Android
///
private void updateSafeArea()
{
- Debug.Assert(Display != null);
-
// compute the usable screen area.
var screenSize = new Point();
#pragma warning disable 618 // GetRealSize is deprecated
- Display.GetRealSize(screenSize);
+ Display.AsNonNull().GetRealSize(screenSize);
#pragma warning restore 618
var screenArea = new RectangleI(0, 0, screenSize.X, screenSize.Y);
var usableScreenArea = screenArea;
@@ -239,41 +262,91 @@ namespace osu.Framework.Android
};
}
- public override bool OnCheckIsTextEditor() => true;
+ public override bool OnCheckIsTextEditor() => textInputActive;
- public override IInputConnection OnCreateInputConnection(EditorInfo outAttrs)
+ /// null to disable input methods
+ public override IInputConnection? OnCreateInputConnection(EditorInfo? outAttrs)
{
+ if (outAttrs == null) throw new ArgumentNullException(nameof(outAttrs));
+
+ // Properly disable native input methods so that the software keyboard doesn't unexpectedly open.
+ // Eg. when pressing keys on a hardware keyboard.
+ if (!textInputActive)
+ return null;
+
outAttrs.ImeOptions = ImeFlags.NoExtractUi | ImeFlags.NoFullscreen;
outAttrs.InputType = InputTypes.TextVariationVisiblePassword | InputTypes.TextFlagNoSuggestions;
return new AndroidInputConnection(this, true);
}
+ internal void StartTextInput()
+ {
+ textInputActive = true;
+ Activity.RunOnUiThread(() =>
+ {
+ inputMethodManager?.RestartInput(this); // this syncs the Android input method state with `OnCreateInputConnection()`.
+ RequestFocus();
+ inputMethodManager?.ShowSoftInput(this, 0);
+ });
+ }
+
+ internal void StopTextInput()
+ {
+ textInputActive = false;
+ Activity.RunOnUiThread(() =>
+ {
+ inputMethodManager?.RestartInput(this);
+ inputMethodManager?.HideSoftInputFromWindow(WindowToken, HideSoftInputFlags.None);
+ ClearFocus();
+ });
+ }
+
+ public override void SwapBuffers()
+ {
+ try
+ {
+ base.SwapBuffers();
+ }
+ catch (GraphicsContextException ex)
+ {
+ // sometimes buffers will spontaneously fail to swap with BAD_SURFACE
+ // just before the activity is suspended to background or just after it has been resumed,
+ // but will continue operating correctly after that transitionary period.
+ // despite some testing it is unclear which view callback can be used to tell whether it is safe to swap buffers,
+ // so for now just catch and suppress these errors.
+ if (ex.Message.Contains("BAD_SURFACE", StringComparison.Ordinal))
+ Logger.Log($"BAD_SURFACE failure in {nameof(SwapBuffers)} suppressed");
+ else
+ throw;
+ }
+ }
+
#region Events
///
/// Invoked on a key down event.
///
- public new event Action KeyDown;
+ public new event Action? KeyDown;
///
/// Invoked on a key up event.
///
- public new event Action KeyUp;
+ public new event Action? KeyUp;
///
/// Invoked on a key long press event.
///
- public event Action KeyLongPress;
+ public event Action? KeyLongPress;
///
/// Invoked when text is committed by an .
///
- public event Action CommitText;
+ public event Action? CommitText;
///
/// Invoked when the has been started on the .
///
- public event Action HostStarted;
+ public event Action? HostStarted;
#endregion
}
diff --git a/osu.Framework.Android/AndroidGameWindow.cs b/osu.Framework.Android/AndroidGameWindow.cs
index f0d71f4b8..8a8038704 100644
--- a/osu.Framework.Android/AndroidGameWindow.cs
+++ b/osu.Framework.Android/AndroidGameWindow.cs
@@ -27,7 +27,7 @@ namespace osu.Framework.Android
set { }
}
- public event Action CursorStateChanged;
+ public event Action? CursorStateChanged;
public override CursorState CursorState
{
diff --git a/osu.Framework.Android/Graphics/Video/AndroidVideoDecoder.cs b/osu.Framework.Android/Graphics/Video/AndroidVideoDecoder.cs
index 241c39c20..edc81ddc3 100644
--- a/osu.Framework.Android/Graphics/Video/AndroidVideoDecoder.cs
+++ b/osu.Framework.Android/Graphics/Video/AndroidVideoDecoder.cs
@@ -8,6 +8,7 @@ using System.Runtime.InteropServices;
using FFmpeg.AutoGen;
using Java.Interop;
using osu.Framework.Extensions.EnumExtensions;
+using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics.Video;
using osu.Framework.Logging;
@@ -142,7 +143,7 @@ namespace osu.Framework.Android.Graphics.Video
: base(videoStream)
{
// Hardware decoding with MediaCodec requires that we pass a Java VM pointer
- // to FFmpeg so that it can call the MediaCodec APIs through JNI (as they're Java only)
+ // to FFmpeg so that it can call the MediaCodec APIs through JNI (as they're Java only).
int result = av_jni_set_java_vm(JniEnvironment.Runtime.InvocationPointer.ToPointer(), null);
if (result < 0)
diff --git a/osu.Framework.Android/Input/AndroidInputConnection.cs b/osu.Framework.Android/Input/AndroidInputConnection.cs
index a0b47e093..1bcdee1fb 100644
--- a/osu.Framework.Android/Input/AndroidInputConnection.cs
+++ b/osu.Framework.Android/Input/AndroidInputConnection.cs
@@ -9,40 +9,43 @@ namespace osu.Framework.Android.Input
{
internal class AndroidInputConnection : BaseInputConnection
{
- public AndroidGameView TargetView { get; set; }
+ private readonly AndroidGameView targetView;
public AndroidInputConnection(AndroidGameView targetView, bool fullEditor)
: base(targetView, fullEditor)
{
- TargetView = targetView;
+ this.targetView = targetView;
}
- public override bool CommitText(ICharSequence text, int newCursorPosition)
+ public override bool CommitText(ICharSequence? text, int newCursorPosition)
{
- if (text.Length() != 0)
+ if (text?.Length() > 0)
{
- TargetView.OnCommitText(text.ToString());
+ targetView.OnCommitText(text.ToString());
return true;
}
return base.CommitText(text, newCursorPosition);
}
- public override bool SendKeyEvent(KeyEvent e)
+ public override bool SendKeyEvent(KeyEvent? e)
{
+ if (e == null)
+ return base.SendKeyEvent(e);
+
switch (e.Action)
{
case KeyEventActions.Down:
- TargetView?.OnKeyDown(e.KeyCode, e);
+ targetView.OnKeyDown(e.KeyCode, e);
return true;
case KeyEventActions.Up:
- TargetView?.OnKeyUp(e.KeyCode, e);
+ targetView.OnKeyUp(e.KeyCode, e);
return true;
case KeyEventActions.Multiple:
- TargetView?.OnKeyDown(e.KeyCode, e);
- TargetView?.OnKeyUp(e.KeyCode, e);
+ targetView.OnKeyDown(e.KeyCode, e);
+ targetView.OnKeyUp(e.KeyCode, e);
return true;
}
diff --git a/osu.Framework.Android/Input/AndroidInputExtensions.cs b/osu.Framework.Android/Input/AndroidInputExtensions.cs
index 19c6a31f6..dd3860029 100644
--- a/osu.Framework.Android/Input/AndroidInputExtensions.cs
+++ b/osu.Framework.Android/Input/AndroidInputExtensions.cs
@@ -2,7 +2,9 @@
// See the LICENCE file in the repository root for full licence text.
using System;
+using System.Collections.Generic;
using Android.Views;
+using osu.Framework.Extensions.EnumExtensions;
using osuTK.Input;
namespace osu.Framework.Android.Input
@@ -10,33 +12,27 @@ namespace osu.Framework.Android.Input
public static class AndroidInputExtensions
{
///
- /// Returns the corresponding for a mouse button given as a .
+ /// Returns the corresponding s for a mouse button given as a .
///
- /// The given button. Must not be a raw state or a non-mouse button.
- /// The corresponding .
+ /// The given button state. Must not be a raw state or a non-mouse button.
+ /// The corresponding s.
/// Thrown if the provided button is not a
- public static MouseButton ToMouseButton(this MotionEventButtonState motionEventMouseButton)
+ public static IEnumerable ToMouseButtons(this MotionEventButtonState motionEventMouseButton)
{
- switch (motionEventMouseButton)
- {
- case MotionEventButtonState.Primary:
- return MouseButton.Left;
+ if (motionEventMouseButton.HasFlagFast(MotionEventButtonState.Primary))
+ yield return MouseButton.Left;
- case MotionEventButtonState.Secondary:
- return MouseButton.Right;
+ if (motionEventMouseButton.HasFlagFast(MotionEventButtonState.Secondary))
+ yield return MouseButton.Right;
- case MotionEventButtonState.Tertiary:
- return MouseButton.Middle;
+ if (motionEventMouseButton.HasFlagFast(MotionEventButtonState.Tertiary))
+ yield return MouseButton.Middle;
- case MotionEventButtonState.Back:
- return MouseButton.Button1;
+ if (motionEventMouseButton.HasFlagFast(MotionEventButtonState.Back))
+ yield return MouseButton.Button1;
- case MotionEventButtonState.Forward:
- return MouseButton.Button2;
-
- default:
- throw new ArgumentOutOfRangeException(nameof(motionEventMouseButton), motionEventMouseButton, "Given button is not a mouse button.");
- }
+ if (motionEventMouseButton.HasFlagFast(MotionEventButtonState.Forward))
+ yield return MouseButton.Button2;
}
///
diff --git a/osu.Framework.Android/Input/AndroidInputHandler.cs b/osu.Framework.Android/Input/AndroidInputHandler.cs
index b3b92ae34..643740383 100644
--- a/osu.Framework.Android/Input/AndroidInputHandler.cs
+++ b/osu.Framework.Android/Input/AndroidInputHandler.cs
@@ -9,8 +9,6 @@ using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Input.Handlers;
using osu.Framework.Platform;
-#nullable enable
-
namespace osu.Framework.Android.Input
{
///
diff --git a/osu.Framework.Android/Input/AndroidKeyboardHandler.cs b/osu.Framework.Android/Input/AndroidKeyboardHandler.cs
index 8adbfa7d0..9b7e8b792 100644
--- a/osu.Framework.Android/Input/AndroidKeyboardHandler.cs
+++ b/osu.Framework.Android/Input/AndroidKeyboardHandler.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using Android.Views;
diff --git a/osu.Framework.Android/Input/AndroidMouseHandler.cs b/osu.Framework.Android/Input/AndroidMouseHandler.cs
index 79a7855b5..64a66733b 100644
--- a/osu.Framework.Android/Input/AndroidMouseHandler.cs
+++ b/osu.Framework.Android/Input/AndroidMouseHandler.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using Android.OS;
@@ -180,11 +182,13 @@ namespace osu.Framework.Android.Input
switch (genericMotionEvent.Action)
{
case MotionEventActions.ButtonPress:
- handleMouseDown(genericMotionEvent.ActionButton.ToMouseButton());
+ foreach (var button in genericMotionEvent.ActionButton.ToMouseButtons())
+ handleMouseDown(button);
break;
case MotionEventActions.ButtonRelease:
- handleMouseUp(genericMotionEvent.ActionButton.ToMouseButton());
+ foreach (var button in genericMotionEvent.ActionButton.ToMouseButtons())
+ handleMouseUp(button);
break;
case MotionEventActions.Scroll:
@@ -212,17 +216,21 @@ namespace osu.Framework.Android.Input
break;
case MotionEventActions.ButtonPress:
- handleMouseDown(capturedPointerEvent.ActionButton.ToMouseButton());
+ foreach (var button in capturedPointerEvent.ActionButton.ToMouseButtons())
+ handleMouseDown(button);
break;
case MotionEventActions.ButtonRelease:
- handleMouseUp(capturedPointerEvent.ActionButton.ToMouseButton());
+ foreach (var button in capturedPointerEvent.ActionButton.ToMouseButtons())
+ handleMouseUp(button);
break;
}
}
}
- private Vector2 getEventScroll(MotionEvent e) => new Vector2(e.GetAxisValue(Axis.Hscroll), e.GetAxisValue(Axis.Vscroll));
+ private Vector2 getEventScroll(MotionEvent e) =>
+ // Android reports horizontal scroll opposite of what framework expects.
+ new Vector2(-e.GetAxisValue(Axis.Hscroll), e.GetAxisValue(Axis.Vscroll));
private void handleMouseMoveEvent(MotionEvent evt)
{
diff --git a/osu.Framework.Android/Input/AndroidTextInput.cs b/osu.Framework.Android/Input/AndroidTextInput.cs
index 524bdb40f..eab5a518d 100644
--- a/osu.Framework.Android/Input/AndroidTextInput.cs
+++ b/osu.Framework.Android/Input/AndroidTextInput.cs
@@ -1,22 +1,18 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-using Android.Content;
using Android.Views;
-using Android.Views.InputMethods;
using osu.Framework.Input;
namespace osu.Framework.Android.Input
{
- public class AndroidTextInput : TextInputSource
+ internal class AndroidTextInput : TextInputSource
{
private readonly AndroidGameView view;
- private readonly InputMethodManager inputMethodManager;
public AndroidTextInput(AndroidGameView view)
{
this.view = view;
- inputMethodManager = view.Activity.GetSystemService(Context.InputMethodService) as InputMethodManager;
}
private void commitText(string text)
@@ -34,33 +30,19 @@ namespace osu.Framework.Android.Input
{
view.KeyDown += keyDown;
view.CommitText += commitText;
-
- view.Activity.RunOnUiThread(() =>
- {
- view.RequestFocus();
- inputMethodManager?.ShowSoftInput(view, 0);
- });
+ view.StartTextInput();
}
protected override void EnsureTextInputActivated(bool allowIme)
{
- view.Activity.RunOnUiThread(() =>
- {
- view.RequestFocus();
- inputMethodManager?.ShowSoftInput(view, 0);
- });
+ view.StartTextInput();
}
protected override void DeactivateTextInput()
{
view.KeyDown -= keyDown;
view.CommitText -= commitText;
-
- view.Activity.RunOnUiThread(() =>
- {
- inputMethodManager?.HideSoftInputFromWindow(view.WindowToken, HideSoftInputFlags.None);
- view.ClearFocus();
- });
+ view.StopTextInput();
}
}
}
diff --git a/osu.Framework.Android/Input/AndroidTouchHandler.cs b/osu.Framework.Android/Input/AndroidTouchHandler.cs
index 8f838076a..14b6ef38c 100644
--- a/osu.Framework.Android/Input/AndroidTouchHandler.cs
+++ b/osu.Framework.Android/Input/AndroidTouchHandler.cs
@@ -1,12 +1,15 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using Android.Views;
using osu.Framework.Input;
using osu.Framework.Input.StateChanges;
using osu.Framework.Input.States;
+using osu.Framework.Logging;
using osu.Framework.Platform;
using osuTK;
using osuTK.Input;
@@ -48,41 +51,83 @@ namespace osu.Framework.Android.Input
protected override void OnTouch(MotionEvent touchEvent)
{
- if (touchEvent.Action == MotionEventActions.Move)
- {
- for (int i = 0; i < Math.Min(touchEvent.PointerCount, TouchState.MAX_TOUCH_COUNT); i++)
- {
- var touch = getEventTouch(touchEvent, i);
- PendingInputs.Enqueue(new TouchInput(touch, true));
- }
- }
- else if (touchEvent.ActionIndex < TouchState.MAX_TOUCH_COUNT)
- {
- var touch = getEventTouch(touchEvent, touchEvent.ActionIndex);
+ Touch touch;
- switch (touchEvent.ActionMasked)
- {
- case MotionEventActions.Down:
- case MotionEventActions.PointerDown:
+ switch (touchEvent.ActionMasked)
+ {
+ // MotionEventActions.Down arrives at the beginning of a touch event chain and implies the 0th pointer is pressed.
+ // ActionIndex is generally not valid here.
+ case MotionEventActions.Down:
+ if (tryGetEventTouch(touchEvent, 0, out touch))
PendingInputs.Enqueue(new TouchInput(touch, true));
- break;
+ break;
- case MotionEventActions.Up:
- case MotionEventActions.PointerUp:
- case MotionEventActions.Cancel:
- PendingInputs.Enqueue(new TouchInput(touch, false));
- break;
- }
+ // events that apply only to the ActionIndex pointer (other pointers' states remain unchanged)
+ case MotionEventActions.PointerDown:
+ case MotionEventActions.PointerUp:
+ if (touchEvent.ActionIndex < TouchState.MAX_TOUCH_COUNT)
+ {
+ if (tryGetEventTouch(touchEvent, touchEvent.ActionIndex, out touch))
+ PendingInputs.Enqueue(new TouchInput(touch, touchEvent.ActionMasked == MotionEventActions.PointerDown));
+ }
+
+ break;
+
+ // events that apply to every pointer (up to PointerCount).
+ case MotionEventActions.Move:
+ case MotionEventActions.Up:
+ case MotionEventActions.Cancel:
+ for (int i = 0; i < Math.Min(touchEvent.PointerCount, TouchState.MAX_TOUCH_COUNT); i++)
+ {
+ if (tryGetEventTouch(touchEvent, i, out touch))
+ PendingInputs.Enqueue(new TouchInput(touch, touchEvent.ActionMasked == MotionEventActions.Move));
+ }
+
+ break;
+
+ default:
+ Logger.Log($"Unknown touch event action: {touchEvent.Action}, masked: {touchEvent.ActionMasked}");
+ break;
}
}
protected override void OnHover(MotionEvent hoverEvent)
{
- PendingInputs.Enqueue(new MousePositionAbsoluteInput { Position = getEventPosition(hoverEvent) });
+ if (tryGetEventPosition(hoverEvent, 0, out var position))
+ PendingInputs.Enqueue(new MousePositionAbsoluteInput { Position = position });
PendingInputs.Enqueue(new MouseButtonInput(MouseButton.Right, hoverEvent.IsButtonPressed(MotionEventButtonState.StylusPrimary)));
}
- private Touch getEventTouch(MotionEvent e, int index) => new Touch((TouchSource)e.GetPointerId(index), getEventPosition(e, index));
- private Vector2 getEventPosition(MotionEvent e, int index = 0) => new Vector2(e.GetX(index) * View.ScaleX, e.GetY(index) * View.ScaleY);
+ private bool tryGetEventTouch(MotionEvent e, int index, out Touch touch)
+ {
+ if (tryGetEventPosition(e, index, out var position))
+ {
+ touch = new Touch((TouchSource)e.GetPointerId(index), position);
+ return true;
+ }
+ else
+ {
+ touch = new Touch();
+ return false;
+ }
+ }
+
+ private bool tryGetEventPosition(MotionEvent e, int index, out Vector2 position)
+ {
+ float x = e.GetX(index);
+ float y = e.GetY(index);
+
+ // in empirical testing, `MotionEvent.Get{X,Y}()` methods can return NaN positions early on in the android activity's lifetime.
+ // these nonsensical inputs then cause issues later down the line when they are converted into framework inputs.
+ // as there is really nothing to recover from such inputs, drop them entirely.
+ if (float.IsNaN(x) || float.IsNaN(y))
+ {
+ position = Vector2.Zero;
+ return false;
+ }
+
+ position = new Vector2(x * View.ScaleX, y * View.ScaleY);
+ return true;
+ }
}
}
diff --git a/osu.Framework.Benchmarks/BenchmarkBeginAbsoluteSequence.cs b/osu.Framework.Benchmarks/BenchmarkBeginAbsoluteSequence.cs
index 22e95c425..dfdfc8158 100644
--- a/osu.Framework.Benchmarks/BenchmarkBeginAbsoluteSequence.cs
+++ b/osu.Framework.Benchmarks/BenchmarkBeginAbsoluteSequence.cs
@@ -14,7 +14,7 @@ namespace osu.Framework.Benchmarks
[MemoryDiagnoser]
public class BenchmarkBeginAbsoluteSequence : GameBenchmark
{
- private TestGame game;
+ private TestGame game = null!;
[Test]
[Benchmark]
@@ -104,9 +104,9 @@ namespace osu.Framework.Benchmarks
private class TestGame : Game
{
- public Container Flat;
- public Container VeryNested;
- public Container SlightlyNested;
+ public Container Flat = null!;
+ public Container VeryNested = null!;
+ public Container SlightlyNested = null!;
protected override void LoadComplete()
{
diff --git a/osu.Framework.Benchmarks/BenchmarkBindableInstantiation.cs b/osu.Framework.Benchmarks/BenchmarkBindableInstantiation.cs
index 6aa680782..be5c1cd98 100644
--- a/osu.Framework.Benchmarks/BenchmarkBindableInstantiation.cs
+++ b/osu.Framework.Benchmarks/BenchmarkBindableInstantiation.cs
@@ -4,6 +4,7 @@
using System;
using BenchmarkDotNet.Attributes;
using osu.Framework.Bindables;
+using osu.Framework.Extensions.ObjectExtensions;
namespace osu.Framework.Benchmarks
{
@@ -19,14 +20,14 @@ namespace osu.Framework.Benchmarks
[Benchmark(Baseline = true)]
public Bindable GetBoundCopyOld() => new BindableOld().GetBoundCopy();
- private class BindableOld : Bindable
+ private class BindableOld : Bindable where T : notnull
{
- public BindableOld(T defaultValue = default)
+ public BindableOld(T defaultValue = default!)
: base(defaultValue)
{
}
- protected override Bindable CreateInstance() => (BindableOld)Activator.CreateInstance(GetType(), Value);
+ protected override Bindable CreateInstance() => (BindableOld)Activator.CreateInstance(GetType(), Value).AsNonNull();
}
}
}
diff --git a/osu.Framework.Benchmarks/BenchmarkCompositeDrawableAllocations.cs b/osu.Framework.Benchmarks/BenchmarkCompositeDrawableAllocations.cs
index b3173ddde..0513c0206 100644
--- a/osu.Framework.Benchmarks/BenchmarkCompositeDrawableAllocations.cs
+++ b/osu.Framework.Benchmarks/BenchmarkCompositeDrawableAllocations.cs
@@ -11,7 +11,7 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkCompositeDrawableAllocations : GameBenchmark
{
- private TestGame game;
+ private TestGame game = null!;
[Test]
[Benchmark]
@@ -63,7 +63,7 @@ namespace osu.Framework.Benchmarks
{
base.Update();
- Drawable drawable = null;
+ Drawable? drawable = null;
switch (Mode)
{
diff --git a/osu.Framework.Benchmarks/BenchmarkDependencyContainer.cs b/osu.Framework.Benchmarks/BenchmarkDependencyContainer.cs
index fe3f5b05a..5cab656f7 100644
--- a/osu.Framework.Benchmarks/BenchmarkDependencyContainer.cs
+++ b/osu.Framework.Benchmarks/BenchmarkDependencyContainer.cs
@@ -18,9 +18,9 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkDependencyContainer : GameBenchmark
{
- private Game game;
- private TestBdlReceiver bdlReceiver;
- private TestCachedReceiver cachedReceiver;
+ private Game game = null!;
+ private TestBdlReceiver bdlReceiver = null!;
+ private TestCachedReceiver cachedReceiver = null!;
public override void SetUp()
{
@@ -63,13 +63,13 @@ namespace osu.Framework.Benchmarks
private class TestCachedReceiver : Drawable
{
[Resolved]
- private GameHost host { get; set; }
+ private GameHost host { get; set; } = null!;
[Resolved]
- private FrameworkConfigManager frameworkConfigManager { get; set; }
+ private FrameworkConfigManager frameworkConfigManager { get; set; } = null!;
[Resolved]
- private FrameworkDebugConfigManager frameworkDebugConfigManager { get; set; }
+ private FrameworkDebugConfigManager frameworkDebugConfigManager { get; set; } = null!;
}
private class TestGame : Game
diff --git a/osu.Framework.Benchmarks/BenchmarkDrawableAudioWrapper.cs b/osu.Framework.Benchmarks/BenchmarkDrawableAudioWrapper.cs
index c44c8b68c..bd7154974 100644
--- a/osu.Framework.Benchmarks/BenchmarkDrawableAudioWrapper.cs
+++ b/osu.Framework.Benchmarks/BenchmarkDrawableAudioWrapper.cs
@@ -37,7 +37,7 @@ namespace osu.Framework.Benchmarks
public bool TransferBetween { get; set; }
- private AudioContainer lastContainer;
+ private AudioContainer? lastContainer;
protected override void LoadComplete()
{
diff --git a/osu.Framework.Benchmarks/BenchmarkDrawableLoad.cs b/osu.Framework.Benchmarks/BenchmarkDrawableLoad.cs
index 7155e12f8..441dbebd8 100644
--- a/osu.Framework.Benchmarks/BenchmarkDrawableLoad.cs
+++ b/osu.Framework.Benchmarks/BenchmarkDrawableLoad.cs
@@ -14,7 +14,7 @@ namespace osu.Framework.Benchmarks
[MemoryDiagnoser]
public class BenchmarkDrawableLoad : GameBenchmark
{
- private TestGame game;
+ private TestGame game = null!;
private const int nesting_level = 100;
diff --git a/osu.Framework.Benchmarks/BenchmarkFillFlowContainerAllocations.cs b/osu.Framework.Benchmarks/BenchmarkFillFlowContainerAllocations.cs
index 363739d03..28ce812b6 100644
--- a/osu.Framework.Benchmarks/BenchmarkFillFlowContainerAllocations.cs
+++ b/osu.Framework.Benchmarks/BenchmarkFillFlowContainerAllocations.cs
@@ -12,7 +12,7 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkFillFlowContainerAllocations : GameBenchmark
{
- private TestGame game;
+ private TestGame game = null!;
[Benchmark]
public void MultipleComputeLayoutPositions()
diff --git a/osu.Framework.Benchmarks/BenchmarkFontLoading.cs b/osu.Framework.Benchmarks/BenchmarkFontLoading.cs
index 282341b28..a98a26fbb 100644
--- a/osu.Framework.Benchmarks/BenchmarkFontLoading.cs
+++ b/osu.Framework.Benchmarks/BenchmarkFontLoading.cs
@@ -16,8 +16,8 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkFontLoading : BenchmarkTest
{
- private NamespacedResourceStore baseResources;
- private TemporaryNativeStorage sharedTemp;
+ private NamespacedResourceStore baseResources = null!;
+ private TemporaryNativeStorage sharedTemp = null!;
public override void SetUp()
{
@@ -30,7 +30,7 @@ namespace osu.Framework.Benchmarks
[OneTimeTearDown]
public void TearDown()
{
- sharedTemp?.Dispose();
+ sharedTemp.Dispose();
}
[Params(1, 10, 100, 1000, 10000)]
@@ -91,7 +91,7 @@ namespace osu.Framework.Benchmarks
{
foreach (var p in props)
{
- object propValue = p.GetValue(null);
+ object? propValue = p.GetValue(null);
Debug.Assert(propValue != null);
var icon = (IconUsage)propValue;
diff --git a/osu.Framework.Benchmarks/BenchmarkHashing.cs b/osu.Framework.Benchmarks/BenchmarkHashing.cs
index c09a41f12..5bff2e9be 100644
--- a/osu.Framework.Benchmarks/BenchmarkHashing.cs
+++ b/osu.Framework.Benchmarks/BenchmarkHashing.cs
@@ -12,7 +12,7 @@ namespace osu.Framework.Benchmarks
public class BenchmarkHashing
{
private const string test_string = @"A string with reasonable length";
- private MemoryStream memoryStream;
+ private MemoryStream memoryStream = null!;
[Benchmark]
public string StringMD5() => test_string.ComputeMD5Hash();
diff --git a/osu.Framework.Benchmarks/BenchmarkLocalisableDescription.cs b/osu.Framework.Benchmarks/BenchmarkLocalisableDescription.cs
index fbd008a09..db694e29c 100644
--- a/osu.Framework.Benchmarks/BenchmarkLocalisableDescription.cs
+++ b/osu.Framework.Benchmarks/BenchmarkLocalisableDescription.cs
@@ -9,7 +9,7 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkLocalisableDescription
{
- private LocalisableString[] descriptions;
+ private LocalisableString[] descriptions = null!;
[Params(1, 10, 100, 1000)]
public int Times { get; set; }
diff --git a/osu.Framework.Benchmarks/BenchmarkLocalisableString.cs b/osu.Framework.Benchmarks/BenchmarkLocalisableString.cs
index 97f4d9ee2..d04220cc8 100644
--- a/osu.Framework.Benchmarks/BenchmarkLocalisableString.cs
+++ b/osu.Framework.Benchmarks/BenchmarkLocalisableString.cs
@@ -10,8 +10,8 @@ namespace osu.Framework.Benchmarks
[MemoryDiagnoser]
public class BenchmarkLocalisableString
{
- private string string1;
- private string string2;
+ private string string1 = null!;
+ private string string2 = null!;
private LocalisableString localisableString1;
private LocalisableString localisableString2;
private LocalisableString romanisableString1;
diff --git a/osu.Framework.Benchmarks/BenchmarkLocalisedBindableString.cs b/osu.Framework.Benchmarks/BenchmarkLocalisedBindableString.cs
index 456bd2834..5d5813704 100644
--- a/osu.Framework.Benchmarks/BenchmarkLocalisedBindableString.cs
+++ b/osu.Framework.Benchmarks/BenchmarkLocalisedBindableString.cs
@@ -12,13 +12,13 @@ namespace osu.Framework.Benchmarks
[MemoryDiagnoser]
public class BenchmarkLocalisedBindableString
{
- private LocalisationManager manager;
- private TemporaryNativeStorage storage;
+ private LocalisationManager manager = null!;
+ private TemporaryNativeStorage storage = null!;
[GlobalSetup]
public void GlobalSetup()
{
- storage = new TemporaryNativeStorage(new Guid().ToString());
+ storage = new TemporaryNativeStorage(Guid.NewGuid().ToString());
manager = new LocalisationManager(new FrameworkConfigManager(storage));
}
diff --git a/osu.Framework.Benchmarks/BenchmarkManySpinningBoxes.cs b/osu.Framework.Benchmarks/BenchmarkManySpinningBoxes.cs
index 0635ccf77..12e6be556 100644
--- a/osu.Framework.Benchmarks/BenchmarkManySpinningBoxes.cs
+++ b/osu.Framework.Benchmarks/BenchmarkManySpinningBoxes.cs
@@ -13,7 +13,7 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkManySpinningBoxes : GameBenchmark
{
- private TestGame game;
+ private TestGame game = null!;
[Test]
[Benchmark]
@@ -47,7 +47,7 @@ namespace osu.Framework.Benchmarks
private class TestGame : Game
{
- public Container MainContent;
+ public Container MainContent = null!;
protected override void LoadComplete()
{
diff --git a/osu.Framework.Benchmarks/BenchmarkScheduler.cs b/osu.Framework.Benchmarks/BenchmarkScheduler.cs
new file mode 100644
index 000000000..4ac44dc3c
--- /dev/null
+++ b/osu.Framework.Benchmarks/BenchmarkScheduler.cs
@@ -0,0 +1,60 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using BenchmarkDotNet.Attributes;
+using osu.Framework.Threading;
+
+namespace osu.Framework.Benchmarks
+{
+ public class BenchmarkScheduler : BenchmarkTest
+ {
+ private Scheduler scheduler = null!;
+ private Scheduler schedulerWithEveryUpdate = null!;
+ private Scheduler schedulerWithManyDelayed = null!;
+
+ public override void SetUp()
+ {
+ base.SetUp();
+
+ scheduler = new Scheduler();
+
+ schedulerWithEveryUpdate = new Scheduler();
+ schedulerWithEveryUpdate.AddDelayed(() => { }, 0, true);
+
+ schedulerWithManyDelayed = new Scheduler();
+ for (int i = 0; i < 1000; i++)
+ schedulerWithManyDelayed.AddDelayed(() => { }, int.MaxValue);
+ }
+
+ [Benchmark]
+ public void UpdateEmptyScheduler()
+ {
+ for (int i = 0; i < 1000; i++)
+ scheduler.Update();
+ }
+
+ [Benchmark]
+ public void UpdateSchedulerWithManyDelayed()
+ {
+ for (int i = 0; i < 1000; i++)
+ schedulerWithManyDelayed.Update();
+ }
+
+ [Benchmark]
+ public void UpdateSchedulerWithEveryUpdate()
+ {
+ for (int i = 0; i < 1000; i++)
+ schedulerWithEveryUpdate.Update();
+ }
+
+ [Benchmark]
+ public void UpdateSchedulerWithManyAdded()
+ {
+ for (int i = 0; i < 1000; i++)
+ {
+ scheduler.Add(() => { });
+ scheduler.Update();
+ }
+ }
+ }
+}
diff --git a/osu.Framework.Benchmarks/BenchmarkScreenExtensions.cs b/osu.Framework.Benchmarks/BenchmarkScreenExtensions.cs
index 0ade9fe42..f9553e7d6 100644
--- a/osu.Framework.Benchmarks/BenchmarkScreenExtensions.cs
+++ b/osu.Framework.Benchmarks/BenchmarkScreenExtensions.cs
@@ -9,7 +9,7 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkScreenExtensions : GameBenchmark
{
- private Screen testScreen;
+ private Screen testScreen = null!;
[Test]
[Benchmark]
diff --git a/osu.Framework.Benchmarks/BenchmarkStreamExtensions.cs b/osu.Framework.Benchmarks/BenchmarkStreamExtensions.cs
index 4a9fa7c4b..575109e5b 100644
--- a/osu.Framework.Benchmarks/BenchmarkStreamExtensions.cs
+++ b/osu.Framework.Benchmarks/BenchmarkStreamExtensions.cs
@@ -11,7 +11,7 @@ namespace osu.Framework.Benchmarks
[MemoryDiagnoser]
public class BenchmarkStreamExtensions
{
- private MemoryStream memoryStream;
+ private MemoryStream memoryStream = null!;
[Params(100, 10000, 1000000)]
public int Length { get; set; }
diff --git a/osu.Framework.Benchmarks/BenchmarkTabletDriver.cs b/osu.Framework.Benchmarks/BenchmarkTabletDriver.cs
index ba866956c..68218d22f 100644
--- a/osu.Framework.Benchmarks/BenchmarkTabletDriver.cs
+++ b/osu.Framework.Benchmarks/BenchmarkTabletDriver.cs
@@ -9,7 +9,7 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkTabletDriver : BenchmarkTest
{
- private TabletDriver driver;
+ private TabletDriver driver = null!;
public override void SetUp()
{
diff --git a/osu.Framework.Benchmarks/BenchmarkTextBuilder.cs b/osu.Framework.Benchmarks/BenchmarkTextBuilder.cs
index 61df335fa..4a40634bd 100644
--- a/osu.Framework.Benchmarks/BenchmarkTextBuilder.cs
+++ b/osu.Framework.Benchmarks/BenchmarkTextBuilder.cs
@@ -13,7 +13,7 @@ namespace osu.Framework.Benchmarks
{
private readonly ITexturedGlyphLookupStore store = new TestStore();
- private TextBuilder textBuilder;
+ private TextBuilder textBuilder = null!;
[Benchmark]
public void AddCharacters() => initialiseBuilder(false);
diff --git a/osu.Framework.Benchmarks/BenchmarkTransform.cs b/osu.Framework.Benchmarks/BenchmarkTransform.cs
index 4384db6bf..e6a62ae8d 100644
--- a/osu.Framework.Benchmarks/BenchmarkTransform.cs
+++ b/osu.Framework.Benchmarks/BenchmarkTransform.cs
@@ -13,7 +13,7 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkTransform : BenchmarkTest
{
- private Drawable target;
+ private Drawable target = null!;
public override void SetUp()
{
diff --git a/osu.Framework.Benchmarks/BenchmarkTransformUpdate.cs b/osu.Framework.Benchmarks/BenchmarkTransformUpdate.cs
index e13dd27bd..90e0d34bd 100644
--- a/osu.Framework.Benchmarks/BenchmarkTransformUpdate.cs
+++ b/osu.Framework.Benchmarks/BenchmarkTransformUpdate.cs
@@ -11,7 +11,8 @@ namespace osu.Framework.Benchmarks
{
public class BenchmarkTransformUpdate : BenchmarkTest
{
- private TestBox target;
+ private TestBox target = null!;
+ private TestBox targetNoTransforms = null!;
public override void SetUp()
{
@@ -21,7 +22,8 @@ namespace osu.Framework.Benchmarks
ManualClock clock;
- target = new TestBox { Clock = new FramedClock(clock = new ManualClock()) };
+ targetNoTransforms = new TestBox { Clock = new FramedClock(clock = new ManualClock()) };
+ target = new TestBox { Clock = new FramedClock(clock) };
// transform one target member over a long period
target.RotateTo(360, transforms_count * 2);
@@ -34,6 +36,13 @@ namespace osu.Framework.Benchmarks
target.Clock.ProcessFrame();
}
+ [Benchmark]
+ public void UpdateTransformsWithNonePresent()
+ {
+ for (int i = 0; i < 10000; i++)
+ targetNoTransforms.UpdateTransforms();
+ }
+
[Benchmark]
public void UpdateTransformsWithManyPresent()
{
diff --git a/osu.Framework.Benchmarks/BenchmarkWeakList.cs b/osu.Framework.Benchmarks/BenchmarkWeakList.cs
index 6bb38b307..54ab24df7 100644
--- a/osu.Framework.Benchmarks/BenchmarkWeakList.cs
+++ b/osu.Framework.Benchmarks/BenchmarkWeakList.cs
@@ -14,7 +14,7 @@ namespace osu.Framework.Benchmarks
public int ItemCount { get; set; }
private readonly object[] objects = new object[1000];
- private WeakList
-
+
diff --git a/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/Application.cs b/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/Application.cs
index 6007015d0..ae9254f74 100644
--- a/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/Application.cs
+++ b/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/Application.cs
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+using osu.Framework.iOS;
using UIKit;
namespace TemplateGame.iOS
diff --git a/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/Info.plist b/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/Info.plist
index 6941e1b55..54c72da68 100644
--- a/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/Info.plist
+++ b/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/Info.plist
@@ -44,5 +44,9 @@
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
+ UIApplicationSupportsIndirectInputEvents
+
+ CADisableMinimumFrameDurationOnPhone
+
diff --git a/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/TemplateGame.iOS.csproj b/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/TemplateGame.iOS.csproj
index 409c83a6b..7448f3e88 100644
--- a/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/TemplateGame.iOS.csproj
+++ b/osu.Framework.Templates/templates/template-empty/TemplateGame.iOS/TemplateGame.iOS.csproj
@@ -19,6 +19,12 @@
TemplateGame.iOS
TemplateGame
+
+
+ --nosymbolstrip=BASS_FX_BPM_BeatCallbackReset --nosymbolstrip=BASS_FX_BPM_BeatCallbackSet --nosymbolstrip=BASS_FX_BPM_BeatDecodeGet --nosymbolstrip=BASS_FX_BPM_BeatFree --nosymbolstrip=BASS_FX_BPM_BeatGetParameters --nosymbolstrip=BASS_FX_BPM_BeatSetParameters --nosymbolstrip=BASS_FX_BPM_CallbackReset --nosymbolstrip=BASS_FX_BPM_CallbackSet --nosymbolstrip=BASS_FX_BPM_DecodeGet --nosymbolstrip=BASS_FX_BPM_Free --nosymbolstrip=BASS_FX_BPM_Translate --nosymbolstrip=BASS_FX_GetVersion --nosymbolstrip=BASS_FX_ReverseCreate --nosymbolstrip=BASS_FX_ReverseGetSource --nosymbolstrip=BASS_FX_TempoCreate --nosymbolstrip=BASS_FX_TempoGetRateRatio --nosymbolstrip=BASS_FX_TempoGetSource --nosymbolstrip=BASS_Mixer_ChannelFlags --nosymbolstrip=BASS_Mixer_ChannelGetData --nosymbolstrip=BASS_Mixer_ChannelGetEnvelopePos --nosymbolstrip=BASS_Mixer_ChannelGetLevel --nosymbolstrip=BASS_Mixer_ChannelGetLevelEx --nosymbolstrip=BASS_Mixer_ChannelGetMatrix --nosymbolstrip=BASS_Mixer_ChannelGetMixer --nosymbolstrip=BASS_Mixer_ChannelGetPosition --nosymbolstrip=BASS_Mixer_ChannelGetPositionEx --nosymbolstrip=BASS_Mixer_ChannelIsActive --nosymbolstrip=BASS_Mixer_ChannelRemove --nosymbolstrip=BASS_Mixer_ChannelRemoveSync --nosymbolstrip=BASS_Mixer_ChannelSetEnvelope --nosymbolstrip=BASS_Mixer_ChannelSetEnvelopePos --nosymbolstrip=BASS_Mixer_ChannelSetMatrix --nosymbolstrip=BASS_Mixer_ChannelSetMatrixEx --nosymbolstrip=BASS_Mixer_ChannelSetPosition --nosymbolstrip=BASS_Mixer_ChannelSetSync --nosymbolstrip=BASS_Mixer_GetVersion --nosymbolstrip=BASS_Mixer_StreamAddChannel --nosymbolstrip=BASS_Mixer_StreamAddChannelEx --nosymbolstrip=BASS_Mixer_StreamCreate --nosymbolstrip=BASS_Mixer_StreamGetChannels --nosymbolstrip=BASS_Split_StreamCreate --nosymbolstrip=BASS_Split_StreamGetAvailable --nosymbolstrip=BASS_Split_StreamGetSource --nosymbolstrip=BASS_Split_StreamGetSplits --nosymbolstrip=BASS_Split_StreamReset --nosymbolstrip=BASS_Split_StreamResetEx
+
+ --nolinkaway --nostrip $(GeneratedMtouchSymbolStripFlags)
+
true
full
@@ -54,7 +60,6 @@
prompt
true
None
- --nolinkaway -gcc_flags "-lstdc++ -lbz2 -framework AudioToolbox -framework AVFoundation -framework CoreMedia -framework VideoToolbox -framework SystemConfiguration -framework CFNetwork -framework Accelerate"
iPhone Developer
@@ -80,7 +85,6 @@
true
- --nolinkaway -gcc_flags "-lstdc++ -lbz2 -framework AudioToolbox -framework AVFoundation -framework CoreMedia -framework VideoToolbox -framework SystemConfiguration -framework CFNetwork -framework Accelerate"
iPhone Developer
@@ -98,7 +102,6 @@
4
None
x86_64
- --nolinkaway -gcc_flags "-lstdc++ -lbz2 -framework AudioToolbox -framework AVFoundation -framework CoreMedia -framework VideoToolbox -framework SystemConfiguration -framework CFNetwork -framework Accelerate"
true
@@ -106,7 +109,6 @@
iPhone Developer
bin\iPhone\Release
ARM64
- --nolinkaway -gcc_flags "-lstdc++ -lbz2 -framework AudioToolbox -framework AVFoundation -framework CoreMedia -framework VideoToolbox -framework SystemConfiguration -framework CFNetwork -framework Accelerate"
@@ -128,18 +130,6 @@
{6E3EBF71-8664-49D7-BD0D-2B21B3EEC540}
TemplateGame.Resources
-
-
-
- Static
- False
- True
-
-
- Static
- False
- True
-
@@ -150,11 +140,11 @@
-
+
+
-
-
+
diff --git a/osu.Framework.Templates/templates/template-empty/TemplateGame.sln b/osu.Framework.Templates/templates/template-empty/TemplateGame.sln
index c2d8c48d7..ff1127b8f 100644
--- a/osu.Framework.Templates/templates/template-empty/TemplateGame.sln
+++ b/osu.Framework.Templates/templates/template-empty/TemplateGame.sln
@@ -34,6 +34,7 @@ Global
{AEB3FC89-DC3E-4BC9-9EC7-03B72FC5D849}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEB3FC89-DC3E-4BC9-9EC7-03B72FC5D849}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEB3FC89-DC3E-4BC9-9EC7-03B72FC5D849}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Debug|iPhone.ActiveCfg = Debug|iPhone
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Debug|iPhone.Build.0 = Debug|iPhone
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Desktop/Program.cs b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Desktop/Program.cs
index 0e6bdc4f1..18a210664 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Desktop/Program.cs
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Desktop/Program.cs
@@ -8,7 +8,7 @@ namespace FlappyDon.Desktop
{
public static void Main()
{
- using (GameHost host = Host.GetSuitableHost(@"FlappyDon"))
+ using (GameHost host = Host.GetSuitableDesktopHost(@"FlappyDon"))
using (osu.Framework.Game game = new FlappyDonGame())
{
host.Run(game);
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Program.cs b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Program.cs
index 59fbaf650..483bfaf1d 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Program.cs
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Program.cs
@@ -8,7 +8,7 @@ namespace FlappyDon.Game.Tests
{
public static void Main()
{
- using (GameHost host = Host.GetSuitableHost("visual-tests"))
+ using (GameHost host = Host.GetSuitableDesktopHost("visual-tests"))
using (var game = new FlappyDonTestBrowser())
host.Run(game);
}
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneBackdrop.cs b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneBackdrop.cs
index e3e95a63d..442170ffa 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneBackdrop.cs
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneBackdrop.cs
@@ -1,5 +1,6 @@
using FlappyDon.Game.Elements;
using osu.Framework.Allocation;
+using NUnit.Framework;
namespace FlappyDon.Game.Tests.Visual
{
@@ -7,6 +8,7 @@ namespace FlappyDon.Game.Tests.Visual
/// A test scene for testing the alignment
/// and placement of the sprites that make up the backdrop
///
+ [TestFixture]
public class TestSceneBackdrop : FlappyDonTestScene
{
[BackgroundDependencyLoader]
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneFlappyDonGame.cs b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneFlappyDonGame.cs
index c9b6c4224..a891a7d51 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneFlappyDonGame.cs
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneFlappyDonGame.cs
@@ -1,5 +1,6 @@
using osu.Framework.Allocation;
using osu.Framework.Platform;
+using NUnit.Framework;
namespace FlappyDon.Game.Tests.Visual
{
@@ -7,6 +8,7 @@ namespace FlappyDon.Game.Tests.Visual
/// A test scene wrapping the entire game,
/// including audio.
///
+ [TestFixture]
public class TestSceneFlappyDonGame : FlappyDonTestScene
{
private FlappyDonGame game;
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneObstacles.cs b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneObstacles.cs
index 133af5dc5..4a7702f1d 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneObstacles.cs
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestSceneObstacles.cs
@@ -1,12 +1,14 @@
using FlappyDon.Game.Elements;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
+using NUnit.Framework;
namespace FlappyDon.Game.Tests.Visual
{
///
/// A scene to test the layout and positioning and rotation of two pipe sprites.
///
+ [TestFixture]
public class TestSceneObstacles : FlappyDonTestScene
{
[BackgroundDependencyLoader]
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestScenePipeObstacle.cs b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestScenePipeObstacle.cs
index 1ef9bed52..a0491b8d3 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestScenePipeObstacle.cs
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game.Tests/Visual/TestScenePipeObstacle.cs
@@ -1,12 +1,14 @@
using FlappyDon.Game.Elements;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
+using NUnit.Framework;
namespace FlappyDon.Game.Tests.Visual
{
///
/// A scene to test the layout and positioning and rotation of two pipe sprites.
///
+ [TestFixture]
public class TestScenePipeObstacle : FlappyDonTestScene
{
[BackgroundDependencyLoader]
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDon.Game.csproj b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDon.Game.csproj
index 157b6500b..170c58c54 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDon.Game.csproj
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDon.Game.csproj
@@ -2,10 +2,10 @@
netstandard2.1
-
-
-
+
+
+
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDonGameBase.cs b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDonGameBase.cs
index c0ce37846..bfbe526b8 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDonGameBase.cs
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.Game/FlappyDonGameBase.cs
@@ -2,8 +2,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
-using osu.Framework.Platform;
-using osuTK.Graphics.ES30;
namespace FlappyDon.Game
{
@@ -12,23 +10,16 @@ namespace FlappyDon.Game
///
public abstract class FlappyDonGameBase : osu.Framework.Game
{
- private TextureStore textures;
-
- private DependencyContainer dependencies;
+ protected override TextureFilteringMode DefaultTextureFilteringMode
+ // To preserve the 8-bit aesthetic, disable texture filtering
+ // so they won't become blurry when upscaled
+ => TextureFilteringMode.Nearest;
[BackgroundDependencyLoader]
- private void load(GameHost host)
+ private void load()
{
// Load the assets from our Resources project
Resources.AddStore(new DllResourceStore(FlappyDonResources.ResourceAssembly));
-
- // To preserve the 8-bit aesthetic, disable texture filtering
- // so they won't become blurry when upscaled
- textures = new TextureStore(Textures, filteringMode: All.Nearest);
- dependencies.Cache(textures);
}
-
- protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
- => dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
}
}
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.iOS/FlappyDon.iOS.csproj b/osu.Framework.Templates/templates/template-flappy/FlappyDon.iOS/FlappyDon.iOS.csproj
index 0a65e0c0e..963d8d177 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.iOS/FlappyDon.iOS.csproj
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.iOS/FlappyDon.iOS.csproj
@@ -19,6 +19,12 @@
FlappyDon.iOS
FlappyDon
+
+
+ --nosymbolstrip=BASS_FX_BPM_BeatCallbackReset --nosymbolstrip=BASS_FX_BPM_BeatCallbackSet --nosymbolstrip=BASS_FX_BPM_BeatDecodeGet --nosymbolstrip=BASS_FX_BPM_BeatFree --nosymbolstrip=BASS_FX_BPM_BeatGetParameters --nosymbolstrip=BASS_FX_BPM_BeatSetParameters --nosymbolstrip=BASS_FX_BPM_CallbackReset --nosymbolstrip=BASS_FX_BPM_CallbackSet --nosymbolstrip=BASS_FX_BPM_DecodeGet --nosymbolstrip=BASS_FX_BPM_Free --nosymbolstrip=BASS_FX_BPM_Translate --nosymbolstrip=BASS_FX_GetVersion --nosymbolstrip=BASS_FX_ReverseCreate --nosymbolstrip=BASS_FX_ReverseGetSource --nosymbolstrip=BASS_FX_TempoCreate --nosymbolstrip=BASS_FX_TempoGetRateRatio --nosymbolstrip=BASS_FX_TempoGetSource --nosymbolstrip=BASS_Mixer_ChannelFlags --nosymbolstrip=BASS_Mixer_ChannelGetData --nosymbolstrip=BASS_Mixer_ChannelGetEnvelopePos --nosymbolstrip=BASS_Mixer_ChannelGetLevel --nosymbolstrip=BASS_Mixer_ChannelGetLevelEx --nosymbolstrip=BASS_Mixer_ChannelGetMatrix --nosymbolstrip=BASS_Mixer_ChannelGetMixer --nosymbolstrip=BASS_Mixer_ChannelGetPosition --nosymbolstrip=BASS_Mixer_ChannelGetPositionEx --nosymbolstrip=BASS_Mixer_ChannelIsActive --nosymbolstrip=BASS_Mixer_ChannelRemove --nosymbolstrip=BASS_Mixer_ChannelRemoveSync --nosymbolstrip=BASS_Mixer_ChannelSetEnvelope --nosymbolstrip=BASS_Mixer_ChannelSetEnvelopePos --nosymbolstrip=BASS_Mixer_ChannelSetMatrix --nosymbolstrip=BASS_Mixer_ChannelSetMatrixEx --nosymbolstrip=BASS_Mixer_ChannelSetPosition --nosymbolstrip=BASS_Mixer_ChannelSetSync --nosymbolstrip=BASS_Mixer_GetVersion --nosymbolstrip=BASS_Mixer_StreamAddChannel --nosymbolstrip=BASS_Mixer_StreamAddChannelEx --nosymbolstrip=BASS_Mixer_StreamCreate --nosymbolstrip=BASS_Mixer_StreamGetChannels --nosymbolstrip=BASS_Split_StreamCreate --nosymbolstrip=BASS_Split_StreamGetAvailable --nosymbolstrip=BASS_Split_StreamGetSource --nosymbolstrip=BASS_Split_StreamGetSplits --nosymbolstrip=BASS_Split_StreamReset --nosymbolstrip=BASS_Split_StreamResetEx
+
+ --nolinkaway --nostrip $(GeneratedMtouchSymbolStripFlags)
+
true
full
@@ -62,7 +68,6 @@
True
true
None
- --nolinkaway -gcc_flags "-lstdc++ -lbz2 -framework AudioToolbox -framework AVFoundation -framework CoreMedia -framework VideoToolbox -framework SystemConfiguration -framework CFNetwork -framework Accelerate"
iPhone Developer
@@ -91,7 +96,6 @@
true
- --nolinkaway -gcc_flags "-lstdc++ -lbz2 -framework AudioToolbox -framework AVFoundation -framework CoreMedia -framework VideoToolbox -framework SystemConfiguration -framework CFNetwork -framework Accelerate"
true
@@ -107,14 +111,12 @@
SdkOnly
true
iPhone Developer
- --nolinkaway -gcc_flags "-lstdc++ -lbz2 -framework AudioToolbox -framework AVFoundation -framework CoreMedia -framework VideoToolbox -framework SystemConfiguration -framework CFNetwork -framework Accelerate"
x86_64
true
iPhone Distribution
true
- --nolinkaway -gcc_flags "-lstdc++ -lbz2 -framework AudioToolbox -framework AVFoundation -framework CoreMedia -framework VideoToolbox -framework SystemConfiguration -framework CFNetwork -framework Accelerate"
bin\iPhone\Release
ARM64
@@ -139,19 +141,9 @@
false
-
-
-
-
- Static
- False
- True
-
-
- Static
- False
- True
-
+
+ false
+
@@ -162,11 +154,11 @@
-
+
+
-
-
+
-
+
\ No newline at end of file
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.iOS/Info.plist b/osu.Framework.Templates/templates/template-flappy/FlappyDon.iOS/Info.plist
index 6cf61d564..9d594bf3b 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.iOS/Info.plist
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.iOS/Info.plist
@@ -44,5 +44,9 @@
MinimumOSVersion
11.0
+ UIApplicationSupportsIndirectInputEvents
+
+ CADisableMinimumFrameDurationOnPhone
+
diff --git a/osu.Framework.Templates/templates/template-flappy/FlappyDon.sln b/osu.Framework.Templates/templates/template-flappy/FlappyDon.sln
index 0cdcc038a..8125e85c5 100644
--- a/osu.Framework.Templates/templates/template-flappy/FlappyDon.sln
+++ b/osu.Framework.Templates/templates/template-flappy/FlappyDon.sln
@@ -33,6 +33,7 @@ Global
{AEB3FC89-DC3E-4BC9-9EC7-03B72FC5D849}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AEB3FC89-DC3E-4BC9-9EC7-03B72FC5D849}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AEB3FC89-DC3E-4BC9-9EC7-03B72FC5D849}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Debug|iPhone.ActiveCfg = Debug|iPhone
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Debug|iPhone.Build.0 = Debug|iPhone
{7AA1DB5D-78DB-4693-AE50-D6078F5A0CAB}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
diff --git a/osu.Framework.Tests.Android/TestGameActivity.cs b/osu.Framework.Tests.Android/TestGameActivity.cs
index bc48ab8bd..19851817f 100644
--- a/osu.Framework.Tests.Android/TestGameActivity.cs
+++ b/osu.Framework.Tests.Android/TestGameActivity.cs
@@ -6,7 +6,7 @@ using osu.Framework.Android;
namespace osu.Framework.Tests.Android
{
- [Activity(ConfigurationChanges = DEFAULT_CONFIG_CHANGES, LaunchMode = DEFAULT_LAUNCH_MODE, MainLauncher = true)]
+ [Activity(ConfigurationChanges = DEFAULT_CONFIG_CHANGES, Exported = true, LaunchMode = DEFAULT_LAUNCH_MODE, MainLauncher = true)]
public class TestGameActivity : AndroidGameActivity
{
protected override Game CreateGame()
diff --git a/osu.Framework.Tests.iOS/AppDelegate.cs b/osu.Framework.Tests.iOS/AppDelegate.cs
index 474d39c6d..ffe7ca39d 100644
--- a/osu.Framework.Tests.iOS/AppDelegate.cs
+++ b/osu.Framework.Tests.iOS/AppDelegate.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using Foundation;
using osu.Framework.iOS;
diff --git a/osu.Framework.Tests.iOS/Application.cs b/osu.Framework.Tests.iOS/Application.cs
index 5e4c4f780..210ad989d 100644
--- a/osu.Framework.Tests.iOS/Application.cs
+++ b/osu.Framework.Tests.iOS/Application.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.iOS;
using UIKit;
diff --git a/osu.Framework.Tests/Audio/AudioCollectionManagerTest.cs b/osu.Framework.Tests/Audio/AudioCollectionManagerTest.cs
index ca51933d8..53c39d793 100644
--- a/osu.Framework.Tests/Audio/AudioCollectionManagerTest.cs
+++ b/osu.Framework.Tests/Audio/AudioCollectionManagerTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Threading;
using NUnit.Framework;
using osu.Framework.Audio;
diff --git a/osu.Framework.Tests/Audio/AudioComponentTest.cs b/osu.Framework.Tests/Audio/AudioComponentTest.cs
index 98845de4b..accb910b7 100644
--- a/osu.Framework.Tests/Audio/AudioComponentTest.cs
+++ b/osu.Framework.Tests/Audio/AudioComponentTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
diff --git a/osu.Framework.Tests/Audio/AudioManagerWithDeviceLoss.cs b/osu.Framework.Tests/Audio/AudioManagerWithDeviceLoss.cs
index d1f5977b3..924318008 100644
--- a/osu.Framework.Tests/Audio/AudioManagerWithDeviceLoss.cs
+++ b/osu.Framework.Tests/Audio/AudioManagerWithDeviceLoss.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Generic;
using System.Linq;
using ManagedBass;
diff --git a/osu.Framework.Tests/Audio/AudioThreadTest.cs b/osu.Framework.Tests/Audio/AudioThreadTest.cs
index 66318ea20..dd85628fd 100644
--- a/osu.Framework.Tests/Audio/AudioThreadTest.cs
+++ b/osu.Framework.Tests/Audio/AudioThreadTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using System.Threading.Tasks;
diff --git a/osu.Framework.Tests/Audio/BassAudioMixerTest.cs b/osu.Framework.Tests/Audio/BassAudioMixerTest.cs
index 9163cf9cc..cc9a5fdbb 100644
--- a/osu.Framework.Tests/Audio/BassAudioMixerTest.cs
+++ b/osu.Framework.Tests/Audio/BassAudioMixerTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using ManagedBass;
diff --git a/osu.Framework.Tests/Audio/BassTestComponents.cs b/osu.Framework.Tests/Audio/BassTestComponents.cs
index 2f407b764..772bb0c6c 100644
--- a/osu.Framework.Tests/Audio/BassTestComponents.cs
+++ b/osu.Framework.Tests/Audio/BassTestComponents.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Threading;
diff --git a/osu.Framework.Tests/Audio/DeviceLosingAudioTest.cs b/osu.Framework.Tests/Audio/DeviceLosingAudioTest.cs
index cf2a00ee2..0a92aa35e 100644
--- a/osu.Framework.Tests/Audio/DeviceLosingAudioTest.cs
+++ b/osu.Framework.Tests/Audio/DeviceLosingAudioTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Audio/DevicelessAudioTest.cs b/osu.Framework.Tests/Audio/DevicelessAudioTest.cs
index 2ca741bd5..2d38c7d82 100644
--- a/osu.Framework.Tests/Audio/DevicelessAudioTest.cs
+++ b/osu.Framework.Tests/Audio/DevicelessAudioTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
namespace osu.Framework.Tests.Audio
diff --git a/osu.Framework.Tests/Audio/SampleBassInitTest.cs b/osu.Framework.Tests/Audio/SampleBassInitTest.cs
index dea9f79fd..bf4df08a9 100644
--- a/osu.Framework.Tests/Audio/SampleBassInitTest.cs
+++ b/osu.Framework.Tests/Audio/SampleBassInitTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Audio.Sample;
diff --git a/osu.Framework.Tests/Audio/SampleBassTest.cs b/osu.Framework.Tests/Audio/SampleBassTest.cs
index 399e20bf3..ed0155b18 100644
--- a/osu.Framework.Tests/Audio/SampleBassTest.cs
+++ b/osu.Framework.Tests/Audio/SampleBassTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Audio/SampleChannelVirtualTest.cs b/osu.Framework.Tests/Audio/SampleChannelVirtualTest.cs
index 3ca56f2f7..67a4a2e07 100644
--- a/osu.Framework.Tests/Audio/SampleChannelVirtualTest.cs
+++ b/osu.Framework.Tests/Audio/SampleChannelVirtualTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Audio/TestAudioAdjustments.cs b/osu.Framework.Tests/Audio/TestAudioAdjustments.cs
index b40dd2222..3506b811a 100644
--- a/osu.Framework.Tests/Audio/TestAudioAdjustments.cs
+++ b/osu.Framework.Tests/Audio/TestAudioAdjustments.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Runtime.CompilerServices;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Audio/TestSceneDrawableTrack.cs b/osu.Framework.Tests/Audio/TestSceneDrawableTrack.cs
index fad2adc5e..63d912105 100644
--- a/osu.Framework.Tests/Audio/TestSceneDrawableTrack.cs
+++ b/osu.Framework.Tests/Audio/TestSceneDrawableTrack.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
diff --git a/osu.Framework.Tests/Audio/TrackBassTest.cs b/osu.Framework.Tests/Audio/TrackBassTest.cs
index 643c74730..49b711428 100644
--- a/osu.Framework.Tests/Audio/TrackBassTest.cs
+++ b/osu.Framework.Tests/Audio/TrackBassTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Audio/TrackVirtualTest.cs b/osu.Framework.Tests/Audio/TrackVirtualTest.cs
index f3b9ffa55..9c8632d26 100644
--- a/osu.Framework.Tests/Audio/TrackVirtualTest.cs
+++ b/osu.Framework.Tests/Audio/TrackVirtualTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Diagnostics;
using System.Threading;
diff --git a/osu.Framework.Tests/AutomatedVisualTestGame.cs b/osu.Framework.Tests/AutomatedVisualTestGame.cs
index 517aa0039..a209f0836 100644
--- a/osu.Framework.Tests/AutomatedVisualTestGame.cs
+++ b/osu.Framework.Tests/AutomatedVisualTestGame.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Testing;
namespace osu.Framework.Tests
diff --git a/osu.Framework.Tests/Bindables/AggregateBindableTest.cs b/osu.Framework.Tests/Bindables/AggregateBindableTest.cs
index d74800a28..b9f7d1bdb 100644
--- a/osu.Framework.Tests/Bindables/AggregateBindableTest.cs
+++ b/osu.Framework.Tests/Bindables/AggregateBindableTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Threading;
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableBindingTest.cs b/osu.Framework.Tests/Bindables/BindableBindingTest.cs
index d4bfc49ef..110ddaefa 100644
--- a/osu.Framework.Tests/Bindables/BindableBindingTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableBindingTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Allocation;
@@ -109,7 +111,7 @@ namespace osu.Framework.Tests.Bindables
int changed1 = 0, changed2 = 0;
- bindable1.DefaultChanged += v => changed1++;
+ bindable1.DefaultChanged += _ => changed1++;
bindable2.DefaultChanged += _ =>
{
bindable2.Default = "won't change";
@@ -167,7 +169,7 @@ namespace osu.Framework.Tests.Bindables
int changed1 = 0, changed2 = 0;
- bindable1.ValueChanged += v => changed1++;
+ bindable1.ValueChanged += _ => changed1++;
bindable2.ValueChanged += _ =>
{
bindable2.Value = "won't change";
@@ -218,7 +220,7 @@ namespace osu.Framework.Tests.Bindables
int changed1 = 0, changed2 = 0;
- bindable1.DisabledChanged += v => changed1++;
+ bindable1.DisabledChanged += _ => changed1++;
bindable2.DisabledChanged += _ =>
{
bindable2.Disabled = false;
@@ -267,7 +269,7 @@ namespace osu.Framework.Tests.Bindables
int changed1 = 0, changed2 = 0;
- bindable1.MinValueChanged += v => changed1++;
+ bindable1.MinValueChanged += _ => changed1++;
bindable2.MinValueChanged += _ =>
{
bindable2.MinValue = 1337;
@@ -316,7 +318,7 @@ namespace osu.Framework.Tests.Bindables
int changed1 = 0, changed2 = 0;
- bindable1.MaxValueChanged += v => changed1++;
+ bindable1.MaxValueChanged += _ => changed1++;
bindable2.MaxValueChanged += _ =>
{
bindable2.MaxValue = 1337;
diff --git a/osu.Framework.Tests/Bindables/BindableBoolTest.cs b/osu.Framework.Tests/Bindables/BindableBoolTest.cs
index dc7677fd2..3114ec961 100644
--- a/osu.Framework.Tests/Bindables/BindableBoolTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableBoolTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableDictionaryTest.cs b/osu.Framework.Tests/Bindables/BindableDictionaryTest.cs
index 8b4a53cff..e23094190 100644
--- a/osu.Framework.Tests/Bindables/BindableDictionaryTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableDictionaryTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -815,7 +817,7 @@ namespace osu.Framework.Tests.Bindables
[Test]
public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber()
{
- bindableStringByteDictionary.DisabledChanged += b => Assert.Fail();
+ bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail();
bindableStringByteDictionary.Disabled = bindableStringByteDictionary.Disabled;
}
@@ -823,9 +825,9 @@ namespace osu.Framework.Tests.Bindables
[Test]
public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscribers()
{
- bindableStringByteDictionary.DisabledChanged += b => Assert.Fail();
- bindableStringByteDictionary.DisabledChanged += b => Assert.Fail();
- bindableStringByteDictionary.DisabledChanged += b => Assert.Fail();
+ bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail();
+ bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail();
+ bindableStringByteDictionary.DisabledChanged += _ => Assert.Fail();
bindableStringByteDictionary.Disabled = bindableStringByteDictionary.Disabled;
}
diff --git a/osu.Framework.Tests/Bindables/BindableDoubleTest.cs b/osu.Framework.Tests/Bindables/BindableDoubleTest.cs
index c6e8a8053..506d0ef51 100644
--- a/osu.Framework.Tests/Bindables/BindableDoubleTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableDoubleTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableEnumTest.cs b/osu.Framework.Tests/Bindables/BindableEnumTest.cs
index 7d8a6aa0f..c2df41339 100644
--- a/osu.Framework.Tests/Bindables/BindableEnumTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableEnumTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Linq;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Bindables/BindableFloatTest.cs b/osu.Framework.Tests/Bindables/BindableFloatTest.cs
index f671afcfe..37c5e1421 100644
--- a/osu.Framework.Tests/Bindables/BindableFloatTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableFloatTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableIntTest.cs b/osu.Framework.Tests/Bindables/BindableIntTest.cs
index 7626da2ca..328a9c4ba 100644
--- a/osu.Framework.Tests/Bindables/BindableIntTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableIntTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableLeasingTest.cs b/osu.Framework.Tests/Bindables/BindableLeasingTest.cs
index 3fa444bed..fc2323e67 100644
--- a/osu.Framework.Tests/Bindables/BindableLeasingTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableLeasingTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableListTest.cs b/osu.Framework.Tests/Bindables/BindableListTest.cs
index e856d3c00..dc60ea921 100644
--- a/osu.Framework.Tests/Bindables/BindableListTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableListTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
@@ -1277,7 +1279,7 @@ namespace osu.Framework.Tests.Bindables
[Test]
public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscriber()
{
- bindableStringList.DisabledChanged += b => Assert.Fail();
+ bindableStringList.DisabledChanged += _ => Assert.Fail();
bindableStringList.Disabled = bindableStringList.Disabled;
}
@@ -1285,9 +1287,9 @@ namespace osu.Framework.Tests.Bindables
[Test]
public void TestDisabledWhenSetToCurrentValueDoesNotNotifySubscribers()
{
- bindableStringList.DisabledChanged += b => Assert.Fail();
- bindableStringList.DisabledChanged += b => Assert.Fail();
- bindableStringList.DisabledChanged += b => Assert.Fail();
+ bindableStringList.DisabledChanged += _ => Assert.Fail();
+ bindableStringList.DisabledChanged += _ => Assert.Fail();
+ bindableStringList.DisabledChanged += _ => Assert.Fail();
bindableStringList.Disabled = bindableStringList.Disabled;
}
diff --git a/osu.Framework.Tests/Bindables/BindableLongTest.cs b/osu.Framework.Tests/Bindables/BindableLongTest.cs
index 5d92490a8..8da72a093 100644
--- a/osu.Framework.Tests/Bindables/BindableLongTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableLongTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableMarginPaddingTest.cs b/osu.Framework.Tests/Bindables/BindableMarginPaddingTest.cs
index fad7c26d6..391e6a42f 100644
--- a/osu.Framework.Tests/Bindables/BindableMarginPaddingTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableMarginPaddingTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Bindables/BindableNumberTest.cs b/osu.Framework.Tests/Bindables/BindableNumberTest.cs
index d9147a780..cf17ed00e 100644
--- a/osu.Framework.Tests/Bindables/BindableNumberTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableNumberTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Reflection;
diff --git a/osu.Framework.Tests/Bindables/BindableSerializationTest.cs b/osu.Framework.Tests/Bindables/BindableSerializationTest.cs
index a54854bed..de0012fbe 100644
--- a/osu.Framework.Tests/Bindables/BindableSerializationTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableSerializationTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using Newtonsoft.Json;
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableSizeTest.cs b/osu.Framework.Tests/Bindables/BindableSizeTest.cs
index d5e4c9c70..8721e4846 100644
--- a/osu.Framework.Tests/Bindables/BindableSizeTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableSizeTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using System.Drawing;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableStringTest.cs b/osu.Framework.Tests/Bindables/BindableStringTest.cs
index e2344ddae..6419651c5 100644
--- a/osu.Framework.Tests/Bindables/BindableStringTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableStringTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Bindables/BindableTest.cs b/osu.Framework.Tests/Bindables/BindableTest.cs
index 93a523dc2..5cff3b295 100644
--- a/osu.Framework.Tests/Bindables/BindableTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/osu.Framework.Tests/Bindables/BindableWithCurrentTest.cs b/osu.Framework.Tests/Bindables/BindableWithCurrentTest.cs
index a5d2f56a5..78ebfcce2 100644
--- a/osu.Framework.Tests/Bindables/BindableWithCurrentTest.cs
+++ b/osu.Framework.Tests/Bindables/BindableWithCurrentTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
using osu.Framework.Graphics.UserInterface;
diff --git a/osu.Framework.Tests/Bindables/RangeConstrainedBindableTest.cs b/osu.Framework.Tests/Bindables/RangeConstrainedBindableTest.cs
index 04ca637f7..f95976f1c 100644
--- a/osu.Framework.Tests/Bindables/RangeConstrainedBindableTest.cs
+++ b/osu.Framework.Tests/Bindables/RangeConstrainedBindableTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Clocks/DecoupleableClockTest.cs b/osu.Framework.Tests/Clocks/DecoupleableClockTest.cs
index 5941686f9..27ead2418 100644
--- a/osu.Framework.Tests/Clocks/DecoupleableClockTest.cs
+++ b/osu.Framework.Tests/Clocks/DecoupleableClockTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Clocks/InterpolatingClockTest.cs b/osu.Framework.Tests/Clocks/InterpolatingClockTest.cs
index 0f2c1fbc3..b5e00d463 100644
--- a/osu.Framework.Tests/Clocks/InterpolatingClockTest.cs
+++ b/osu.Framework.Tests/Clocks/InterpolatingClockTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Clocks/StopwatchClockTest.cs b/osu.Framework.Tests/Clocks/StopwatchClockTest.cs
index 3b19a9b4f..1a04ec4b6 100644
--- a/osu.Framework.Tests/Clocks/StopwatchClockTest.cs
+++ b/osu.Framework.Tests/Clocks/StopwatchClockTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Threading;
using NUnit.Framework;
using osu.Framework.Timing;
diff --git a/osu.Framework.Tests/Clocks/TestClock.cs b/osu.Framework.Tests/Clocks/TestClock.cs
index a91b4de8c..ac4bf7e38 100644
--- a/osu.Framework.Tests/Clocks/TestClock.cs
+++ b/osu.Framework.Tests/Clocks/TestClock.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Timing;
namespace osu.Framework.Tests.Clocks
diff --git a/osu.Framework.Tests/Configuration/FrameworkConfigManagerTest.cs b/osu.Framework.Tests/Configuration/FrameworkConfigManagerTest.cs
index 83bce11e7..52c7bbc0a 100644
--- a/osu.Framework.Tests/Configuration/FrameworkConfigManagerTest.cs
+++ b/osu.Framework.Tests/Configuration/FrameworkConfigManagerTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using NUnit.Framework;
@@ -15,7 +17,7 @@ namespace osu.Framework.Tests.Configuration
[Test]
public void TestDefault()
{
- using (var storage = new TemporaryNativeStorage(new Guid().ToString()))
+ using (var storage = new TemporaryNativeStorage(Guid.NewGuid().ToString()))
{
using (var configManager = new FrameworkConfigManager(storage))
{
@@ -33,7 +35,7 @@ namespace osu.Framework.Tests.Configuration
{
const double test_volume = 0.65;
- using (var storage = new TemporaryNativeStorage(new Guid().ToString()))
+ using (var storage = new TemporaryNativeStorage(Guid.NewGuid().ToString()))
{
using (var configManager = new FrameworkConfigManager(storage))
{
@@ -61,7 +63,7 @@ namespace osu.Framework.Tests.Configuration
{
const string test_locale = "override test";
- using (var storage = new TemporaryNativeStorage(new Guid().ToString()))
+ using (var storage = new TemporaryNativeStorage(Guid.NewGuid().ToString()))
{
using (var configManager = new FrameworkConfigManager(storage, new Dictionary { { FrameworkSetting.Locale, test_locale } }))
{
diff --git a/osu.Framework.Tests/Configuration/InputConfigManagerTest.cs b/osu.Framework.Tests/Configuration/InputConfigManagerTest.cs
index eed00dacc..34442f3d6 100644
--- a/osu.Framework.Tests/Configuration/InputConfigManagerTest.cs
+++ b/osu.Framework.Tests/Configuration/InputConfigManagerTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -42,7 +44,7 @@ namespace osu.Framework.Tests.Configuration
using (var host = new TestHeadlessGameHost())
{
- host.Run(new TestGame((h, config) => sensitivity = h.AvailableInputHandlers.OfType().First().Sensitivity.Value));
+ host.Run(new TestGame((h, _) => sensitivity = h.AvailableInputHandlers.OfType().First().Sensitivity.Value));
}
Assert.AreEqual(5, sensitivity);
@@ -53,7 +55,7 @@ namespace osu.Framework.Tests.Configuration
{
using (var host = new TestHeadlessGameHost(bypassCleanup: true))
{
- host.Run(new TestGame((h, config) =>
+ host.Run(new TestGame((h, _) =>
{
storage = h.Storage;
h.AvailableInputHandlers.OfType().First().Sensitivity.Value = 5;
@@ -67,7 +69,7 @@ namespace osu.Framework.Tests.Configuration
using (var host = new TestHeadlessGameHost())
{
- host.Run(new TestGame((h, config) => sensitivity = h.AvailableInputHandlers.OfType().First().Sensitivity.Value));
+ host.Run(new TestGame((h, _) => sensitivity = h.AvailableInputHandlers.OfType().First().Sensitivity.Value));
}
Assert.AreEqual(5, sensitivity);
diff --git a/osu.Framework.Tests/Containers/ContainerEnumerableTest.cs b/osu.Framework.Tests/Containers/ContainerEnumerableTest.cs
index db4071e4c..13c5e5ce3 100644
--- a/osu.Framework.Tests/Containers/ContainerEnumerableTest.cs
+++ b/osu.Framework.Tests/Containers/ContainerEnumerableTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Containers/TestSceneCompositeMutability.cs b/osu.Framework.Tests/Containers/TestSceneCompositeMutability.cs
index bc66b8eaf..9a5c93553 100644
--- a/osu.Framework.Tests/Containers/TestSceneCompositeMutability.cs
+++ b/osu.Framework.Tests/Containers/TestSceneCompositeMutability.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using NUnit.Framework;
@@ -167,12 +169,14 @@ namespace osu.Framework.Tests.Containers
[BackgroundDependencyLoader]
private void load()
{
- LoadingEvent.Wait();
+ if (!LoadingEvent.Wait(10000))
+ throw new TimeoutException("Load took too long");
OnLoading?.Invoke();
OnLoading = null;
- ReadyEvent.Wait();
+ if (!ReadyEvent.Wait(10000))
+ throw new TimeoutException("Ready took too long");
}
public override bool UpdateSubTree()
diff --git a/osu.Framework.Tests/Containers/TestSceneContainerState.cs b/osu.Framework.Tests/Containers/TestSceneContainerState.cs
index 89d72397a..0bd03824f 100644
--- a/osu.Framework.Tests/Containers/TestSceneContainerState.cs
+++ b/osu.Framework.Tests/Containers/TestSceneContainerState.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Linq;
using System.Threading;
diff --git a/osu.Framework.Tests/Containers/TestSceneLoadComponentAsync.cs b/osu.Framework.Tests/Containers/TestSceneLoadComponentAsync.cs
index 580588a89..b1c77b2a9 100644
--- a/osu.Framework.Tests/Containers/TestSceneLoadComponentAsync.cs
+++ b/osu.Framework.Tests/Containers/TestSceneLoadComponentAsync.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Containers/TestSceneLongRunningLoad.cs b/osu.Framework.Tests/Containers/TestSceneLongRunningLoad.cs
index b8989da7f..19fda8a05 100644
--- a/osu.Framework.Tests/Containers/TestSceneLongRunningLoad.cs
+++ b/osu.Framework.Tests/Containers/TestSceneLongRunningLoad.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Threading;
diff --git a/osu.Framework.Tests/Containers/TestSceneSyncDisposal.cs b/osu.Framework.Tests/Containers/TestSceneSyncDisposal.cs
index 8082efb1b..5a3742b88 100644
--- a/osu.Framework.Tests/Containers/TestSceneSyncDisposal.cs
+++ b/osu.Framework.Tests/Containers/TestSceneSyncDisposal.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Dependencies/CachedAttributeTest.cs b/osu.Framework.Tests/Dependencies/CachedAttributeTest.cs
index 3491539b2..d70384e56 100644
--- a/osu.Framework.Tests/Dependencies/CachedAttributeTest.cs
+++ b/osu.Framework.Tests/Dependencies/CachedAttributeTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Allocation;
diff --git a/osu.Framework.Tests/Dependencies/CachedModelDependenciesTest.cs b/osu.Framework.Tests/Dependencies/CachedModelDependenciesTest.cs
index c8e6c324d..30f8bf4ab 100644
--- a/osu.Framework.Tests/Dependencies/CachedModelDependenciesTest.cs
+++ b/osu.Framework.Tests/Dependencies/CachedModelDependenciesTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Allocation;
diff --git a/osu.Framework.Tests/Dependencies/DependencyContainerTest.cs b/osu.Framework.Tests/Dependencies/DependencyContainerTest.cs
index 489778bf9..ff9396d68 100644
--- a/osu.Framework.Tests/Dependencies/DependencyContainerTest.cs
+++ b/osu.Framework.Tests/Dependencies/DependencyContainerTest.cs
@@ -1,7 +1,10 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
+using System.Diagnostics.CodeAnalysis;
using System.Threading;
using JetBrains.Annotations;
using NUnit.Framework;
@@ -318,6 +321,20 @@ namespace osu.Framework.Tests.Dependencies
});
}
+ [Test]
+ public void TestResolveWithNullableReferenceTypes()
+ {
+ var dependencies = new DependencyContainer();
+ var receiver = new Receiver14();
+
+ // Throws with missing non-nullable dependency.
+ Assert.Throws(() => dependencies.Inject(receiver));
+
+ // Cache the non-nullable dependency.
+ dependencies.CacheAs(new BaseObject());
+ Assert.DoesNotThrow(() => dependencies.Inject(receiver));
+ }
+
private interface IBaseInterface
{
}
@@ -435,5 +452,16 @@ namespace osu.Framework.Tests.Dependencies
[BackgroundDependencyLoader(true)]
private void load(int testObject) => TestObject = testObject;
}
+
+#nullable enable
+ [SuppressMessage("ReSharper", "UnusedParameter.Local")]
+ private class Receiver14
+ {
+ [BackgroundDependencyLoader]
+ private void load(BaseObject nonNullObject, DerivedObject? nullableObject)
+ {
+ }
+ }
+#nullable disable
}
}
diff --git a/osu.Framework.Tests/Dependencies/ResolvedAttributeTest.cs b/osu.Framework.Tests/Dependencies/ResolvedAttributeTest.cs
index d58a69c95..d5407b800 100644
--- a/osu.Framework.Tests/Dependencies/ResolvedAttributeTest.cs
+++ b/osu.Framework.Tests/Dependencies/ResolvedAttributeTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@@ -189,6 +191,25 @@ namespace osu.Framework.Tests.Dependencies
Assert.AreEqual(bindable.Value, receiver.Obj2.Value);
}
+ [Test]
+ public void TestResolveNullableWithNullableReferenceTypes()
+ {
+ var receiver = new Receiver17();
+ Assert.DoesNotThrow(() => createDependencies().Inject(receiver));
+ }
+
+ [Test]
+ public void TestResolveNonNullWithNullableReferenceTypes()
+ {
+ var receiver = new Receiver18();
+
+ // Throws with non-nullable dependency not cached.
+ Assert.Throws(() => createDependencies().Inject(receiver));
+
+ // Does not throw with the non-nullable dependency cached.
+ Assert.DoesNotThrow(() => createDependencies(new Bindable(10)).Inject(receiver));
+ }
+
private DependencyContainer createDependencies(params object[] toCache)
{
var dependencies = new DependencyContainer();
@@ -306,5 +327,19 @@ namespace osu.Framework.Tests.Dependencies
[Resolved]
public IBindable Obj2 { get; private set; }
}
+
+#nullable enable
+ private class Receiver17
+ {
+ [Resolved]
+ public Bindable? Obj { get; private set; }
+ }
+
+ private class Receiver18
+ {
+ [Resolved]
+ public Bindable Obj { get; private set; } = null!;
+ }
+#nullable disable
}
}
diff --git a/osu.Framework.Tests/Exceptions/TestAddRemoveExceptions.cs b/osu.Framework.Tests/Exceptions/TestAddRemoveExceptions.cs
index 0313afb27..526d5f966 100644
--- a/osu.Framework.Tests/Exceptions/TestAddRemoveExceptions.cs
+++ b/osu.Framework.Tests/Exceptions/TestAddRemoveExceptions.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Exceptions/TestLoadExceptions.cs b/osu.Framework.Tests/Exceptions/TestLoadExceptions.cs
index 17f63e910..434d87f60 100644
--- a/osu.Framework.Tests/Exceptions/TestLoadExceptions.cs
+++ b/osu.Framework.Tests/Exceptions/TestLoadExceptions.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
@@ -8,9 +10,11 @@ using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
+using osu.Framework.Extensions.ExceptionExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
+using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Testing;
using osuTK;
@@ -47,6 +51,47 @@ namespace osu.Framework.Tests.Exceptions
});
}
+ [Test]
+ public void TestUnobservedException()
+ {
+ Exception loggedException = null;
+
+ Logger.NewEntry += newLogEntry;
+
+ try
+ {
+ var exception = Assert.Throws(() =>
+ {
+ Task.Factory.StartNew(() =>
+ {
+ runGameWithLogic(g =>
+ {
+ g.Scheduler.Add(() => Task.Run(() => throw new InvalidOperationException()));
+ g.Scheduler.AddDelayed(() => collect(), 1, true);
+
+ if (loggedException != null)
+ throw loggedException;
+ });
+ }, TaskCreationOptions.LongRunning).Wait(TimeSpan.FromSeconds(10));
+
+ Assert.Fail("Game execution was not aborted");
+ });
+
+ Assert.True(exception?.AsSingular() is InvalidOperationException);
+ }
+ finally
+ {
+ Logger.NewEntry -= newLogEntry;
+ }
+
+ void newLogEntry(LogEntry entry) => loggedException = entry.Exception;
+ }
+
+ private static void collect()
+ {
+ GC.Collect();
+ }
+
[Test]
public void TestSingleAsyncAdd()
{
@@ -59,7 +104,7 @@ namespace osu.Framework.Tests.Exceptions
{
g.Add(loadTarget);
loadTarget.PerformAsyncLoad();
- }, g => loadable.Parent == loadTarget);
+ }, _ => loadable.Parent == loadTarget);
});
}
@@ -76,7 +121,7 @@ namespace osu.Framework.Tests.Exceptions
g.Add(loadTarget);
loadTarget.PerformAsyncLoad();
loadTarget.PerformAsyncLoad(false);
- }, g => loadable.Parent == loadTarget);
+ }, _ => loadable.Parent == loadTarget);
});
}
@@ -164,7 +209,7 @@ namespace osu.Framework.Tests.Exceptions
runGameWithLogic(g =>
{
g.Add(loadTarget);
- loadTarget.PerformAsyncLoad().ContinueWith(t => allowDispose = true);
+ loadTarget.PerformAsyncLoad().ContinueWith(_ => allowDispose = true);
}, g =>
{
// The following code is done here for a very specific reason, but can occur naturally in normal use
diff --git a/osu.Framework.Tests/Exceptions/TestSceneDependencyInjectionExceptions.cs b/osu.Framework.Tests/Exceptions/TestSceneDependencyInjectionExceptions.cs
index 2c800b39e..e8646db91 100644
--- a/osu.Framework.Tests/Exceptions/TestSceneDependencyInjectionExceptions.cs
+++ b/osu.Framework.Tests/Exceptions/TestSceneDependencyInjectionExceptions.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Diagnostics;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Extensions/TestExtensions.cs b/osu.Framework.Tests/Extensions/TestExtensions.cs
index 93eb3ed87..d26059310 100644
--- a/osu.Framework.Tests/Extensions/TestExtensions.cs
+++ b/osu.Framework.Tests/Extensions/TestExtensions.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Extensions;
diff --git a/osu.Framework.Tests/Extensions/TestIsNullableTypeExtensions.cs b/osu.Framework.Tests/Extensions/TestIsNullableTypeExtensions.cs
new file mode 100644
index 000000000..8c1fdd471
--- /dev/null
+++ b/osu.Framework.Tests/Extensions/TestIsNullableTypeExtensions.cs
@@ -0,0 +1,142 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Reflection;
+using NUnit.Framework;
+using osu.Framework.Extensions.TypeExtensions;
+
+#pragma warning disable CS8618
+#pragma warning disable CS0649
+
+namespace osu.Framework.Tests.Extensions
+{
+ [TestFixture]
+ [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")]
+ [SuppressMessage("ReSharper", "ValueParameterNotUsed")]
+ [SuppressMessage("ReSharper", "UnusedParameter.Local")]
+ public class TestIsNullableTypeExtensions
+ {
+ private const BindingFlags binding_flags = BindingFlags.Instance | BindingFlags.NonPublic;
+
+ private int nonNullValueField;
+ private int? nullableValueField;
+
+ private int nonNullValueGetSetProperty { get; set; }
+ private int? nullableValueGetSetProperty { get; set; }
+
+ private int nonNullValueGetProperty { get; }
+ private int? nullableValueGetProperty { get; }
+
+ private int nonNullValueSetProperty { set { } }
+ private int? nullableValueSetProperty { set { } }
+
+ private object nonNullReferenceField;
+ private object? nullableReferenceField;
+
+ private object nonNullReferenceGetSetProperty { get; set; }
+ private object? nullableReferenceGetSetProperty { get; set; }
+
+ private object nonNullReferenceGetProperty { get; }
+ private object? nullableReferenceGetProperty { get; }
+
+ private object nonNullReferenceSetProperty { set { } }
+ private object? nullableReferenceSetProperty { set { } }
+
+#nullable disable
+ private object nonNullReferenceFieldWithoutNullableReferenceTypes;
+#nullable enable
+
+ private event Action nonNullEvent;
+ private event Action? nullableEvent;
+
+ private void testValueParamMethod(int param1, int? param2) { }
+ private void testReferenceParamMethod(object param1, object? param2) { }
+
+ [Test]
+ public void TestNonNullValueField() => Assert.False(GetType().GetField(nameof(nonNullValueField), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableValueField() => Assert.True(GetType().GetField(nameof(nullableValueField), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullValueGetSetProperty() => Assert.False(GetType().GetProperty(nameof(nonNullValueGetSetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableValueGetSetProperty() => Assert.True(GetType().GetProperty(nameof(nullableValueGetSetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullValueGetProperty() => Assert.False(GetType().GetProperty(nameof(nonNullValueGetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableValueGetProperty() => Assert.True(GetType().GetProperty(nameof(nullableValueGetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullValueSetProperty() => Assert.False(GetType().GetProperty(nameof(nonNullValueSetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableValueSetProperty() => Assert.True(GetType().GetProperty(nameof(nullableValueSetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullReferenceField() => Assert.False(GetType().GetField(nameof(nonNullReferenceField), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableReferenceField() => Assert.True(GetType().GetField(nameof(nullableReferenceField), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullReferenceGetSetProperty() => Assert.False(GetType().GetProperty(nameof(nonNullReferenceGetSetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableReferenceGetSetProperty() => Assert.True(GetType().GetProperty(nameof(nullableReferenceGetSetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullReferenceGetProperty() => Assert.False(GetType().GetProperty(nameof(nonNullReferenceGetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableReferenceGetProperty() => Assert.True(GetType().GetProperty(nameof(nullableReferenceGetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullReferenceSetProperty() => Assert.False(GetType().GetProperty(nameof(nonNullReferenceSetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableReferenceSetProperty() => Assert.True(GetType().GetProperty(nameof(nullableReferenceSetProperty), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullReferenceFieldWithoutNullableReferenceTypes()
+ => Assert.False(GetType().GetField(nameof(nonNullReferenceFieldWithoutNullableReferenceTypes), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNonNullEvent() => Assert.False(GetType().GetEvent(nameof(nonNullEvent), binding_flags).IsNullable());
+
+ [Test]
+ public void TestNullableEvent() => Assert.True(GetType().GetEvent(nameof(nullableEvent), binding_flags).IsNullable());
+
+ [Test]
+ public void TestValueParameters()
+ {
+ var parameters = GetType().GetMethod(nameof(testValueParamMethod), binding_flags)!.GetParameters();
+ Assert.False(parameters[0].IsNullable());
+ Assert.True(parameters[1].IsNullable());
+ }
+
+ [Test]
+ public void TestReferenceParameters()
+ {
+ var parameters = GetType().GetMethod(nameof(testReferenceParamMethod), binding_flags)!.GetParameters();
+ Assert.False(parameters[0].IsNullable());
+ Assert.True(parameters[1].IsNullable());
+ }
+
+ [Test]
+ public void TestNonNullValueType() => Assert.False(typeof(int).IsNullable());
+
+ [Test]
+ public void TestNullableValueType() => Assert.True(typeof(int?).IsNullable());
+
+ [Test]
+ public void TestNonNullReferenceType() => Assert.False(typeof(object).IsNullable());
+
+ // typeof cannot be used on "object?".
+ }
+}
diff --git a/osu.Framework.Tests/Extensions/TestStreamExtensions.cs b/osu.Framework.Tests/Extensions/TestStreamExtensions.cs
index 8f713c254..d7b3aa189 100644
--- a/osu.Framework.Tests/Extensions/TestStreamExtensions.cs
+++ b/osu.Framework.Tests/Extensions/TestStreamExtensions.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.IO;
using System.Linq;
using System.Threading.Tasks;
diff --git a/osu.Framework.Tests/Graphics/ColourTest.cs b/osu.Framework.Tests/Graphics/ColourTest.cs
index d5ae5539e..a061871b5 100644
--- a/osu.Framework.Tests/Graphics/ColourTest.cs
+++ b/osu.Framework.Tests/Graphics/ColourTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Numerics;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs b/osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs
index 51caeebf9..2e7a3e4ca 100644
--- a/osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs
+++ b/osu.Framework.Tests/Graphics/LifetimeEntryManagerTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
@@ -207,7 +209,7 @@ namespace osu.Framework.Tests.Graphics
addEntry();
- manager.EntryCrossedBoundary += (entry, kind, direction) => changeLifetime();
+ manager.EntryCrossedBoundary += (_, _, _) => changeLifetime();
manager.Update(0);
int count = 1;
diff --git a/osu.Framework.Tests/Graphics/ShaderRegexTest.cs b/osu.Framework.Tests/Graphics/ShaderRegexTest.cs
index 20b28ed37..7bf9a84f1 100644
--- a/osu.Framework.Tests/Graphics/ShaderRegexTest.cs
+++ b/osu.Framework.Tests/Graphics/ShaderRegexTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Text.RegularExpressions;
using NUnit.Framework;
using osu.Framework.Graphics.Shaders;
diff --git a/osu.Framework.Tests/Graphics/TestSceneDrawableScheduling.cs b/osu.Framework.Tests/Graphics/TestSceneDrawableScheduling.cs
index cb2fb7275..10da54b86 100644
--- a/osu.Framework.Tests/Graphics/TestSceneDrawableScheduling.cs
+++ b/osu.Framework.Tests/Graphics/TestSceneDrawableScheduling.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Graphics/TextureAtlasTest.cs b/osu.Framework.Tests/Graphics/TextureAtlasTest.cs
index 7f63e9208..bf4e1ea76 100644
--- a/osu.Framework.Tests/Graphics/TextureAtlasTest.cs
+++ b/osu.Framework.Tests/Graphics/TextureAtlasTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Primitives;
diff --git a/osu.Framework.Tests/Graphics/TripleBufferTest.cs b/osu.Framework.Tests/Graphics/TripleBufferTest.cs
new file mode 100644
index 000000000..705bbf0d4
--- /dev/null
+++ b/osu.Framework.Tests/Graphics/TripleBufferTest.cs
@@ -0,0 +1,102 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System.Threading;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using osu.Framework.Allocation;
+using osu.Framework.Extensions;
+
+namespace osu.Framework.Tests.Graphics
+{
+ [TestFixture]
+ public class TripleBufferTest
+ {
+ [Test]
+ public void TestWriteOnly()
+ {
+ var tripleBuffer = new TripleBuffer();
+
+ for (int i = 0; i < 1000; i++)
+ {
+ using (tripleBuffer.GetForWrite())
+ {
+ }
+ }
+ }
+
+ [Test]
+ public void TestReadOnly()
+ {
+ var tripleBuffer = new TripleBuffer();
+
+ using (var buffer = tripleBuffer.GetForRead())
+ Assert.That(buffer, Is.Null);
+ }
+
+ [Test]
+ public void TestWriteThenRead()
+ {
+ var tripleBuffer = new TripleBuffer();
+
+ for (int i = 0; i < 1000; i++)
+ {
+ var obj = new TestObject(i);
+
+ using (var buffer = tripleBuffer.GetForWrite())
+ buffer.Object = obj;
+
+ using (var buffer = tripleBuffer.GetForRead())
+ Assert.That(buffer?.Object, Is.EqualTo(obj));
+ }
+
+ using (var buffer = tripleBuffer.GetForRead())
+ Assert.That(buffer, Is.Null);
+ }
+
+ [Test]
+ public void TestReadSaturated()
+ {
+ var tripleBuffer = new TripleBuffer();
+
+ for (int i = 0; i < 10; i++)
+ {
+ var obj = new TestObject(i);
+ ManualResetEventSlim resetEventSlim = new ManualResetEventSlim();
+
+ var readTask = Task.Factory.StartNew(() =>
+ {
+ resetEventSlim.Set();
+ using (var buffer = tripleBuffer.GetForRead())
+ Assert.That(buffer?.Object, Is.EqualTo(obj));
+ }, TaskCreationOptions.LongRunning);
+
+ Task.Factory.StartNew(() =>
+ {
+ resetEventSlim.Wait(1000);
+ Thread.Sleep(10);
+
+ using (var buffer = tripleBuffer.GetForWrite())
+ buffer.Object = obj;
+ }, TaskCreationOptions.LongRunning);
+
+ readTask.WaitSafely();
+ }
+ }
+
+ private class TestObject
+ {
+ private readonly int i;
+
+ public TestObject(int i)
+ {
+ this.i = i;
+ }
+
+ public override string ToString()
+ {
+ return $"{base.ToString()} {i}";
+ }
+ }
+ }
+}
diff --git a/osu.Framework.Tests/IO/BackgroundGameHeadlessGameHost.cs b/osu.Framework.Tests/IO/BackgroundGameHeadlessGameHost.cs
index c923180b1..6f7b14c27 100644
--- a/osu.Framework.Tests/IO/BackgroundGameHeadlessGameHost.cs
+++ b/osu.Framework.Tests/IO/BackgroundGameHeadlessGameHost.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using System.Threading.Tasks;
@@ -31,7 +33,8 @@ namespace osu.Framework.Tests.IO
Task.Factory.StartNew(() => Run(testGame), TaskCreationOptions.LongRunning);
- testGame.HasProcessed.Wait();
+ if (!testGame.HasProcessed.Wait(10000))
+ throw new TimeoutException("Game took too long to process a frame");
}
private class TestGame : Game
diff --git a/osu.Framework.Tests/IO/FontStoreTest.cs b/osu.Framework.Tests/IO/FontStoreTest.cs
index 54674d28a..cab61144f 100644
--- a/osu.Framework.Tests/IO/FontStoreTest.cs
+++ b/osu.Framework.Tests/IO/FontStoreTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.IO.Stores;
diff --git a/osu.Framework.Tests/IO/TestDesktopStorage.cs b/osu.Framework.Tests/IO/TestDesktopStorage.cs
index a067d40ca..195236b1d 100644
--- a/osu.Framework.Tests/IO/TestDesktopStorage.cs
+++ b/osu.Framework.Tests/IO/TestDesktopStorage.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.IO;
using NUnit.Framework;
@@ -14,7 +16,7 @@ namespace osu.Framework.Tests.IO
[Test]
public void TestRelativePaths()
{
- string guid = new Guid().ToString();
+ string guid = Guid.NewGuid().ToString();
using (var storage = new TemporaryNativeStorage(guid))
{
@@ -34,11 +36,15 @@ namespace osu.Framework.Tests.IO
[Test]
public void TestAttemptEscapeRoot()
{
- string guid = new Guid().ToString();
+ string guid = Guid.NewGuid().ToString();
using (var storage = new TemporaryNativeStorage(guid))
{
- Assert.Throws(() => storage.GetStream("../test"));
+ Assert.Throws(() =>
+ {
+ using var x = storage.GetStream("../test");
+ });
+
Assert.Throws(() => storage.GetStorageForDirectory("../"));
}
}
@@ -46,7 +52,7 @@ namespace osu.Framework.Tests.IO
[Test]
public void TestGetSubDirectoryStorage()
{
- string guid = new Guid().ToString();
+ string guid = Guid.NewGuid().ToString();
using (var storage = new TemporaryNativeStorage(guid))
{
@@ -57,7 +63,7 @@ namespace osu.Framework.Tests.IO
[Test]
public void TestGetEmptySubDirectoryStorage()
{
- string guid = new Guid().ToString();
+ string guid = Guid.NewGuid().ToString();
using (var storage = new TemporaryNativeStorage(guid))
{
diff --git a/osu.Framework.Tests/IO/TestLogging.cs b/osu.Framework.Tests/IO/TestLogging.cs
index 02358bce0..2759ecd32 100644
--- a/osu.Framework.Tests/IO/TestLogging.cs
+++ b/osu.Framework.Tests/IO/TestLogging.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using System.Threading.Tasks;
@@ -98,7 +100,7 @@ namespace osu.Framework.Tests.IO
{
using (var host = new TestRunHeadlessGameHost())
{
- host.ExceptionThrown += ex => ignoreCount-- > 0;
+ host.ExceptionThrown += _ => ignoreCount-- > 0;
var game = new TestGame();
@@ -129,32 +131,6 @@ namespace osu.Framework.Tests.IO
}
}
- [Test]
- public void TestGameUnobservedExceptionDoesntCrashGame()
- {
- using (var host = new TestRunHeadlessGameHost())
- {
- TaskCrashTestGame game = new TaskCrashTestGame();
- host.Run(game);
- }
- }
-
- private class TaskCrashTestGame : Game
- {
- private int frameCount;
-
- protected override void Update()
- {
- base.Update();
-
- Task.Run(() => throw new TestException());
-
- // only start counting frames once the task has completed, to allow some time for the unobserved exception to be handled.
- if (frameCount++ > 10)
- Exit();
- }
- }
-
[Test]
public void TestTaskExceptionLogging()
{
@@ -162,7 +138,7 @@ namespace osu.Framework.Tests.IO
void logTest(LogEntry entry)
{
- if (entry.Exception is AggregateException ex)
+ if (entry.Exception is TestException ex)
{
Assert.IsNull(resolvedException, "exception was forwarded more than once");
resolvedException = ex;
@@ -177,8 +153,7 @@ namespace osu.Framework.Tests.IO
// needs to be in a separate method so the Task gets GC'd.
performTaskException();
- GC.Collect();
- GC.WaitForPendingFinalizers();
+ collectAndFireUnobserved();
}
Assert.IsNotNull(resolvedException, "exception wasn't forwarded by logger");
@@ -237,5 +212,21 @@ namespace osu.Framework.Tests.IO
private class TestInnerException : Exception
{
}
+
+ [TearDown]
+ public void TearDown()
+ {
+ // Safety against any unobserved exceptions being left in the pipe.
+ collectAndFireUnobserved();
+ }
+
+ ///
+ /// Forcefully collect so the unobserved exception isn't handled by a future test execution.
+ ///
+ private static void collectAndFireUnobserved()
+ {
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+ }
}
}
diff --git a/osu.Framework.Tests/IO/TestSortedListSerialization.cs b/osu.Framework.Tests/IO/TestSortedListSerialization.cs
index c8585caca..98d5f8941 100644
--- a/osu.Framework.Tests/IO/TestSortedListSerialization.cs
+++ b/osu.Framework.Tests/IO/TestSortedListSerialization.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using Newtonsoft.Json;
using NUnit.Framework;
using osu.Framework.Lists;
diff --git a/osu.Framework.Tests/IO/TestWebRequest.cs b/osu.Framework.Tests/IO/TestWebRequest.cs
index 917ba8966..417ab837c 100644
--- a/osu.Framework.Tests/IO/TestWebRequest.cs
+++ b/osu.Framework.Tests/IO/TestWebRequest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -295,9 +297,7 @@ namespace osu.Framework.Tests.IO
bool hasThrown = false;
request.Failed += exception => hasThrown = exception != null;
-#pragma warning disable 4014
- request.PerformAsync();
-#pragma warning restore 4014
+ Task.Run(() => request.PerformAsync());
Assert.DoesNotThrow(request.Abort);
@@ -310,7 +310,38 @@ namespace osu.Framework.Tests.IO
}
///
- /// Tests being able to abort + restart a request.
+ /// Tests not being able to perform a request after an abort (before any perform).
+ ///
+ [Test, Retry(5)]
+ public void TestStartAfterAbort([Values(true, false)] bool async)
+ {
+ var request = new JsonWebRequest($"{default_protocol}://{host}/get")
+ {
+ Method = HttpMethod.Get,
+ AllowInsecureRequests = true,
+ };
+
+ bool hasThrown = false;
+ request.Failed += exception => hasThrown = exception != null;
+
+ Assert.DoesNotThrow(request.Abort);
+
+ if (async)
+ Assert.ThrowsAsync(() => request.PerformAsync());
+ else
+ Assert.Throws(request.Perform);
+
+ Assert.IsTrue(request.Completed);
+ Assert.IsTrue(request.Aborted);
+
+ var responseObject = request.ResponseObject;
+
+ Assert.IsTrue(responseObject == null);
+ Assert.IsFalse(hasThrown);
+ }
+
+ ///
+ /// Tests not being able to perform a request after an initial perform-abort sequence.
///
[Test, Retry(5)]
public void TestRestartAfterAbort([Values(true, false)] bool async)
@@ -324,16 +355,14 @@ namespace osu.Framework.Tests.IO
bool hasThrown = false;
request.Failed += exception => hasThrown = exception != null;
-#pragma warning disable 4014
- request.PerformAsync();
-#pragma warning restore 4014
+ Task.Run(() => request.PerformAsync());
Assert.DoesNotThrow(request.Abort);
if (async)
- Assert.ThrowsAsync(() => request.PerformAsync());
+ Assert.ThrowsAsync(() => request.PerformAsync());
else
- Assert.Throws(request.Perform);
+ Assert.Throws(request.Perform);
Assert.IsTrue(request.Completed);
Assert.IsTrue(request.Aborted);
@@ -402,7 +431,7 @@ namespace osu.Framework.Tests.IO
/// Tests being able to cancel + restart a request.
///
[Test, Retry(5)]
- public void TestRestartAfterAbort()
+ public void TestRestartAfterAbortViaCancellationToken()
{
var cancellationSource = new CancellationTokenSource();
var request = new JsonWebRequest($"{default_protocol}://{host}/get")
@@ -417,7 +446,7 @@ namespace osu.Framework.Tests.IO
cancellationSource.Cancel();
request.PerformAsync(cancellationSource.Token).WaitSafely();
- Assert.ThrowsAsync(() => request.PerformAsync(cancellationSource.Token));
+ Assert.ThrowsAsync(() => request.PerformAsync(cancellationSource.Token));
Assert.IsTrue(request.Completed);
Assert.IsTrue(request.Aborted);
@@ -494,9 +523,9 @@ namespace osu.Framework.Tests.IO
};
request.Started += () => { };
- request.Failed += e => { };
- request.DownloadProgress += (l1, l2) => { };
- request.UploadProgress += (l1, l2) => { };
+ request.Failed += _ => { };
+ request.DownloadProgress += (_, _) => { };
+ request.UploadProgress += (_, _) => { };
Assert.DoesNotThrow(request.Perform);
@@ -524,9 +553,9 @@ namespace osu.Framework.Tests.IO
using (request)
{
request.Started += () => { };
- request.Failed += e => { };
- request.DownloadProgress += (l1, l2) => { };
- request.UploadProgress += (l1, l2) => { };
+ request.Failed += _ => { };
+ request.DownloadProgress += (_, _) => { };
+ request.UploadProgress += (_, _) => { };
Assert.DoesNotThrow(request.Perform);
}
diff --git a/osu.Framework.Tests/IO/TextureStoreTest.cs b/osu.Framework.Tests/IO/TextureStoreTest.cs
new file mode 100644
index 000000000..780d6859a
--- /dev/null
+++ b/osu.Framework.Tests/IO/TextureStoreTest.cs
@@ -0,0 +1,73 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using System.Linq;
+using NUnit.Framework;
+using osu.Framework.Graphics;
+using osu.Framework.Graphics.Textures;
+using osu.Framework.IO.Stores;
+
+namespace osu.Framework.Tests.IO
+{
+ [TestFixture]
+ public class TextureStoreTest
+ {
+ private TextureLoaderStore fontResourceStore = null!;
+
+ [OneTimeSetUp]
+ public void OneTimeSetUp()
+ {
+ fontResourceStore = new TextureLoaderStore(new NamespacedResourceStore(new DllResourceStore(typeof(Drawable).Assembly), "Resources/Fonts"));
+ }
+
+ [Test]
+ public void TestLookupStores()
+ {
+ using (var lookupStore1 = new NamespacedResourceStore(fontResourceStore, "Roboto"))
+ using (var lookupStore2 = new NamespacedResourceStore(fontResourceStore, "RobotoCondensed"))
+ using (var textureStore = new TextureStore(scaleAdjust: 100))
+ {
+ textureStore.AddTextureSource(lookupStore1);
+ textureStore.AddTextureSource(lookupStore2);
+
+ Assert.That(textureStore.GetAvailableResources().Contains("Roboto-Regular_0.png"));
+ Assert.That(textureStore.GetStream("Roboto-Regular_0"), Is.Not.Null);
+
+ var normalSheet = textureStore.Get("Roboto-Regular_0");
+ Assert.That(normalSheet, Is.Not.Null);
+ Assert.That(normalSheet.ScaleAdjust, Is.EqualTo(100));
+
+ Assert.That(textureStore.GetAvailableResources().Contains("RobotoCondensed-Regular_0.png"));
+ Assert.That(textureStore.GetStream("RobotoCondensed-Regular_0"), Is.Not.Null);
+
+ var condensedSheet = textureStore.Get("RobotoCondensed-Regular_0");
+ Assert.That(condensedSheet, Is.Not.Null);
+ Assert.That(condensedSheet.ScaleAdjust, Is.EqualTo(100));
+ }
+ }
+
+ [Test]
+ public void TestNestedTextureStores()
+ {
+ using (var textureStore = new TextureStore(new NamespacedResourceStore(fontResourceStore, "Roboto"), scaleAdjust: 100))
+ using (var nestedTextureStore = new TextureStore(new NamespacedResourceStore(fontResourceStore, "RobotoCondensed"), scaleAdjust: 200))
+ {
+ textureStore.AddStore(nestedTextureStore);
+
+ Assert.That(textureStore.GetAvailableResources().Contains("Roboto-Regular_0.png"));
+ Assert.That(textureStore.GetStream("Roboto-Regular_0"), Is.Not.Null);
+
+ var normalSheet = textureStore.Get("Roboto-Regular_0");
+ Assert.That(normalSheet, Is.Not.Null);
+ Assert.That(normalSheet.ScaleAdjust, Is.EqualTo(100));
+
+ Assert.That(textureStore.GetAvailableResources().Contains("RobotoCondensed-Regular_0.png"));
+ Assert.That(textureStore.GetStream("RobotoCondensed-Regular_0"), Is.Not.Null);
+
+ var condensedSheet = textureStore.Get("RobotoCondensed-Regular_0");
+ Assert.That(condensedSheet, Is.Not.Null);
+ Assert.That(condensedSheet.ScaleAdjust, Is.EqualTo(200));
+ }
+ }
+ }
+}
diff --git a/osu.Framework.Tests/Input/JoystickInputTest.cs b/osu.Framework.Tests/Input/JoystickInputTest.cs
index 30cc8d41a..520b2113e 100644
--- a/osu.Framework.Tests/Input/JoystickInputTest.cs
+++ b/osu.Framework.Tests/Input/JoystickInputTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Input/KeyBindingInputTest.cs b/osu.Framework.Tests/Input/KeyBindingInputTest.cs
index 19dd49fe0..f211cb916 100644
--- a/osu.Framework.Tests/Input/KeyBindingInputTest.cs
+++ b/osu.Framework.Tests/Input/KeyBindingInputTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Input/KeyCombinationModifierTest.cs b/osu.Framework.Tests/Input/KeyCombinationModifierTest.cs
index b74e09260..6ae0e5e31 100644
--- a/osu.Framework.Tests/Input/KeyCombinationModifierTest.cs
+++ b/osu.Framework.Tests/Input/KeyCombinationModifierTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Input.Bindings;
diff --git a/osu.Framework.Tests/Input/KeyboardInputTest.cs b/osu.Framework.Tests/Input/KeyboardInputTest.cs
index 00d3987f4..fbe9a3b45 100644
--- a/osu.Framework.Tests/Input/KeyboardInputTest.cs
+++ b/osu.Framework.Tests/Input/KeyboardInputTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Input/MouseInputTest.cs b/osu.Framework.Tests/Input/MouseInputTest.cs
index b97ae8b3c..bbfedceb3 100644
--- a/osu.Framework.Tests/Input/MouseInputTest.cs
+++ b/osu.Framework.Tests/Input/MouseInputTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Input/ReadableKeyCombinationTest.cs b/osu.Framework.Tests/Input/ReadableKeyCombinationTest.cs
index 01d9eb8dd..a273b074d 100644
--- a/osu.Framework.Tests/Input/ReadableKeyCombinationTest.cs
+++ b/osu.Framework.Tests/Input/ReadableKeyCombinationTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
diff --git a/osu.Framework.Tests/Layout/TestSceneContainerLayout.cs b/osu.Framework.Tests/Layout/TestSceneContainerLayout.cs
index 376998632..3c4b661b5 100644
--- a/osu.Framework.Tests/Layout/TestSceneContainerLayout.cs
+++ b/osu.Framework.Tests/Layout/TestSceneContainerLayout.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Layout/TestSceneDrawableLayout.cs b/osu.Framework.Tests/Layout/TestSceneDrawableLayout.cs
index 8f324b325..0a730d87b 100644
--- a/osu.Framework.Tests/Layout/TestSceneDrawableLayout.cs
+++ b/osu.Framework.Tests/Layout/TestSceneDrawableLayout.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Layout/TestSceneGridContainerLayout.cs b/osu.Framework.Tests/Layout/TestSceneGridContainerLayout.cs
index c073d24af..550b6dcd4 100644
--- a/osu.Framework.Tests/Layout/TestSceneGridContainerLayout.cs
+++ b/osu.Framework.Tests/Layout/TestSceneGridContainerLayout.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Layout/TestSceneSpriteLayout.cs b/osu.Framework.Tests/Layout/TestSceneSpriteLayout.cs
index 08fbbd69d..99b9fb194 100644
--- a/osu.Framework.Tests/Layout/TestSceneSpriteLayout.cs
+++ b/osu.Framework.Tests/Layout/TestSceneSpriteLayout.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Lists/TestArrayExtensions.cs b/osu.Framework.Tests/Lists/TestArrayExtensions.cs
index 576f3d692..b894ca294 100644
--- a/osu.Framework.Tests/Lists/TestArrayExtensions.cs
+++ b/osu.Framework.Tests/Lists/TestArrayExtensions.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Linq;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Lists/TestEnumerableExtensions.cs b/osu.Framework.Tests/Lists/TestEnumerableExtensions.cs
index 83b0b437e..4bd2ce0c6 100644
--- a/osu.Framework.Tests/Lists/TestEnumerableExtensions.cs
+++ b/osu.Framework.Tests/Lists/TestEnumerableExtensions.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
diff --git a/osu.Framework.Tests/Lists/TestSortedList.cs b/osu.Framework.Tests/Lists/TestSortedList.cs
index b19f4bc3d..6ca89e31f 100644
--- a/osu.Framework.Tests/Lists/TestSortedList.cs
+++ b/osu.Framework.Tests/Lists/TestSortedList.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using osu.Framework.Lists;
diff --git a/osu.Framework.Tests/Lists/TestWeakList.cs b/osu.Framework.Tests/Lists/TestWeakList.cs
index 08e491804..4777dee7a 100644
--- a/osu.Framework.Tests/Lists/TestWeakList.cs
+++ b/osu.Framework.Tests/Lists/TestWeakList.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Localisation/LocalisableDescriptionAttributeTest.cs b/osu.Framework.Tests/Localisation/LocalisableDescriptionAttributeTest.cs
index 676dadab5..495a079c9 100644
--- a/osu.Framework.Tests/Localisation/LocalisableDescriptionAttributeTest.cs
+++ b/osu.Framework.Tests/Localisation/LocalisableDescriptionAttributeTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Extensions;
@@ -49,6 +51,13 @@ namespace osu.Framework.Tests.Localisation
Assert.Throws(() => EnumD.Item1.GetLocalisableDescription());
}
+ [Test]
+ public void TestLocalisableStringDescription()
+ {
+ object description = TestStrings.Romanisable;
+ Assert.AreEqual(description, description.GetLocalisableDescription());
+ }
+
public enum EnumA
{
Item1,
@@ -63,7 +72,7 @@ namespace osu.Framework.Tests.Localisation
Item1,
[LocalisableDescription(typeof(TestStrings), nameof(TestStrings.B))]
- Item2
+ Item2,
}
public enum EnumC
@@ -89,6 +98,8 @@ namespace osu.Framework.Tests.Localisation
public static readonly LocalisableString B = "Localised B";
+ public static LocalisableString Romanisable => new RomanisableString("Original", "Romanised");
+
public LocalisableString Instance => string.Empty;
}
}
diff --git a/osu.Framework.Tests/Localisation/LocalisableStringTest.cs b/osu.Framework.Tests/Localisation/LocalisableStringTest.cs
index f49c3e739..3ebf89e7c 100644
--- a/osu.Framework.Tests/Localisation/LocalisableStringTest.cs
+++ b/osu.Framework.Tests/Localisation/LocalisableStringTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Localisation;
diff --git a/osu.Framework.Tests/Localisation/LocalisationTest.cs b/osu.Framework.Tests/Localisation/LocalisationTest.cs
index 3ba5d094c..f689e926e 100644
--- a/osu.Framework.Tests/Localisation/LocalisationTest.cs
+++ b/osu.Framework.Tests/Localisation/LocalisationTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Globalization;
@@ -56,6 +58,32 @@ namespace osu.Framework.Tests.Localisation
Assert.AreEqual(FakeStorage.LOCALISABLE_STRING_JA_JP, localisedText.Value);
}
+ [Test]
+ public void TestConfigSettingRetainedWhenAddingLocaleMappings()
+ {
+ config.SetValue(FrameworkSetting.Locale, "ja-JP");
+
+ // ensure that adding a new language which doesn't match the user's choice doesn't cause the configuration value to get reset.
+ manager.AddLocaleMappings(new[]
+ {
+ new LocaleMapping("po", new FakeStorage("po-OP")),
+ new LocaleMapping("wa", new FakeStorage("wa-NG"))
+ });
+
+ Assert.AreEqual("ja-JP", config.Get(FrameworkSetting.Locale));
+
+ var localisedText = manager.GetLocalisedBindableString(new TranslatableString(FakeStorage.LOCALISABLE_STRING_EN, FakeStorage.LOCALISABLE_STRING_EN));
+ Assert.AreEqual(FakeStorage.LOCALISABLE_STRING_EN, localisedText.Value);
+
+ // ensure that if the user's selection is added in a further AddLanguage call, the manager correctly translates strings.
+ manager.AddLocaleMappings(new[]
+ {
+ new LocaleMapping("ja-JP", new FakeStorage("ja-JP"))
+ });
+
+ Assert.AreEqual(FakeStorage.LOCALISABLE_STRING_JA_JP, localisedText.Value);
+ }
+
[Test]
public void TestNotLocalised()
{
@@ -120,7 +148,8 @@ namespace osu.Framework.Tests.Localisation
string expectedResult = string.Format(FakeStorage.LOCALISABLE_FORMAT_STRING_JA, arg_0);
- var formattedText = manager.GetLocalisedBindableString(new TranslatableString(FakeStorage.LOCALISABLE_FORMAT_STRING_EN, interpolation: $"The {arg_0} fallback should only matches argument count"));
+ var formattedText = manager.GetLocalisedBindableString(new TranslatableString(FakeStorage.LOCALISABLE_FORMAT_STRING_EN,
+ interpolation: $"The {arg_0} fallback should only matches argument count"));
Assert.AreEqual(expectedResult, formattedText.Value);
}
diff --git a/osu.Framework.Tests/Localisation/ThreadCultureTest.cs b/osu.Framework.Tests/Localisation/ThreadCultureTest.cs
index 0ba342532..5a663f876 100644
--- a/osu.Framework.Tests/Localisation/ThreadCultureTest.cs
+++ b/osu.Framework.Tests/Localisation/ThreadCultureTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Concurrent;
using System.Globalization;
using System.Linq;
diff --git a/osu.Framework.Tests/MathUtils/TestInterpolation.cs b/osu.Framework.Tests/MathUtils/TestInterpolation.cs
index 054f1caaa..6f427293e 100644
--- a/osu.Framework.Tests/MathUtils/TestInterpolation.cs
+++ b/osu.Framework.Tests/MathUtils/TestInterpolation.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/MathUtils/TestPathApproximator.cs b/osu.Framework.Tests/MathUtils/TestPathApproximator.cs
index 2a58c2edb..b421d9dfc 100644
--- a/osu.Framework.Tests/MathUtils/TestPathApproximator.cs
+++ b/osu.Framework.Tests/MathUtils/TestPathApproximator.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Utils;
diff --git a/osu.Framework.Tests/Platform/ComponentAsyncDisposalTest.cs b/osu.Framework.Tests/Platform/ComponentAsyncDisposalTest.cs
index 30cd87374..7d654c628 100644
--- a/osu.Framework.Tests/Platform/ComponentAsyncDisposalTest.cs
+++ b/osu.Framework.Tests/Platform/ComponentAsyncDisposalTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Platform/GameExitTest.cs b/osu.Framework.Tests/Platform/GameExitTest.cs
index ce538fcaf..62ec625a8 100644
--- a/osu.Framework.Tests/Platform/GameExitTest.cs
+++ b/osu.Framework.Tests/Platform/GameExitTest.cs
@@ -1,10 +1,11 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
-using osu.Framework.Extensions;
using osu.Framework.Platform;
using osu.Framework.Testing;
@@ -40,9 +41,7 @@ namespace osu.Framework.Tests.Platform
// block game from exiting.
game.BlockExit.Value = true;
- // `RequestExit()` should return true.
- Assert.That(host.RequestExit(), Is.True);
- // game's last exit result should match.
+ requestExit();
Assert.That(game.LastExitResult, Is.True);
// exit should be blocked.
@@ -51,9 +50,7 @@ namespace osu.Framework.Tests.Platform
// unblock game from exiting.
game.BlockExit.Value = false;
- // `RequestExit()` should not be blocked and return false.
- Assert.That(host.RequestExit(), Is.False);
- // game's last exit result should match.
+ requestExit();
Assert.That(game.LastExitResult, Is.False);
// finally, the game should exit.
@@ -61,23 +58,24 @@ namespace osu.Framework.Tests.Platform
Assert.That(host.ExecutionState, Is.EqualTo(ExecutionState.Stopped));
}
+ private void requestExit()
+ {
+ host.RequestExit();
+
+ // wait for the event to be handled by the game (on the update thread)
+ Assert.That(game.ExitRequested.Wait(timeout), Is.True);
+ game.ExitRequested.Reset();
+ }
+
private class ManualExitHeadlessGameHost : TestRunHeadlessGameHost
{
- public bool RequestExit()
- {
- // The exit request has to come from the thread that is also running the game host
- // to avoid corrupting the host's internal state.
- // Therefore, use a task completion source as an intermediary that can be used
- // to request the exit on the correct thread and wait for the result of the exit operation.
- var exitRequestTask = new TaskCompletionSource();
- InputThread.Scheduler.Add(() => exitRequestTask.SetResult(OnExitRequested()));
- return exitRequestTask.Task.GetResultSafely();
- }
+ public void RequestExit() => OnExitRequested();
}
private class TestTestGame : TestGame
{
public readonly ManualResetEventSlim BecameAlive = new ManualResetEventSlim();
+ public readonly ManualResetEventSlim ExitRequested = new ManualResetEventSlim();
public bool? LastExitResult { get; private set; }
@@ -90,6 +88,7 @@ namespace osu.Framework.Tests.Platform
{
bool result = base.OnExiting();
LastExitResult = result;
+ ExitRequested.Set();
return result;
}
}
diff --git a/osu.Framework.Tests/Platform/GameHostSuspendTest.cs b/osu.Framework.Tests/Platform/GameHostSuspendTest.cs
index 3304ea624..f537d3240 100644
--- a/osu.Framework.Tests/Platform/GameHostSuspendTest.cs
+++ b/osu.Framework.Tests/Platform/GameHostSuspendTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
diff --git a/osu.Framework.Tests/Platform/HeadlessGameHostTest.cs b/osu.Framework.Tests/Platform/HeadlessGameHostTest.cs
index 5a31b7f1c..ab8ca8ed6 100644
--- a/osu.Framework.Tests/Platform/HeadlessGameHostTest.cs
+++ b/osu.Framework.Tests/Platform/HeadlessGameHostTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
@@ -110,7 +112,8 @@ namespace osu.Framework.Tests.Platform
await clientChannel.SendMessageAsync(new Foobar { Bar = "example" }).ConfigureAwait(false);
- received.Wait();
+ if (!received.Wait(10000))
+ throw new TimeoutException("Message was not received in a timely fashion");
}
}
diff --git a/osu.Framework.Tests/Platform/PortableInstallationTest.cs b/osu.Framework.Tests/Platform/PortableInstallationTest.cs
index d686e4b35..8ee2c2304 100644
--- a/osu.Framework.Tests/Platform/PortableInstallationTest.cs
+++ b/osu.Framework.Tests/Platform/PortableInstallationTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Configuration;
using osu.Framework.Platform;
diff --git a/osu.Framework.Tests/Platform/UserInputManagerTest.cs b/osu.Framework.Tests/Platform/UserInputManagerTest.cs
index a3f6e91b7..d35758dc7 100644
--- a/osu.Framework.Tests/Platform/UserInputManagerTest.cs
+++ b/osu.Framework.Tests/Platform/UserInputManagerTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Testing;
diff --git a/osu.Framework.Tests/Platform/UserStorageLookupTest.cs b/osu.Framework.Tests/Platform/UserStorageLookupTest.cs
index ad85d3838..0ecf20ce2 100644
--- a/osu.Framework.Tests/Platform/UserStorageLookupTest.cs
+++ b/osu.Framework.Tests/Platform/UserStorageLookupTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.IO;
diff --git a/osu.Framework.Tests/Polygons/ConvexPolygonClipperFuzzingTest.cs b/osu.Framework.Tests/Polygons/ConvexPolygonClipperFuzzingTest.cs
new file mode 100644
index 000000000..b0f09b335
--- /dev/null
+++ b/osu.Framework.Tests/Polygons/ConvexPolygonClipperFuzzingTest.cs
@@ -0,0 +1,118 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using NUnit.Framework;
+using osu.Framework.Graphics.Primitives;
+using osu.Framework.Utils;
+using osuTK;
+
+namespace osu.Framework.Tests.Polygons
+{
+ [TestFixture]
+ [Ignore("This test will never complete if working correctly. Test manually if required.")]
+ public class ConvexPolygonClipperFuzzingTest
+ {
+ private const int parallelism = 4;
+
+ private static readonly float[] possible_values =
+ {
+ float.NegativeInfinity,
+ float.MinValue,
+ float.MinValue / 2,
+ -10.0f,
+ -2.0f,
+ -1.0f,
+ -0.5f,
+ -0.1f,
+ 0.0f,
+ float.Epsilon,
+ 0.1f,
+ 0.5f,
+ 1.0f,
+ 2.0f,
+ 10.0f,
+ float.MaxValue / 2,
+ float.MaxValue,
+ float.PositiveInfinity,
+ float.NaN,
+ };
+
+ private static readonly int[] possible_sizes =
+ {
+ 3,
+ 4,
+ 5,
+ 8,
+ 16
+ };
+
+ [Test]
+ public void RunTest()
+ {
+ Task[] tasks = new Task[parallelism];
+
+ for (int i = 0; i < tasks.Length; i++)
+ {
+ tasks[i] = Task.Factory.StartNew(() =>
+ {
+ while (true)
+ {
+ int count1 = getRand(possible_sizes);
+ int count2 = getRand(possible_sizes);
+
+ HashSet vertices1 = new HashSet();
+ HashSet vertices2 = new HashSet();
+
+ while (vertices1.Count < count1)
+ vertices1.Add(new Vector2(getRand(possible_values), getRand(possible_values)));
+
+ while (vertices2.Count < count2)
+ vertices2.Add(new Vector2(getRand(possible_values), getRand(possible_values)));
+
+ SimpleConvexPolygon poly1 = new SimpleConvexPolygon(vertices1.ToArray());
+ SimpleConvexPolygon poly2 = new SimpleConvexPolygon(vertices2.ToArray());
+
+ try
+ {
+ clip(poly1, poly2);
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail($"Failed.\nPoly1: {poly1}\nPoly2: {poly2}\n\nException: {ex}");
+ return;
+ }
+
+ try
+ {
+ clip(poly2, poly1);
+ }
+ catch (Exception ex)
+ {
+ Assert.Fail($"Failed.\nPoly1: {poly2}\nPoly2: {poly1}\n\nException: {ex}");
+ return;
+ }
+ }
+ }, TaskCreationOptions.LongRunning);
+ }
+
+ Task.WaitAny(tasks);
+ }
+
+ private static Vector2[] clip(SimpleConvexPolygon poly1, SimpleConvexPolygon poly2)
+ {
+ var clipper = new ConvexPolygonClipper(ref poly1, ref poly2);
+
+ Span buffer = stackalloc Vector2[clipper.GetClipBufferSize()];
+
+ return clipper.Clip(buffer).ToArray();
+ }
+
+ private static T getRand(T[] arr) => arr[RNG.Next(0, arr.Length)];
+ }
+}
diff --git a/osu.Framework.Tests/Polygons/ConvexPolygonClippingTest.cs b/osu.Framework.Tests/Polygons/ConvexPolygonClippingTest.cs
index dc002e89d..8ad7b8d3e 100644
--- a/osu.Framework.Tests/Polygons/ConvexPolygonClippingTest.cs
+++ b/osu.Framework.Tests/Polygons/ConvexPolygonClippingTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
@@ -241,6 +243,64 @@ namespace osu.Framework.Tests.Polygons
false);
}
+ private static object[] fuzzedEdgeCases => new object[]
+ {
+ new object[]
+ {
+ new[] { new Vector2(0, 0.5f), new Vector2(100, 1), new Vector2(2, 2), new Vector2(1, 2) },
+ new[] { new Vector2(0, 0.5f), new Vector2(100, 0), new Vector2(0.5f, 100) },
+ },
+ new object[]
+ {
+ new[] { new Vector2(0, 1), new Vector2(100, 0), new Vector2(100, 2), new Vector2(2, 2) },
+ new[] { new Vector2(1, 100), new Vector2(2, 0.5f), new Vector2(100, 2) },
+ },
+ new object[]
+ {
+ new[] { new Vector2(0, 1), new Vector2(2, 0.5f), new Vector2(100, 0), new Vector2(1, 2) },
+ new[] { new Vector2(1, 0.5f), new Vector2(100, 0), new Vector2(1, 100) },
+ },
+ new object[]
+ {
+ new[] { new Vector2(0, 1), new Vector2(0, 0), new Vector2(2, 1), new Vector2(1, 2) },
+ new[] { new Vector2(0.5f, 2), new Vector2(100, 0.5f), new Vector2(1, 0.5f), new Vector2(100, 2) },
+ },
+ new object[]
+ {
+ new[] { new Vector2(2, float.MinValue), new Vector2(float.MaxValue, 0.5f), new Vector2(float.MaxValue, float.NegativeInfinity), new Vector2(1, float.MaxValue) },
+ new[] { new Vector2(0, 1), new Vector2(0, float.NegativeInfinity), new Vector2(float.Epsilon, 1), new Vector2(1, 0.5f) },
+ },
+ new object[]
+ {
+ new[] { new Vector2(float.Epsilon, 0.5f), new Vector2(float.Epsilon, 100), new Vector2(float.MaxValue, float.NegativeInfinity), new Vector2(1, float.MaxValue) },
+ new[] { new Vector2(0, 1), new Vector2(0, float.NegativeInfinity), new Vector2(float.Epsilon, 1), new Vector2(1, 0.5f) },
+ },
+ new object[]
+ {
+ new[] { new Vector2(-0.1f, 2), new Vector2(0, 0), new Vector2(0.5f, -0.1f) },
+ new[] { new Vector2(-10, 2), new Vector2(-0.5f, 0.1f), new Vector2(0.5f, 0.5f) }
+ },
+ new object[]
+ {
+ new[] { new Vector2(-10, 1), new Vector2(0.1f, 0), new Vector2(-0.5f, 2) },
+ new[] { new Vector2(-1, 2), new Vector2(-0.1f, -0.5f), new Vector2(0.1f, 0) }
+ },
+ new object[]
+ {
+ new[] { new Vector2(-1, 0.5f), new Vector2(0.1f, 0.1f), new Vector2(0, 1) },
+ new[] { new Vector2(-2, -0.5f), new Vector2(0.1f, 0.1f), new Vector2(-0.1f, 1) }
+ }
+ };
+
+ [TestCaseSource(nameof(fuzzedEdgeCases))]
+ public void TestFuzzedEdgeCases(Vector2[] clipVertices, Vector2[] subjectVertices)
+ {
+ var clipPolygon = new SimpleConvexPolygon(clipVertices);
+ var subjectPolygon = new SimpleConvexPolygon(subjectVertices);
+
+ clip(clipPolygon, subjectPolygon);
+ }
+
private Span clip(SimpleConvexPolygon clipPolygon, SimpleConvexPolygon subjectPolygon)
=> new ConvexPolygonClipper(ref clipPolygon, ref subjectPolygon).Clip();
diff --git a/osu.Framework.Tests/Polygons/LineIntersections.cs b/osu.Framework.Tests/Polygons/LineIntersections.cs
index d19007d58..025043fe2 100644
--- a/osu.Framework.Tests/Polygons/LineIntersections.cs
+++ b/osu.Framework.Tests/Polygons/LineIntersections.cs
@@ -1,7 +1,10 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
+using osu.Framework.Graphics;
using osu.Framework.Graphics.Primitives;
using osuTK;
@@ -56,7 +59,7 @@ namespace osu.Framework.Tests.Polygons
new object[] { new Line(up_1, origin), new Line(origin, up_1), false, 0f },
new object[] { new Line(origin, up_1), new Line(up_1, origin), false, 0f },
new object[] { new Line(up_1, origin), new Line(up_1, origin), false, 0f },
- // Colinear touching
+ // Collinear touching
new object[] { new Line(origin, up_1), new Line(origin, down_1), false, 0f },
new object[] { new Line(origin, up_1), new Line(down_1, origin), false, 0f },
};
@@ -69,5 +72,12 @@ namespace osu.Framework.Tests.Polygons
Assert.That(success, Is.EqualTo(expectedResult));
Assert.That(t, Is.EqualTo(expectedT));
}
+
+ [Test]
+ public void TestCollinearPointNotInRightHalfPlane()
+ {
+ Line line = new Line(new Vector2(-0.5f, 0.1f), new Vector2(-10, 2));
+ Assert.That(new Vector2(0.5f, -0.1f).InRightHalfPlaneOf(line), Is.False);
+ }
}
}
diff --git a/osu.Framework.Tests/Primitives/QuadTest.cs b/osu.Framework.Tests/Primitives/QuadTest.cs
index d69a2a9f0..6a31e455c 100644
--- a/osu.Framework.Tests/Primitives/QuadTest.cs
+++ b/osu.Framework.Tests/Primitives/QuadTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections;
using NUnit.Framework;
using osu.Framework.Extensions.MatrixExtensions;
diff --git a/osu.Framework.Tests/Primitives/TriangleTest.cs b/osu.Framework.Tests/Primitives/TriangleTest.cs
index 91d66cfab..1ac187efd 100644
--- a/osu.Framework.Tests/Primitives/TriangleTest.cs
+++ b/osu.Framework.Tests/Primitives/TriangleTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics.Primitives;
using osuTK;
diff --git a/osu.Framework.Tests/Primitives/Vector2ExtensionsTest.cs b/osu.Framework.Tests/Primitives/Vector2ExtensionsTest.cs
index 719d479d7..81a473792 100644
--- a/osu.Framework.Tests/Primitives/Vector2ExtensionsTest.cs
+++ b/osu.Framework.Tests/Primitives/Vector2ExtensionsTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Program.cs b/osu.Framework.Tests/Program.cs
index 8fb25e4db..1743924e2 100644
--- a/osu.Framework.Tests/Program.cs
+++ b/osu.Framework.Tests/Program.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Linq;
using osu.Framework.Platform;
diff --git a/osu.Framework.Tests/Shaders/TestSceneShaderDisposal.cs b/osu.Framework.Tests/Shaders/TestSceneShaderDisposal.cs
index a43db97fc..15d48ad28 100644
--- a/osu.Framework.Tests/Shaders/TestSceneShaderDisposal.cs
+++ b/osu.Framework.Tests/Shaders/TestSceneShaderDisposal.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Sprites/TestSceneSpriteTextPresence.cs b/osu.Framework.Tests/Sprites/TestSceneSpriteTextPresence.cs
index 2e1bee049..c675db517 100644
--- a/osu.Framework.Tests/Sprites/TestSceneSpriteTextPresence.cs
+++ b/osu.Framework.Tests/Sprites/TestSceneSpriteTextPresence.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/TestGame.cs b/osu.Framework.Tests/TestGame.cs
index 8183f4e45..b2a09a141 100644
--- a/osu.Framework.Tests/TestGame.cs
+++ b/osu.Framework.Tests/TestGame.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.IO.Stores;
diff --git a/osu.Framework.Tests/Text/TextBuilderTest.cs b/osu.Framework.Tests/Text/TextBuilderTest.cs
index 1c1e37d1d..c8d2c6e74 100644
--- a/osu.Framework.Tests/Text/TextBuilderTest.cs
+++ b/osu.Framework.Tests/Text/TextBuilderTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Linq;
using System.Threading.Tasks;
diff --git a/osu.Framework.Tests/Threading/AsyncDisposalQueueTest.cs b/osu.Framework.Tests/Threading/AsyncDisposalQueueTest.cs
index d554767d5..b092fe6a1 100644
--- a/osu.Framework.Tests/Threading/AsyncDisposalQueueTest.cs
+++ b/osu.Framework.Tests/Threading/AsyncDisposalQueueTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Threading/SchedulerTest.cs b/osu.Framework.Tests/Threading/SchedulerTest.cs
index bb4641bf5..b2b25d6dd 100644
--- a/osu.Framework.Tests/Threading/SchedulerTest.cs
+++ b/osu.Framework.Tests/Threading/SchedulerTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Logging;
diff --git a/osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs b/osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs
index 4e8733e3e..380b0871d 100644
--- a/osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs
+++ b/osu.Framework.Tests/Threading/ThreadedTaskSchedulerTest.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Transforms/TestSceneTransformEventBindings.cs b/osu.Framework.Tests/Transforms/TestSceneTransformEventBindings.cs
index 6fea2a255..b92482358 100644
--- a/osu.Framework.Tests/Transforms/TestSceneTransformEventBindings.cs
+++ b/osu.Framework.Tests/Transforms/TestSceneTransformEventBindings.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@@ -41,7 +43,7 @@ namespace osu.Framework.Tests.Transforms
Child = container = new Container();
completedFired = 0;
- container.FadeIn(500).Then().FadeOut().OnComplete(a => { completedFired++; });
+ container.FadeIn(500).Then().FadeOut().OnComplete(_ => { completedFired++; });
});
AddAssert("not immediately fired", () => completedFired == 0);
diff --git a/osu.Framework.Tests/Visual/Audio/TestSceneAudioMixer.cs b/osu.Framework.Tests/Visual/Audio/TestSceneAudioMixer.cs
index 065f366e7..147b57dc7 100644
--- a/osu.Framework.Tests/Visual/Audio/TestSceneAudioMixer.cs
+++ b/osu.Framework.Tests/Visual/Audio/TestSceneAudioMixer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using ManagedBass;
using ManagedBass.Fx;
diff --git a/osu.Framework.Tests/Visual/Audio/TestSceneSampleAmplitudes.cs b/osu.Framework.Tests/Visual/Audio/TestSceneSampleAmplitudes.cs
index bf5925edf..3b4aed7a0 100644
--- a/osu.Framework.Tests/Visual/Audio/TestSceneSampleAmplitudes.cs
+++ b/osu.Framework.Tests/Visual/Audio/TestSceneSampleAmplitudes.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio.Sample;
diff --git a/osu.Framework.Tests/Visual/Audio/TestSceneSampleChannels.cs b/osu.Framework.Tests/Visual/Audio/TestSceneSampleChannels.cs
index 9e46c5c6c..be046822f 100644
--- a/osu.Framework.Tests/Visual/Audio/TestSceneSampleChannels.cs
+++ b/osu.Framework.Tests/Visual/Audio/TestSceneSampleChannels.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Allocation;
diff --git a/osu.Framework.Tests/Visual/Audio/TestSceneSampleLooping.cs b/osu.Framework.Tests/Visual/Audio/TestSceneSampleLooping.cs
index 380419039..bcc2b5dca 100644
--- a/osu.Framework.Tests/Visual/Audio/TestSceneSampleLooping.cs
+++ b/osu.Framework.Tests/Visual/Audio/TestSceneSampleLooping.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
diff --git a/osu.Framework.Tests/Visual/Audio/TestSceneSamples.cs b/osu.Framework.Tests/Visual/Audio/TestSceneSamples.cs
index dfa294c10..165f07e1d 100644
--- a/osu.Framework.Tests/Visual/Audio/TestSceneSamples.cs
+++ b/osu.Framework.Tests/Visual/Audio/TestSceneSamples.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio;
diff --git a/osu.Framework.Tests/Visual/Audio/TestSceneTrackAdjustments.cs b/osu.Framework.Tests/Visual/Audio/TestSceneTrackAdjustments.cs
index 10554b353..271ec1f41 100644
--- a/osu.Framework.Tests/Visual/Audio/TestSceneTrackAdjustments.cs
+++ b/osu.Framework.Tests/Visual/Audio/TestSceneTrackAdjustments.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Visual/Audio/TestSceneTrackAmplitudes.cs b/osu.Framework.Tests/Visual/Audio/TestSceneTrackAmplitudes.cs
index 888de7048..6a545105f 100644
--- a/osu.Framework.Tests/Visual/Audio/TestSceneTrackAmplitudes.cs
+++ b/osu.Framework.Tests/Visual/Audio/TestSceneTrackAmplitudes.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
diff --git a/osu.Framework.Tests/Visual/Bindables/TestSceneBindableAutoUnbinding.cs b/osu.Framework.Tests/Visual/Bindables/TestSceneBindableAutoUnbinding.cs
index 18687c386..6f59fff87 100644
--- a/osu.Framework.Tests/Visual/Bindables/TestSceneBindableAutoUnbinding.cs
+++ b/osu.Framework.Tests/Visual/Bindables/TestSceneBindableAutoUnbinding.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Visual/Bindables/TestSceneBindableNumbers.cs b/osu.Framework.Tests/Visual/Bindables/TestSceneBindableNumbers.cs
index b0cc82d27..7c568b99e 100644
--- a/osu.Framework.Tests/Visual/Bindables/TestSceneBindableNumbers.cs
+++ b/osu.Framework.Tests/Visual/Bindables/TestSceneBindableNumbers.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Globalization;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Visual/Clocks/LaggyFramedClock.cs b/osu.Framework.Tests/Visual/Clocks/LaggyFramedClock.cs
index 139129660..ce97d6bf2 100644
--- a/osu.Framework.Tests/Visual/Clocks/LaggyFramedClock.cs
+++ b/osu.Framework.Tests/Visual/Clocks/LaggyFramedClock.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Timing;
namespace osu.Framework.Tests.Visual.Clocks
diff --git a/osu.Framework.Tests/Visual/Clocks/TestSceneClock.cs b/osu.Framework.Tests/Visual/Clocks/TestSceneClock.cs
index 68e540cce..66f8bcf41 100644
--- a/osu.Framework.Tests/Visual/Clocks/TestSceneClock.cs
+++ b/osu.Framework.Tests/Visual/Clocks/TestSceneClock.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Clocks/TestSceneClocks.cs b/osu.Framework.Tests/Visual/Clocks/TestSceneClocks.cs
index 719e39d7e..ccde6c823 100644
--- a/osu.Framework.Tests/Visual/Clocks/TestSceneClocks.cs
+++ b/osu.Framework.Tests/Visual/Clocks/TestSceneClocks.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Timing;
namespace osu.Framework.Tests.Visual.Clocks
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneBufferedContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneBufferedContainer.cs
index eee36160c..f4626bd9c 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneBufferedContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneBufferedContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osuTK;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneCachedBufferedContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneCachedBufferedContainer.cs
index 6a6ec4417..3ce61c0f0 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneCachedBufferedContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneCachedBufferedContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneCircularContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneCircularContainer.cs
index ddc522dc4..9a02ddff3 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneCircularContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneCircularContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneCircularContainerSizing.cs b/osu.Framework.Tests/Visual/Containers/TestSceneCircularContainerSizing.cs
index 120a587bd..c8e5ec960 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneCircularContainerSizing.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneCircularContainerSizing.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneCompositeDrawable.cs b/osu.Framework.Tests/Visual/Containers/TestSceneCompositeDrawable.cs
index 2e2b22d62..42fa0329a 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneCompositeDrawable.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneCompositeDrawable.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneCoordinateSpaces.cs b/osu.Framework.Tests/Visual/Containers/TestSceneCoordinateSpaces.cs
index f30e59c26..0a6c5dd18 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneCoordinateSpaces.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneCoordinateSpaces.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Globalization;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneCursorContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneCursorContainer.cs
index ae3b1314d..232468500 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneCursorContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneCursorContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneCustomizableTextContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneCustomizableTextContainer.cs
index d840ce46e..046f3ba6e 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneCustomizableTextContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneCustomizableTextContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneDrawSizePreservingFillContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneDrawSizePreservingFillContainer.cs
index 7a9afa775..5a487f7f8 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneDrawSizePreservingFillContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneDrawSizePreservingFillContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneDynamicDepth.cs b/osu.Framework.Tests/Visual/Containers/TestSceneDynamicDepth.cs
index 7b6ecdf47..7ebdcb42c 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneDynamicDepth.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneDynamicDepth.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBack.cs b/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBack.cs
index bb7a19761..4b063cb02 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBack.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBack.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackBox.cs b/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackBox.cs
index 8f29609cb..bb3c11bfd 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackBox.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackBox.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Allocation;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackBufferedContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackBufferedContainer.cs
index 4dac0f217..b01008cb9 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackBufferedContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackBufferedContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackTriangle.cs b/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackTriangle.cs
index d87fef535..3aa327882 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackTriangle.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneFrontToBackTriangle.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneLifetimeManagementContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneLifetimeManagementContainer.cs
index 3677452ae..12d241000 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneLifetimeManagementContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneLifetimeManagementContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneMasking.cs b/osu.Framework.Tests/Visual/Containers/TestSceneMasking.cs
index 0eaabbbae..2ca117832 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneMasking.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneMasking.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Containers/TestScenePadding.cs b/osu.Framework.Tests/Visual/Containers/TestScenePadding.cs
index e4387ad8c..9e87fac85 100644
--- a/osu.Framework.Tests/Visual/Containers/TestScenePadding.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestScenePadding.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneSafeAreaContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneSafeAreaContainer.cs
index 475fa20ef..b8f87bb24 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneSafeAreaContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneSafeAreaContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneSafeAreaOverrides.cs b/osu.Framework.Tests/Visual/Containers/TestSceneSafeAreaOverrides.cs
index 88c2339a7..852313188 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneSafeAreaOverrides.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneSafeAreaOverrides.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneScrollContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneScrollContainer.cs
index 09660da23..0089c4e20 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneScrollContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneScrollContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Diagnostics;
using System.Linq;
@@ -140,9 +142,9 @@ namespace osu.Framework.Tests.Visual.Containers
InputManager.MoveMouseTo(scrollContainer.ToScreenSpace(scrollContainer.LayoutRectangle.Centre + new Vector2(10f)));
});
- AddStep("Move mouse up", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre - new Vector2(0, 400)));
+ AddStep("Move mouse up", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre - new Vector2(0, 1000)));
checkPosition(withClampExtension ? 200 : 100);
- AddStep("Move mouse down", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre + new Vector2(0, 400)));
+ AddStep("Move mouse down", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre + new Vector2(0, 1000)));
checkPosition(withClampExtension ? -100 : 0);
AddStep("Release mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
checkPosition(0);
@@ -451,6 +453,135 @@ namespace osu.Framework.Tests.Visual.Containers
static bool checkScrollCurrent(BasicScrollContainer scrolled, BasicScrollContainer notScrolled) => notScrolled.Current == 0 && Precision.DefinitelyBigger(scrolled.Current, 0f);
}
+ ///
+ /// Ensures that initiating a drag with horizontal delta on a singular vertical doesn't prevent from continuing with vertical drags.
+ ///
+ ///
+ /// If the vertical scroll container is nested inside of a horizontal one, then it should prevent it, as covered in .
+ ///
+ [TestCase(false)]
+ [TestCase(true)]
+ public void TestSingularVerticalScrollWithHorizontalDelta(bool withClampExtension)
+ {
+ AddStep("Create scroll container", () =>
+ {
+ Add(scrollContainer = new BasicScrollContainer
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(200),
+ ClampExtension = withClampExtension ? 100 : 0,
+ Child = new Box { Size = new Vector2(200, 300) }
+ });
+ });
+
+ AddStep("Click and drag horizontally", () =>
+ {
+ InputManager.MoveMouseTo(scrollContainer);
+ InputManager.PressButton(MouseButton.Left);
+
+ // Required for the dragging state to be set correctly.
+ InputManager.MoveMouseTo(scrollContainer.ToScreenSpace(scrollContainer.LayoutRectangle.Centre + new Vector2(20f, 0f)));
+ });
+
+ AddStep("Move mouse up", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre - new Vector2(0, 1000)));
+ checkPosition(withClampExtension ? 200 : 100);
+ AddStep("Move mouse down", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre + new Vector2(0, 1000)));
+ checkPosition(withClampExtension ? -100 : 0);
+
+ AddStep("Move mouse diagonally up", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre - new Vector2(2000, 1000)));
+ checkPosition(withClampExtension ? 200 : 100);
+ AddStep("Move mouse diagonally down", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre + new Vector2(2000, 1000)));
+ checkPosition(withClampExtension ? -100 : 0);
+
+ AddStep("Release mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
+ checkPosition(0);
+
+ AddStep("Hover over scroll container", () => InputManager.MoveMouseTo(scrollContainer));
+ AddStep("Scroll diagonally down", () => InputManager.ScrollBy(new Vector2(-20, -10)));
+ checkPosition(100);
+ AddStep("Scroll diagonally up", () => InputManager.ScrollBy(new Vector2(20, 10)));
+ checkPosition(0);
+ }
+
+ [Test]
+ public void TestDragHandlingUpdatesOnParentChanges()
+ {
+ BasicScrollContainer horizontalScrollContainer = null;
+
+ AddStep("Create scroll container", () =>
+ {
+ Add(scrollContainer = new BasicScrollContainer
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(200),
+ ClampExtension = 0,
+ Child = new Box { Size = new Vector2(200, 300) }
+ });
+ });
+
+ AddStep("Click and drag horizontally", () =>
+ {
+ InputManager.MoveMouseTo(scrollContainer);
+ InputManager.PressButton(MouseButton.Left);
+
+ // Required for the dragging state to be set correctly.
+ InputManager.MoveMouseTo(scrollContainer.ToScreenSpace(scrollContainer.LayoutRectangle.Centre + new Vector2(20f, 0f)));
+ });
+
+ AddStep("Move mouse diagonally up", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre - new Vector2(1000, 1000)));
+ checkPosition(100);
+ AddStep("Move mouse diagonally down", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre + new Vector2(1000, 1000)));
+ checkPosition(0);
+
+ AddStep("Release mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
+ checkPosition(0);
+
+ AddStep("Nest vertical scroll inside of horizontal", () =>
+ {
+ Remove(scrollContainer);
+
+ Add(horizontalScrollContainer = new BasicScrollContainer(Direction.Horizontal)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Size = new Vector2(400),
+ ClampExtension = 0,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ Size = new Vector2(500, 400),
+ Colour = FrameworkColour.Yellow,
+ },
+ scrollContainer
+ },
+ });
+ });
+
+ AddStep("Click and drag horizontally", () =>
+ {
+ InputManager.MoveMouseTo(scrollContainer);
+ InputManager.PressButton(MouseButton.Left);
+
+ // Required for the dragging state to be set correctly.
+ InputManager.MoveMouseTo(scrollContainer.ToScreenSpace(scrollContainer.LayoutRectangle.Centre + new Vector2(20f, 0f)));
+ });
+
+ AddStep("Move mouse diagonally up", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre - new Vector2(1000, 1000)));
+ AddUntilStep("horizontal position at 100", () => Precision.AlmostEquals(100, horizontalScrollContainer.Current, 1));
+ AddUntilStep("vertical position at 0", () => Precision.AlmostEquals(0, scrollContainer.Current, 1));
+
+ AddStep("Move mouse diagonally down", () => InputManager.MoveMouseTo(scrollContainer.ScreenSpaceDrawQuad.Centre + new Vector2(1000, 1000)));
+ AddUntilStep("horizontal position at 0", () => Precision.AlmostEquals(0, horizontalScrollContainer.Current, 1));
+ AddUntilStep("vertical position at 0", () => Precision.AlmostEquals(0, scrollContainer.Current, 1));
+
+ AddStep("Release mouse button", () => InputManager.ReleaseButton(MouseButton.Left));
+ AddUntilStep("horizontal position at 0", () => Precision.AlmostEquals(0, horizontalScrollContainer.Current, 1));
+ AddUntilStep("vertical position at 0", () => Precision.AlmostEquals(0, scrollContainer.Current, 1));
+ }
+
private void scrollIntoView(int index, float expectedPosition, float? heightAdjust = null, float? expectedPostAdjustPosition = null)
{
if (heightAdjust != null)
@@ -484,7 +615,7 @@ namespace osu.Framework.Tests.Visual.Containers
AddAssert($"immediately scrolled to {clampedTarget}", () => Precision.AlmostEquals(clampedTarget, immediateScrollPosition, 1));
}
- private void checkPosition(float expected) => AddUntilStep($"position at {expected}", () => Precision.AlmostEquals(expected, scrollContainer.Current, 1));
+ private void checkPosition(float expected, ScrollContainer scroll = null) => AddUntilStep($"position at {expected}", () => Precision.AlmostEquals(expected, (scroll ?? scrollContainer).Current, 1));
private void checkScrollbarPosition(float expected) =>
AddUntilStep($"scrollbar position at {expected}", () => Precision.AlmostEquals(expected, scrollContainer.InternalChildren[1].DrawPosition.Y, 1));
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneSizing.cs b/osu.Framework.Tests/Visual/Containers/TestSceneSizing.cs
index 529af6b21..c9865ff6b 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneSizing.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneSizing.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneTextFlowContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneTextFlowContainer.cs
index 4f595111d..c217c0eae 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneTextFlowContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneTextFlowContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using NUnit.Framework;
using osu.Framework.Extensions.Color4Extensions;
diff --git a/osu.Framework.Tests/Visual/Containers/TestSceneVisibilityContainer.cs b/osu.Framework.Tests/Visual/Containers/TestSceneVisibilityContainer.cs
index 92b87ef41..9ecb0f8db 100644
--- a/osu.Framework.Tests/Visual/Containers/TestSceneVisibilityContainer.cs
+++ b/osu.Framework.Tests/Visual/Containers/TestSceneVisibilityContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
@@ -186,7 +188,7 @@ namespace osu.Framework.Tests.Visual.Containers
},
};
- State.ValueChanged += e => FireCount++;
+ State.ValueChanged += _ => FireCount++;
}
public int FireCount { get; private set; }
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneBlending.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneBlending.cs
index 07148212e..db011ab06 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneBlending.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneBlending.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneBorderColour.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneBorderColour.cs
index 92498e6ff..8fc6df02f 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneBorderColour.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneBorderColour.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneBorderSmoothing.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneBorderSmoothing.cs
index ef3386524..cbc0fa553 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneBorderSmoothing.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneBorderSmoothing.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneCircularArcBoundingBox.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneCircularArcBoundingBox.cs
index bb215330d..35f04d547 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneCircularArcBoundingBox.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneCircularArcBoundingBox.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Linq;
using osu.Framework.Allocation;
@@ -66,7 +68,7 @@ namespace osu.Framework.Tests.Visual.Drawables
protected override void LoadComplete()
{
- controlPoints.BindCollectionChanged((_, __) =>
+ controlPoints.BindCollectionChanged((_, _) =>
{
var copy = controlPoints.ToArray();
if (copy.Length != 3)
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneColourGradient.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneColourGradient.cs
index 957411e6e..e38567e07 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneColourGradient.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneColourGradient.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneColourInterpolation.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneColourInterpolation.cs
index 7838f7474..86d8c8aaa 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneColourInterpolation.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneColourInterpolation.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs
index f6da815ec..484cec3d2 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneComplexBlending.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
@@ -225,13 +227,13 @@ namespace osu.Framework.Tests.Visual.Drawables
blendingAlphaSrcDropdown.Current.Value = BlendingType.One;
blendingAlphaDestDropdown.Current.Value = BlendingType.One;
- colourModeDropdown.Current.ValueChanged += v => updateBlending();
- colourEquation.Current.ValueChanged += v => updateBlending();
- alphaEquation.Current.ValueChanged += v => updateBlending();
- blendingSrcDropdown.Current.ValueChanged += v => updateBlending();
- blendingDestDropdown.Current.ValueChanged += v => updateBlending();
- blendingAlphaSrcDropdown.Current.ValueChanged += v => updateBlending();
- blendingAlphaDestDropdown.Current.ValueChanged += v => updateBlending();
+ colourModeDropdown.Current.ValueChanged += _ => updateBlending();
+ colourEquation.Current.ValueChanged += _ => updateBlending();
+ alphaEquation.Current.ValueChanged += _ => updateBlending();
+ blendingSrcDropdown.Current.ValueChanged += _ => updateBlending();
+ blendingDestDropdown.Current.ValueChanged += _ => updateBlending();
+ blendingAlphaSrcDropdown.Current.ValueChanged += _ => updateBlending();
+ blendingAlphaDestDropdown.Current.ValueChanged += _ => updateBlending();
}
private void switchToCustomBlending()
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneConcurrentLoad.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneConcurrentLoad.cs
index 346369407..eb2c36dba 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneConcurrentLoad.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneConcurrentLoad.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneCustomEasingCurve.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneCustomEasingCurve.cs
index bf5b1a46c..760e3e8aa 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneCustomEasingCurve.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneCustomEasingCurve.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneDelayedLoadUnloadWrapper.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneDelayedLoadUnloadWrapper.cs
index dd8f7e316..15fb5bf5f 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneDelayedLoadUnloadWrapper.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneDelayedLoadUnloadWrapper.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneDelayedLoadWrapper.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneDelayedLoadWrapper.cs
index 6dbf9fa6c..e213cb5a1 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneDelayedLoadWrapper.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneDelayedLoadWrapper.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneDrawNodeDisposal.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneDrawNodeDisposal.cs
index 51f929c80..c54a05a73 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneDrawNodeDisposal.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneDrawNodeDisposal.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneDrawableLoadCancellation.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneDrawableLoadCancellation.cs
index 27b885be1..0325a8a51 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneDrawableLoadCancellation.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneDrawableLoadCancellation.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneDrawablePool.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneDrawablePool.cs
index 2b40224cf..6de869777 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneDrawablePool.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneDrawablePool.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneEasingCurves.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneEasingCurves.cs
index aba316c18..e63d1e00f 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneEasingCurves.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneEasingCurves.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Linq;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneEffects.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneEffects.cs
index 5171b7b10..aeabe8d6e 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneEffects.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneEffects.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneFillModes.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneFillModes.cs
index eade96962..319b6946a 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneFillModes.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneFillModes.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneFocus.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneFocus.cs
index e9ea2706c..e52a9203b 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneFocus.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneFocus.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Extensions.Color4Extensions;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneHollowEdgeEffect.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneHollowEdgeEffect.cs
index 11c26a510..22ff6a214 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneHollowEdgeEffect.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneHollowEdgeEffect.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneIsMaskedAway.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneIsMaskedAway.cs
index 19c5714d4..be4b0abe5 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneIsMaskedAway.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneIsMaskedAway.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawable.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawable.cs
index b67a5a885..8d3e4c300 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawable.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawable.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Threading;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawableWithLoading.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawableWithLoading.cs
index 3d248ee17..e19c0b6d5 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawableWithLoading.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawableWithLoading.cs
@@ -1,6 +1,9 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
+using System;
using System.Threading;
using NUnit.Framework;
using osu.Framework.Allocation;
@@ -175,7 +178,8 @@ namespace osu.Framework.Tests.Visual.Drawables
[BackgroundDependencyLoader]
private void load()
{
- AllowLoad.Wait();
+ if (!AllowLoad.Wait(10000))
+ throw new TimeoutException("Load was not allowed in a timely fashion");
}
}
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawableWithUnloading.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawableWithUnloading.cs
index 578c1857a..c244d96dc 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawableWithUnloading.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneModelBackedDrawableWithUnloading.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestScenePathApproximator.cs b/osu.Framework.Tests/Visual/Drawables/TestScenePathApproximator.cs
index 73a8d25d2..51e7b93dd 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestScenePathApproximator.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestScenePathApproximator.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestScenePropertyBoundaries.cs b/osu.Framework.Tests/Visual/Drawables/TestScenePropertyBoundaries.cs
index d7443454f..32e13f0d9 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestScenePropertyBoundaries.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestScenePropertyBoundaries.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneProxyDrawableLifetime.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneProxyDrawableLifetime.cs
index ddd1174cf..7027e8b2d 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneProxyDrawableLifetime.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneProxyDrawableLifetime.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneProxyDrawables.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneProxyDrawables.cs
index 7782629c1..56b76113b 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneProxyDrawables.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneProxyDrawables.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneStressGLDisposal.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneStressGLDisposal.cs
index 8aff35ed1..a2d845c3a 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneStressGLDisposal.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneStressGLDisposal.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneSynchronizationContext.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneSynchronizationContext.cs
index c3ea4b06f..cf6642118 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneSynchronizationContext.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneSynchronizationContext.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -8,6 +10,7 @@ using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Allocation;
+using osu.Framework.Configuration;
using osu.Framework.Development;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
@@ -22,6 +25,9 @@ namespace osu.Framework.Tests.Visual.Drawables
[Resolved]
private GameHost host { get; set; }
+ [Resolved]
+ private FrameworkConfigManager config { get; set; }
+
private AsyncPerformingBox box;
[Test]
@@ -194,6 +200,29 @@ namespace osu.Framework.Tests.Visual.Drawables
AddUntilStep("has spun", () => box.Rotation == 0);
}
+ [Test]
+ public void TestExecutionMode()
+ {
+ AddStep("add box", () => Child = box = new AsyncPerformingBox(true));
+ AddAssert("not spun", () => box.Rotation == 0);
+
+ AddStep("toggle execution mode", () => toggleExecutionMode());
+
+ AddStep("trigger", () => box.ReleaseAsyncLoadCompleteLock());
+ AddUntilStep("has spun", () => box.Rotation == 180);
+
+ AddStep("revert execution mode", () => toggleExecutionMode());
+
+ void toggleExecutionMode()
+ {
+ var executionMode = config.GetBindable(FrameworkSetting.ExecutionMode);
+
+ executionMode.Value = executionMode.Value == ExecutionMode.MultiThreaded
+ ? ExecutionMode.SingleThread
+ : ExecutionMode.MultiThreaded;
+ }
+ }
+
public class AsyncPerformingBox : Box
{
private readonly bool performAsyncLoadComplete;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneTransformRewinding.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneTransformRewinding.cs
index 7b7d20d53..954178eb1 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneTransformRewinding.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneTransformRewinding.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneTransformSequence.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneTransformSequence.cs
index 79e77ea27..af06eca17 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneTransformSequence.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneTransformSequence.cs
@@ -1,6 +1,10 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
+using System;
+using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
@@ -65,6 +69,20 @@ namespace osu.Framework.Tests.Visual.Drawables
AddAssert("finalize triggered", () => finalizeTriggered);
}
+ [Test]
+ public void TestValidation()
+ {
+ AddStep("Animate", () =>
+ {
+ setup();
+ animate();
+ });
+
+ AddStep("nan width", () => Assert.Throws(() => boxes[0].ResizeWidthTo(float.NaN)));
+ AddStep("nan width sequence", () => Assert.Throws(() => boxes[0].FadeIn(200).ResizeWidthTo(float.NaN)));
+ AddStep("zero child size", () => Assert.Throws(() => boxes[0].TransformRelativeChildSizeTo(Vector2.Zero)));
+ }
+
private void setup()
{
finalizeTriggered = false;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneUpdateBeforeDraw.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneUpdateBeforeDraw.cs
index 45ba533ee..c77f8bfe5 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneUpdateBeforeDraw.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneUpdateBeforeDraw.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Drawables/TestSceneWaveform.cs b/osu.Framework.Tests/Visual/Drawables/TestSceneWaveform.cs
index c5943fc24..2e4ec1eb3 100644
--- a/osu.Framework.Tests/Visual/Drawables/TestSceneWaveform.cs
+++ b/osu.Framework.Tests/Visual/Drawables/TestSceneWaveform.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
diff --git a/osu.Framework.Tests/Visual/FrameworkGridTestScene.cs b/osu.Framework.Tests/Visual/FrameworkGridTestScene.cs
index 9d29c7512..5b87824f4 100644
--- a/osu.Framework.Tests/Visual/FrameworkGridTestScene.cs
+++ b/osu.Framework.Tests/Visual/FrameworkGridTestScene.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Testing;
namespace osu.Framework.Tests.Visual
diff --git a/osu.Framework.Tests/Visual/FrameworkTestScene.cs b/osu.Framework.Tests/Visual/FrameworkTestScene.cs
index c277a2f2d..c26b485bc 100644
--- a/osu.Framework.Tests/Visual/FrameworkTestScene.cs
+++ b/osu.Framework.Tests/Visual/FrameworkTestScene.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Testing;
namespace osu.Framework.Tests.Visual
diff --git a/osu.Framework.Tests/Visual/FrameworkTestSceneTestRunner.cs b/osu.Framework.Tests/Visual/FrameworkTestSceneTestRunner.cs
index 4c0499ee7..3b579126b 100644
--- a/osu.Framework.Tests/Visual/FrameworkTestSceneTestRunner.cs
+++ b/osu.Framework.Tests/Visual/FrameworkTestSceneTestRunner.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Allocation;
using osu.Framework.IO.Stores;
using osu.Framework.Testing;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneClickLenience.cs b/osu.Framework.Tests/Visual/Input/TestSceneClickLenience.cs
index 4463408f7..a865c831c 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneClickLenience.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneClickLenience.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneHandleInput.cs b/osu.Framework.Tests/Visual/Input/TestSceneHandleInput.cs
index 03a472780..3116b6627 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneHandleInput.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneHandleInput.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs b/osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs
index c65dfc5e0..d1b1db764 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneInputManager.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
@@ -184,12 +186,14 @@ namespace osu.Framework.Tests.Visual.Input
AddSliderStep("Cursor sensitivity", 0.5, 5, 1, setCursorSensitivityConfig);
setCursorSensitivityConfig(1);
AddToggleStep("Toggle relative mode", setRelativeMode);
- AddToggleStep("Toggle ConfineMouseMode", setConfineMouseModeConfig);
+ AddStep("Set confine to Never", () => setConfineMouseModeConfig(ConfineMouseMode.Never));
+ AddStep("Set confine to Fullscreen", () => setConfineMouseModeConfig(ConfineMouseMode.Fullscreen));
+ AddStep("Set confine to Always", () => setConfineMouseModeConfig(ConfineMouseMode.Always));
AddToggleStep("Toggle cursor visibility", setCursorVisibility);
AddToggleStep("Toggle cursor confine rect", setCursorConfineRect);
setRelativeMode(false);
- setConfineMouseModeConfig(false);
+ setConfineMouseModeConfig(ConfineMouseMode.Never);
setCursorConfineRect(false);
AddStep("Reset handlers", () => host.ResetInputHandlers());
@@ -231,9 +235,9 @@ namespace osu.Framework.Tests.Visual.Input
host.Window.CursorState |= CursorState.Hidden;
}
- private void setConfineMouseModeConfig(bool enabled)
+ private void setConfineMouseModeConfig(ConfineMouseMode mode)
{
- config.SetValue(FrameworkSetting.ConfineMouseMode, enabled ? ConfineMouseMode.Always : ConfineMouseMode.Fullscreen);
+ config.SetValue(FrameworkSetting.ConfineMouseMode, mode);
}
private void setCursorConfineRect(bool enabled)
@@ -249,7 +253,7 @@ namespace osu.Framework.Tests.Visual.Input
Width = host.Window.ClientSize.Width * 2 / 3f,
Height = host.Window.ClientSize.Height * 2 / 3f,
}
- : (RectangleF?)null;
+ : null;
}
}
}
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneInputPropagationForLoadStates.cs b/osu.Framework.Tests/Visual/Input/TestSceneInputPropagationForLoadStates.cs
index 13e680ba9..181026676 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneInputPropagationForLoadStates.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneInputPropagationForLoadStates.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Input.Events;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneInputQueueChange.cs b/osu.Framework.Tests/Visual/Input/TestSceneInputQueueChange.cs
index 682e7ccf9..dfb1c4276 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneInputQueueChange.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneInputQueueChange.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneInputResampler.cs b/osu.Framework.Tests/Visual/Input/TestSceneInputResampler.cs
index 16a4822bc..ae270ad0e 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneInputResampler.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneInputResampler.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Lines;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneJoystick.cs b/osu.Framework.Tests/Visual/Input/TestSceneJoystick.cs
index 94eba9ded..606bf80f1 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneJoystick.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneJoystick.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs
index 8f234729d..3ed25fe04 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingInputQueueChange.cs b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingInputQueueChange.cs
index 0851b4370..c2955cd5e 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingInputQueueChange.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingInputQueueChange.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs
index 86ee6f813..e9a5eb872 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneKeyBindingsGrid.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -281,9 +283,9 @@ namespace osu.Framework.Tests.Visual.Input
scrollMouseWheel(0, -1);
check(TestAction.WheelDown, allPressAndReleased);
- scrollMouseWheel(-1, 0);
- check(TestAction.WheelLeft, allPressAndReleased);
scrollMouseWheel(1, 0);
+ check(TestAction.WheelLeft, allPressAndReleased);
+ scrollMouseWheel(-1, 0);
check(TestAction.WheelRight, allPressAndReleased);
toggleKey(Key.ControlLeft);
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneMidi.cs b/osu.Framework.Tests/Visual/Input/TestSceneMidi.cs
index 0a31ad3c3..0e75b85d9 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneMidi.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneMidi.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneMouseStates.cs b/osu.Framework.Tests/Visual/Input/TestSceneMouseStates.cs
index abac5dd7d..8d4b0a95d 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneMouseStates.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneMouseStates.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/osu.Framework.Tests/Visual/Input/TestSceneNestedHover.cs b/osu.Framework.Tests/Visual/Input/TestSceneNestedHover.cs
index 6cfab935e..ec6685dab 100644
--- a/osu.Framework.Tests/Visual/Input/TestSceneNestedHover.cs
+++ b/osu.Framework.Tests/Visual/Input/TestSceneNestedHover.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
diff --git a/osu.Framework.Tests/Visual/Input/TestScenePassThroughInputManager.cs b/osu.Framework.Tests/Visual/Input/TestScenePassThroughInputManager.cs
index bcc3c0222..6d2ff089b 100644
--- a/osu.Framework.Tests/Visual/Input/TestScenePassThroughInputManager.cs
+++ b/osu.Framework.Tests/Visual/Input/TestScenePassThroughInputManager.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System;
using System.Linq;
using NUnit.Framework;
diff --git a/osu.Framework.Tests/Visual/Input/TestScenePathInput.cs b/osu.Framework.Tests/Visual/Input/TestScenePathInput.cs
index 3ee4b9ea8..b3e10d786 100644
--- a/osu.Framework.Tests/Visual/Input/TestScenePathInput.cs
+++ b/osu.Framework.Tests/Visual/Input/TestScenePathInput.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
+#nullable disable
+
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
diff --git a/osu.Framework.Tests/Visual/Input/TestScenePlatformActionContainer.cs b/osu.Framework.Tests/Visual/Input/TestScenePlatformActionContainer.cs
index 372014694..422c591e9 100644
--- a/osu.Framework.Tests/Visual/Input/TestScenePlatformActionContainer.cs
+++ b/osu.Framework.Tests/Visual/Input/TestScenePlatformActionContainer.cs
@@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd