mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 07:22:55 +08:00
Merge pull request #25468 from peppy/argon-skin-coverage
Add test coverage of accessing skin layout after importing customised default skins
This commit is contained in:
commit
4642b916b0
@ -13,6 +13,7 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Tests.Resources;
|
||||||
using SharpCompress.Archives.Zip;
|
using SharpCompress.Archives.Zip;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Skins.IO
|
namespace osu.Game.Tests.Skins.IO
|
||||||
@ -21,6 +22,25 @@ namespace osu.Game.Tests.Skins.IO
|
|||||||
{
|
{
|
||||||
#region Testing filename metadata inclusion
|
#region Testing filename metadata inclusion
|
||||||
|
|
||||||
|
[TestCase("Archives/modified-classic-20220723.osk")]
|
||||||
|
[TestCase("Archives/modified-default-20230117.osk")]
|
||||||
|
[TestCase("Archives/modified-argon-20231106.osk")]
|
||||||
|
public Task TestImportModifiedSkinHasResources(string archive) => runSkinTest(async osu =>
|
||||||
|
{
|
||||||
|
using (var stream = TestResources.OpenResource(archive))
|
||||||
|
{
|
||||||
|
var imported = await loadSkinIntoOsu(osu, new ImportTask(stream, "skin.osk"));
|
||||||
|
|
||||||
|
// When the import filename doesn't match, it should be appended (and update the skin.ini).
|
||||||
|
|
||||||
|
var skinManager = osu.Dependencies.Get<SkinManager>();
|
||||||
|
|
||||||
|
skinManager.CurrentSkinInfo.Value = imported;
|
||||||
|
|
||||||
|
Assert.That(skinManager.CurrentSkin.Value.LayoutInfos.Count, Is.EqualTo(2));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public Task TestSingleImportDifferentFilename() => runSkinTest(async osu =>
|
public Task TestSingleImportDifferentFilename() => runSkinTest(async osu =>
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ using osu.Game.IO.Archives;
|
|||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osu.Game.Screens.Play.HUD.HitErrorMeters;
|
using osu.Game.Screens.Play.HUD.HitErrorMeters;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Skinning.Components;
|
||||||
using osu.Game.Tests.Resources;
|
using osu.Game.Tests.Resources;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Skins
|
namespace osu.Game.Tests.Skins
|
||||||
@ -102,6 +103,20 @@ namespace osu.Game.Tests.Skins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDeserialiseModifiedArgon()
|
||||||
|
{
|
||||||
|
using (var stream = TestResources.OpenResource("Archives/modified-argon-20231106.osk"))
|
||||||
|
using (var storage = new ZipArchiveReader(stream))
|
||||||
|
{
|
||||||
|
var skin = new TestSkin(new SkinInfo(), null, storage);
|
||||||
|
|
||||||
|
Assert.That(skin.LayoutInfos, Has.Count.EqualTo(2));
|
||||||
|
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.ToArray(), Has.Length.EqualTo(10));
|
||||||
|
Assert.That(skin.LayoutInfos[SkinComponentsContainerLookup.TargetArea.MainHUDComponents].AllDrawables.Select(i => i.Type), Contains.Item(typeof(PlayerName)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDeserialiseModifiedClassic()
|
public void TestDeserialiseModifiedClassic()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user