2020-10-04 12:50:25 +00: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 NUnit.Framework;
|
2022-09-07 08:38:00 +00:00
|
|
|
using osu.Framework.Audio;
|
2023-09-22 05:32:31 +00:00
|
|
|
using osu.Framework.Audio.Track;
|
2022-09-07 08:38:00 +00:00
|
|
|
using osu.Framework.Bindables;
|
2020-10-04 12:50:25 +00:00
|
|
|
using osu.Framework.Timing;
|
|
|
|
using osu.Game.Screens.Play;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.NonVisual
|
|
|
|
{
|
|
|
|
[TestFixture]
|
2022-08-15 10:59:08 +00:00
|
|
|
public partial class GameplayClockContainerTest
|
2020-10-04 12:50:25 +00:00
|
|
|
{
|
|
|
|
[TestCase(0)]
|
|
|
|
[TestCase(1)]
|
2022-09-06 11:06:30 +00:00
|
|
|
public void TestTrueGameplayRateWithGameplayAdjustment(double underlyingClockRate)
|
2020-10-04 12:50:25 +00:00
|
|
|
{
|
2023-10-06 17:43:00 +00:00
|
|
|
var trackVirtual = new TrackVirtual(60000) { Frequency = { Value = underlyingClockRate } };
|
|
|
|
var gameplayClock = new TestGameplayClockContainer(trackVirtual);
|
2020-10-04 12:50:25 +00:00
|
|
|
|
2022-09-06 11:06:30 +00:00
|
|
|
Assert.That(gameplayClock.GetTrueGameplayRate(), Is.EqualTo(2));
|
2020-10-04 12:50:25 +00:00
|
|
|
}
|
|
|
|
|
2022-08-15 10:46:29 +00:00
|
|
|
private partial class TestGameplayClockContainer : GameplayClockContainer
|
2020-10-04 12:50:25 +00:00
|
|
|
{
|
2023-09-22 05:32:31 +00:00
|
|
|
public TestGameplayClockContainer(IClock underlyingClock)
|
2023-09-22 05:26:33 +00:00
|
|
|
: base(underlyingClock, false, false)
|
2020-10-04 12:50:25 +00:00
|
|
|
{
|
2022-09-08 08:14:06 +00:00
|
|
|
AdjustmentsFromMods.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(2.0));
|
2020-10-04 12:50:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|