From 0a58d5471a813835fa5c9d0133e7d49873da70b0 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 17 Jan 2024 22:52:11 +0800 Subject: [PATCH 1/2] 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, + }; } } From 2591298e07b67dfdb83181325cc7500e2a5f8286 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Wed, 17 Jan 2024 22:52:39 +0800 Subject: [PATCH 2/2] Time-tag assertion should check romanization-related property. --- osu.Game.Rulesets.Karaoke.Tests/Asserts/TimeTagAssert.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Asserts/TimeTagAssert.cs b/osu.Game.Rulesets.Karaoke.Tests/Asserts/TimeTagAssert.cs index 61fc56a77..1d292df95 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Asserts/TimeTagAssert.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Asserts/TimeTagAssert.cs @@ -23,5 +23,7 @@ public static void ArePropertyEqual(TimeTag expect, TimeTag actually) { AreEqual(expect.Index, actually.Index); AreEqual(expect.Time, actually.Time); + AreEqual(expect.FirstSyllable, actually.FirstSyllable); + AreEqual(expect.RomanizedSyllable, actually.RomanizedSyllable); } }