mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 16:32:59 +08:00
Merge pull request #28770 from bdach/really-now
Fix editor playback control not removing correct adjustment
This commit is contained in:
commit
5cae005027
@ -1,10 +1,13 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
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.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Components;
|
using osu.Game.Screens.Edit.Components;
|
||||||
@ -19,9 +22,10 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
[Cached]
|
[Cached]
|
||||||
private EditorBeatmap editorBeatmap = new EditorBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo));
|
private EditorBeatmap editorBeatmap = new EditorBeatmap(new TestBeatmap(new OsuRuleset().RulesetInfo));
|
||||||
|
|
||||||
public TestSceneEditorClock()
|
[SetUpSteps]
|
||||||
|
public void SetUpSteps()
|
||||||
{
|
{
|
||||||
Add(new FillFlowContainer
|
AddStep("create content", () => Add(new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -39,19 +43,17 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
Size = new Vector2(200, 100)
|
Size = new Vector2(200, 100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}));
|
||||||
|
AddStep("set working beatmap", () =>
|
||||||
|
{
|
||||||
|
Beatmap.Disabled = false;
|
||||||
|
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
|
// ensure that music controller does not change this beatmap due to it
|
||||||
|
// completing naturally as part of the test.
|
||||||
|
Beatmap.Disabled = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
|
||||||
// ensure that music controller does not change this beatmap due to it
|
|
||||||
// completing naturally as part of the test.
|
|
||||||
Beatmap.Disabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestStopAtTrackEnd()
|
public void TestStopAtTrackEnd()
|
||||||
{
|
{
|
||||||
@ -102,6 +104,18 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
AddUntilStep("time is clamped to track length", () => EditorClock.CurrentTime, () => Is.EqualTo(EditorClock.TrackLength));
|
AddUntilStep("time is clamped to track length", () => EditorClock.CurrentTime, () => Is.EqualTo(EditorClock.TrackLength));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAdjustmentsRemovedOnDisposal()
|
||||||
|
{
|
||||||
|
AddStep("reset clock", () => EditorClock.Seek(0));
|
||||||
|
|
||||||
|
AddStep("set 0.25x speed", () => this.ChildrenOfType<OsuTabControl<double>>().First().Current.Value = 0.25);
|
||||||
|
AddAssert("track has 0.25x tempo", () => Beatmap.Value.Track.AggregateTempo.Value, () => Is.EqualTo(0.25));
|
||||||
|
|
||||||
|
AddStep("dispose playback control", () => Clear(disposeChildren: true));
|
||||||
|
AddAssert("track has 1x tempo", () => Beatmap.Value.Track.AggregateTempo.Value, () => Is.EqualTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
Beatmap.Disabled = false;
|
Beatmap.Disabled = false;
|
||||||
|
@ -105,7 +105,7 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
Track.Value?.RemoveAdjustment(AdjustableProperty.Frequency, tempoAdjustment);
|
Track.Value?.RemoveAdjustment(AdjustableProperty.Tempo, tempoAdjustment);
|
||||||
|
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user