mirror of
https://github.com/SK-la/osu-framework.git
synced 2026-03-13 11:20:31 +00:00
Appease the rider gods
This commit is contained in:
@@ -33,7 +33,7 @@ namespace osu.Framework.Tests.Audio
|
||||
|
||||
Assert.IsTrue(updateLoopStarted.Wait(10000));
|
||||
|
||||
Assert.DoesNotThrow(() => manager.Dispose());
|
||||
Assert.DoesNotThrow(manager.Dispose);
|
||||
|
||||
thread.Dispose();
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace osu.Framework.Tests.Dependencies.Reflection
|
||||
[Test]
|
||||
public void TestGetValueNullInternal()
|
||||
{
|
||||
Assert.AreEqual(default(int), new DependencyContainer().GetValue<int>());
|
||||
Assert.AreEqual(0, new DependencyContainer().GetValue<int>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace osu.Framework.Tests.Dependencies.Reflection
|
||||
{
|
||||
var dependencies = new DependencyContainer();
|
||||
|
||||
toCache?.ForEach(o => dependencies.Cache(o));
|
||||
toCache?.ForEach(dependencies.Cache);
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace osu.Framework.Tests.Dependencies.SourceGeneration
|
||||
[Test]
|
||||
public void TestGetValueNullInternal()
|
||||
{
|
||||
Assert.AreEqual(default(int), new DependencyContainer().GetValue<int>());
|
||||
Assert.AreEqual(0, new DependencyContainer().GetValue<int>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace osu.Framework.Tests.Dependencies.SourceGeneration
|
||||
{
|
||||
var dependencies = new DependencyContainer();
|
||||
|
||||
toCache?.ForEach(o => dependencies.Cache(o));
|
||||
toCache?.ForEach(dependencies.Cache);
|
||||
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace osu.Framework.Tests.IO
|
||||
|
||||
for (int i = 0; i < fireCount; i++)
|
||||
game.Schedule(() => throw new TestException());
|
||||
game.Schedule(() => game.Exit());
|
||||
game.Schedule(game.Exit);
|
||||
|
||||
host.Run(game);
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace osu.Framework.Tests.IO
|
||||
|
||||
bool hasThrown = false;
|
||||
request.Failed += exception => hasThrown = exception != null;
|
||||
request.Started += () => request.Abort();
|
||||
request.Started += request.Abort;
|
||||
|
||||
if (async)
|
||||
Assert.DoesNotThrowAsync(() => request.PerformAsync());
|
||||
@@ -388,7 +388,7 @@ namespace osu.Framework.Tests.IO
|
||||
|
||||
bool hasThrown = false;
|
||||
request.Failed += exception => hasThrown = exception != null;
|
||||
request.Started += () => cancellationSource.Cancel();
|
||||
request.Started += cancellationSource.Cancel;
|
||||
|
||||
Assert.DoesNotThrowAsync(() => request.PerformAsync(cancellationSource.Token));
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace osu.Framework.Tests.Platform
|
||||
|
||||
// check that scheduler doesn't process while suspended..
|
||||
completed.Reset();
|
||||
game.Schedule(() => completed.Set());
|
||||
game.Schedule(completed.Set);
|
||||
Assert.IsFalse(completed.Wait(timeout / 10));
|
||||
|
||||
// ..and does after resume.
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace osu.Framework.Tests.Platform
|
||||
var task = Task.Factory.StartNew(() =>
|
||||
{
|
||||
var game = new TestGame();
|
||||
game.Scheduler.Add(() => host.Exit());
|
||||
game.Scheduler.Add(host.Exit);
|
||||
|
||||
host.Run(game);
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace osu.Framework.Tests.Platform
|
||||
private static void runHost(StorageLookupHeadlessGameHost host)
|
||||
{
|
||||
TestGame game = new TestGame();
|
||||
game.Schedule(() => game.Exit());
|
||||
game.Schedule(game.Exit);
|
||||
host.Run(game);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace osu.Framework.Tests.Threading
|
||||
{
|
||||
Interlocked.Increment(ref runCount);
|
||||
Thread.Sleep(100);
|
||||
}, default, TaskCreationOptions.HideScheduler, taskScheduler);
|
||||
}, CancellationToken.None, TaskCreationOptions.HideScheduler, taskScheduler);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace osu.Framework.Tests.Threading
|
||||
{
|
||||
while (!exited.IsSet)
|
||||
Thread.Sleep(100);
|
||||
}, default, TaskCreationOptions.HideScheduler, taskScheduler);
|
||||
}, CancellationToken.None, TaskCreationOptions.HideScheduler, taskScheduler);
|
||||
}
|
||||
|
||||
exited.Set();
|
||||
@@ -76,7 +76,7 @@ namespace osu.Framework.Tests.Threading
|
||||
Task.Run(async () =>
|
||||
{
|
||||
// ReSharper disable once AccessToDisposedClosure
|
||||
await Task.Factory.StartNew(() => { run.Set(); }, default, TaskCreationOptions.HideScheduler, taskScheduler).ConfigureAwait(false);
|
||||
await Task.Factory.StartNew(run.Set, CancellationToken.None, TaskCreationOptions.HideScheduler, taskScheduler).ConfigureAwait(false);
|
||||
exited.Set();
|
||||
});
|
||||
|
||||
@@ -90,10 +90,7 @@ namespace osu.Framework.Tests.Threading
|
||||
{
|
||||
ThreadedTaskScheduler scheduler = new ThreadedTaskScheduler(1, string.Empty);
|
||||
|
||||
Thread disposeThread = new Thread(() =>
|
||||
{
|
||||
scheduler.Dispose();
|
||||
})
|
||||
Thread disposeThread = new Thread(scheduler.Dispose)
|
||||
{
|
||||
IsBackground = true
|
||||
};
|
||||
|
||||
@@ -65,8 +65,8 @@ namespace osu.Framework.Tests.Visual.Input
|
||||
{
|
||||
Child = new TestKeyBindingReceptor
|
||||
{
|
||||
Pressed = a => pressedActions.Add(a),
|
||||
Released = a => releasedActions.Add(a)
|
||||
Pressed = pressedActions.Add,
|
||||
Released = releasedActions.Add
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -99,8 +99,8 @@ namespace osu.Framework.Tests.Visual.Input
|
||||
{
|
||||
Child = new TestKeyBindingReceptor
|
||||
{
|
||||
Pressed = a => pressedActions.Add(a),
|
||||
Released = a => releasedActions.Add(a)
|
||||
Pressed = pressedActions.Add,
|
||||
Released = releasedActions.Add
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -135,8 +135,8 @@ namespace osu.Framework.Tests.Visual.Input
|
||||
{
|
||||
Child = new TestKeyBindingReceptor
|
||||
{
|
||||
Pressed = a => pressedActions.Add(a),
|
||||
Released = a => releasedActions.Add(a)
|
||||
Pressed = pressedActions.Add,
|
||||
Released = releasedActions.Add
|
||||
},
|
||||
}
|
||||
};
|
||||
@@ -178,8 +178,8 @@ namespace osu.Framework.Tests.Visual.Input
|
||||
},
|
||||
new TestKeyBindingReceptor
|
||||
{
|
||||
Pressed = a => pressedActions.Add(a),
|
||||
Released = a => releasedActions.Add(a)
|
||||
Pressed = pressedActions.Add,
|
||||
Released = releasedActions.Add
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -438,8 +438,8 @@ namespace osu.Framework.Tests.Visual.Input
|
||||
{
|
||||
Child = receptor = new TestKeyBindingReceptor
|
||||
{
|
||||
Pressed = a => pressedActions.Add(a),
|
||||
Released = a => releasedActions.Add(a)
|
||||
Pressed = pressedActions.Add,
|
||||
Released = releasedActions.Add
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
@@ -300,18 +300,18 @@ namespace osu.Framework.Tests.Visual.UserInterface
|
||||
};
|
||||
|
||||
AddStep("push screen1", () => stack.Push(screen1));
|
||||
AddUntilStep("ensure current", () => screen1.IsCurrentScreen());
|
||||
AddUntilStep("ensure current", screen1.IsCurrentScreen);
|
||||
|
||||
AddStep("preload screen2", () => LoadComponentAsync(screen2));
|
||||
AddUntilStep("wait for load", () => screen2.LoadState == LoadState.Ready);
|
||||
|
||||
AddStep("push screen2", () => screen1.Push(screen2));
|
||||
AddUntilStep("ensure current", () => screen2.IsCurrentScreen());
|
||||
AddUntilStep("ensure current", screen2.IsCurrentScreen);
|
||||
|
||||
AddStep("exit screen2", () => screen2.Exit());
|
||||
AddStep("exit screen2", screen2.Exit);
|
||||
AddUntilStep("ensure exited", () => !screen2.IsCurrentScreen());
|
||||
|
||||
AddStep("push screen2", () => screen1.Exit());
|
||||
AddStep("push screen2", screen1.Exit);
|
||||
AddUntilStep("ensure exited", () => !screen1.IsCurrentScreen());
|
||||
|
||||
AddAssert("order is correct", () => order.SequenceEqual(order.OrderBy(i => i)));
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace osu.Framework.Allocation
|
||||
private TModel createChildShadowModel()
|
||||
{
|
||||
var result = new TModel();
|
||||
updateShadowModel(result, default, shadowModel);
|
||||
updateShadowModel(result, null, shadowModel);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace osu.Framework.Allocation
|
||||
{
|
||||
if (!handle.IsAllocated)
|
||||
{
|
||||
target = default;
|
||||
target = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace osu.Framework.Allocation
|
||||
{
|
||||
}
|
||||
|
||||
target = default;
|
||||
target = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace osu.Framework.Audio
|
||||
/// Channels removed from this <see cref="AudioMixer"/> fall back to the global <see cref="SampleMixer"/>.
|
||||
/// </remarks>
|
||||
/// <param name="identifier">An identifier displayed on the audio mixer visualiser.</param>
|
||||
public AudioMixer CreateAudioMixer(string identifier = default) =>
|
||||
public AudioMixer CreateAudioMixer(string identifier = null) =>
|
||||
createAudioMixer(SampleMixer, !string.IsNullOrEmpty(identifier) ? identifier : $"user #{Interlocked.Increment(ref userMixerID)}");
|
||||
|
||||
private AudioMixer createAudioMixer(AudioMixer fallbackMixer, string identifier)
|
||||
|
||||
@@ -236,7 +236,7 @@ namespace osu.Framework.Audio.Mixing.Bass
|
||||
/// <param name="procedure">The callback function which should be invoked with the sync.</param>
|
||||
/// <param name="user">User instance data to pass to the callback function.</param>
|
||||
/// <returns>If successful, then the new synchroniser's handle is returned, else 0 is returned. Use <see cref="ManagedBass.Bass.LastError" /> to get the error code.</returns>
|
||||
public int ChannelSetSync(IBassAudioChannel channel, SyncFlags type, long parameter, SyncProcedure procedure, IntPtr user = default)
|
||||
public int ChannelSetSync(IBassAudioChannel channel, SyncFlags type, long parameter, SyncProcedure procedure, IntPtr user = 0)
|
||||
=> BassMix.ChannelSetSync(channel.Handle, type, parameter, procedure, user);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace osu.Framework.Bindables
|
||||
{
|
||||
public class BindableLong : BindableNumber<long>
|
||||
{
|
||||
public BindableLong(long defaultValue = default)
|
||||
public BindableLong(long defaultValue = 0)
|
||||
: base(defaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ namespace osu.Framework.Graphics.OpenGL.Textures
|
||||
var rgbaColour = new Rgba32(new Vector4(initialisationColour.Value.R, initialisationColour.Value.G, initialisationColour.Value.B, initialisationColour.Value.A));
|
||||
|
||||
// it is faster to initialise without a background specification if transparent black is all that's required.
|
||||
using var image = initialisationColour == default
|
||||
using var image = initialisationColour == null
|
||||
? new Image<Rgba32>(width, height)
|
||||
: new Image<Rgba32>(width, height, rgbaColour);
|
||||
|
||||
|
||||
@@ -503,7 +503,7 @@ namespace osu.Framework.Graphics.Veldrid.Textures
|
||||
var rgbaColour = new Rgba32(new Vector4(initialisationColour.Value.R, initialisationColour.Value.G, initialisationColour.Value.B, initialisationColour.Value.A));
|
||||
|
||||
// it is faster to initialise without a background specification if transparent black is all that's required.
|
||||
using var image = initialisationColour == default
|
||||
using var image = initialisationColour == null
|
||||
? new Image<Rgba32>(width, height)
|
||||
: new Image<Rgba32>(width, height, rgbaColour);
|
||||
|
||||
|
||||
@@ -351,12 +351,12 @@ namespace osu.Framework.Graphics.Veldrid
|
||||
|
||||
var info = device.GetD3D11Info();
|
||||
var dxgiAdapter = MarshallingHelpers.FromPointer<IDXGIAdapter>(info.Adapter).AsNonNull();
|
||||
var d3d11Device = MarshallingHelpers.FromPointer<ID3D11Device>(info.Device).AsNonNull();
|
||||
var d3D11Device = MarshallingHelpers.FromPointer<ID3D11Device>(info.Device).AsNonNull();
|
||||
|
||||
maxTextureSize = ID3D11Resource.MaximumTexture2DSize;
|
||||
|
||||
Logger.Log($@"Direct3D 11 Initialized
|
||||
Direct3D 11 Feature Level: {d3d11Device.FeatureLevel.ToString().Replace("Level_", string.Empty).Replace("_", ".")}
|
||||
Direct3D 11 Feature Level: {d3D11Device.FeatureLevel.ToString().Replace("Level_", string.Empty).Replace("_", ".")}
|
||||
Direct3D 11 Adapter: {dxgiAdapter.Description.Description}
|
||||
Direct3D 11 Dedicated Video Memory: {dxgiAdapter.Description.DedicatedVideoMemory / 1024 / 1024} MB
|
||||
Direct3D 11 Dedicated System Memory: {dxgiAdapter.Description.DedicatedSystemMemory / 1024 / 1024} MB
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace osu.Framework.IO.Stores
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -122,7 +122,7 @@ namespace osu.Framework.IO.Stores
|
||||
}
|
||||
}
|
||||
|
||||
return default;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Stream GetStream(string name)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace osu.Framework.Lists
|
||||
this.weakList = weakList;
|
||||
|
||||
currentItemIndex = weakList.listStart - 1; // The first MoveNext() should bring the iterator to the start
|
||||
Current = default!;
|
||||
Current = null!;
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -55,7 +55,7 @@ namespace osu.Framework.Lists
|
||||
public void Reset()
|
||||
{
|
||||
currentItemIndex = weakList.listStart - 1;
|
||||
Current = default!;
|
||||
Current = null!;
|
||||
}
|
||||
|
||||
public T Current { get; private set; }
|
||||
@@ -64,7 +64,7 @@ namespace osu.Framework.Lists
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Current = default!;
|
||||
Current = null!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ namespace osu.Framework.Platform.SDL2
|
||||
return true;
|
||||
}
|
||||
|
||||
maximized = default;
|
||||
maximized = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -682,7 +682,7 @@ namespace osu.Framework.Platform.SDL3
|
||||
}
|
||||
}
|
||||
|
||||
index = default;
|
||||
index = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -770,7 +770,7 @@ namespace osu.Framework.Platform.SDL3
|
||||
return true;
|
||||
}
|
||||
|
||||
maximized = default;
|
||||
maximized = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace osu.Framework.Platform.Windows.Native
|
||||
if (waitableTimer == IntPtr.Zero) return false;
|
||||
|
||||
// Not sure if we want to fall back to Thread.Sleep on failure here, needs further investigation.
|
||||
if (Execution.SetWaitableTimerEx(waitableTimer, Execution.CreateFileTime(duration), 0, null, default, IntPtr.Zero, 0))
|
||||
if (Execution.SetWaitableTimerEx(waitableTimer, Execution.CreateFileTime(duration), 0, null, 0, IntPtr.Zero, 0))
|
||||
{
|
||||
Execution.WaitForSingleObject(waitableTimer, Execution.INFINITE);
|
||||
return true;
|
||||
|
||||
@@ -41,10 +41,10 @@ namespace osu.Framework.Utils
|
||||
if (Precision.AlmostEquals(0, (b.Y - a.Y) * (c.X - a.X) - (b.X - a.X) * (c.Y - a.Y)))
|
||||
{
|
||||
IsValid = false;
|
||||
ThetaStart = default;
|
||||
ThetaRange = default;
|
||||
Direction = default;
|
||||
Radius = default;
|
||||
ThetaStart = 0;
|
||||
ThetaRange = 0;
|
||||
Direction = 0;
|
||||
Radius = 0;
|
||||
Centre = default;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user