From d15db378ce2598a66f5bdad3958d964dbd1b869b Mon Sep 17 00:00:00 2001 From: iiSaLMaN Date: Wed, 9 Oct 2019 23:06:53 +0300 Subject: [PATCH] Add tests for legacy skin decoding --- osu.Game.Tests/Resources/skin-20.ini | 2 ++ osu.Game.Tests/Resources/skin-latest.ini | 2 ++ osu.Game.Tests/Skins/LegacySkinDecoderTest.cs | 11 +++++++++++ 3 files changed, 15 insertions(+) create mode 100644 osu.Game.Tests/Resources/skin-20.ini create mode 100644 osu.Game.Tests/Resources/skin-latest.ini diff --git a/osu.Game.Tests/Resources/skin-20.ini b/osu.Game.Tests/Resources/skin-20.ini new file mode 100644 index 0000000000..947b56b2f9 --- /dev/null +++ b/osu.Game.Tests/Resources/skin-20.ini @@ -0,0 +1,2 @@ +[General] +Version: 2 \ No newline at end of file diff --git a/osu.Game.Tests/Resources/skin-latest.ini b/osu.Game.Tests/Resources/skin-latest.ini new file mode 100644 index 0000000000..32f500263f --- /dev/null +++ b/osu.Game.Tests/Resources/skin-latest.ini @@ -0,0 +1,2 @@ +[General] +Version: latest \ No newline at end of file diff --git a/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs b/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs index 0d96dd08da..8c85074456 100644 --- a/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs +++ b/osu.Game.Tests/Skins/LegacySkinDecoderTest.cs @@ -56,5 +56,16 @@ namespace osu.Game.Tests.Skins Assert.AreEqual("TestValue", config.ConfigDictionary["TestLookup"]); } } + + [TestCase("skin-20.ini", 2.0)] + [TestCase("skin-latest.ini", LegacySkinConfiguration.LATEST_VERSION)] + [TestCase("skin-empty.ini", null)] + public void TestDecodeVersion(string filename, double? expected) + { + var decoder = new LegacySkinDecoder(); + using (var resStream = TestResources.OpenResource(filename)) + using (var stream = new LineBufferedReader(resStream)) + Assert.AreEqual(expected, decoder.Decode(stream).LegacyVersion); + } } }