1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Fix timeline test

This commit is contained in:
smoogipoo 2020-11-13 17:51:01 +09:00
parent 688a442fb3
commit 864e4006b9
3 changed files with 10 additions and 23 deletions

View File

@ -10,7 +10,7 @@ namespace osu.Game.Tests.Visual.Editing
[TestFixture]
public class TestSceneTimelineBlueprintContainer : TimelineTestScene
{
public override Drawable CreateTestComponent() => new TimelineBlueprintContainer(null);
public override Drawable CreateTestComponent() => new TimelineBlueprintContainer(Composer);
protected override void LoadComplete()
{

View File

@ -21,21 +21,25 @@ namespace osu.Game.Tests.Visual.Editing
{
protected TimelineArea TimelineArea { get; private set; }
protected HitObjectComposer Composer { get; private set; }
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
Beatmap.Value = new WaveformTestBeatmap(audio);
var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset);
var editorBeatmap = new EditorBeatmap(playable);
Dependencies.Cache(editorBeatmap);
Dependencies.CacheAs<IBeatSnapProvider>(editorBeatmap);
Composer = playable.BeatmapInfo.Ruleset.CreateInstance().CreateHitObjectComposer().With(d => d.Alpha = 0);
AddRange(new Drawable[]
{
editorBeatmap,
Composer,
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,

View File

@ -8,10 +8,9 @@ using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Formats;
using osu.Game.IO;
using osu.Game.IO.Archives;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Tests.Beatmaps;
using osu.Game.Tests.Resources;
@ -25,8 +24,8 @@ namespace osu.Game.Tests
private readonly Beatmap beatmap;
private readonly ITrackStore trackStore;
public WaveformTestBeatmap(AudioManager audioManager)
: this(audioManager, new WaveformBeatmap())
public WaveformTestBeatmap(AudioManager audioManager, RulesetInfo rulesetInfo = null)
: this(audioManager, new TestBeatmap(rulesetInfo ?? new OsuRuleset().RulesetInfo))
{
}
@ -63,21 +62,5 @@ namespace osu.Game.Tests
return reader.Filenames.First(f => f.EndsWith(".mp3", StringComparison.Ordinal));
}
}
private class WaveformBeatmap : TestBeatmap
{
public WaveformBeatmap()
: base(new CatchRuleset().RulesetInfo)
{
}
protected override Beatmap CreateBeatmap()
{
using (var reader = getZipReader())
using (var beatmapStream = reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu", StringComparison.Ordinal))))
using (var beatmapReader = new LineBufferedReader(beatmapStream))
return Decoder.GetDecoder<Beatmap>(beatmapReader).Decode(beatmapReader);
}
}
}
}