1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 02:17:46 +08:00

Demonstrate failure case in visual test scene

This commit is contained in:
Bartłomiej Dach 2020-05-21 21:35:12 +02:00
parent 8702a1b5a5
commit 24d898c870

View File

@ -78,19 +78,18 @@ namespace osu.Game.Tests.Visual.Gameplay
} }
}; };
setUpHitObjects(); hitObjectSpawnDelegate?.Cancel();
}); });
private void setUpHitObjects() private void setUpHitObjects() => AddStep("set up hit objects", () =>
{ {
scrollContainers.ForEach(c => c.ControlPoints.Add(new MultiplierControlPoint(0))); scrollContainers.ForEach(c => c.ControlPoints.Add(new MultiplierControlPoint(0)));
for (int i = spawn_rate / 2; i <= time_range; i += spawn_rate) for (int i = spawn_rate / 2; i <= time_range; i += spawn_rate)
addHitObject(Time.Current + i); addHitObject(Time.Current + i);
hitObjectSpawnDelegate?.Cancel();
hitObjectSpawnDelegate = Scheduler.AddDelayed(() => addHitObject(Time.Current + time_range), spawn_rate, true); hitObjectSpawnDelegate = Scheduler.AddDelayed(() => addHitObject(Time.Current + time_range), spawn_rate, true);
} });
private IList<MultiplierControlPoint> testControlPoints => new List<MultiplierControlPoint> private IList<MultiplierControlPoint> testControlPoints => new List<MultiplierControlPoint>
{ {
@ -102,6 +101,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test] [Test]
public void TestScrollAlgorithms() public void TestScrollAlgorithms()
{ {
setUpHitObjects();
AddStep("constant scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Constant)); AddStep("constant scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Constant));
AddStep("overlapping scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Overlapping)); AddStep("overlapping scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Overlapping));
AddStep("sequential scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Sequential)); AddStep("sequential scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Sequential));
@ -114,6 +115,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test] [Test]
public void TestConstantScrollLifetime() public void TestConstantScrollLifetime()
{ {
setUpHitObjects();
AddStep("set constant scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Constant)); AddStep("set constant scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Constant));
// scroll container time range must be less than the rate of spawning hitobjects // scroll container time range must be less than the rate of spawning hitobjects
// otherwise the hitobjects will spawn already partly visible on screen and look wrong // otherwise the hitobjects will spawn already partly visible on screen and look wrong
@ -123,14 +126,40 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test] [Test]
public void TestSequentialScrollLifetime() public void TestSequentialScrollLifetime()
{ {
setUpHitObjects();
AddStep("set sequential scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Sequential)); AddStep("set sequential scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Sequential));
AddStep("set time range", () => scrollContainers.ForEach(c => c.TimeRange = time_range / 2.0)); AddStep("set time range", () => scrollContainers.ForEach(c => c.TimeRange = time_range / 2.0));
AddStep("add control points", () => addControlPoints(testControlPoints, Time.Current)); AddStep("add control points", () => addControlPoints(testControlPoints, Time.Current));
} }
[Test]
public void TestSlowSequentialScroll()
{
AddStep("set sequential scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Sequential));
AddStep("set time range", () => scrollContainers.ForEach(c => c.TimeRange = time_range));
AddStep("add control points", () => addControlPoints(
new List<MultiplierControlPoint>
{
new MultiplierControlPoint { Velocity = 0.1 }
},
Time.Current + time_range));
// All of the hit objects added below should be immediately visible on screen
AddStep("add hit objects", () =>
{
for (int i = 0; i < 20; ++i)
{
addHitObject(Time.Current + time_range * (2 + 0.1 * i));
}
});
}
[Test] [Test]
public void TestOverlappingScrollLifetime() public void TestOverlappingScrollLifetime()
{ {
setUpHitObjects();
AddStep("set overlapping scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Overlapping)); AddStep("set overlapping scroll", () => setScrollAlgorithm(ScrollVisualisationMethod.Overlapping));
AddStep("set time range", () => scrollContainers.ForEach(c => c.TimeRange = time_range / 2.0)); AddStep("set time range", () => scrollContainers.ForEach(c => c.TimeRange = time_range / 2.0));
AddStep("add control points", () => addControlPoints(testControlPoints, Time.Current)); AddStep("add control points", () => addControlPoints(testControlPoints, Time.Current));