mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge branch 'refactor-combo-colour-retrieval' into legacy-beatmap-combo-offset
This commit is contained in:
@ -9,6 +9,7 @@ using System.Reflection;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
@ -16,6 +17,7 @@ using osu.Game.IO;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
@ -164,7 +166,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
private Stream openResource(string name)
|
||||
{
|
||||
var localPath = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
|
||||
var localPath = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)).AsNonNull();
|
||||
return Assembly.LoadFrom(Path.Combine(localPath, $"{ResourceAssembly}.dll")).GetManifestResourceStream($@"{ResourceAssembly}.Resources.{name}");
|
||||
}
|
||||
|
||||
@ -215,6 +217,8 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
|
||||
|
||||
protected override ISkin GetSkin() => throw new NotImplementedException();
|
||||
|
||||
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
|
||||
|
||||
protected override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.IO;
|
||||
@ -30,18 +31,22 @@ namespace osu.Game.Tests.Beatmaps
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
{
|
||||
var decoder = Decoder.GetDecoder<Beatmap>(stream);
|
||||
|
||||
((LegacyBeatmapDecoder)decoder).ApplyOffsets = false;
|
||||
|
||||
var working = new TestWorkingBeatmap(decoder.Decode(stream));
|
||||
working.BeatmapInfo.Ruleset = CreateRuleset().RulesetInfo;
|
||||
|
||||
return working;
|
||||
return new TestWorkingBeatmap(decoder.Decode(stream))
|
||||
{
|
||||
BeatmapInfo =
|
||||
{
|
||||
Ruleset = CreateRuleset().RulesetInfo
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private Stream openResource(string name)
|
||||
{
|
||||
var localPath = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
|
||||
var localPath = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)).AsNonNull();
|
||||
return Assembly.LoadFrom(Path.Combine(localPath, $"{ResourceAssembly}.dll")).GetManifestResourceStream($@"{ResourceAssembly}.Resources.{name}");
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
[HeadlessTest]
|
||||
public abstract class HitObjectSampleTest : PlayerTestScene, IStorageResourceProvider
|
||||
{
|
||||
protected abstract IResourceStore<byte[]> Resources { get; }
|
||||
protected abstract IResourceStore<byte[]> RulesetResources { get; }
|
||||
protected LegacySkin Skin { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
@ -75,7 +75,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
AddStep($"load {filename}", () =>
|
||||
{
|
||||
using (var reader = new LineBufferedReader(Resources.GetStream($"Resources/SampleLookups/{filename}")))
|
||||
using (var reader = new LineBufferedReader(RulesetResources.GetStream($"Resources/SampleLookups/{filename}")))
|
||||
currentTestBeatmap = Decoder.GetDecoder<Beatmap>(reader).Decode(reader);
|
||||
|
||||
// populate ruleset for beatmap converters that require it to be present.
|
||||
@ -127,6 +127,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
public AudioManager AudioManager => Audio;
|
||||
public IResourceStore<byte[]> Files => userSkinResourceStore;
|
||||
public new IResourceStore<byte[]> Resources => base.Resources;
|
||||
public IResourceStore<TextureUpload> CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore) => null;
|
||||
|
||||
#endregion
|
||||
|
@ -20,23 +20,17 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
protected readonly Bindable<bool> BeatmapSkins = new Bindable<bool>();
|
||||
protected readonly Bindable<bool> BeatmapColours = new Bindable<bool>();
|
||||
|
||||
protected ExposedPlayer TestPlayer;
|
||||
protected WorkingBeatmap TestBeatmap;
|
||||
|
||||
public virtual void TestBeatmapComboColours(bool userHasCustomColours, bool useBeatmapSkin) => ConfigureTest(useBeatmapSkin, true, userHasCustomColours);
|
||||
private WorkingBeatmap testBeatmap;
|
||||
|
||||
public virtual void TestBeatmapComboColoursOverride(bool useBeatmapSkin) => ConfigureTest(useBeatmapSkin, false, true);
|
||||
protected void PrepareBeatmap(Func<WorkingBeatmap> createBeatmap) => AddStep("prepare beatmap", () => testBeatmap = createBeatmap());
|
||||
|
||||
public virtual void TestBeatmapComboColoursOverrideWithDefaultColours(bool useBeatmapSkin) => ConfigureTest(useBeatmapSkin, false, false);
|
||||
|
||||
public virtual void TestBeatmapNoComboColours(bool useBeatmapSkin, bool useBeatmapColour) => ConfigureTest(useBeatmapSkin, useBeatmapColour, false);
|
||||
|
||||
public virtual void TestBeatmapNoComboColoursSkinOverride(bool useBeatmapSkin, bool useBeatmapColour) => ConfigureTest(useBeatmapSkin, useBeatmapColour, true);
|
||||
|
||||
protected virtual void ConfigureTest(bool useBeatmapSkin, bool useBeatmapColours, bool userHasCustomColours)
|
||||
protected void ConfigureTest(bool useBeatmapSkin, bool useBeatmapColours, bool userHasCustomColours)
|
||||
{
|
||||
configureSettings(useBeatmapSkin, useBeatmapColours);
|
||||
AddStep($"load {(((CustomSkinWorkingBeatmap)TestBeatmap).HasColours ? "coloured " : "")} beatmap", () => TestPlayer = LoadBeatmap(userHasCustomColours));
|
||||
AddStep("load beatmap", () => TestPlayer = LoadBeatmap(userHasCustomColours));
|
||||
AddUntilStep("wait for player load", () => TestPlayer.IsLoaded);
|
||||
}
|
||||
|
||||
@ -56,7 +50,7 @@ namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
ExposedPlayer player;
|
||||
|
||||
Beatmap.Value = TestBeatmap;
|
||||
Beatmap.Value = testBeatmap;
|
||||
|
||||
LoadScreen(player = CreateTestPlayer(userHasCustomColours));
|
||||
|
||||
@ -163,6 +157,10 @@ namespace osu.Game.Tests.Beatmaps
|
||||
add { }
|
||||
remove { }
|
||||
}
|
||||
|
||||
public ISkin FindProvider(Func<ISkin, bool> lookupFunction) => lookupFunction(this) ? this : null;
|
||||
|
||||
public IEnumerable<ISkin> AllSources => new[] { this };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ namespace osu.Game.Tests.Beatmaps
|
||||
BeatmapInfo.Ruleset = ruleset;
|
||||
BeatmapInfo.RulesetID = ruleset.ID ?? 0;
|
||||
BeatmapInfo.BeatmapSet.Metadata = BeatmapInfo.Metadata;
|
||||
BeatmapInfo.BeatmapSet.Files = new List<BeatmapSetFileInfo>();
|
||||
BeatmapInfo.BeatmapSet.Beatmaps = new List<BeatmapInfo> { BeatmapInfo };
|
||||
BeatmapInfo.Length = 75000;
|
||||
BeatmapInfo.OnlineInfo = new BeatmapOnlineInfo();
|
||||
|
@ -6,6 +6,7 @@ using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Storyboards;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps
|
||||
@ -36,6 +37,8 @@ namespace osu.Game.Tests.Beatmaps
|
||||
|
||||
protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard();
|
||||
|
||||
protected override ISkin GetSkin() => null;
|
||||
|
||||
public override Stream GetStream(string storagePath) => null;
|
||||
|
||||
protected override Texture GetBackground() => null;
|
||||
|
Reference in New Issue
Block a user