2018-01-05 19:21:19 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-09-19 22:09:08 +08:00
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
2017-09-20 14:40:27 +08:00
|
|
|
using System;
|
2017-09-20 15:59:03 +08:00
|
|
|
using System.Collections.Generic;
|
2018-03-02 14:34:31 +08:00
|
|
|
using NUnit.Framework;
|
2017-09-20 15:40:37 +08:00
|
|
|
using osu.Framework.Audio.Track;
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2017-09-20 16:16:12 +08:00
|
|
|
using osu.Framework.Graphics;
|
2017-09-19 22:09:08 +08:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Beatmaps.ControlPoints;
|
2017-09-20 16:16:12 +08:00
|
|
|
using OpenTK;
|
2017-09-26 14:45:27 +08:00
|
|
|
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
2017-09-26 16:56:16 +08:00
|
|
|
using osu.Framework.Configuration;
|
2018-03-15 17:24:57 +08:00
|
|
|
using osu.Framework.Timing;
|
2017-09-19 22:09:08 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
{
|
2018-03-02 14:34:31 +08:00
|
|
|
[TestFixture]
|
2017-12-20 20:47:45 +08:00
|
|
|
public class TestCaseEditorSummaryTimeline : OsuTestCase
|
2017-09-19 22:09:08 +08:00
|
|
|
{
|
2017-09-20 15:40:37 +08:00
|
|
|
private const int length = 60000;
|
|
|
|
private readonly Random random;
|
|
|
|
|
2017-09-20 16:16:12 +08:00
|
|
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(SummaryTimeline) };
|
2017-09-20 15:59:03 +08:00
|
|
|
|
2017-09-26 16:56:16 +08:00
|
|
|
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
|
|
|
|
2017-09-20 15:48:30 +08:00
|
|
|
public TestCaseEditorSummaryTimeline()
|
2017-09-19 22:09:08 +08:00
|
|
|
{
|
2017-09-20 15:40:37 +08:00
|
|
|
random = new Random(1337);
|
|
|
|
|
2018-03-15 17:24:57 +08:00
|
|
|
var clock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
|
|
|
|
2017-09-26 16:56:16 +08:00
|
|
|
SummaryTimeline summaryTimeline;
|
2018-03-15 17:24:57 +08:00
|
|
|
Add(summaryTimeline = new SummaryTimeline(clock)
|
2017-09-19 22:09:08 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Size = new Vector2(500, 50)
|
|
|
|
});
|
2017-09-26 16:56:16 +08:00
|
|
|
|
|
|
|
summaryTimeline.Beatmap.BindTo(beatmap);
|
|
|
|
|
|
|
|
AddStep("New beatmap", newBeatmap);
|
|
|
|
|
|
|
|
newBeatmap();
|
2017-09-19 22:09:08 +08:00
|
|
|
}
|
|
|
|
|
2017-09-26 16:56:16 +08:00
|
|
|
private void newBeatmap()
|
2017-09-20 14:40:42 +08:00
|
|
|
{
|
2017-09-26 16:56:16 +08:00
|
|
|
var b = new Beatmap();
|
2017-09-20 15:40:37 +08:00
|
|
|
|
|
|
|
for (int i = 0; i < random.Next(1, 10); i++)
|
2017-09-26 16:56:16 +08:00
|
|
|
b.ControlPointInfo.TimingPoints.Add(new TimingControlPoint { Time = random.Next(0, length) });
|
2017-09-20 15:40:37 +08:00
|
|
|
|
|
|
|
for (int i = 0; i < random.Next(1, 5); i++)
|
2017-09-26 16:56:16 +08:00
|
|
|
b.ControlPointInfo.DifficultyPoints.Add(new DifficultyControlPoint { Time = random.Next(0, length) });
|
2017-09-20 14:40:42 +08:00
|
|
|
|
2017-09-20 15:40:37 +08:00
|
|
|
for (int i = 0; i < random.Next(1, 5); i++)
|
2017-09-26 16:56:16 +08:00
|
|
|
b.ControlPointInfo.EffectPoints.Add(new EffectControlPoint { Time = random.Next(0, length) });
|
2017-09-20 14:40:42 +08:00
|
|
|
|
2017-09-20 15:40:37 +08:00
|
|
|
for (int i = 0; i < random.Next(1, 5); i++)
|
2017-12-23 15:31:45 +08:00
|
|
|
b.ControlPointInfo.SamplePoints.Add(new SampleControlPoint { Time = random.Next(0, length) });
|
2017-09-20 14:40:42 +08:00
|
|
|
|
2017-09-26 16:56:16 +08:00
|
|
|
b.BeatmapInfo.Bookmarks = new int[random.Next(10, 30)];
|
|
|
|
for (int i = 0; i < b.BeatmapInfo.Bookmarks.Length; i++)
|
|
|
|
b.BeatmapInfo.Bookmarks[i] = random.Next(0, length);
|
2017-09-20 15:40:37 +08:00
|
|
|
|
2017-09-26 16:56:16 +08:00
|
|
|
beatmap.Value = new TestWorkingBeatmap(b);
|
2017-09-20 15:40:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private class TestWorkingBeatmap : WorkingBeatmap
|
|
|
|
{
|
|
|
|
private readonly Beatmap beatmap;
|
|
|
|
|
|
|
|
public TestWorkingBeatmap(Beatmap beatmap)
|
|
|
|
: base(beatmap.BeatmapInfo)
|
|
|
|
{
|
|
|
|
this.beatmap = beatmap;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override Texture GetBackground() => null;
|
|
|
|
|
|
|
|
protected override Beatmap GetBeatmap() => beatmap;
|
|
|
|
|
|
|
|
protected override Track GetTrack() => new TestTrack();
|
|
|
|
|
|
|
|
private class TestTrack : TrackVirtual
|
|
|
|
{
|
|
|
|
public TestTrack()
|
|
|
|
{
|
|
|
|
Length = length;
|
|
|
|
}
|
|
|
|
}
|
2017-09-20 14:40:42 +08:00
|
|
|
}
|
2017-09-19 22:09:08 +08:00
|
|
|
}
|
|
|
|
}
|