1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 03:42:57 +08:00

null check in test

This commit is contained in:
cdwcgt 2023-07-29 22:41:26 +09:00
parent 8a06914438
commit 4c33013674
No known key found for this signature in database
GPG Key ID: 144396D01095C3A2

View File

@ -1,11 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Tournament.Components;
@ -16,7 +15,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
public partial class TestSceneMapPoolScreen : TournamentScreenTestScene
{
private MapPoolScreen screen;
private MapPoolScreen screen = null!;
[BackgroundDependencyLoader]
private void load()
@ -32,7 +31,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
AddStep("load few maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
for (int i = 0; i < 8; i++)
addBeatmap();
@ -52,7 +51,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
AddStep("load just enough maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
for (int i = 0; i < 18; i++)
addBeatmap();
@ -72,7 +71,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
AddStep("load many maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
for (int i = 0; i < 19; i++)
addBeatmap();
@ -92,7 +91,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
AddStep("load many maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
for (int i = 0; i < 11; i++)
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
@ -118,7 +117,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
AddStep("load many maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
for (int i = 0; i < 12; i++)
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
@ -138,7 +137,7 @@ namespace osu.Game.Tournament.Tests.Screens
{
AddStep("load many maps", () =>
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Clear();
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Clear();
for (int i = 0; i < 12; i++)
addBeatmap(i > 4 ? Ruleset.Value.CreateInstance().AllMods.ElementAt(i).Acronym : "NM");
@ -155,7 +154,7 @@ namespace osu.Game.Tournament.Tests.Screens
private void addBeatmap(string mods = "NM")
{
Ladder.CurrentMatch.Value.Round.Value.Beatmaps.Add(new RoundBeatmap
Ladder.CurrentMatch.Value.AsNonNull().Round.Value.AsNonNull().Beatmaps.Add(new RoundBeatmap
{
Beatmap = CreateSampleBeatmap(),
Mods = mods