1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 07:42:55 +08:00

Fix remaining test failures

This commit is contained in:
Dean Herbert 2020-05-22 18:23:24 +09:00
parent dd09d7830d
commit 866db629d6
4 changed files with 15 additions and 14 deletions

View File

@ -4,8 +4,8 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components;
using osuTK; using osuTK;
@ -17,9 +17,8 @@ namespace osu.Game.Tests.Visual.Editing
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; var clock = new EditorClock { IsCoupled = false };
Dependencies.CacheAs<IAdjustableClock>(clock); Dependencies.CacheAs(clock);
Dependencies.CacheAs<IFrameBasedClock>(clock);
var playback = new PlaybackControl var playback = new PlaybackControl
{ {

View File

@ -102,7 +102,9 @@ namespace osu.Game.Tests.Visual.Editing
private class StartStopButton : OsuButton private class StartStopButton : OsuButton
{ {
private IAdjustableClock adjustableClock; [Resolved]
private EditorClock editorClock { get; set; }
private bool started; private bool started;
public StartStopButton() public StartStopButton()
@ -114,22 +116,16 @@ namespace osu.Game.Tests.Visual.Editing
Action = onClick; Action = onClick;
} }
[BackgroundDependencyLoader]
private void load(IAdjustableClock adjustableClock)
{
this.adjustableClock = adjustableClock;
}
private void onClick() private void onClick()
{ {
if (started) if (started)
{ {
adjustableClock.Stop(); editorClock.Stop();
Text = "Start"; Text = "Start";
} }
else else
{ {
adjustableClock.Start(); editorClock.Start();
Text = "Stop"; Text = "Stop";
} }

View File

@ -37,6 +37,11 @@ namespace osu.Game.Screens.Edit
TrackLength = trackLength; TrackLength = trackLength;
} }
public EditorClock()
: this(new ControlPointInfo(), 1000, new BindableBeatDivisor())
{
}
/// <summary> /// <summary>
/// Seek to the closest snappable beat from a time. /// Seek to the closest snappable beat from a time.
/// </summary> /// </summary>

View File

@ -8,6 +8,7 @@ using osu.Framework.Timing;
using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Compose;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
@ -32,7 +33,7 @@ namespace osu.Game.Tests.Visual
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
{ {
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs<IAdjustableClock>(new StopwatchClock()); dependencies.CacheAs(new EditorClock());
return dependencies; return dependencies;
} }