From 0a58d5471a813835fa5c9d0133e7d49873da70b0 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 17 Jan 2024 22:52:11 +0800 Subject: [PATCH] Deep clone the time-tag should copy the romanization-related property. --- osu.Game.Rulesets.Karaoke.Tests/Objects/TimeTagTest.cs | 8 +++++++- osu.Game.Rulesets.Karaoke/Objects/TimeTag.cs | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Objects/TimeTagTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Objects/TimeTagTest.cs index 62816cf64..3221fdc40 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Objects/TimeTagTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Objects/TimeTagTest.cs @@ -12,7 +12,11 @@ public class TimeTagTest [Test] public void TestClone() { - var timeTag = new TimeTag(new TextIndex(1, TextIndex.IndexState.End), 1000); + var timeTag = new TimeTag(new TextIndex(1, TextIndex.IndexState.End), 1000) + { + FirstSyllable = true, + RomanizedSyllable = "karaoke", + }; var clonedTimeTag = timeTag.DeepClone(); @@ -20,5 +24,7 @@ public void TestClone() Assert.AreNotSame(clonedTimeTag.TimeBindable, timeTag.TimeBindable); Assert.AreEqual(clonedTimeTag.Time, timeTag.Time); + Assert.AreNotSame(clonedTimeTag.FirstSyllable, timeTag.FirstSyllable); + Assert.AreEqual(clonedTimeTag.RomanizedSyllable, timeTag.RomanizedSyllable); } } diff --git a/osu.Game.Rulesets.Karaoke/Objects/TimeTag.cs b/osu.Game.Rulesets.Karaoke/Objects/TimeTag.cs index 79ffc86eb..3704a7b95 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/TimeTag.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/TimeTag.cs @@ -85,6 +85,10 @@ public string? RomanizedSyllable public TimeTag DeepClone() { - return new TimeTag(Index, Time); + return new TimeTag(Index, Time) + { + FirstSyllable = FirstSyllable, + RomanizedSyllable = RomanizedSyllable, + }; } }