2022-08-15 09:23:29 +00:00
|
|
|
|
// 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.
|
|
|
|
|
|
2022-10-06 17:21:31 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2022-08-15 09:23:29 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Testing;
|
2022-10-06 17:21:31 +00:00
|
|
|
|
using osu.Game.Rulesets.Catch.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets.Catch.Mods;
|
2022-08-15 09:23:29 +00:00
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
2022-10-06 17:21:31 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2022-08-15 09:23:29 +00:00
|
|
|
|
using osu.Game.Tests.Visual;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Tests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
public partial class TestSceneCatchTouchInput : OsuTestScene
|
|
|
|
|
{
|
2022-10-06 17:21:31 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestBasic()
|
2022-08-15 09:23:29 +00:00
|
|
|
|
{
|
2022-10-06 17:21:31 +00:00
|
|
|
|
CatchTouchInputMapper catchTouchInputMapper = null!;
|
|
|
|
|
|
2022-09-08 10:41:04 +00:00
|
|
|
|
AddStep("create input overlay", () =>
|
2022-08-15 09:23:29 +00:00
|
|
|
|
{
|
|
|
|
|
Child = new CatchInputManager(new CatchRuleset().RulesetInfo)
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2022-09-08 10:41:04 +00:00
|
|
|
|
catchTouchInputMapper = new CatchTouchInputMapper
|
2022-08-15 09:23:29 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
2022-10-06 17:21:31 +00:00
|
|
|
|
|
|
|
|
|
AddStep("show overlay", () => catchTouchInputMapper.Show());
|
2022-08-15 09:23:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
2022-10-06 17:21:31 +00:00
|
|
|
|
public void TestWithoutRelax()
|
2022-08-15 09:23:29 +00:00
|
|
|
|
{
|
2022-10-06 17:21:31 +00:00
|
|
|
|
AddStep("create drawable ruleset without relax mod", () =>
|
|
|
|
|
{
|
|
|
|
|
Child = new DrawableCatchRuleset(new CatchRuleset(), new CatchBeatmap(), new List<Mod>());
|
|
|
|
|
});
|
|
|
|
|
AddUntilStep("wait for load", () => Child.IsLoaded);
|
|
|
|
|
AddAssert("check touch input is shown", () => this.ChildrenOfType<CatchTouchInputMapper>().Any());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestWithRelax()
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
AddAssert("check touch input is not shown", () => !this.ChildrenOfType<CatchTouchInputMapper>().Any());
|
2022-08-15 09:23:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|