From 7645da7d379b19b6d9a106efd4fc463d0eaccc69 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 5 Jul 2021 18:20:04 +0900 Subject: [PATCH] Fix incorrect filename --- .../NonVisual/FirstAvailableHitWindowTest.cs | 104 ---------------- .../NonVisual/FirstAvailableHitWindowsTest.cs | 112 ++++++++++++++++++ 2 files changed, 112 insertions(+), 104 deletions(-) create mode 100644 osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowTest.cs index aed2a5c122..51e15d2426 100644 --- a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowTest.cs +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowTest.cs @@ -1,115 +1,11 @@ // 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.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using NUnit.Framework; -using osu.Framework.Graphics.Containers; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects; -using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.UI; -using osu.Game.Scoring; namespace osu.Game.Tests.NonVisual { - public class FirstAvailableHitWindowsTest - { - private TestDrawableRuleset testDrawableRuleset; - - [SetUp] - public void Setup() - { - testDrawableRuleset = new TestDrawableRuleset(); - } - - [Test] - public void TestResultIfOnlyParentHitWindowIsEmpty() - { - var testObject = new TestHitObject(HitWindows.Empty); - HitObject nested = new TestHitObject(new HitWindows()); - testObject.AddNested(nested); - testDrawableRuleset.HitObjects = new List { testObject }; - - Assert.AreSame(testDrawableRuleset.FirstAvailableHitWindows, nested.HitWindows); - } - - [Test] - public void TestResultIfParentHitWindowsIsNotEmpty() - { - var testObject = new TestHitObject(new HitWindows()); - HitObject nested = new TestHitObject(new HitWindows()); - testObject.AddNested(nested); - testDrawableRuleset.HitObjects = new List { testObject }; - - Assert.AreSame(testDrawableRuleset.FirstAvailableHitWindows, testObject.HitWindows); - } - - [Test] - public void TestResultIfParentAndChildHitWindowsAreEmpty() - { - var firstObject = new TestHitObject(HitWindows.Empty); - HitObject nested = new TestHitObject(HitWindows.Empty); - firstObject.AddNested(nested); - - var secondObject = new TestHitObject(new HitWindows()); - testDrawableRuleset.HitObjects = new List { firstObject, secondObject }; - - Assert.AreSame(testDrawableRuleset.FirstAvailableHitWindows, secondObject.HitWindows); - } - - [Test] - public void TestResultIfAllHitWindowsAreEmpty() - { - var firstObject = new TestHitObject(HitWindows.Empty); - HitObject nested = new TestHitObject(HitWindows.Empty); - firstObject.AddNested(nested); - - testDrawableRuleset.HitObjects = new List { firstObject }; - - Assert.IsNull(testDrawableRuleset.FirstAvailableHitWindows); - } - - [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] - private class TestDrawableRuleset : DrawableRuleset - { - public List HitObjects; - public override IEnumerable Objects => HitObjects; - - public override event Action NewResult; - public override event Action RevertResult; - - public override Playfield Playfield { get; } - public override Container Overlays { get; } - public override Container FrameStableComponents { get; } - public override IFrameStableClock FrameStableClock { get; } - internal override bool FrameStablePlayback { get; set; } - public override IReadOnlyList Mods { get; } - - public override double GameplayStartTime { get; } - public override GameplayCursorContainer Cursor { get; } - - public TestDrawableRuleset() - : base(new OsuRuleset()) - { - // won't compile without this. - NewResult?.Invoke(null); - RevertResult?.Invoke(null); - } - - public override void SetReplayScore(Score replayScore) => throw new NotImplementedException(); - - public override void SetRecordTarget(Score score) => throw new NotImplementedException(); - - public override void RequestResume(Action continueResume) => throw new NotImplementedException(); - - public override void CancelResume() => throw new NotImplementedException(); - } - } - public class TestHitObject : HitObject { public TestHitObject(HitWindows hitWindows) diff --git a/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs new file mode 100644 index 0000000000..d4364b15e7 --- /dev/null +++ b/osu.Game.Tests/NonVisual/FirstAvailableHitWindowsTest.cs @@ -0,0 +1,112 @@ +// 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.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using NUnit.Framework; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; +using osu.Game.Scoring; + +namespace osu.Game.Tests.NonVisual +{ + public class FirstAvailableHitWindowsTest + { + private TestDrawableRuleset testDrawableRuleset; + + [SetUp] + public void Setup() + { + testDrawableRuleset = new TestDrawableRuleset(); + } + + [Test] + public void TestResultIfOnlyParentHitWindowIsEmpty() + { + var testObject = new TestHitObject(HitWindows.Empty); + HitObject nested = new TestHitObject(new HitWindows()); + testObject.AddNested(nested); + testDrawableRuleset.HitObjects = new List { testObject }; + + Assert.AreSame(testDrawableRuleset.FirstAvailableHitWindows, nested.HitWindows); + } + + [Test] + public void TestResultIfParentHitWindowsIsNotEmpty() + { + var testObject = new TestHitObject(new HitWindows()); + HitObject nested = new TestHitObject(new HitWindows()); + testObject.AddNested(nested); + testDrawableRuleset.HitObjects = new List { testObject }; + + Assert.AreSame(testDrawableRuleset.FirstAvailableHitWindows, testObject.HitWindows); + } + + [Test] + public void TestResultIfParentAndChildHitWindowsAreEmpty() + { + var firstObject = new TestHitObject(HitWindows.Empty); + HitObject nested = new TestHitObject(HitWindows.Empty); + firstObject.AddNested(nested); + + var secondObject = new TestHitObject(new HitWindows()); + testDrawableRuleset.HitObjects = new List { firstObject, secondObject }; + + Assert.AreSame(testDrawableRuleset.FirstAvailableHitWindows, secondObject.HitWindows); + } + + [Test] + public void TestResultIfAllHitWindowsAreEmpty() + { + var firstObject = new TestHitObject(HitWindows.Empty); + HitObject nested = new TestHitObject(HitWindows.Empty); + firstObject.AddNested(nested); + + testDrawableRuleset.HitObjects = new List { firstObject }; + + Assert.IsNull(testDrawableRuleset.FirstAvailableHitWindows); + } + + [SuppressMessage("ReSharper", "UnassignedGetOnlyAutoProperty")] + private class TestDrawableRuleset : DrawableRuleset + { + public List HitObjects; + public override IEnumerable Objects => HitObjects; + + public override event Action NewResult; + public override event Action RevertResult; + + public override Playfield Playfield { get; } + public override Container Overlays { get; } + public override Container FrameStableComponents { get; } + public override IFrameStableClock FrameStableClock { get; } + internal override bool FrameStablePlayback { get; set; } + public override IReadOnlyList Mods { get; } + + public override double GameplayStartTime { get; } + public override GameplayCursorContainer Cursor { get; } + + public TestDrawableRuleset() + : base(new OsuRuleset()) + { + // won't compile without this. + NewResult?.Invoke(null); + RevertResult?.Invoke(null); + } + + public override void SetReplayScore(Score replayScore) => throw new NotImplementedException(); + + public override void SetRecordTarget(Score score) => throw new NotImplementedException(); + + public override void RequestResume(Action continueResume) => throw new NotImplementedException(); + + public override void CancelResume() => throw new NotImplementedException(); + } + } +}