1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 00:53:22 +08:00

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.Beatmaps;
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 @@ namespace osu.Game.Tests.Visual
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 @@ namespace osu.Game.Tests.Visual
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 @@ namespace osu.Game.Tests.Visual
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 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private void updateDisplay()
{
scoreTable.ClearScores();
loading = false;
var scoreCount = scores?.Count() ?? 0;
@ -80,15 +82,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
if (scoreCount == 0)
{
topScore.Hide();
scoreTable.ClearScores();
return;
}
topScore.Score = scores.FirstOrDefault();
topScore.Show();
scoreTable.ClearScores();
if (scoreCount < 2)
return;