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

Merge branch 'master' into split-offset-clock

This commit is contained in:
Bartłomiej Dach 2022-08-18 17:52:45 +02:00 committed by GitHub
commit 4ad782b5a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
@ -19,7 +17,7 @@ namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneLeadIn : RateAdjustedBeatmapTestScene
{
private LeadInPlayer player;
private LeadInPlayer player = null!;
private const double lenience_ms = 10;
@ -36,11 +34,7 @@ namespace osu.Game.Tests.Visual.Gameplay
BeatmapInfo = { AudioLeadIn = leadIn }
});
AddStep("check first frame time", () =>
{
Assert.That(player.FirstFrameClockTime, Is.Not.Null);
Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms));
});
checkFirstFrameTime(expectedStartTime);
}
[TestCase(1000, 0)]
@ -59,11 +53,7 @@ namespace osu.Game.Tests.Visual.Gameplay
loadPlayerWithBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo), storyboard);
AddStep("check first frame time", () =>
{
Assert.That(player.FirstFrameClockTime, Is.Not.Null);
Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms));
});
checkFirstFrameTime(expectedStartTime);
}
[TestCase(1000, 0, false)]
@ -97,14 +87,13 @@ namespace osu.Game.Tests.Visual.Gameplay
loadPlayerWithBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo), storyboard);
AddStep("check first frame time", () =>
{
Assert.That(player.FirstFrameClockTime, Is.Not.Null);
Assert.That(player.FirstFrameClockTime.Value, Is.EqualTo(expectedStartTime).Within(lenience_ms));
});
checkFirstFrameTime(expectedStartTime);
}
private void loadPlayerWithBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
private void checkFirstFrameTime(double expectedStartTime) =>
AddAssert("check first frame time", () => player.FirstFrameClockTime, () => Is.EqualTo(expectedStartTime).Within(lenience_ms));
private void loadPlayerWithBeatmap(IBeatmap beatmap, Storyboard? storyboard = null)
{
AddStep("create player", () =>
{
@ -126,12 +115,8 @@ namespace osu.Game.Tests.Visual.Gameplay
public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer;
public double GameplayStartTime => DrawableRuleset.GameplayStartTime;
public double FirstHitObjectTime => DrawableRuleset.Objects.First().StartTime;
public double GameplayClockTime => GameplayClockContainer.CurrentTime;
protected override void UpdateAfterChildren()
{
base.UpdateAfterChildren();