2020-04-16 13:11:38 +08: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;
|
2020-12-04 05:38:51 +08:00
|
|
|
using System.Linq;
|
2020-04-16 13:11:38 +08:00
|
|
|
using NUnit.Framework;
|
2020-12-04 05:38:51 +08:00
|
|
|
using osu.Framework.Testing;
|
2020-04-16 13:11:38 +08:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Rulesets.Objects.Types;
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2020-12-04 05:38:51 +08:00
|
|
|
using osu.Game.Screens.Play;
|
2020-04-16 13:11:38 +08:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|
|
|
{
|
2020-06-04 04:23:56 +08:00
|
|
|
public class TestSceneOsuModHidden : OsuModTestScene
|
2020-04-16 13:11:38 +08:00
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
public void TestDefaultBeatmapTest() => CreateModTest(new ModTestData
|
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
Mod = new TestOsuModHidden(),
|
2020-04-16 13:11:38 +08:00
|
|
|
Autoplay = true,
|
2020-12-04 05:38:51 +08:00
|
|
|
PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(0)
|
2020-04-16 13:11:38 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void FirstCircleAfterTwoSpinners() => CreateModTest(new ModTestData
|
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
Mod = new TestOsuModHidden(),
|
2020-04-16 13:11:38 +08:00
|
|
|
Autoplay = true,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new Spinner
|
|
|
|
{
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
EndTime = 1000,
|
|
|
|
},
|
|
|
|
new Spinner
|
|
|
|
{
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
StartTime = 1200,
|
|
|
|
EndTime = 2200,
|
|
|
|
},
|
|
|
|
new HitCircle
|
|
|
|
{
|
|
|
|
Position = new Vector2(300, 192),
|
|
|
|
StartTime = 3200,
|
|
|
|
},
|
|
|
|
new HitCircle
|
|
|
|
{
|
|
|
|
Position = new Vector2(384, 192),
|
|
|
|
StartTime = 4200,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-12-04 05:38:51 +08:00
|
|
|
PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(2)
|
2020-04-16 13:11:38 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void FirstSliderAfterTwoSpinners() => CreateModTest(new ModTestData
|
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
Mod = new TestOsuModHidden(),
|
2020-04-16 13:11:38 +08:00
|
|
|
Autoplay = true,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new Spinner
|
|
|
|
{
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
EndTime = 1000,
|
|
|
|
},
|
|
|
|
new Spinner
|
|
|
|
{
|
|
|
|
Position = new Vector2(256, 192),
|
|
|
|
StartTime = 1200,
|
|
|
|
EndTime = 2200,
|
|
|
|
},
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 3200,
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
|
|
|
|
},
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 5200,
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2020-12-04 05:38:51 +08:00
|
|
|
PassCondition = () => checkSomeHit() && objectWithIncreasedVisibilityHasIndex(2)
|
2020-04-16 13:11:38 +08:00
|
|
|
});
|
|
|
|
|
2020-12-03 13:54:02 +08:00
|
|
|
[Test]
|
|
|
|
public void TestWithSliderReuse() => CreateModTest(new ModTestData
|
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
Mod = new TestOsuModHidden(),
|
2020-12-03 13:54:02 +08:00
|
|
|
Autoplay = true,
|
|
|
|
Beatmap = new Beatmap
|
|
|
|
{
|
|
|
|
HitObjects = new List<HitObject>
|
|
|
|
{
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 1000,
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
|
|
|
|
},
|
|
|
|
new Slider
|
|
|
|
{
|
|
|
|
StartTime = 4000,
|
|
|
|
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
|
|
|
|
},
|
|
|
|
}
|
|
|
|
},
|
|
|
|
PassCondition = checkSomeHit
|
|
|
|
});
|
|
|
|
|
2020-12-04 05:38:51 +08:00
|
|
|
private bool checkSomeHit() => Player.ScoreProcessor.JudgedHits >= 4;
|
|
|
|
|
|
|
|
private bool objectWithIncreasedVisibilityHasIndex(int index)
|
|
|
|
=> Player.Mods.Value.OfType<TestOsuModHidden>().Single().FirstObject == Player.ChildrenOfType<GameplayBeatmap>().Single().HitObjects[index];
|
|
|
|
|
|
|
|
private class TestOsuModHidden : OsuModHidden
|
2020-04-16 13:11:38 +08:00
|
|
|
{
|
2020-12-04 05:38:51 +08:00
|
|
|
public new HitObject FirstObject => base.FirstObject;
|
2020-04-16 13:11:38 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|