forked from karaoke-dev/karaoke
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
It's time to collect all generators into same change handler.
means revert the change in the karaoke-dev#1958.
- Loading branch information
1 parent
3d519c8
commit 5d5e5dc
Showing
22 changed files
with
587 additions
and
603 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
osu.Game.Rulesets.Karaoke.Tests/Editor/ChangeHandlers/Lyrics/LyricNotesChangeHandlerTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,10 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Lyrics; | ||
using osu.Game.Rulesets.Karaoke.Edit.Generator; | ||
using osu.Game.Rulesets.Karaoke.Edit.Utils; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
using osu.Game.Screens.Edit; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Editor.ChangeHandlers.Lyrics; | ||
|
||
public partial class LyricNotesChangeHandlerTest : LyricPropertyChangeHandlerTest<LyricNotesChangeHandler> | ||
{ | ||
protected override bool IncludeAutoGenerator => true; | ||
|
||
#region Note | ||
|
||
[Test] | ||
public void TestAutoGenerateNotes() | ||
{ | ||
PrepareHitObject(() => new Lyric | ||
{ | ||
Text = "カラオケ", | ||
TimeTags = new[] | ||
{ | ||
new TimeTag(new TextIndex(0), 0), | ||
new TimeTag(new TextIndex(1), 1000), | ||
new TimeTag(new TextIndex(2), 2000), | ||
new TimeTag(new TextIndex(3), 3000), | ||
new TimeTag(new TextIndex(3, TextIndex.IndexState.End), 4000), | ||
}, | ||
}); | ||
|
||
TriggerHandlerChanged(c => c.AutoGenerate()); | ||
|
||
AssertSelectedHitObject(h => | ||
{ | ||
var actualNotes = getMatchedNotes(h); | ||
Assert.AreEqual(4, actualNotes.Length); | ||
|
||
Assert.AreEqual("カ", actualNotes[0].Text); | ||
Assert.AreEqual("ラ", actualNotes[1].Text); | ||
Assert.AreEqual("オ", actualNotes[2].Text); | ||
Assert.AreEqual("ケ", actualNotes[3].Text); | ||
}); | ||
} | ||
|
||
[Test] | ||
public void TestAutoGenerateNotesWithNonSupportedLyric() | ||
{ | ||
PrepareHitObject(() => new Lyric | ||
{ | ||
Text = "カラオケ", | ||
}); | ||
|
||
TriggerHandlerChangedWithException<GeneratorNotSupportedException>(c => c.AutoGenerate()); | ||
} | ||
|
||
private Note[] getMatchedNotes(Lyric lyric) | ||
{ | ||
var editorBeatmap = Dependencies.Get<EditorBeatmap>(); | ||
return EditorBeatmapUtils.GetNotesByLyric(editorBeatmap, lyric).ToArray(); | ||
} | ||
|
||
#endregion | ||
} |
Oops, something went wrong.