osu/osu.Game.Rulesets.Catch.Tests/Mods/TestSceneCatchModRelax.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

102 lines
3.2 KiB
C#
Raw Normal View History

2020-08-23 16:00:06 +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.
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
2020-08-23 16:00:06 +00:00
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Cursor;
2020-08-23 16:00:06 +00:00
using osu.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Objects;
2020-08-23 19:35:15 +00:00
using osu.Game.Rulesets.Objects.Types;
2020-08-23 16:00:06 +00:00
using osu.Game.Tests.Visual;
2020-08-23 19:35:15 +00:00
using osuTK;
2020-08-23 16:00:06 +00:00
namespace osu.Game.Rulesets.Catch.Tests.Mods
{
public partial class TestSceneCatchModRelax : ModTestScene
{
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
[Test]
public void TestModRelax() => CreateModTest(new ModTestData
{
Mod = new CatchModRelax(),
Autoplay = false,
2020-08-23 19:35:15 +00:00
PassCondition = passCondition,
2020-08-23 16:00:06 +00:00
Beatmap = new Beatmap
{
HitObjects = new List<HitObject>
{
new Fruit
{
2020-08-23 19:35:15 +00:00
X = CatchPlayfield.CENTER_X,
StartTime = 0
},
new Fruit
{
X = 0,
StartTime = 1000
2020-08-23 19:35:15 +00:00
},
new Fruit
{
X = CatchPlayfield.WIDTH,
StartTime = 2000
2020-08-23 19:35:15 +00:00
},
new JuiceStream
{
X = CatchPlayfield.CENTER_X,
StartTime = 3000,
Path = new SliderPath(PathType.LINEAR, new[] { Vector2.Zero, Vector2.UnitY * 200 })
2020-08-23 16:00:06 +00:00
}
}
}
});
2020-08-23 19:35:15 +00:00
[Test]
public void TestGameCursorHidden()
{
CreateModTest(new ModTestData
{
Mod = new CatchModRelax(),
Autoplay = false,
PassCondition = () =>
{
InputManager.MoveMouseTo(this.ChildrenOfType<DrawableCatchRuleset>().Single());
return this.ChildrenOfType<MenuCursorContainer>().Single().State.Value == Visibility.Hidden;
}
});
}
2020-08-23 19:35:15 +00:00
private bool passCondition()
{
var playfield = this.ChildrenOfType<CatchPlayfield>().Single();
switch (Player.ScoreProcessor.Combo.Value)
{
case 0:
InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre);
break;
2020-08-23 19:52:50 +00:00
2020-08-23 19:35:15 +00:00
case 1:
InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.BottomLeft);
break;
2020-08-23 19:52:50 +00:00
2020-08-23 19:35:15 +00:00
case 2:
InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.BottomRight);
break;
2020-08-23 19:52:50 +00:00
2020-08-23 19:35:15 +00:00
case 3:
InputManager.MoveMouseTo(playfield.ScreenSpaceDrawQuad.Centre);
break;
}
return Player.ScoreProcessor.Combo.Value >= 6;
}
2020-08-23 16:00:06 +00:00
}
}