Skip to content

Commit

Permalink
Fix the api broken in the test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Jun 28, 2022
1 parent 7fbeae4 commit ba03509
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ namespace osu.Game.Rulesets.Karaoke.Tests.Editor.Lyrics.States
public class LyricCaretStateTest : OsuTestScene
{
private readonly IBeatmap beatmap;
private ILyricEditorState state;
private LyricCaretState lyricCaretState;
private ILyricEditorState state = null!;
private LyricCaretState lyricCaretState = null!;

public LyricCaretStateTest()
{
Expand Down Expand Up @@ -237,11 +237,11 @@ public void MovingHoverCaretByCaretPositionWithEditMode()

// because switch to the singer lyric, so current caret position will at the first lyric.
assertCaretPosition(Assert.IsInstanceOf<NavigateCaretPosition>);
assertCaretPosition(x => Assert.AreEqual(firstLyric, x.Lyric));
assertCaretPosition(x => Assert.AreEqual(firstLyric, x?.Lyric));

// yes, should change the position if contains algorithm.
assertHoverCaretPosition(Assert.IsInstanceOf<NavigateCaretPosition>);
assertHoverCaretPosition(x => Assert.AreEqual(targetLyric, x.Lyric));
assertHoverCaretPosition(x => Assert.AreEqual(targetLyric, x?.Lyric));
}

[Test]
Expand Down Expand Up @@ -316,17 +316,17 @@ private void movingHoverCaretByLyric(ICaretPosition caretPosition, bool exceptSu
}

private Lyric getLyricFromBeatmap(int index)
=> beatmap.HitObjects[index] as Lyric;
=> (Lyric)beatmap.HitObjects[index];

private void assertCaretPosition(Action<ICaretPosition> caretPosition)
private void assertCaretPosition(Action<ICaretPosition?> caretPosition)
{
AddStep("Assert caret position", () =>
{
caretPosition.Invoke(lyricCaretState.BindableCaretPosition.Value);
});
}

private void assertHoverCaretPosition(Action<ICaretPosition> caretPosition)
private void assertHoverCaretPosition(Action<ICaretPosition?> caretPosition)
{
AddStep("Assert hover caret position", () =>
{
Expand Down

0 comments on commit ba03509

Please sign in to comment.