1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:58:21 +08:00

updated TestCase and some null checks

This commit is contained in:
Jorolf 2017-04-07 20:32:09 +02:00
parent 6a87fd6112
commit c60a55285c
3 changed files with 8 additions and 8 deletions

View File

@ -45,7 +45,9 @@ namespace osu.Desktop.VisualTests.Tests
});
AddRepeatStep("new retry/fail values", newRetryAndFailValues, 10);
AddStep("new ratings", newRatings);
AddStep("new ratings", () => details.Ratings = Enumerable.Range(1, 10));
AddStep("remove retries and fails", () => details.Retries = null );
AddStep("remove ratings", () => details.Ratings = null);
}
private int lastRange = 1;
@ -56,7 +58,5 @@ namespace osu.Desktop.VisualTests.Tests
details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100));
lastRange += 100;
}
private void newRatings() => details.Ratings = Enumerable.Range(1, 10);
}
}

View File

@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface
{
set
{
List<float> values = value.ToList();
List<float> values = value?.ToList() ?? new List<float>();
List<Bar> graphBars = Children.ToList();
for (int i = 0; i < values.Count; i++)
if (graphBars.Count > i)

View File

@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select
}
set
{
ratings = value.ToList();
ratings = value?.ToList() ?? new List<int>();
if(ratings.Count == 0)
ratingsContainer.FadeOut(250);
else
@ -99,7 +99,7 @@ namespace osu.Game.Screens.Select
}
set
{
retries = value.ToList();
retries = value?.ToList() ?? new List<int>();
calcRetryAndFailGraph();
}
}
@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select
}
set
{
fails = value.ToList();
fails = value?.ToList() ?? new List<int>();
calcRetryAndFailGraph();
}
}
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Select
{
retryAndFailContainer.FadeIn(250);
failGraph.Values = fails.Select(fail => (float)fail);
retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]) ?? new List<float>();
retryGraph.Values = retries?.Select((retry, index) => (float)retry + fails[index]);
}
}