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

Fix bugs and add test

This commit is contained in:
NullifiedJosh 2022-10-06 18:17:33 +08:00
parent 0e38ff07c7
commit 0f6a6287f2
No known key found for this signature in database
GPG Key ID: 6E3E27526CE3C16E
2 changed files with 60 additions and 1 deletions

View File

@ -0,0 +1,59 @@
// 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.
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Logging;
using osu.Framework.Testing;
using osu.Game.Rulesets.Catch.Beatmaps;
using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Catch.Tests
{
[TestFixture]
public class TestSceneDrawableCatchRulesetWithRelax : OsuTestScene
{
[SetUpSteps]
public void SetUpSteps()
{
AddStep("create drawable ruleset with relax mod", () =>
{
Child = new DrawableCatchRuleset(new CatchRuleset(), new CatchBeatmap(), new List<Mod>() {
new CatchModRelax()
});
});
AddUntilStep("wait for load", () => Child.IsLoaded);
}
[Test]
public void TestBasic()
{
AddAssert("check if touch catcher is showing", () => this.ChildrenOfType<CatchTouchInputMapper>().Any() == false);
}
}
[TestFixture]
public class TestSceneDrawableCatchRulesetWithoutRelax : OsuTestScene
{
[SetUpSteps]
public void SetUpSteps()
{
AddStep("create drawable ruleset without relax mod", () =>
{
Child = new DrawableCatchRuleset(new CatchRuleset(), new CatchBeatmap(), new List<Mod>());
});
AddUntilStep("wait for load", () => Child.IsLoaded);
Logger.Log("Ready");
}
[Test]
public void TestBasic()
{
AddAssert("check if touch catcher is showing", () => this.ChildrenOfType<CatchTouchInputMapper>().Any());
}
}
}

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.UI
: base(ruleset, beatmap, mods)
{
// Check if mods have RelaxMod instance
if (mods.OfType<ModRelax>().Any())
if (mods != null && mods.OfType<ModRelax>().Any())
showMobileMapper = false;
Direction.Value = ScrollingDirection.Down;