2017-02-07 13:26:17 -04:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-02-09 19:08:23 -04:00
|
|
|
|
using System.Collections.Generic;
|
2017-03-02 20:20:27 +09:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-03-22 09:27:04 -03:00
|
|
|
|
using osu.Framework.MathUtils;
|
2017-04-07 09:40:35 +09:00
|
|
|
|
using osu.Framework.Testing;
|
2017-04-14 19:23:33 +09:00
|
|
|
|
using osu.Framework.Timing;
|
2017-04-18 16:05:58 +09:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2017-04-14 14:40:52 +09:00
|
|
|
|
using osu.Game.Screens.Play;
|
2017-02-07 01:49:41 -04:00
|
|
|
|
|
2017-03-02 20:20:27 +09:00
|
|
|
|
namespace osu.Desktop.VisualTests.Tests
|
2017-02-07 01:49:41 -04:00
|
|
|
|
{
|
2017-03-22 08:50:17 -03:00
|
|
|
|
internal class TestCaseSongProgress : TestCase
|
2017-02-07 01:49:41 -04:00
|
|
|
|
{
|
2017-03-23 23:38:23 -03:00
|
|
|
|
public override string Description => @"With fake data";
|
2017-02-07 01:49:41 -04:00
|
|
|
|
|
2017-02-09 19:08:23 -04:00
|
|
|
|
private SongProgress progress;
|
2017-04-18 18:40:02 +09:00
|
|
|
|
private SongProgressGraph graph;
|
2017-02-09 19:08:23 -04:00
|
|
|
|
|
2017-05-11 01:49:57 +03:00
|
|
|
|
private StopwatchClock clock;
|
|
|
|
|
|
2017-02-07 01:49:41 -04:00
|
|
|
|
public override void Reset()
|
|
|
|
|
{
|
|
|
|
|
base.Reset();
|
|
|
|
|
|
2017-05-11 01:49:57 +03:00
|
|
|
|
clock = new StopwatchClock(true);
|
|
|
|
|
|
2017-02-09 19:08:23 -04:00
|
|
|
|
Add(progress = new SongProgress
|
2017-02-03 15:22:02 -04:00
|
|
|
|
{
|
2017-04-18 18:10:01 +09:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2017-04-14 19:23:33 +09:00
|
|
|
|
AudioClock = new StopwatchClock(true),
|
2017-03-23 18:20:00 +09:00
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
2017-02-07 01:49:41 -04:00
|
|
|
|
});
|
2017-02-09 19:08:23 -04:00
|
|
|
|
|
2017-04-18 18:40:02 +09:00
|
|
|
|
Add(graph = new SongProgressGraph
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 200,
|
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
|
});
|
|
|
|
|
|
2017-04-25 19:07:07 +09:00
|
|
|
|
AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking);
|
2017-04-07 15:20:39 +09:00
|
|
|
|
AddWaitStep(5);
|
2017-04-25 19:07:07 +09:00
|
|
|
|
AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking);
|
2017-04-14 19:23:33 +09:00
|
|
|
|
AddWaitStep(2);
|
|
|
|
|
AddRepeatStep("New Values", displayNewValues, 5);
|
2017-02-09 20:12:15 -04:00
|
|
|
|
|
|
|
|
|
displayNewValues();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void displayNewValues()
|
|
|
|
|
{
|
2017-04-14 17:58:30 +09:00
|
|
|
|
List<HitObject> objects = new List<HitObject>();
|
2017-04-14 19:23:33 +09:00
|
|
|
|
for (double i = 0; i < 5000; i += RNG.NextDouble() * 10 + i / 1000)
|
2017-04-14 17:58:30 +09:00
|
|
|
|
objects.Add(new HitObject { StartTime = i });
|
2017-02-09 19:08:23 -04:00
|
|
|
|
|
2017-04-14 17:58:30 +09:00
|
|
|
|
progress.Objects = objects;
|
2017-04-18 18:40:02 +09:00
|
|
|
|
graph.Objects = objects;
|
2017-05-11 01:49:57 +03:00
|
|
|
|
|
|
|
|
|
progress.AudioClock = clock;
|
|
|
|
|
progress.OnSeek = pos => clock.Seek(pos);
|
2017-04-07 15:20:39 +09:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-07 01:49:41 -04:00
|
|
|
|
}
|