1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:37:28 +08:00

Fix some remaining test failures

This commit is contained in:
Dean Herbert 2022-01-04 15:59:41 +09:00
parent 3811bd8520
commit de076678fe
4 changed files with 14 additions and 6 deletions

View File

@ -9,10 +9,12 @@ using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Solo;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
@ -93,7 +95,11 @@ namespace osu.Game.Tests.Online
[Test]
public void TestDeserialiseSubmittableScoreWithEmptyMods()
{
var score = new SubmittableScore(new ScoreInfo());
var score = new SubmittableScore(new ScoreInfo
{
User = new APIUser(),
Ruleset = new OsuRuleset().RulesetInfo,
});
var deserialised = JsonConvert.DeserializeObject<SubmittableScore>(JsonConvert.SerializeObject(score));
@ -105,7 +111,9 @@ namespace osu.Game.Tests.Online
{
var score = new SubmittableScore(new ScoreInfo
{
Mods = new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 2 } } }
Mods = new Mod[] { new OsuModDoubleTime { SpeedChange = { Value = 2 } } },
User = new APIUser(),
Ruleset = new OsuRuleset().RulesetInfo,
});
var deserialised = JsonConvert.DeserializeObject<SubmittableScore>(JsonConvert.SerializeObject(score));

View File

@ -72,6 +72,7 @@ namespace osu.Game.Tests.Visual.Ranking
Username = "peppy",
},
BeatmapInfo = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo,
Ruleset = new OsuRuleset().RulesetInfo,
Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
TotalScore = 2845370,
Accuracy = accuracy,

View File

@ -10,7 +10,6 @@ using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Users;
namespace osu.Game.Online.Solo
{
@ -48,7 +47,7 @@ namespace osu.Game.Online.Solo
public APIMod[] Mods { get; set; }
[JsonProperty("user")]
public IUser User { get; set; }
public APIUser User { get; set; }
[JsonProperty("statistics")]
public Dictionary<HitResult, int> Statistics { get; set; }

View File

@ -158,7 +158,7 @@ namespace osu.Game.Screens.Ranking
trackingContainer.Show();
if (SelectedScore.Value.Equals(score))
if (SelectedScore.Value?.Equals(score) == true)
{
SelectedScore.TriggerChange();
}
@ -185,7 +185,7 @@ namespace osu.Game.Screens.Ranking
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
{
// avoid contracting panels unnecessarily when TriggerChange is fired manually.
if (!score.OldValue.Equals(score.NewValue))
if (score.OldValue != null && !score.OldValue.Equals(score.NewValue))
{
// Contract the old panel.
foreach (var t in flow.Where(t => t.Panel.Score.Equals(score.OldValue)))