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

Update tests in line with new structure

This commit is contained in:
Dean Herbert 2024-05-14 21:56:00 +08:00
parent 5c9a90cb40
commit 636e200471
No known key found for this signature in database

View File

@ -3,42 +3,28 @@
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.Testing; using osu.Framework.Testing;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Mania.Tests.Mods namespace osu.Game.Rulesets.Mania.Tests
{ {
public partial class TestSceneModTouchDevice : ModTestScene public partial class TestSceneManiaTouchInputArea : PlayerTestScene
{ {
protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset(); protected override Ruleset CreatePlayerRuleset() => new ManiaRuleset();
[Test] [Test]
public void TestOverlayVisibleWithMod() => CreateModTest(new ModTestData public void TestTouchAreaNotInitiallyVisible()
{ {
Mod = new ModTouchDevice(), AddAssert("touch area not visible", () => getTouchOverlay()?.State.Value == Visibility.Hidden);
Autoplay = false, }
PassCondition = () => getTouchOverlay()?.IsPresent == true
});
[Test]
public void TestOverlayNotVisibleWithoutMod() => CreateModTest(new ModTestData
{
Autoplay = false,
PassCondition = () => getTouchOverlay()?.IsPresent == false
});
[Test] [Test]
public void TestPressReceptors() public void TestPressReceptors()
{ {
CreateModTest(new ModTestData AddAssert("touch area not visible", () => getTouchOverlay()?.State.Value == Visibility.Hidden);
{
Mod = new ModTouchDevice(),
Autoplay = false,
PassCondition = () => true
});
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
@ -51,6 +37,8 @@ namespace osu.Game.Rulesets.Mania.Tests.Mods
() => Does.Contain(getReceptor(index).Action.Value)); () => Does.Contain(getReceptor(index).Action.Value));
AddStep($"release receptor {index}", () => InputManager.EndTouch(new Touch(TouchSource.Touch1, getReceptor(index).ScreenSpaceDrawQuad.Centre))); AddStep($"release receptor {index}", () => InputManager.EndTouch(new Touch(TouchSource.Touch1, getReceptor(index).ScreenSpaceDrawQuad.Centre)));
AddAssert("touch area visible", () => getTouchOverlay()?.State.Value == Visibility.Visible);
} }
} }