Skip to content

Commit

Permalink
Merge pull request #2307 from andy840119/remove-layout-definition-fro…
Browse files Browse the repository at this point in the history
…m-skin

Remove layout definition from skin.
  • Loading branch information
andy840119 authored Dec 6, 2024
2 parents a46eb6d + 314bd23 commit c3d3b9d
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 480 deletions.
101 changes: 0 additions & 101 deletions osu.Game.Rulesets.Karaoke.Tests/Editor/TestSceneLayoutToolTip.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -44,47 +44,13 @@ public void TestLyricConfigDeserialize()
ObjectAssert.ArePropertyEqual(expected, actual);
}

[Test]
public void TestLyricLayoutSerializer()
{
var lyricLayout = new LyricLayout
{
ID = 1,
Name = "Testing layout",
Alignment = Anchor.TopLeft,
HorizontalMargin = 10,
VerticalMargin = 20,
};

const string expected = "{\"$type\":1,\"id\":1,\"name\":\"Testing layout\",\"alignment\":9,\"horizontal_margin\":10,\"vertical_margin\":20}";
string actual = JsonConvert.SerializeObject(lyricLayout, CreateSettings());
Assert.AreEqual(expected, actual);
}

[Test]
public void TestLyricLayoutDeserialize()
{
const string json = "{\"$type\":1,\"id\":1,\"name\":\"Testing layout\",\"alignment\":9,\"horizontal_margin\":10,\"vertical_margin\":20}";

var expected = new LyricLayout
{
ID = 1,
Name = "Testing layout",
Alignment = Anchor.TopLeft,
HorizontalMargin = 10,
VerticalMargin = 20,
};
var actual = (LyricLayout)JsonConvert.DeserializeObject<IKaraokeSkinElement>(json, CreateSettings())!;
ObjectAssert.ArePropertyEqual(expected, actual);
}

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

const string expected =
"{\"$type\":2,\"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\"}";
"{\"$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);
}
Expand All @@ -93,7 +59,7 @@ public void TestLyricStyleSerializer()
public void TestLyricStyleDeserializer()
{
const string json =
"{\"$type\":2,\"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\"}";
"{\"$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())!;
Expand All @@ -105,15 +71,15 @@ public void TestNoteStyleSerializer()
{
var lyricConfig = NoteStyle.CreateDefault();

const string expected = "{\"$type\":3,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}";
const string expected = "{\"$type\":2,\"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\":3,\"name\":\"Default\",\"note_color\":\"#44AADD\",\"blink_color\":\"#FF66AA\",\"text_color\":\"#FFFFFF\",\"bold_text\":true}";
const string json = "{\"$type\":2,\"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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,4 @@ public void TestKaraokeBeatmapSkinDefaultValue()
Assert.IsNotNull(defaultLyricStyle.Name, "Default lyric style");
Assert.IsNotNull(defaultNoteStyle.Name, "Default note style");
}

[Test]
public void TestKaraokeBeatmapSkinLayout()
{
var storage = TestResources.CreateSkinStorageResourceProvider();
var skin = new KaraokeBeatmapSkin(new SkinInfo { Name = "special-skin" }, storage);

var firstLyric = new Lyric();
var secondLyric = new Lyric();

// try to get customized value from the skin.
var firstLyricLayout = skin.GetConfig<Lyric, LyricLayout>(firstLyric)!.Value;
var secondLyricLayout = skin.GetConfig<Lyric, LyricLayout>(secondLyric)!.Value;

// There's no default layout in the skin.
Assert.IsNull(firstLyricLayout);
Assert.IsNull(secondLyricLayout);
}
}
47 changes: 0 additions & 47 deletions osu.Game.Rulesets.Karaoke/Edit/Components/Cursor/LayoutToolTip.cs

This file was deleted.

This file was deleted.

Loading

0 comments on commit c3d3b9d

Please sign in to comment.