Apply NRT to TestSceneBeatmapSkinFallbacks

This commit is contained in:
Dean Herbert 2023-02-15 17:26:05 +09:00
parent 8bbd00822c
commit ca75f0ec77

View File

@ -1,13 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
#nullable disable
using System; using System;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Graphics.Containers;
using osu.Framework.Lists; using osu.Framework.Lists;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Framework.Timing; using osu.Framework.Timing;
@ -28,10 +27,10 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
public partial class TestSceneBeatmapSkinFallbacks : OsuPlayerTestScene public partial class TestSceneBeatmapSkinFallbacks : OsuPlayerTestScene
{ {
private ISkin currentBeatmapSkin; private ISkin currentBeatmapSkin = null!;
[Resolved] [Resolved]
private SkinManager skinManager { get; set; } private SkinManager skinManager { get; set; } = null!;
protected override bool HasCustomSteps => true; protected override bool HasCustomSteps => true;
@ -65,7 +64,7 @@ namespace osu.Game.Tests.Visual.Gameplay
var actualInfo = actualComponentsContainer.CreateSkinnableInfo(); var actualInfo = actualComponentsContainer.CreateSkinnableInfo();
var expectedComponentsContainer = (DefaultSkinComponentsContainer)expectedSource.GetDrawableComponent(new GlobalSkinComponentLookup(target)); var expectedComponentsContainer = expectedSource.GetDrawableComponent(new GlobalSkinComponentLookup(target)) as Container;
if (expectedComponentsContainer == null) if (expectedComponentsContainer == null)
return false; return false;
@ -92,7 +91,7 @@ namespace osu.Game.Tests.Visual.Gameplay
return almostEqual(actualInfo, expectedInfo); return almostEqual(actualInfo, expectedInfo);
} }
private static bool almostEqual(SkinnableInfo info, SkinnableInfo other) => private static bool almostEqual(SkinnableInfo info, SkinnableInfo? other) =>
other != null other != null
&& info.Type == other.Type && info.Type == other.Type
&& info.Anchor == other.Anchor && info.Anchor == other.Anchor
@ -102,7 +101,7 @@ namespace osu.Game.Tests.Visual.Gameplay
&& Precision.AlmostEquals(info.Rotation, other.Rotation) && Precision.AlmostEquals(info.Rotation, other.Rotation)
&& info.Children.SequenceEqual(other.Children, new FuncEqualityComparer<SkinnableInfo>(almostEqual)); && info.Children.SequenceEqual(other.Children, new FuncEqualityComparer<SkinnableInfo>(almostEqual));
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null) protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard? storyboard = null)
=> new CustomSkinWorkingBeatmap(beatmap, storyboard, Clock, Audio, currentBeatmapSkin); => new CustomSkinWorkingBeatmap(beatmap, storyboard, Clock, Audio, currentBeatmapSkin);
protected override Ruleset CreatePlayerRuleset() => new TestOsuRuleset(); protected override Ruleset CreatePlayerRuleset() => new TestOsuRuleset();
@ -111,7 +110,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
private readonly ISkin beatmapSkin; private readonly ISkin beatmapSkin;
public CustomSkinWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio, ISkin beatmapSkin) public CustomSkinWorkingBeatmap(IBeatmap beatmap, Storyboard? storyboard, IFrameBasedClock referenceClock, AudioManager audio, ISkin beatmapSkin)
: base(beatmap, storyboard, referenceClock, audio) : base(beatmap, storyboard, referenceClock, audio)
{ {
this.beatmapSkin = beatmapSkin; this.beatmapSkin = beatmapSkin;