mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Merge branch 'master' of https://github.com/ppy/osu into remove-the-nullable-disable-in-the-ruleset
# Conflicts: # osu.Game.Rulesets.Catch/CatchRuleset.cs # osu.Game.Rulesets.Osu/OsuRuleset.cs # osu.Game.Rulesets.Taiko/TaikoRuleset.cs # osu.Game/Rulesets/Ruleset.cs
This commit is contained in:
@ -9,6 +9,7 @@ using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -34,9 +35,11 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
var beatmap = new OsuBeatmap
|
||||
{
|
||||
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo }
|
||||
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo },
|
||||
};
|
||||
|
||||
beatmap.ControlPointInfo.Add(0, new TimingControlPoint());
|
||||
|
||||
editorBeatmap = new EditorBeatmap(beatmap, new LegacyBeatmapSkin(beatmap.BeatmapInfo, null));
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
||||
@ -50,7 +53,11 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
(typeof(IBeatSnapProvider), editorBeatmap),
|
||||
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
|
||||
},
|
||||
Child = new ComposeScreen { State = { Value = Visibility.Visible } },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
editorBeatmap,
|
||||
new ComposeScreen { State = { Value = Visibility.Visible } },
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
85
osu.Game.Tests/Visual/Editing/TestSceneDifficultyDelete.cs
Normal file
85
osu.Game.Tests/Visual/Editing/TestSceneDifficultyDelete.cs
Normal file
@ -0,0 +1,85 @@
|
||||
// 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 System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Storyboards;
|
||||
using osu.Game.Tests.Beatmaps.IO;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
public class TestSceneDifficultyDelete : EditorTestScene
|
||||
{
|
||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||
protected override bool IsolateSavingFromDatabase => false;
|
||||
|
||||
[Resolved]
|
||||
private OsuGameBase game { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; } = null!;
|
||||
|
||||
private BeatmapSetInfo importedBeatmapSet = null!;
|
||||
|
||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null!)
|
||||
=> beatmaps.GetWorkingBeatmap(importedBeatmapSet.Beatmaps.First());
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
AddStep("import test beatmap", () => importedBeatmapSet = BeatmapImportHelper.LoadOszIntoOsu(game, virtualTrack: true).GetResultSafely());
|
||||
base.SetUpSteps();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeleteDifficulties()
|
||||
{
|
||||
Guid deletedDifficultyID = Guid.Empty;
|
||||
int countBeforeDeletion = 0;
|
||||
string beatmapSetHashBefore = string.Empty;
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
// Will be reloaded after each deletion.
|
||||
AddUntilStep("wait for editor to load", () => Editor?.ReadyForUse == true);
|
||||
|
||||
AddStep("store selected difficulty", () =>
|
||||
{
|
||||
deletedDifficultyID = EditorBeatmap.BeatmapInfo.ID;
|
||||
countBeforeDeletion = Beatmap.Value.BeatmapSetInfo.Beatmaps.Count;
|
||||
beatmapSetHashBefore = Beatmap.Value.BeatmapSetInfo.Hash;
|
||||
});
|
||||
|
||||
AddStep("click File", () => this.ChildrenOfType<DrawableOsuMenuItem>().First().TriggerClick());
|
||||
|
||||
if (i == 11)
|
||||
{
|
||||
// last difficulty shouldn't be able to be deleted.
|
||||
AddAssert("Delete menu item disabled", () => getDeleteMenuItem().Item.Action.Disabled);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddStep("click delete", () => getDeleteMenuItem().TriggerClick());
|
||||
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
|
||||
AddStep("confirm", () => InputManager.Key(Key.Number1));
|
||||
|
||||
AddAssert($"difficulty {i} is deleted", () => Beatmap.Value.BeatmapSetInfo.Beatmaps.Select(b => b.ID), () => Does.Not.Contain(deletedDifficultyID));
|
||||
AddAssert("count decreased by one", () => Beatmap.Value.BeatmapSetInfo.Beatmaps.Count, () => Is.EqualTo(countBeforeDeletion - 1));
|
||||
AddAssert("set hash changed", () => Beatmap.Value.BeatmapSetInfo.Hash, () => Is.Not.EqualTo(beatmapSetHashBefore));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DrawableOsuMenuItem getDeleteMenuItem() => this.ChildrenOfType<DrawableOsuMenuItem>()
|
||||
.Single(item => item.ChildrenOfType<SpriteText>().Any(text => text.Text.ToString().StartsWith("Delete", StringComparison.Ordinal)));
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Screens;
|
||||
@ -55,8 +56,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
[Test]
|
||||
public void TestCreateNewBeatmap()
|
||||
{
|
||||
AddAssert("status is none", () => EditorBeatmap.BeatmapInfo.Status == BeatmapOnlineStatus.None);
|
||||
AddStep("save beatmap", () => Editor.Save());
|
||||
AddAssert("new beatmap in database", () => beatmapManager.QueryBeatmapSet(s => s.ID == currentBeatmapSetID)?.Value.DeletePending == false);
|
||||
AddAssert("status is modified", () => EditorBeatmap.BeatmapInfo.Status == BeatmapOnlineStatus.LocallyModified);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -103,6 +106,8 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
*/
|
||||
public void TestAddAudioTrack()
|
||||
{
|
||||
AddAssert("track is virtual", () => Beatmap.Value.Track is TrackVirtual);
|
||||
|
||||
AddAssert("switch track to real track", () =>
|
||||
{
|
||||
var setup = Editor.ChildrenOfType<SetupScreen>().First();
|
||||
@ -131,7 +136,22 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
}
|
||||
});
|
||||
|
||||
AddAssert("track is not virtual", () => Beatmap.Value.Track is not TrackVirtual);
|
||||
AddAssert("track length changed", () => Beatmap.Value.Track.Length > 60000);
|
||||
|
||||
AddStep("test play", () => Editor.TestGameplay());
|
||||
|
||||
AddUntilStep("wait for dialog", () => DialogOverlay.CurrentDialog != null);
|
||||
AddStep("confirm save", () => InputManager.Key(Key.Number1));
|
||||
|
||||
AddUntilStep("wait for return to editor", () => Editor.IsCurrentScreen());
|
||||
|
||||
AddAssert("track is still not virtual", () => Beatmap.Value.Track is not TrackVirtual);
|
||||
AddAssert("track length correct", () => Beatmap.Value.Track.Length > 60000);
|
||||
|
||||
AddUntilStep("track not playing", () => !EditorClock.IsRunning);
|
||||
AddStep("play track", () => InputManager.Key(Key.Space));
|
||||
AddUntilStep("wait for track playing", () => EditorClock.IsRunning);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -190,6 +210,8 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
AddAssert("created difficulty has no objects", () => EditorBeatmap.HitObjects.Count == 0);
|
||||
|
||||
AddAssert("status is modified", () => EditorBeatmap.BeatmapInfo.Status == BeatmapOnlineStatus.LocallyModified);
|
||||
|
||||
AddStep("set unique difficulty name", () => EditorBeatmap.BeatmapInfo.DifficultyName = secondDifficultyName);
|
||||
AddStep("save beatmap", () => Editor.Save());
|
||||
AddAssert("new beatmap persisted", () =>
|
||||
@ -200,7 +222,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
return beatmap != null
|
||||
&& beatmap.DifficultyName == secondDifficultyName
|
||||
&& set != null
|
||||
&& set.PerformRead(s => s.Beatmaps.Count == 2 && s.Beatmaps.Any(b => b.DifficultyName == secondDifficultyName));
|
||||
&& set.PerformRead(s => s.Beatmaps.Count == 2 && s.Beatmaps.Any(b => b.DifficultyName == secondDifficultyName) && s.Beatmaps.All(b => s.Status == BeatmapOnlineStatus.LocallyModified));
|
||||
});
|
||||
}
|
||||
|
||||
@ -276,7 +298,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddAssert("approach rate correctly copied", () => EditorBeatmap.Difficulty.ApproachRate == 4);
|
||||
AddAssert("combo colours correctly copied", () => EditorBeatmap.BeatmapSkin.AsNonNull().ComboColours.Count == 2);
|
||||
|
||||
AddAssert("status not copied", () => EditorBeatmap.BeatmapInfo.Status == BeatmapOnlineStatus.None);
|
||||
AddAssert("status is modified", () => EditorBeatmap.BeatmapInfo.Status == BeatmapOnlineStatus.LocallyModified);
|
||||
AddAssert("online ID not copied", () => EditorBeatmap.BeatmapInfo.OnlineID == -1);
|
||||
|
||||
AddStep("save beatmap", () => Editor.Save());
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
@ -57,51 +55,51 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
[Test]
|
||||
public void TestStopAtTrackEnd()
|
||||
{
|
||||
AddStep("reset clock", () => Clock.Seek(0));
|
||||
AddStep("reset clock", () => EditorClock.Seek(0));
|
||||
|
||||
AddStep("start clock", Clock.Start);
|
||||
AddAssert("clock running", () => Clock.IsRunning);
|
||||
AddStep("start clock", () => EditorClock.Start());
|
||||
AddAssert("clock running", () => EditorClock.IsRunning);
|
||||
|
||||
AddStep("seek near end", () => Clock.Seek(Clock.TrackLength - 250));
|
||||
AddUntilStep("clock stops", () => !Clock.IsRunning);
|
||||
AddStep("seek near end", () => EditorClock.Seek(EditorClock.TrackLength - 250));
|
||||
AddUntilStep("clock stops", () => !EditorClock.IsRunning);
|
||||
|
||||
AddAssert("clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength);
|
||||
AddUntilStep("clock stopped at end", () => EditorClock.CurrentTime - EditorClock.TotalAppliedOffset, () => Is.EqualTo(EditorClock.TrackLength));
|
||||
|
||||
AddStep("start clock again", Clock.Start);
|
||||
AddAssert("clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500);
|
||||
AddStep("start clock again", () => EditorClock.Start());
|
||||
AddAssert("clock looped to start", () => EditorClock.IsRunning && EditorClock.CurrentTime < 500);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestWrapWhenStoppedAtTrackEnd()
|
||||
{
|
||||
AddStep("reset clock", () => Clock.Seek(0));
|
||||
AddStep("reset clock", () => EditorClock.Seek(0));
|
||||
|
||||
AddStep("stop clock", Clock.Stop);
|
||||
AddAssert("clock stopped", () => !Clock.IsRunning);
|
||||
AddStep("stop clock", () => EditorClock.Stop());
|
||||
AddAssert("clock stopped", () => !EditorClock.IsRunning);
|
||||
|
||||
AddStep("seek exactly to end", () => Clock.Seek(Clock.TrackLength));
|
||||
AddAssert("clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength);
|
||||
AddStep("seek exactly to end", () => EditorClock.Seek(EditorClock.TrackLength));
|
||||
AddAssert("clock stopped at end", () => EditorClock.CurrentTime, () => Is.EqualTo(EditorClock.TrackLength));
|
||||
|
||||
AddStep("start clock again", Clock.Start);
|
||||
AddAssert("clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500);
|
||||
AddStep("start clock again", () => EditorClock.Start());
|
||||
AddAssert("clock looped to start", () => EditorClock.IsRunning && EditorClock.CurrentTime < 500);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClampWhenSeekOutsideBeatmapBounds()
|
||||
{
|
||||
AddStep("stop clock", Clock.Stop);
|
||||
AddStep("stop clock", () => EditorClock.Stop());
|
||||
|
||||
AddStep("seek before start time", () => Clock.Seek(-1000));
|
||||
AddAssert("time is clamped to 0", () => Clock.CurrentTime == 0);
|
||||
AddStep("seek before start time", () => EditorClock.Seek(-1000));
|
||||
AddAssert("time is clamped to 0", () => EditorClock.CurrentTime, () => Is.EqualTo(0));
|
||||
|
||||
AddStep("seek beyond track length", () => Clock.Seek(Clock.TrackLength + 1000));
|
||||
AddAssert("time is clamped to track length", () => Clock.CurrentTime == Clock.TrackLength);
|
||||
AddStep("seek beyond track length", () => EditorClock.Seek(EditorClock.TrackLength + 1000));
|
||||
AddAssert("time is clamped to track length", () => EditorClock.CurrentTime, () => Is.EqualTo(EditorClock.TrackLength));
|
||||
|
||||
AddStep("seek smoothly before start time", () => Clock.SeekSmoothlyTo(-1000));
|
||||
AddAssert("time is clamped to 0", () => Clock.CurrentTime == 0);
|
||||
AddStep("seek smoothly before start time", () => EditorClock.SeekSmoothlyTo(-1000));
|
||||
AddUntilStep("time is clamped to 0", () => EditorClock.CurrentTime, () => Is.EqualTo(0));
|
||||
|
||||
AddStep("seek smoothly beyond track length", () => Clock.SeekSmoothlyTo(Clock.TrackLength + 1000));
|
||||
AddAssert("time is clamped to track length", () => Clock.CurrentTime == Clock.TrackLength);
|
||||
AddStep("seek smoothly beyond track length", () => EditorClock.SeekSmoothlyTo(EditorClock.TrackLength + 1000));
|
||||
AddUntilStep("time is clamped to track length", () => EditorClock.CurrentTime, () => Is.EqualTo(EditorClock.TrackLength));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -6,11 +6,13 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
using osu.Game.Screens.Select;
|
||||
@ -23,7 +25,9 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
[Test]
|
||||
public void TestCantExitWithoutSaving()
|
||||
{
|
||||
AddUntilStep("Wait for dialog overlay load", () => ((Drawable)Game.Dependencies.Get<IDialogOverlay>()).IsLoaded);
|
||||
AddRepeatStep("Exit", () => InputManager.Key(Key.Escape), 10);
|
||||
AddAssert("Sample playback disabled", () => Editor.SamplePlaybackDisabled.Value);
|
||||
AddAssert("Editor is still active screen", () => Game.ScreenStack.CurrentScreen is Editor);
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,11 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Child = new TimingPointVisualiser(Beatmap.Value.Beatmap, 5000) { Clock = EditorClock };
|
||||
}
|
||||
|
||||
protected override Beatmap CreateEditorClockBeatmap()
|
||||
{
|
||||
var testBeatmap = new Beatmap
|
||||
{
|
||||
ControlPointInfo = new ControlPointInfo(),
|
||||
@ -45,9 +50,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
testBeatmap.ControlPointInfo.Add(450, new TimingControlPoint { BeatLength = 100 });
|
||||
testBeatmap.ControlPointInfo.Add(500, new TimingControlPoint { BeatLength = 307.69230769230802 });
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(testBeatmap);
|
||||
|
||||
Child = new TimingPointVisualiser(testBeatmap, 5000) { Clock = Clock };
|
||||
return testBeatmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -59,18 +62,18 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
reset();
|
||||
|
||||
// Forwards
|
||||
AddStep("Seek(0)", () => Clock.Seek(0));
|
||||
AddAssert("Time = 0", () => Clock.CurrentTime == 0);
|
||||
AddStep("Seek(33)", () => Clock.Seek(33));
|
||||
AddAssert("Time = 33", () => Clock.CurrentTime == 33);
|
||||
AddStep("Seek(89)", () => Clock.Seek(89));
|
||||
AddAssert("Time = 89", () => Clock.CurrentTime == 89);
|
||||
AddStep("Seek(0)", () => EditorClock.Seek(0));
|
||||
checkTime(0);
|
||||
AddStep("Seek(33)", () => EditorClock.Seek(33));
|
||||
checkTime(33);
|
||||
AddStep("Seek(89)", () => EditorClock.Seek(89));
|
||||
checkTime(89);
|
||||
|
||||
// Backwards
|
||||
AddStep("Seek(25)", () => Clock.Seek(25));
|
||||
AddAssert("Time = 25", () => Clock.CurrentTime == 25);
|
||||
AddStep("Seek(0)", () => Clock.Seek(0));
|
||||
AddAssert("Time = 0", () => Clock.CurrentTime == 0);
|
||||
AddStep("Seek(25)", () => EditorClock.Seek(25));
|
||||
checkTime(25);
|
||||
AddStep("Seek(0)", () => EditorClock.Seek(0));
|
||||
checkTime(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -82,20 +85,20 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
reset();
|
||||
|
||||
AddStep("Seek(0), Snap", () => Clock.SeekSnapped(0));
|
||||
AddAssert("Time = 0", () => Clock.CurrentTime == 0);
|
||||
AddStep("Seek(50), Snap", () => Clock.SeekSnapped(50));
|
||||
AddAssert("Time = 50", () => Clock.CurrentTime == 50);
|
||||
AddStep("Seek(100), Snap", () => Clock.SeekSnapped(100));
|
||||
AddAssert("Time = 100", () => Clock.CurrentTime == 100);
|
||||
AddStep("Seek(175), Snap", () => Clock.SeekSnapped(175));
|
||||
AddAssert("Time = 175", () => Clock.CurrentTime == 175);
|
||||
AddStep("Seek(350), Snap", () => Clock.SeekSnapped(350));
|
||||
AddAssert("Time = 350", () => Clock.CurrentTime == 350);
|
||||
AddStep("Seek(400), Snap", () => Clock.SeekSnapped(400));
|
||||
AddAssert("Time = 400", () => Clock.CurrentTime == 400);
|
||||
AddStep("Seek(450), Snap", () => Clock.SeekSnapped(450));
|
||||
AddAssert("Time = 450", () => Clock.CurrentTime == 450);
|
||||
AddStep("Seek(0), Snap", () => EditorClock.SeekSnapped(0));
|
||||
checkTime(0);
|
||||
AddStep("Seek(50), Snap", () => EditorClock.SeekSnapped(50));
|
||||
checkTime(50);
|
||||
AddStep("Seek(100), Snap", () => EditorClock.SeekSnapped(100));
|
||||
checkTime(100);
|
||||
AddStep("Seek(175), Snap", () => EditorClock.SeekSnapped(175));
|
||||
checkTime(175);
|
||||
AddStep("Seek(350), Snap", () => EditorClock.SeekSnapped(350));
|
||||
checkTime(350);
|
||||
AddStep("Seek(400), Snap", () => EditorClock.SeekSnapped(400));
|
||||
checkTime(400);
|
||||
AddStep("Seek(450), Snap", () => EditorClock.SeekSnapped(450));
|
||||
checkTime(450);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -107,18 +110,18 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
reset();
|
||||
|
||||
AddStep("Seek(24), Snap", () => Clock.SeekSnapped(24));
|
||||
AddAssert("Time = 0", () => Clock.CurrentTime == 0);
|
||||
AddStep("Seek(26), Snap", () => Clock.SeekSnapped(26));
|
||||
AddAssert("Time = 50", () => Clock.CurrentTime == 50);
|
||||
AddStep("Seek(150), Snap", () => Clock.SeekSnapped(150));
|
||||
AddAssert("Time = 100", () => Clock.CurrentTime == 100);
|
||||
AddStep("Seek(170), Snap", () => Clock.SeekSnapped(170));
|
||||
AddAssert("Time = 175", () => Clock.CurrentTime == 175);
|
||||
AddStep("Seek(274), Snap", () => Clock.SeekSnapped(274));
|
||||
AddAssert("Time = 175", () => Clock.CurrentTime == 175);
|
||||
AddStep("Seek(276), Snap", () => Clock.SeekSnapped(276));
|
||||
AddAssert("Time = 350", () => Clock.CurrentTime == 350);
|
||||
AddStep("Seek(24), Snap", () => EditorClock.SeekSnapped(24));
|
||||
checkTime(0);
|
||||
AddStep("Seek(26), Snap", () => EditorClock.SeekSnapped(26));
|
||||
checkTime(50);
|
||||
AddStep("Seek(150), Snap", () => EditorClock.SeekSnapped(150));
|
||||
checkTime(100);
|
||||
AddStep("Seek(170), Snap", () => EditorClock.SeekSnapped(170));
|
||||
checkTime(175);
|
||||
AddStep("Seek(274), Snap", () => EditorClock.SeekSnapped(274));
|
||||
checkTime(175);
|
||||
AddStep("Seek(276), Snap", () => EditorClock.SeekSnapped(276));
|
||||
checkTime(350);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -129,16 +132,16 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
reset();
|
||||
|
||||
AddStep("SeekForward", () => Clock.SeekForward());
|
||||
AddAssert("Time = 50", () => Clock.CurrentTime == 50);
|
||||
AddStep("SeekForward", () => Clock.SeekForward());
|
||||
AddAssert("Time = 100", () => Clock.CurrentTime == 100);
|
||||
AddStep("SeekForward", () => Clock.SeekForward());
|
||||
AddAssert("Time = 200", () => Clock.CurrentTime == 200);
|
||||
AddStep("SeekForward", () => Clock.SeekForward());
|
||||
AddAssert("Time = 400", () => Clock.CurrentTime == 400);
|
||||
AddStep("SeekForward", () => Clock.SeekForward());
|
||||
AddAssert("Time = 450", () => Clock.CurrentTime == 450);
|
||||
AddStep("SeekForward", () => EditorClock.SeekForward());
|
||||
checkTime(50);
|
||||
AddStep("SeekForward", () => EditorClock.SeekForward());
|
||||
checkTime(100);
|
||||
AddStep("SeekForward", () => EditorClock.SeekForward());
|
||||
checkTime(200);
|
||||
AddStep("SeekForward", () => EditorClock.SeekForward());
|
||||
checkTime(400);
|
||||
AddStep("SeekForward", () => EditorClock.SeekForward());
|
||||
checkTime(450);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -149,18 +152,18 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
reset();
|
||||
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 50", () => Clock.CurrentTime == 50);
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 100", () => Clock.CurrentTime == 100);
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 175", () => Clock.CurrentTime == 175);
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 350", () => Clock.CurrentTime == 350);
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 400", () => Clock.CurrentTime == 400);
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 450", () => Clock.CurrentTime == 450);
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(50);
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(100);
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(175);
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(350);
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(400);
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(450);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -172,30 +175,31 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
reset();
|
||||
|
||||
AddStep("Seek(49)", () => Clock.Seek(49));
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 50", () => Clock.CurrentTime == 50);
|
||||
AddStep("Seek(49.999)", () => Clock.Seek(49.999));
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 100", () => Clock.CurrentTime == 100);
|
||||
AddStep("Seek(99)", () => Clock.Seek(99));
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 100", () => Clock.CurrentTime == 100);
|
||||
AddStep("Seek(99.999)", () => Clock.Seek(99.999));
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 100", () => Clock.CurrentTime == 150);
|
||||
AddStep("Seek(174)", () => Clock.Seek(174));
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 175", () => Clock.CurrentTime == 175);
|
||||
AddStep("Seek(349)", () => Clock.Seek(349));
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 350", () => Clock.CurrentTime == 350);
|
||||
AddStep("Seek(399)", () => Clock.Seek(399));
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 400", () => Clock.CurrentTime == 400);
|
||||
AddStep("Seek(449)", () => Clock.Seek(449));
|
||||
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
|
||||
AddAssert("Time = 450", () => Clock.CurrentTime == 450);
|
||||
AddStep("Seek(49)", () => EditorClock.Seek(49));
|
||||
checkTime(49);
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(50);
|
||||
AddStep("Seek(49.999)", () => EditorClock.Seek(49.999));
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(100);
|
||||
AddStep("Seek(99)", () => EditorClock.Seek(99));
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(100);
|
||||
AddStep("Seek(99.999)", () => EditorClock.Seek(99.999));
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(150);
|
||||
AddStep("Seek(174)", () => EditorClock.Seek(174));
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(175);
|
||||
AddStep("Seek(349)", () => EditorClock.Seek(349));
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(350);
|
||||
AddStep("Seek(399)", () => EditorClock.Seek(399));
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(400);
|
||||
AddStep("Seek(449)", () => EditorClock.Seek(449));
|
||||
AddStep("SeekForward, Snap", () => EditorClock.SeekForward(true));
|
||||
checkTime(450);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -206,17 +210,18 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
reset();
|
||||
|
||||
AddStep("Seek(450)", () => Clock.Seek(450));
|
||||
AddStep("SeekBackward", () => Clock.SeekBackward());
|
||||
AddAssert("Time = 400", () => Clock.CurrentTime == 400);
|
||||
AddStep("SeekBackward", () => Clock.SeekBackward());
|
||||
AddAssert("Time = 350", () => Clock.CurrentTime == 350);
|
||||
AddStep("SeekBackward", () => Clock.SeekBackward());
|
||||
AddAssert("Time = 150", () => Clock.CurrentTime == 150);
|
||||
AddStep("SeekBackward", () => Clock.SeekBackward());
|
||||
AddAssert("Time = 50", () => Clock.CurrentTime == 50);
|
||||
AddStep("SeekBackward", () => Clock.SeekBackward());
|
||||
AddAssert("Time = 0", () => Clock.CurrentTime == 0);
|
||||
AddStep("Seek(450)", () => EditorClock.Seek(450));
|
||||
checkTime(450);
|
||||
AddStep("SeekBackward", () => EditorClock.SeekBackward());
|
||||
checkTime(400);
|
||||
AddStep("SeekBackward", () => EditorClock.SeekBackward());
|
||||
checkTime(350);
|
||||
AddStep("SeekBackward", () => EditorClock.SeekBackward());
|
||||
checkTime(150);
|
||||
AddStep("SeekBackward", () => EditorClock.SeekBackward());
|
||||
checkTime(50);
|
||||
AddStep("SeekBackward", () => EditorClock.SeekBackward());
|
||||
checkTime(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -227,19 +232,20 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
reset();
|
||||
|
||||
AddStep("Seek(450)", () => Clock.Seek(450));
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 400", () => Clock.CurrentTime == 400);
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 350", () => Clock.CurrentTime == 350);
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 175", () => Clock.CurrentTime == 175);
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 100", () => Clock.CurrentTime == 100);
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 50", () => Clock.CurrentTime == 50);
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 0", () => Clock.CurrentTime == 0);
|
||||
AddStep("Seek(450)", () => EditorClock.Seek(450));
|
||||
checkTime(450);
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(400);
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(350);
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(175);
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(100);
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(50);
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -251,18 +257,19 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
reset();
|
||||
|
||||
AddStep("Seek(451)", () => Clock.Seek(451));
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 450", () => Clock.CurrentTime == 450);
|
||||
AddStep("Seek(450.999)", () => Clock.Seek(450.999));
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 450", () => Clock.CurrentTime == 450);
|
||||
AddStep("Seek(401)", () => Clock.Seek(401));
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 400", () => Clock.CurrentTime == 400);
|
||||
AddStep("Seek(401.999)", () => Clock.Seek(401.999));
|
||||
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
|
||||
AddAssert("Time = 400", () => Clock.CurrentTime == 400);
|
||||
AddStep("Seek(451)", () => EditorClock.Seek(451));
|
||||
checkTime(451);
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(450);
|
||||
AddStep("Seek(450.999)", () => EditorClock.Seek(450.999));
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(450);
|
||||
AddStep("Seek(401)", () => EditorClock.Seek(401));
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(400);
|
||||
AddStep("Seek(401.999)", () => EditorClock.Seek(401.999));
|
||||
AddStep("SeekBackward, Snap", () => EditorClock.SeekBackward(true));
|
||||
checkTime(400);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -275,34 +282,37 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
double lastTime = 0;
|
||||
|
||||
AddStep("Seek(0)", () => Clock.Seek(0));
|
||||
AddStep("Seek(0)", () => EditorClock.Seek(0));
|
||||
checkTime(0);
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
AddStep("SeekForward, Snap", () =>
|
||||
{
|
||||
lastTime = Clock.CurrentTime;
|
||||
Clock.SeekForward(true);
|
||||
lastTime = EditorClock.CurrentTime;
|
||||
EditorClock.SeekForward(true);
|
||||
});
|
||||
AddAssert("Time > lastTime", () => Clock.CurrentTime > lastTime);
|
||||
AddAssert("Time > lastTime", () => EditorClock.CurrentTime > lastTime);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
AddStep("SeekBackward, Snap", () =>
|
||||
{
|
||||
lastTime = Clock.CurrentTime;
|
||||
Clock.SeekBackward(true);
|
||||
lastTime = EditorClock.CurrentTime;
|
||||
EditorClock.SeekBackward(true);
|
||||
});
|
||||
AddAssert("Time < lastTime", () => Clock.CurrentTime < lastTime);
|
||||
AddAssert("Time < lastTime", () => EditorClock.CurrentTime < lastTime);
|
||||
}
|
||||
|
||||
AddAssert("Time = 0", () => Clock.CurrentTime == 0);
|
||||
checkTime(0);
|
||||
}
|
||||
|
||||
private void checkTime(double expectedTime) => AddUntilStep($"Current time is {expectedTime}", () => EditorClock.CurrentTime, () => Is.EqualTo(expectedTime));
|
||||
|
||||
private void reset()
|
||||
{
|
||||
AddStep("Reset", () => Clock.Seek(0));
|
||||
AddStep("Reset", () => EditorClock.Seek(0));
|
||||
}
|
||||
|
||||
private class TimingPointVisualiser : CompositeDrawable
|
||||
|
@ -4,7 +4,6 @@
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets;
|
||||
@ -120,7 +119,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
private void pressAndCheckTime(Key key, double expectedTime)
|
||||
{
|
||||
AddStep($"press {key}", () => InputManager.Key(key));
|
||||
AddUntilStep($"time is {expectedTime}", () => Precision.AlmostEquals(expectedTime, EditorClock.CurrentTime, 1));
|
||||
AddUntilStep($"time is {expectedTime}", () => EditorClock.CurrentTime, () => Is.EqualTo(expectedTime).Within(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +1,9 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Components;
|
||||
using osuTK;
|
||||
|
||||
@ -19,19 +15,12 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var clock = new EditorClock { IsCoupled = false };
|
||||
Dependencies.CacheAs(clock);
|
||||
|
||||
var playback = new PlaybackControl
|
||||
Child = new PlaybackControl
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(200, 100)
|
||||
};
|
||||
|
||||
Beatmap.Value = CreateWorkingBeatmap(new Beatmap());
|
||||
|
||||
Child = playback;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
.TriggerClick();
|
||||
});
|
||||
|
||||
AddUntilStep("wait for track playing", () => Clock.IsRunning);
|
||||
AddUntilStep("wait for track playing", () => EditorClock.IsRunning);
|
||||
|
||||
AddStep("click reset button", () =>
|
||||
{
|
||||
@ -122,7 +122,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
.TriggerClick();
|
||||
});
|
||||
|
||||
AddUntilStep("wait for track stopped", () => !Clock.IsRunning);
|
||||
AddUntilStep("wait for track stopped", () => !EditorClock.IsRunning);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Clock.Seek(10000);
|
||||
EditorClock.Seek(10000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Utils;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
@ -14,16 +13,6 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
public override Drawable CreateTestComponent() => Empty();
|
||||
|
||||
[Test]
|
||||
[FlakyTest]
|
||||
/*
|
||||
* Fail rate around 0.3%
|
||||
*
|
||||
* TearDown : osu.Framework.Testing.Drawables.Steps.AssertButton+TracedException : range halved
|
||||
* --TearDown
|
||||
* at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal()
|
||||
* at osu.Framework.Threading.Scheduler.Update()
|
||||
* at osu.Framework.Graphics.Drawable.UpdateSubTree()
|
||||
*/
|
||||
public void TestVisibleRangeUpdatesOnZoomChange()
|
||||
{
|
||||
double initialVisibleRange = 0;
|
||||
@ -32,12 +21,12 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddStep("get initial range", () => initialVisibleRange = TimelineArea.Timeline.VisibleRange);
|
||||
|
||||
AddStep("scale zoom", () => TimelineArea.Timeline.Zoom = 200);
|
||||
AddAssert("range halved", () => Precision.AlmostEquals(TimelineArea.Timeline.VisibleRange, initialVisibleRange / 2, 1));
|
||||
AddStep("range halved", () => Assert.That(TimelineArea.Timeline.VisibleRange, Is.EqualTo(initialVisibleRange / 2).Within(1)));
|
||||
AddStep("descale zoom", () => TimelineArea.Timeline.Zoom = 50);
|
||||
AddAssert("range doubled", () => Precision.AlmostEquals(TimelineArea.Timeline.VisibleRange, initialVisibleRange * 2, 1));
|
||||
AddStep("range doubled", () => Assert.That(TimelineArea.Timeline.VisibleRange, Is.EqualTo(initialVisibleRange * 2).Within(1)));
|
||||
|
||||
AddStep("restore zoom", () => TimelineArea.Timeline.Zoom = 100);
|
||||
AddAssert("range restored", () => Precision.AlmostEquals(TimelineArea.Timeline.VisibleRange, initialVisibleRange, 1));
|
||||
AddStep("range restored", () => Assert.That(TimelineArea.Timeline.VisibleRange, Is.EqualTo(initialVisibleRange).Within(1)));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("Stop clock", () => Clock.Stop());
|
||||
AddStep("Stop clock", () => EditorClock.Stop());
|
||||
|
||||
AddUntilStep("wait for rows to load", () => Child.ChildrenOfType<EffectRowAttribute>().Any());
|
||||
}
|
||||
@ -68,10 +68,10 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
|
||||
AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 54670);
|
||||
AddUntilStep("Ensure seeked to correct time", () => Clock.CurrentTimeAccurate == 54670);
|
||||
AddUntilStep("Ensure seeked to correct time", () => EditorClock.CurrentTimeAccurate == 54670);
|
||||
|
||||
AddStep("Seek to just before next point", () => Clock.Seek(69000));
|
||||
AddStep("Start clock", () => Clock.Start());
|
||||
AddStep("Seek to just before next point", () => EditorClock.Seek(69000));
|
||||
AddStep("Start clock", () => EditorClock.Start());
|
||||
|
||||
AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 69670);
|
||||
}
|
||||
@ -86,9 +86,9 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
|
||||
AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 54670);
|
||||
AddUntilStep("Ensure seeked to correct time", () => Clock.CurrentTimeAccurate == 54670);
|
||||
AddUntilStep("Ensure seeked to correct time", () => EditorClock.CurrentTimeAccurate == 54670);
|
||||
|
||||
AddStep("Seek to later", () => Clock.Seek(80000));
|
||||
AddStep("Seek to later", () => EditorClock.Seek(80000));
|
||||
AddUntilStep("Selection changed", () => timingScreen.SelectedGroup.Value.Time == 69670);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(30)
|
||||
},
|
||||
scrollContainer = new ZoomableScrollContainer
|
||||
scrollContainer = new ZoomableScrollContainer(1, 60, 1)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -80,21 +80,6 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddAssert("Inner container width matches scroll container", () => innerBox.DrawWidth == scrollContainer.DrawWidth);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZoomRangeUpdate()
|
||||
{
|
||||
AddStep("set zoom to 2", () => scrollContainer.Zoom = 2);
|
||||
AddStep("set min zoom to 5", () => scrollContainer.MinZoom = 5);
|
||||
AddAssert("zoom = 5", () => scrollContainer.Zoom == 5);
|
||||
|
||||
AddStep("set max zoom to 10", () => scrollContainer.MaxZoom = 10);
|
||||
AddAssert("zoom = 5", () => scrollContainer.Zoom == 5);
|
||||
|
||||
AddStep("set min zoom to 20", () => scrollContainer.MinZoom = 20);
|
||||
AddStep("set max zoom to 40", () => scrollContainer.MaxZoom = 40);
|
||||
AddAssert("zoom = 20", () => scrollContainer.Zoom == 20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestZoom0()
|
||||
{
|
||||
|
@ -10,12 +10,14 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||
using osu.Game.Storyboards;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -29,10 +31,14 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
protected EditorBeatmap EditorBeatmap { get; private set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
[Resolved]
|
||||
private AudioManager audio { get; set; }
|
||||
|
||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null) => new WaveformTestBeatmap(audio);
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
Beatmap.Value = new WaveformTestBeatmap(audio);
|
||||
base.LoadComplete();
|
||||
|
||||
var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
|
||||
EditorBeatmap = new EditorBeatmap(playable);
|
||||
@ -72,11 +78,11 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Clock.Seek(2500);
|
||||
AddUntilStep("wait for track loaded", () => MusicController.TrackLoaded);
|
||||
AddStep("seek forward", () => EditorClock.Seek(2500));
|
||||
}
|
||||
|
||||
public abstract Drawable CreateTestComponent();
|
||||
|
Reference in New Issue
Block a user