mirror of https://github.com/ppy/osu
Fix `IsCatchingUp` not being in correct state
This commit is contained in:
parent
9bc2e91de0
commit
87760bbc06
|
@ -1,8 +1,6 @@
|
||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
@ -21,22 +19,22 @@ public class TestSceneGameplaySamplePlayback : PlayerTestScene
|
||||||
[Test]
|
[Test]
|
||||||
public void TestAllSamplesStopDuringSeek()
|
public void TestAllSamplesStopDuringSeek()
|
||||||
{
|
{
|
||||||
DrawableSlider slider = null;
|
DrawableSlider? slider = null;
|
||||||
PoolableSkinnableSample[] samples = null;
|
PoolableSkinnableSample[] samples = null!;
|
||||||
ISamplePlaybackDisabler sampleDisabler = null;
|
ISamplePlaybackDisabler sampleDisabler = null!;
|
||||||
|
|
||||||
AddUntilStep("get variables", () =>
|
AddUntilStep("get variables", () =>
|
||||||
{
|
{
|
||||||
sampleDisabler = Player;
|
sampleDisabler = Player;
|
||||||
slider = Player.ChildrenOfType<DrawableSlider>().MinBy(s => s.HitObject.StartTime);
|
slider = Player.ChildrenOfType<DrawableSlider>().MinBy(s => s.HitObject.StartTime);
|
||||||
samples = slider?.ChildrenOfType<PoolableSkinnableSample>().ToArray();
|
samples = slider.ChildrenOfType<PoolableSkinnableSample>().ToArray();
|
||||||
|
|
||||||
return slider != null;
|
return slider != null;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("wait for slider sliding then seek", () =>
|
AddUntilStep("wait for slider sliding then seek", () =>
|
||||||
{
|
{
|
||||||
if (!slider.Tracking.Value)
|
if (slider?.Tracking.Value != true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!samples.Any(s => s.Playing))
|
if (!samples.Any(s => s.Playing))
|
||||||
|
|
|
@ -148,7 +148,7 @@ private void updateClock()
|
||||||
if (state == PlaybackState.Valid && proposedTime != manualClock.CurrentTime)
|
if (state == PlaybackState.Valid && proposedTime != manualClock.CurrentTime)
|
||||||
direction = proposedTime >= manualClock.CurrentTime ? 1 : -1;
|
direction = proposedTime >= manualClock.CurrentTime ? 1 : -1;
|
||||||
|
|
||||||
double timeBehind = Math.Abs(proposedTime - CurrentTime);
|
double timeBehind = Math.Abs(proposedTime - referenceClock.CurrentTime);
|
||||||
|
|
||||||
IsCatchingUp.Value = timeBehind > 200;
|
IsCatchingUp.Value = timeBehind > 200;
|
||||||
WaitingOnFrames.Value = state == PlaybackState.NotValid;
|
WaitingOnFrames.Value = state == PlaybackState.NotValid;
|
||||||
|
|
Loading…
Reference in New Issue