diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 36dd789709..6fa91a46c4 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -9,15 +9,17 @@ using osu.Framework.GameModes.Testing; using osu.Framework.Graphics.Sprites; using osu.Framework.GameModes.Testing; using osu.Framework.Graphics.Colour; +using System.Collections.Generic; namespace osu.Desktop.VisualTests { public class TestCaseSongProgress : TestCase { public override string Name => @"Song Progress"; - public override string Description => @"With real data"; + private SongProgress progress; + public override void Reset() { base.Reset(); @@ -27,12 +29,22 @@ namespace osu.Desktop.VisualTests Colour = Color4.Gray, RelativeSizeAxes = Axes.Both }); - Add(new SongProgress + Add(progress = new SongProgress { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X }); + + var random = new Random(); + + List newValues = new List(); + for (int i = 0; i < 1000; i++) + { + newValues.Add(random.Next(1, 11)); + } + + progress.DisplayValues(newValues); } } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 3cbf70b612..8568d30d38 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -84,18 +84,7 @@ namespace osu.Game.Screens.Play current?.Track?.Start(); } } - }; - - // TODO: Remove - var random = new Random(); - - List newValues = new List(); - for (int i = 0; i < 1000; i++) - { - newValues.Add(random.Next(1, 11)); - } - - DisplayValues(newValues); + }; } } } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 13bae892d7..06810c7d07 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -72,6 +72,16 @@ namespace osu.Game.Screens.Play { calculatedValues.RemoveAll(delegate { return true; }); + if (values == null) + { + for (float i = 0; i < ColumnCount; i++) + { + calculatedValues.Add(0); + } + + return; + } + float step = (float)values.Count / (float)ColumnCount; for (float i = 0; i < values.Count; i += step)