Update current tests to match the expected behaviour

This commit is contained in:
iiSaLMaN 2019-11-07 15:51:03 +03:00
parent cea5bb3963
commit 41515e9e6c

View File

@ -13,23 +13,38 @@ namespace osu.Game.Tests.Skins
[TestFixture]
public class LegacySkinDecoderTest
{
[Test]
public void TestDecodeSkinColours()
[TestCase(true)]
[TestCase(false)]
[TestCase(false, false)]
public void TestDecodeSkinColours(bool hasColours, bool canFallback = true)
{
var decoder = new LegacySkinDecoder();
using (var resStream = TestResources.OpenResource("skin.ini"))
using (var resStream = TestResources.OpenResource(hasColours ? "skin.ini" : "skin-empty.ini"))
using (var stream = new LineBufferedReader(resStream))
{
var comboColors = decoder.Decode(stream).ComboColours;
var skinConfiguration = decoder.Decode(stream);
skinConfiguration.AllowDefaultComboColoursFallback = canFallback;
List<Color4> expectedColors = new List<Color4>
var comboColors = skinConfiguration.ComboColours;
if (!canFallback && !hasColours)
{
Assert.IsNull(comboColors);
return;
}
List<Color4> expectedColors;
if (hasColours)
expectedColors = new List<Color4>
{
new Color4(142, 199, 255, 255),
new Color4(255, 128, 128, 255),
new Color4(128, 255, 255, 255),
new Color4(100, 100, 100, 100),
};
else
expectedColors = SkinConfiguration.DefaultComboColours;
Assert.AreEqual(expectedColors.Count, comboColors.Count);
for (int i = 0; i < expectedColors.Count; i++)