mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Update tests and file access code
This commit is contained in:
parent
3db5646fa8
commit
2a9c7c00c8
@ -181,14 +181,14 @@ namespace osu.Game.Tests.Skins.IO
|
|||||||
{
|
{
|
||||||
Assert.That(import2.ID, Is.Not.EqualTo(import1.ID));
|
Assert.That(import2.ID, Is.Not.EqualTo(import1.ID));
|
||||||
Assert.That(import2.Hash, Is.Not.EqualTo(import1.Hash));
|
Assert.That(import2.Hash, Is.Not.EqualTo(import1.Hash));
|
||||||
Assert.That(import2.Files.Select(f => f.FileInfoID), Is.Not.EquivalentTo(import1.Files.Select(f => f.FileInfoID)));
|
Assert.That(import2.Files.First(), Is.Not.EqualTo(import1.Files.First()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertImportedOnce(SkinInfo import1, SkinInfo import2)
|
private void assertImportedOnce(SkinInfo import1, SkinInfo import2)
|
||||||
{
|
{
|
||||||
Assert.That(import2.ID, Is.EqualTo(import1.ID));
|
Assert.That(import2.ID, Is.EqualTo(import1.ID));
|
||||||
Assert.That(import2.Hash, Is.EqualTo(import1.Hash));
|
Assert.That(import2.Hash, Is.EqualTo(import1.Hash));
|
||||||
Assert.That(import2.Files.Select(f => f.FileInfoID), Is.EquivalentTo(import1.Files.Select(f => f.FileInfoID)));
|
Assert.That(import2.Files.First(), Is.EqualTo(import1.Files.First()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private MemoryStream createEmptyOsk()
|
private MemoryStream createEmptyOsk()
|
||||||
|
@ -122,7 +122,7 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
private void setCustomSkin()
|
private void setCustomSkin()
|
||||||
{
|
{
|
||||||
// feign a skin switch. this doesn't do anything except force CurrentSkin to become a LegacySkin.
|
// feign a skin switch. this doesn't do anything except force CurrentSkin to become a LegacySkin.
|
||||||
AddStep("set custom skin", () => skins.CurrentSkinInfo.Value = new SkinInfo { ID = 5 });
|
AddStep("set custom skin", () => skins.CurrentSkinInfo.Value = new SkinInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDefaultSkin() => AddStep("set default skin", () => skins.CurrentSkinInfo.SetDefault());
|
private void setDefaultSkin() => AddStep("set default skin", () => skins.CurrentSkinInfo.SetDefault());
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Skinning
|
|||||||
if (fileInfo == null)
|
if (fileInfo == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
byte[] bytes = resources?.Files.Get(fileInfo.FileInfo.GetStoragePath());
|
byte[] bytes = resources?.Files.Get(fileInfo.File.GetStoragePath());
|
||||||
|
|
||||||
if (bytes == null)
|
if (bytes == null)
|
||||||
continue;
|
continue;
|
||||||
@ -94,7 +94,7 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
private Stream getConfigurationStream()
|
private Stream getConfigurationStream()
|
||||||
{
|
{
|
||||||
string path = SkinInfo.Files.SingleOrDefault(f => f.Filename.Equals(@"skin.ini", StringComparison.OrdinalIgnoreCase))?.FileInfo.GetStoragePath();
|
string path = SkinInfo.Files.SingleOrDefault(f => f.Filename.Equals(@"skin.ini", StringComparison.OrdinalIgnoreCase))?.File.GetStoragePath();
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
return null;
|
return null;
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
|
using osu.Game.Models;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
@ -88,11 +89,7 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
AddStep("setup skins", () =>
|
AddStep("setup skins", () =>
|
||||||
{
|
{
|
||||||
userSkinInfo.Files.Clear();
|
userSkinInfo.Files.Clear();
|
||||||
userSkinInfo.Files.Add(new SkinFileInfo
|
userSkinInfo.Files.Add(new RealmNamedFileUsage(new RealmFile { Hash = userFile }, userFile));
|
||||||
{
|
|
||||||
Filename = userFile,
|
|
||||||
FileInfo = new IO.FileInfo { Hash = userFile }
|
|
||||||
});
|
|
||||||
|
|
||||||
beatmapInfo.BeatmapSet.Files.Clear();
|
beatmapInfo.BeatmapSet.Files.Clear();
|
||||||
beatmapInfo.BeatmapSet.Files.Add(new BeatmapSetFileInfo
|
beatmapInfo.BeatmapSet.Files.Add(new BeatmapSetFileInfo
|
||||||
|
Loading…
Reference in New Issue
Block a user