mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 12:22:57 +08:00
updated TestCase and some null checks
This commit is contained in:
parent
6a87fd6112
commit
c60a55285c
@ -45,7 +45,9 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddRepeatStep("new retry/fail values", newRetryAndFailValues, 10);
|
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;
|
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));
|
details.Retries = Enumerable.Range(lastRange, 100).Select(i => (int)(Math.Sin(i) * 100));
|
||||||
lastRange += 100;
|
lastRange += 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void newRatings() => details.Ratings = Enumerable.Range(1, 10);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,7 +34,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
List<float> values = value.ToList();
|
List<float> values = value?.ToList() ?? new List<float>();
|
||||||
List<Bar> graphBars = Children.ToList();
|
List<Bar> graphBars = Children.ToList();
|
||||||
for (int i = 0; i < values.Count; i++)
|
for (int i = 0; i < values.Count; i++)
|
||||||
if (graphBars.Count > i)
|
if (graphBars.Count > i)
|
||||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
ratings = value.ToList();
|
ratings = value?.ToList() ?? new List<int>();
|
||||||
if(ratings.Count == 0)
|
if(ratings.Count == 0)
|
||||||
ratingsContainer.FadeOut(250);
|
ratingsContainer.FadeOut(250);
|
||||||
else
|
else
|
||||||
@ -99,7 +99,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
retries = value.ToList();
|
retries = value?.ToList() ?? new List<int>();
|
||||||
calcRetryAndFailGraph();
|
calcRetryAndFailGraph();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
fails = value.ToList();
|
fails = value?.ToList() ?? new List<int>();
|
||||||
calcRetryAndFailGraph();
|
calcRetryAndFailGraph();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
retryAndFailContainer.FadeIn(250);
|
retryAndFailContainer.FadeIn(250);
|
||||||
failGraph.Values = fails.Select(fail => (float)fail);
|
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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user