Skip to content

Commit

Permalink
chore(test): P3.1 - Remove unnecessary test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Dec 11, 2024
1 parent 416ca3e commit d17bddd
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,42 +43,20 @@ public void TestLyricConfigDeserialize()
ObjectAssert.ArePropertyEqual(expected, actual);
}

[Test]
public void TestLyricStyleSerializer()
{
var lyricStyle = LyricStyle.CreateDefault();

const string expected =
"{\"$type\":1,\"left_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#CCA532\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#6B5B2D\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"right_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#5932CC\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#3D2D6B\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"name\":\"Default\"}";
string actual = JsonConvert.SerializeObject(lyricStyle, CreateSettings());
Assert.AreEqual(expected, actual);
}

[Test]
public void TestLyricStyleDeserializer()
{
const string json =
"{\"$type\":1,\"left_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#CCA532\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#6B5B2D\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"right_lyric_text_shaders\":[{\"$type\":\"StepShader\",\"name\":\"Step shader\",\"draw\":true,\"step_shaders\":[{\"$type\":\"OutlineShader\",\"outline_colour\":\"#5932CC\",\"radius\":3.0},{\"$type\":\"ShadowShader\",\"shadow_colour\":\"#3D2D6B\",\"shadow_offset\":{\"x\":3.0,\"y\":3.0}}]}],\"name\":\"Default\"}";

var expected = LyricStyle.CreateDefault();
var actual = (LyricStyle)JsonConvert.DeserializeObject<IKaraokeSkinElement>(json, CreateSettings())!;
ObjectAssert.ArePropertyEqual(expected, actual);
}

[Test]
public void TestNoteStyleSerializer()
{
var lyricConfig = NoteStyle.CreateDefault();

const string expected = "{\"$type\":2,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}";
const string expected = "{\"$type\":1,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}";
string actual = JsonConvert.SerializeObject(lyricConfig, CreateSettings());
Assert.AreEqual(expected, actual);
}

[Test]
public void TestNoteStyleDeserializer()
{
const string json = "{\"$type\":2,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}";
const string json = "{\"$type\":1,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}";

var expected = NoteStyle.CreateDefault();
var actual = (NoteStyle)JsonConvert.DeserializeObject<IKaraokeSkinElement>(json, CreateSettings())!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public TestingSkin(SkinInfo skin, IStorageResourceProvider? resources)
: base(skin, resources)
{
DefaultElement[ElementType.LyricFontInfo] = LyricFontInfo.CreateDefault();
DefaultElement[ElementType.LyricStyle] = LyricStyle.CreateDefault();
DefaultElement[ElementType.NoteStyle] = NoteStyle.CreateDefault();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ public void TestKaraokeBeatmapSkinDefaultValue()

// try to get default value from the skin.
var defaultLyricFontInfo = skin.GetConfig<Lyric, LyricFontInfo>(referencedLyric)!.Value;
var defaultLyricStyle = skin.GetConfig<Lyric, LyricStyle>(referencedLyric)!.Value;
var defaultNoteStyle = skin.GetConfig<Note, NoteStyle>(testingNote)!.Value;

// should be able to get the default value.
Assert.IsNotNull(defaultLyricFontInfo);
Assert.IsNotNull(defaultLyricStyle);
Assert.IsNotNull(defaultNoteStyle);

// Check the content
Assert.IsNotNull(defaultLyricFontInfo.Name, "Default lyric config");
Assert.IsNotNull(defaultLyricStyle.Name, "Default lyric style");
Assert.IsNotNull(defaultNoteStyle.Name, "Default note style");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ public void TestKaraokeSkinDefaultValue()

// try to get default value from the skin.
var defaultLyricFontInfo = skin.GetConfig<Lyric, LyricFontInfo>(referencedLyric)!.Value;
var defaultLyricStyle = skin.GetConfig<Lyric, LyricStyle>(referencedLyric)!.Value;
var defaultNoteStyle = skin.GetConfig<Note, NoteStyle>(testingNote)!.Value;

// should be able to get the default value.
Assert.IsNotNull(defaultLyricFontInfo);
Assert.IsNotNull(defaultLyricStyle);
Assert.IsNotNull(defaultNoteStyle);

// Check the content
Assert.IsNotNull(defaultLyricFontInfo.Name, "Default lyric config");
Assert.IsNotNull(defaultLyricStyle.Name, "Default lyric style");
Assert.IsNotNull(defaultNoteStyle.Name, "Default note style");
}
}

0 comments on commit d17bddd

Please sign in to comment.