1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 02:03:01 +08:00

Add some extra negative test cases

This commit is contained in:
Bartłomiej Dach 2024-12-27 09:41:52 +01:00
parent 0404656629
commit 033fe3fad5
No known key found for this signature in database

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
@ -9,6 +10,7 @@ using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Replays;
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Scoring;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests.Mods
@ -83,5 +85,132 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
},
PassCondition = () => Player.ScoreProcessor.Combo.Value == 2
});
[Test]
public void TestDoNothing() => CreateModTest(new ModTestData
{
Mod = new OsuModStrictTracking(),
Autoplay = false,
CreateBeatmap = () => new Beatmap
{
HitObjects = new List<HitObject>
{
new Slider
{
StartTime = 1000,
Path = new SliderPath
{
ControlPoints =
{
new PathControlPoint(),
new PathControlPoint(new Vector2(0, 100))
}
}
}
}
},
ReplayFrames = new List<ReplayFrame>
{
new OsuReplayFrame(0, new Vector2()),
},
PassCondition = () => Player.ScoreProcessor.JudgedHits == 3 && Player.ScoreProcessor.Statistics.All(s => s.Key.IsMiss())
});
[Test]
public void TestMissHeadButTrackRestOfSlider() => CreateModTest(new ModTestData
{
Mod = new OsuModStrictTracking(),
Autoplay = false,
CreateBeatmap = () => new Beatmap
{
HitObjects = new List<HitObject>
{
new Slider
{
StartTime = 1000,
Path = new SliderPath
{
ControlPoints =
{
new PathControlPoint(),
new PathControlPoint(new Vector2(0, 100))
}
}
}
}
},
ReplayFrames = new List<ReplayFrame>
{
new OsuReplayFrame(0, new Vector2()),
new OsuReplayFrame(1375, new Vector2(0, 50), OsuAction.LeftButton),
new OsuReplayFrame(1751, new Vector2(0, 100)),
},
PassCondition = () => Player.ScoreProcessor.JudgedHits == 3 && Player.ScoreProcessor.Statistics[HitResult.Miss] == 1 && Player.ScoreProcessor.Statistics[HitResult.Great] == 1
});
[Test]
public void TestMissHeadThenDropTracking() => CreateModTest(new ModTestData
{
Mod = new OsuModStrictTracking(),
Autoplay = false,
CreateBeatmap = () => new Beatmap
{
HitObjects = new List<HitObject>
{
new Slider
{
StartTime = 1000,
Path = new SliderPath
{
ControlPoints =
{
new PathControlPoint(),
new PathControlPoint(new Vector2(0, 100))
}
}
}
}
},
ReplayFrames = new List<ReplayFrame>
{
new OsuReplayFrame(0, new Vector2()),
new OsuReplayFrame(1375, new Vector2(0, 50), OsuAction.LeftButton),
new OsuReplayFrame(1475, new Vector2(), OsuAction.LeftButton),
},
PassCondition = () => Player.ScoreProcessor.JudgedHits == 3 && Player.ScoreProcessor.Statistics.All(s => s.Key.IsMiss())
});
[Test]
public void TestLosingTrackingMissesTail() => CreateModTest(new ModTestData
{
Mod = new OsuModStrictTracking(),
Autoplay = false,
CreateBeatmap = () => new Beatmap
{
HitObjects = new List<HitObject>
{
new Slider
{
StartTime = 1000,
Path = new SliderPath
{
ControlPoints =
{
new PathControlPoint(),
new PathControlPoint(new Vector2(0, 100))
}
}
}
}
},
ReplayFrames = new List<ReplayFrame>
{
new OsuReplayFrame(0, new Vector2(), OsuAction.LeftButton),
new OsuReplayFrame(500, new Vector2(200, 0), OsuAction.LeftButton),
new OsuReplayFrame(501, new Vector2(200, 0)),
new OsuReplayFrame(1000, new Vector2(), OsuAction.LeftButton),
},
PassCondition = () => Player.ScoreProcessor.Statistics.GetValueOrDefault(HitResult.Miss) == 1
});
}
}