mirror of
https://github.com/ppy/osu
synced 2024-12-28 09:52:56 +00:00
Use VirtualBeatmapTrack in testcases
This commit is contained in:
parent
5640385f48
commit
c0c94e24b9
@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4");
|
||||
|
||||
protected override Track GetTrack() => new TrackVirtual();
|
||||
protected override Track GetTrack() => new TrackVirtual { Length = 1000 };
|
||||
|
||||
private class DummyRulesetInfo : RulesetInfo
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps
|
||||
/// <summary>
|
||||
/// A type of <see cref="TrackVirtual"/> which provides a valid length based on the <see cref="HitObject"/>s of an <see cref="IBeatmap"/>.
|
||||
/// </summary>
|
||||
private class VirtualBeatmapTrack : TrackVirtual
|
||||
protected class VirtualBeatmapTrack : TrackVirtual
|
||||
{
|
||||
private readonly IBeatmap beatmap;
|
||||
|
||||
|
@ -1,12 +1,10 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
namespace osu.Game.Tests.Beatmaps
|
||||
{
|
||||
@ -26,21 +24,6 @@ namespace osu.Game.Tests.Beatmaps
|
||||
private readonly IBeatmap beatmap;
|
||||
protected override IBeatmap GetBeatmap() => beatmap;
|
||||
protected override Texture GetBackground() => null;
|
||||
|
||||
protected override Track GetTrack()
|
||||
{
|
||||
var lastObject = beatmap.HitObjects.LastOrDefault();
|
||||
if (lastObject != null)
|
||||
return new TestTrack(((lastObject as IHasEndTime)?.EndTime ?? lastObject.StartTime) + 1000);
|
||||
return new TrackVirtual();
|
||||
}
|
||||
|
||||
private class TestTrack : TrackVirtual
|
||||
{
|
||||
public TestTrack(double length)
|
||||
{
|
||||
Length = length;
|
||||
}
|
||||
}
|
||||
protected override Track GetTrack() => null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user