1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 15:27:30 +08:00

Remove all usage of !something!.something

aka don't mix NRT forgiving syntax with not syntax
This commit is contained in:
Dean Herbert 2023-07-07 10:09:24 +09:00
parent ae2896ba7e
commit 8978f2ddd8
2 changed files with 13 additions and 10 deletions

View File

@ -163,7 +163,7 @@ namespace osu.Game.Tests.Visual.SongSelect
InputManager.Key(Key.Enter);
});
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
}
@ -186,7 +186,7 @@ namespace osu.Game.Tests.Visual.SongSelect
InputManager.Key(Key.Down);
});
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
}
@ -215,7 +215,7 @@ namespace osu.Game.Tests.Visual.SongSelect
InputManager.Key(Key.Enter);
});
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
}
@ -244,7 +244,7 @@ namespace osu.Game.Tests.Visual.SongSelect
InputManager.ReleaseButton(MouseButton.Left);
});
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
}
@ -257,7 +257,7 @@ namespace osu.Game.Tests.Visual.SongSelect
createSongSelect();
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddStep("return", () => songSelect!.MakeCurrent());
AddUntilStep("wait for current", () => songSelect!.IsCurrentScreen());
@ -275,7 +275,7 @@ namespace osu.Game.Tests.Visual.SongSelect
createSongSelect();
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddStep("change convert setting", () => config.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
@ -292,7 +292,7 @@ namespace osu.Game.Tests.Visual.SongSelect
createSongSelect();
AddStep("push child screen", () => Stack.Push(new TestSceneOsuScreenStack.TestScreen("test child")));
AddUntilStep("wait for not current", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddStep("update beatmap", () =>
{
@ -1011,7 +1011,7 @@ namespace osu.Game.Tests.Visual.SongSelect
});
});
AddUntilStep("wait for results screen presented", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(getPresentBeatmap()));
AddAssert("check ruleset is correct for score", () => Ruleset.Value.OnlineID == 0);
@ -1040,7 +1040,7 @@ namespace osu.Game.Tests.Visual.SongSelect
songSelect!.PresentScore(TestResources.CreateTestScoreInfo(getPresentBeatmap()));
});
AddUntilStep("wait for results screen presented", () => !songSelect!.IsCurrentScreen());
waitForDismissed();
AddAssert("check beatmap is correct for score", () => Beatmap.Value.BeatmapInfo.MatchesOnlineID(getPresentBeatmap()));
AddAssert("check ruleset is correct for score", () => Ruleset.Value.OnlineID == 0);
@ -1161,6 +1161,8 @@ namespace osu.Game.Tests.Visual.SongSelect
rulesets.Dispose();
}
private void waitForDismissed() => AddUntilStep("wait for not current", () => !songSelect.AsNonNull().IsCurrentScreen());
private partial class TestSongSelect : PlaySongSelect
{
public Action? StartRequested;

View File

@ -4,6 +4,7 @@
using System;
using System.Diagnostics;
using osu.Framework.Development;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Statistics;
using Realms;
@ -133,7 +134,7 @@ namespace osu.Game.Database
{
Debug.Assert(ThreadSafety.IsUpdateThread);
if (dataIsFromUpdateThread && !data.Realm!.IsClosed)
if (dataIsFromUpdateThread && !data.Realm.AsNonNull().IsClosed)
{
RealmLiveStatistics.USAGE_UPDATE_IMMEDIATE.Value++;
return;