diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricPropertyChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricPropertyChangeHandlerTest.cs index e9abe02aa..ce59fed3c 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricPropertyChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricPropertyChangeHandlerTest.cs @@ -11,13 +11,17 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.ChangeHandlers.Lyrics public abstract class LyricPropertyChangeHandlerTest : BaseHitObjectChangeHandlerTest where TChangeHandler : LyricPropertyChangeHandler, new() { - protected void PrepareLyricWithSyncConfig(Lyric hitObject, bool selected = true) + protected Lyric PrepareLyricWithSyncConfig(Lyric referencedLyric, IReferenceLyricPropertyConfig? config = null, bool selected = true) { - // allow to pre-assign the config. - hitObject.ReferenceLyric = new Lyric(); - hitObject.ReferenceLyricConfig ??= new SyncLyricConfig(); + var lyric = new Lyric + { + ReferenceLyric = referencedLyric, + ReferenceLyricConfig = config ?? new SyncLyricConfig() + }; - PrepareHitObjects(new[] { hitObject }, selected); + PrepareHitObjects(new[] { lyric }, selected); + + return lyric; } protected void TriggerHandlerChangedWithChangeForbiddenException(Action c) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricSingerChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricSingerChangeHandlerTest.cs index 404f57fd6..7fbcd2e66 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricSingerChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricSingerChangeHandlerTest.cs @@ -151,12 +151,9 @@ public void TestWithReferenceLyric(bool syncSinger) { Name = "Singer1", }; - PrepareLyricWithSyncConfig(new Lyric + PrepareLyricWithSyncConfig(new Lyric(), new SyncLyricConfig { - ReferenceLyricConfig = new SyncLyricConfig - { - SyncSingerProperty = syncSinger - } + SyncSingerProperty = syncSinger }); if (syncSinger) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTimeTagsChangeHandlerTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTimeTagsChangeHandlerTest.cs index 5141a87f1..953fa620e 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTimeTagsChangeHandlerTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricTimeTagsChangeHandlerTest.cs @@ -420,20 +420,29 @@ public void TestShiftingException(TextIndex.IndexState state, ShiftingDirection [TestCase(false)] public void TestWithReferenceLyric(bool syncTimeTag) { - var timeTag = new TimeTag(new TextIndex(), 1000); - PrepareLyricWithSyncConfig(new Lyric + var lyric = PrepareLyricWithSyncConfig(new Lyric { Text = "カラオケ", TimeTags = new[] { - timeTag - }, - ReferenceLyricConfig = new SyncLyricConfig - { - SyncTimeTagProperty = syncTimeTag + new TimeTag(new TextIndex(), 1000) } + }, new SyncLyricConfig + { + SyncTimeTagProperty = syncTimeTag }); + // should add the time-tag by hand because it does not sync from thr referenced lyric. + if (!syncTimeTag) + { + lyric.TimeTags = new[] + { + new TimeTag(new TextIndex(), 2000) + }; + } + + var timeTag = lyric.TimeTags.First(); + if (syncTimeTag) { TriggerHandlerChangedWithChangeForbiddenException(c => c.SetTimeTagTime(timeTag, 2000));