-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1500 from andy840119/implement-change-the-time-by…
…-reference-lyric
- Loading branch information
Showing
12 changed files
with
233 additions
and
99 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Game.Rulesets.Karaoke.Edit.ChangeHandlers.Notes; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
using osu.Game.Rulesets.Karaoke.Tests.Helper; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Editor.ChangeHandlers.Notes | ||
{ | ||
|
@@ -16,8 +19,7 @@ public void TestSplit() | |
PrepareHitObject(new Note | ||
{ | ||
Text = "カラオケ", | ||
StartTime = 1000, | ||
Duration = 1000, | ||
ReferenceLyric = TestCaseNoteHelper.CreateLyricForNote("カラオケ", 1000, 1000) | ||
}); | ||
|
||
TriggerHandlerChanged(c => c.Split()); | ||
|
@@ -30,6 +32,8 @@ public void TestSplit() | |
var firstNote = actualNotes[0]; | ||
var secondNote = actualNotes[1]; | ||
|
||
Assert.AreSame(firstNote.ReferenceLyric, secondNote.ReferenceLyric); | ||
|
||
Assert.AreEqual("カラオケ", firstNote.Text); | ||
Assert.AreEqual(1000, firstNote.StartTime); | ||
Assert.AreEqual(500, firstNote.Duration); | ||
|
@@ -43,7 +47,7 @@ public void TestSplit() | |
[Test] | ||
public void TestCombine() | ||
{ | ||
var lyric = new Lyric(); | ||
var lyric = TestCaseNoteHelper.CreateLyricForNote("カラオケ", 1000, 1000); | ||
|
||
// note that lyric and notes should in the selection. | ||
PrepareHitObject(lyric); | ||
|
@@ -53,17 +57,15 @@ public void TestCombine() | |
{ | ||
Text = "カラ", | ||
RubyText = "から", | ||
StartTime = 1000, | ||
Duration = 500, | ||
ReferenceLyric = lyric, | ||
ReferenceTimeTagIndex = 0 | ||
}, | ||
new Note | ||
{ | ||
Text = "オケ", | ||
RubyText = "おけ", | ||
StartTime = 1500, | ||
Duration = 500, | ||
ReferenceLyric = lyric, | ||
ReferenceTimeTagIndex = 0 | ||
} | ||
}); | ||
|
||
|
@@ -158,16 +160,12 @@ public void TestClear() | |
{ | ||
Text = "カラ", | ||
RubyText = "から", | ||
StartTime = 1000, | ||
Duration = 500, | ||
ReferenceLyric = lyric, | ||
}, | ||
new Note | ||
{ | ||
Text = "オケ", | ||
RubyText = "おけ", | ||
StartTime = 1500, | ||
Duration = 500, | ||
ReferenceLyric = lyric, | ||
} | ||
}, false); | ||
|
25 changes: 25 additions & 0 deletions
25
osu.Game.Rulesets.Karaoke.Tests/Helper/TestCaseNoteHelper.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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Collections.Generic; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Tests.Helper | ||
{ | ||
public static class TestCaseNoteHelper | ||
{ | ||
public static Lyric CreateLyricForNote(string text, double startTime, double duration) | ||
{ | ||
return new Lyric | ||
{ | ||
Text = text, | ||
TimeTags = new List<TimeTag> | ||
{ | ||
new(new TextIndex(0), startTime), | ||
new(new TextIndex(text.Length - 1, TextIndex.IndexState.End), startTime + duration) | ||
} | ||
}; | ||
} | ||
} | ||
} |
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
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
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
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
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
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
Oops, something went wrong.