TestCase fix

This commit is contained in:
EVAST9919 2019-02-09 00:56:41 +03:00
parent 107e0a5239
commit 105053e91b
2 changed files with 8 additions and 5 deletions

View File

@ -17,10 +17,11 @@
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
using NUnit.Framework;
namespace osu.Game.Tests.Visual
{
[System.ComponentModel.Description("in BeatmapOverlay")]
[Description("in BeatmapOverlay")]
public class TestCaseBeatmapScoresContainer : OsuTestCase
{
private readonly IEnumerable<APIScoreInfo> scores;
@ -160,11 +161,12 @@ public TestCaseBeatmapScoresContainer()
Accuracy = 0.6543,
},
};
foreach(var s in scores)
foreach (var s in scores)
{
s.Statistics.Add(HitResult.Great, RNG.Next(2000));
s.Statistics.Add(HitResult.Good, RNG.Next(2000));
s.Statistics.Add(HitResult.Meh, RNG.Next(2000));
s.Statistics.Add(HitResult.Miss, RNG.Next(2000));
}
anotherScores = new[]
@ -277,6 +279,7 @@ public TestCaseBeatmapScoresContainer()
s.Statistics.Add(HitResult.Great, RNG.Next(2000));
s.Statistics.Add(HitResult.Good, RNG.Next(2000));
s.Statistics.Add(HitResult.Meh, RNG.Next(2000));
s.Statistics.Add(HitResult.Miss, RNG.Next(2000));
}
topScoreInfo = new APIScoreInfo
@ -304,6 +307,7 @@ public TestCaseBeatmapScoresContainer()
topScoreInfo.Statistics.Add(HitResult.Great, RNG.Next(2000));
topScoreInfo.Statistics.Add(HitResult.Good, RNG.Next(2000));
topScoreInfo.Statistics.Add(HitResult.Meh, RNG.Next(2000));
topScoreInfo.Statistics.Add(HitResult.Miss, RNG.Next(2000));
}
[BackgroundDependencyLoader]

View File

@ -73,6 +73,8 @@ public BeatmapInfo Beatmap
private void updateDisplay()
{
scoreTable.ClearScores();
loading = false;
var scoreCount = scores?.Count() ?? 0;
@ -80,15 +82,12 @@ private void updateDisplay()
if (scoreCount == 0)
{
topScore.Hide();
scoreTable.ClearScores();
return;
}
topScore.Score = scores.FirstOrDefault();
topScore.Show();
scoreTable.ClearScores();
if (scoreCount < 2)
return;