2019-12-21 09:26:58 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Audio;
|
|
|
|
using osu.Game.Beatmaps;
|
2021-01-13 05:09:22 +00:00
|
|
|
using osu.Game.Configuration;
|
2019-12-21 09:26:58 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Skinning;
|
2021-01-16 04:46:46 +00:00
|
|
|
using osu.Game.Tests.Beatmaps;
|
2019-12-21 09:26:58 +00:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Tests
|
|
|
|
{
|
2021-01-16 04:46:46 +00:00
|
|
|
public class TestSceneLegacyBeatmapSkin : LegacyBeatmapSkinColourTest
|
2019-12-21 09:26:58 +00:00
|
|
|
{
|
|
|
|
[Resolved]
|
|
|
|
private AudioManager audio { get; set; }
|
|
|
|
|
2021-01-13 05:09:22 +00:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuConfigManager config)
|
|
|
|
{
|
2021-01-16 04:46:46 +00:00
|
|
|
config.BindWith(OsuSetting.BeatmapSkins, BeatmapSkins);
|
|
|
|
config.BindWith(OsuSetting.BeatmapColours, BeatmapColours);
|
2021-01-13 05:09:22 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 21:05:46 +00:00
|
|
|
[TestCase(true, true)]
|
|
|
|
[TestCase(true, false)]
|
|
|
|
[TestCase(false, true)]
|
|
|
|
[TestCase(false, false)]
|
2021-05-31 11:00:47 +00:00
|
|
|
public void TestBeatmapComboColours(bool userHasCustomColours, bool useBeatmapSkin)
|
2019-12-21 09:26:58 +00:00
|
|
|
{
|
2021-05-31 10:57:31 +00:00
|
|
|
PrepareBeatmap(() => new OsuCustomSkinWorkingBeatmap(audio, true));
|
2021-05-31 11:00:47 +00:00
|
|
|
ConfigureTest(useBeatmapSkin, true, userHasCustomColours);
|
2021-01-16 04:46:46 +00:00
|
|
|
AddAssert("is beatmap skin colours", () => TestPlayer.UsableComboColours.SequenceEqual(TestBeatmapSkin.Colours));
|
2019-12-21 09:26:58 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 21:05:46 +00:00
|
|
|
[TestCase(true)]
|
|
|
|
[TestCase(false)]
|
2021-05-31 11:00:47 +00:00
|
|
|
public void TestBeatmapComboColoursOverride(bool useBeatmapSkin)
|
2021-01-13 05:09:22 +00:00
|
|
|
{
|
2021-05-31 10:57:31 +00:00
|
|
|
PrepareBeatmap(() => new OsuCustomSkinWorkingBeatmap(audio, true));
|
2021-05-31 11:00:47 +00:00
|
|
|
ConfigureTest(useBeatmapSkin, false, true);
|
2021-01-16 04:46:46 +00:00
|
|
|
AddAssert("is user custom skin colours", () => TestPlayer.UsableComboColours.SequenceEqual(TestSkin.Colours));
|
2021-01-13 05:09:22 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 21:05:46 +00:00
|
|
|
[TestCase(true)]
|
|
|
|
[TestCase(false)]
|
2021-05-31 11:00:47 +00:00
|
|
|
public void TestBeatmapComboColoursOverrideWithDefaultColours(bool useBeatmapSkin)
|
2019-12-21 09:26:58 +00:00
|
|
|
{
|
2021-05-31 10:57:31 +00:00
|
|
|
PrepareBeatmap(() => new OsuCustomSkinWorkingBeatmap(audio, true));
|
2021-05-31 11:00:47 +00:00
|
|
|
ConfigureTest(useBeatmapSkin, false, false);
|
2021-01-16 04:46:46 +00:00
|
|
|
AddAssert("is default user skin colours", () => TestPlayer.UsableComboColours.SequenceEqual(SkinConfiguration.DefaultComboColours));
|
2021-01-13 05:09:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[TestCase(true, true)]
|
|
|
|
[TestCase(false, true)]
|
|
|
|
[TestCase(true, false)]
|
|
|
|
[TestCase(false, false)]
|
2021-05-31 11:00:47 +00:00
|
|
|
public void TestBeatmapNoComboColours(bool useBeatmapSkin, bool useBeatmapColour)
|
2021-01-13 05:09:22 +00:00
|
|
|
{
|
2021-05-31 10:57:31 +00:00
|
|
|
PrepareBeatmap(() => new OsuCustomSkinWorkingBeatmap(audio, false));
|
2021-05-31 11:00:47 +00:00
|
|
|
ConfigureTest(useBeatmapSkin, useBeatmapColour, false);
|
2021-01-16 04:46:46 +00:00
|
|
|
AddAssert("is default user skin colours", () => TestPlayer.UsableComboColours.SequenceEqual(SkinConfiguration.DefaultComboColours));
|
2019-12-21 09:26:58 +00:00
|
|
|
}
|
|
|
|
|
2021-01-13 05:09:22 +00:00
|
|
|
[TestCase(true, true)]
|
|
|
|
[TestCase(false, true)]
|
|
|
|
[TestCase(true, false)]
|
|
|
|
[TestCase(false, false)]
|
2021-05-31 11:00:47 +00:00
|
|
|
public void TestBeatmapNoComboColoursSkinOverride(bool useBeatmapSkin, bool useBeatmapColour)
|
2019-12-21 09:26:58 +00:00
|
|
|
{
|
2021-05-31 10:57:31 +00:00
|
|
|
PrepareBeatmap(() => new OsuCustomSkinWorkingBeatmap(audio, false));
|
2021-05-31 11:00:47 +00:00
|
|
|
ConfigureTest(useBeatmapSkin, useBeatmapColour, true);
|
2021-01-16 04:46:46 +00:00
|
|
|
AddAssert("is custom user skin colours", () => TestPlayer.UsableComboColours.SequenceEqual(TestSkin.Colours));
|
2019-12-21 09:26:58 +00:00
|
|
|
}
|
2021-01-13 05:09:22 +00:00
|
|
|
|
2021-01-16 04:46:46 +00:00
|
|
|
private class OsuCustomSkinWorkingBeatmap : CustomSkinWorkingBeatmap
|
2019-12-21 09:26:58 +00:00
|
|
|
{
|
2021-01-16 04:46:46 +00:00
|
|
|
public OsuCustomSkinWorkingBeatmap(AudioManager audio, bool hasColours)
|
|
|
|
: base(createBeatmap(), audio, hasColours)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
private static IBeatmap createBeatmap() =>
|
|
|
|
new Beatmap
|
2019-12-21 09:26:58 +00:00
|
|
|
{
|
|
|
|
BeatmapInfo =
|
|
|
|
{
|
|
|
|
BeatmapSet = new BeatmapSetInfo(),
|
|
|
|
Ruleset = new OsuRuleset().RulesetInfo,
|
|
|
|
},
|
|
|
|
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
|
2021-01-16 04:46:46 +00:00
|
|
|
};
|
2019-12-21 09:26:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|