From d75db7ef986664b45c4efc57db85fb349bece581 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 29 Dec 2023 21:17:28 +0900 Subject: [PATCH 1/5] Upgrade package to the latest. --- osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj index a286b0b2e..7718183b1 100644 --- a/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj +++ b/osu.Game.Rulesets.Karaoke/osu.Game.Rulesets.Karaoke.csproj @@ -18,7 +18,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From f92099ef7e5b6df1117bc288b89fe1471843babb Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 29 Dec 2023 21:18:44 +0900 Subject: [PATCH 2/5] Fix api breaking change. See: https://github.com/ppy/osu/pull/26167/files --- osu.Game.Rulesets.Karaoke/Overlays/Changelog/ChangelogHeader.cs | 2 +- .../Screens/Edit/Beatmaps/Pages/PageScreen.cs | 2 +- .../Screens/Edit/Beatmaps/Singers/SingerScreen.cs | 2 +- .../Screens/Edit/Beatmaps/Translate/TranslateScreen.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Overlays/Changelog/ChangelogHeader.cs b/osu.Game.Rulesets.Karaoke/Overlays/Changelog/ChangelogHeader.cs index 0c0b30a86..3c4dafc02 100644 --- a/osu.Game.Rulesets.Karaoke/Overlays/Changelog/ChangelogHeader.cs +++ b/osu.Game.Rulesets.Karaoke/Overlays/Changelog/ChangelogHeader.cs @@ -58,7 +58,7 @@ public ChangelogHeaderTitle() { Title = PageTitleStrings.MainChangelogControllerDefault; Description = NamedOverlayComponentStrings.ChangelogDescription; - Icon = HexaconsIcons.Devtools; + Icon = OsuIcon.ChangelogB; } } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/PageScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/PageScreen.cs index afaedad43..5ad1d0d2e 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/PageScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Pages/PageScreen.cs @@ -118,7 +118,7 @@ public PageScreenTitle() { Title = "page"; Description = "create page of your beatmap"; - Icon = HexaconsIcons.Social; + Icon = OsuIcon.FeaturedArtistCircle; } } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/SingerScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/SingerScreen.cs index 989f7be45..1cc35fa9d 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/SingerScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Singers/SingerScreen.cs @@ -107,7 +107,7 @@ public SingerScreenTitle() { Title = "singer"; Description = "create singer of your beatmap"; - Icon = HexaconsIcons.Social; + Icon = OsuIcon.Player; } } } diff --git a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs index bb9ecb218..fc2520b46 100644 --- a/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Screens/Edit/Beatmaps/Translate/TranslateScreen.cs @@ -55,7 +55,7 @@ public TranslateScreenTitle() { Title = "translate"; Description = "create translation of your beatmap"; - Icon = HexaconsIcons.Social; + Icon = OsuIcon.Online; } } } From e3cf51c3f440612fb865a71b29953c97e3ac9629 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 29 Dec 2023 21:22:30 +0900 Subject: [PATCH 3/5] Fix the api change and follow the behavior how other ruleset did. see: https://github.com/ppy/osu/pull/26036/files --- .../Mods/KaraokeModPerfectTestScene.cs | 17 ----------------- .../Mods/TestSceneKaraokeModPerfect.cs | 5 ++++- 2 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 osu.Game.Rulesets.Karaoke.Tests/Mods/KaraokeModPerfectTestScene.cs diff --git a/osu.Game.Rulesets.Karaoke.Tests/Mods/KaraokeModPerfectTestScene.cs b/osu.Game.Rulesets.Karaoke.Tests/Mods/KaraokeModPerfectTestScene.cs deleted file mode 100644 index d54d7572f..000000000 --- a/osu.Game.Rulesets.Karaoke.Tests/Mods/KaraokeModPerfectTestScene.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) andy840119 . Licensed under the GPL Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Rulesets.Mods; -using osu.Game.Tests.Visual; - -namespace osu.Game.Rulesets.Karaoke.Tests.Mods; - -public abstract partial class KaraokeModPerfectTestScene : ModPerfectTestScene -{ - protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset(); - - protected KaraokeModPerfectTestScene(ModPerfect mod) - : base(mod) - { - } -} diff --git a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModPerfect.cs b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModPerfect.cs index 0127f5ec6..06f3ea7c3 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModPerfect.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModPerfect.cs @@ -4,11 +4,14 @@ using NUnit.Framework; using osu.Game.Rulesets.Karaoke.Mods; using osu.Game.Rulesets.Karaoke.Objects; +using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Karaoke.Tests.Mods; -public partial class TestSceneKaraokeModPerfect : KaraokeModPerfectTestScene +public partial class TestSceneKaraokeModPerfect : ModFailConditionTestScene { + protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset(); + public TestSceneKaraokeModPerfect() : base(new KaraokeModPerfect()) { From 0084f0e0c7f499dc21c619d866ebb24f5946f570 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 29 Dec 2023 21:47:13 +0900 Subject: [PATCH 4/5] Follow the official PR to create the mod test scene. But scoring is not implemented, so mark the test scene ignore. see: https://github.com/ppy/osu/pull/26036/files --- .../Mods/TestSceneKaraokeModSuddenDeath.cs | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModSuddenDeath.cs diff --git a/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModSuddenDeath.cs b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModSuddenDeath.cs new file mode 100644 index 000000000..00c478ef2 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke.Tests/Mods/TestSceneKaraokeModSuddenDeath.cs @@ -0,0 +1,77 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Karaoke.Mods; +using osu.Game.Rulesets.Karaoke.Objects; +using osu.Game.Rulesets.Karaoke.Replays; +using osu.Game.Rulesets.Karaoke.Tests.Helper; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Replays; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Karaoke.Tests.Mods; + +[Ignore("Scoring is not implemented.")] +public partial class TestSceneKaraokeModSuddenDeath : ModFailConditionTestScene +{ + protected override Ruleset CreatePlayerRuleset() => new KaraokeRuleset(); + + private readonly Lyric referencedLyric = TestCaseNoteHelper.CreateLyricForNote(1, "カラオケ", 1000, 1000); + + public TestSceneKaraokeModSuddenDeath() + : base(new KaraokeModSuddenDeath()) + { + } + + [Test] + public void TestGreatHit() => CreateModTest(new ModTestData + { + Mod = new KaraokeModSuddenDeath(), + PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(false), + Autoplay = false, + Beatmap = new Beatmap + { + HitObjects = new List + { + referencedLyric, + new Note + { + ReferenceLyricId = referencedLyric.ID, + Tone = new Tone(0), + }, + }, + }, + ReplayFrames = new List + { + new KaraokeReplayFrame(1000, 0), + new KaraokeReplayFrame(2000, 0), + }, + }); + + [Test] + public void TestBreakOnHoldNote() => CreateModTest(new ModTestData + { + Mod = new KaraokeModSuddenDeath(), + PassCondition = () => ((ModFailConditionTestPlayer)Player).CheckFailed(true) && Player.Results.Count == 2, + Autoplay = false, + Beatmap = new Beatmap + { + HitObjects = new List + { + referencedLyric, + new Note + { + ReferenceLyricId = referencedLyric.ID, + Tone = new Tone(0), + }, + }, + }, + ReplayFrames = new List + { + new KaraokeReplayFrame(0, -1), + }, + }); +} From d3a7aa95ff3817fa5c0afd27c36c953f31d48acc Mon Sep 17 00:00:00 2001 From: andy840119 Date: Fri, 29 Dec 2023 21:47:36 +0900 Subject: [PATCH 5/5] Refactor the code to make the formatter happy. --- .../Beatmaps/TestElementId.cs | 17 ++++++++++++++--- .../CaretPosition/IndexCaretPositionTest.cs | 10 ++++++++-- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs index e79d8c312..53ff9cc22 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Beatmaps/TestElementId.cs @@ -84,9 +84,20 @@ public void TestCompareToOther() var elementId = new ElementId("1234567"); Assert.AreEqual(elementId.CompareTo(null), 1); - Assert.Throws(() => elementId.CompareTo(3)); // should not compare to other type - Assert.Throws(() => elementId.CompareTo("123")); // should not compare to the string also. - Assert.DoesNotThrow(() => elementId.CompareTo(new ElementId("1234567"))); + Assert.Throws(() => + { + int _ = elementId.CompareTo(3); + }); + Assert.Throws(() => + { + // should not compare to other type + int _ = elementId.CompareTo("123"); + }); + Assert.DoesNotThrow(() => + { + // should not compare to the string also. + int _ = elementId.CompareTo(new ElementId("1234567")); + }); } [TestCase("1234567", "1234567", true)] diff --git a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/CaretPosition/IndexCaretPositionTest.cs b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/CaretPosition/IndexCaretPositionTest.cs index 1fd78dbcb..c5ed7693e 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/CaretPosition/IndexCaretPositionTest.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Screens/Edit/Beatmap/Lyrics/CaretPosition/IndexCaretPositionTest.cs @@ -67,7 +67,10 @@ public void CompareWithDifferentLyric() var caretPosition = createBiggerCaretPosition(lyric1); var comparedCaretPosition = createSmallerCaretPosition(lyric2); - Assert.Throws(() => caretPosition.CompareTo(comparedCaretPosition)); + Assert.Throws(() => + { + int _ = caretPosition.CompareTo(comparedCaretPosition); + }); } [Test] @@ -78,7 +81,10 @@ public void CompareDifferentType() var caretPosition = createBiggerCaretPosition(lyric); var comparedCaretPosition = new FakeCaretPosition(lyric); - Assert.Throws(() => caretPosition.CompareTo(comparedCaretPosition)); + Assert.Throws(() => + { + int _ = caretPosition.CompareTo(comparedCaretPosition); + }); } private IIndexCaretPosition createSmallerCaretPosition(Lyric lyric) =>