mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
PreviewTimePart
will not show if preview time is -1
This commit is contained in:
@ -1,9 +1,12 @@
|
|||||||
// 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.Testing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editing
|
namespace osu.Game.Tests.Visual.Editing
|
||||||
{
|
{
|
||||||
@ -12,12 +15,21 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSetPreviewTimingPoint()
|
public void TestSceneSetPreviewTimingPoint()
|
||||||
{
|
{
|
||||||
AddStep("seek to 1000", () => EditorClock.Seek(1000));
|
AddStep("seek to 1000", () => EditorClock.Seek(1000));
|
||||||
AddAssert("time is 1000", () => EditorClock.CurrentTime == 1000);
|
AddAssert("time is 1000", () => EditorClock.CurrentTime == 1000);
|
||||||
AddStep("set current time as preview point", () => Editor.SetCurrectTimeAsPreview());
|
AddStep("set current time as preview point", () => Editor.SetCurrectTimeAsPreview());
|
||||||
AddAssert("preview time is 1000", () => EditorBeatmap.PreviewTime.Value == 1000);
|
AddAssert("preview time is 1000", () => EditorBeatmap.PreviewTime.Value == 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestScenePreviewTimeline()
|
||||||
|
{
|
||||||
|
AddStep("set preview time to -1", () => EditorBeatmap.PreviewTime.Value = -1);
|
||||||
|
AddAssert("preview time line should not show", () => Editor.ChildrenOfType<PreviewTimePart>().Single().Alpha == 0);
|
||||||
|
AddStep("set preview time to 1000", () => EditorBeatmap.PreviewTime.Value = 1000);
|
||||||
|
AddAssert("preview time line should show", () => Editor.ChildrenOfType<PreviewTimePart>().Single().Alpha == 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
{
|
{
|
||||||
base.LoadBeatmap(beatmap);
|
base.LoadBeatmap(beatmap);
|
||||||
Add(new PreviewTimeVisualisation(beatmap.PreviewTime));
|
Add(new PreviewTimeVisualisation(beatmap.PreviewTime));
|
||||||
|
beatmap.PreviewTime.BindValueChanged(s =>
|
||||||
|
{
|
||||||
|
Alpha = s.NewValue == -1 ? 0 : 1;
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private partial class PreviewTimeVisualisation : PointVisualisation
|
private partial class PreviewTimeVisualisation : PointVisualisation
|
||||||
|
Reference in New Issue
Block a user