mirror of
https://github.com/osukey/osukey.git
synced 2025-05-03 04:37:30 +09:00
Enable NRT on TopLocalRank
This commit is contained in:
parent
1d0306810a
commit
3aecd288e2
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -10,6 +8,7 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Extensions.ObjectExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -25,10 +24,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
{
|
{
|
||||||
public class TestSceneTopLocalRank : OsuTestScene
|
public class TestSceneTopLocalRank : OsuTestScene
|
||||||
{
|
{
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets = null!;
|
||||||
private BeatmapManager beatmapManager;
|
private BeatmapManager beatmapManager = null!;
|
||||||
private ScoreManager scoreManager;
|
private ScoreManager scoreManager = null!;
|
||||||
private TopLocalRank topLocalRank;
|
private TopLocalRank topLocalRank = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, AudioManager audio)
|
private void load(GameHost host, AudioManager audio)
|
||||||
@ -64,7 +63,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestBasicImportDelete()
|
public void TestBasicImportDelete()
|
||||||
{
|
{
|
||||||
ScoreInfo testScoreInfo = null;
|
ScoreInfo? testScoreInfo = null;
|
||||||
|
|
||||||
AddStep("Add score for current user", () =>
|
AddStep("Add score for current user", () =>
|
||||||
{
|
{
|
||||||
@ -80,7 +79,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("Delete score", () =>
|
AddStep("Delete score", () =>
|
||||||
{
|
{
|
||||||
scoreManager.Delete(testScoreInfo);
|
scoreManager.Delete(testScoreInfo.AsNonNull());
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("No rank displayed", () => topLocalRank.DisplayedRank == null);
|
AddUntilStep("No rank displayed", () => topLocalRank.DisplayedRank == null);
|
||||||
@ -113,7 +112,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestHigherScoreSet()
|
public void TestHigherScoreSet()
|
||||||
{
|
{
|
||||||
ScoreInfo testScoreInfo = null;
|
ScoreInfo? testScoreInfo = null;
|
||||||
|
|
||||||
AddStep("Add score for current user", () =>
|
AddStep("Add score for current user", () =>
|
||||||
{
|
{
|
||||||
@ -133,7 +132,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
testScoreInfo2.User = API.LocalUser.Value;
|
testScoreInfo2.User = API.LocalUser.Value;
|
||||||
testScoreInfo2.Rank = ScoreRank.S;
|
testScoreInfo2.Rank = ScoreRank.S;
|
||||||
testScoreInfo2.TotalScore = testScoreInfo.TotalScore + 1;
|
testScoreInfo2.TotalScore = testScoreInfo.AsNonNull().TotalScore + 1;
|
||||||
testScoreInfo2.Statistics = new Dictionary<HitResult, int>
|
testScoreInfo2.Statistics = new Dictionary<HitResult, int>
|
||||||
{
|
{
|
||||||
[HitResult.Miss] = 0,
|
[HitResult.Miss] = 0,
|
||||||
@ -153,7 +152,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestLegacyScore()
|
public void TestLegacyScore()
|
||||||
{
|
{
|
||||||
ScoreInfo testScoreInfo = null;
|
ScoreInfo? testScoreInfo = null;
|
||||||
|
|
||||||
AddStep("Add legacy score for current user", () =>
|
AddStep("Add legacy score for current user", () =>
|
||||||
{
|
{
|
||||||
@ -184,10 +183,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
[HitResult.SmallBonus] = 50
|
[HitResult.SmallBonus] = 50
|
||||||
};
|
};
|
||||||
|
|
||||||
testScoreInfo2.TotalScore = scoreManager.GetTotalScoreAsync(testScoreInfo).GetResultSafely();
|
testScoreInfo2.TotalScore = scoreManager.GetTotalScoreAsync(testScoreInfo.AsNonNull()).GetResultSafely();
|
||||||
|
|
||||||
// ensure standardised total score is less than classic, otherwise this test is pointless.
|
// ensure standardised total score is less than classic, otherwise this test is pointless.
|
||||||
Debug.Assert(testScoreInfo2.TotalScore < testScoreInfo.TotalScore);
|
Debug.Assert(testScoreInfo2.TotalScore < testScoreInfo.AsNonNull().TotalScore);
|
||||||
|
|
||||||
scoreManager.Import(testScoreInfo2);
|
scoreManager.Import(testScoreInfo2);
|
||||||
});
|
});
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -29,19 +27,19 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
private readonly BeatmapInfo beatmapInfo;
|
private readonly BeatmapInfo beatmapInfo;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
private IBindable<RulesetInfo> ruleset { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private RealmAccess realm { get; set; }
|
private RealmAccess realm { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ScoreManager scoreManager { get; set; }
|
private ScoreManager scoreManager { get; set; } = null!;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
private IDisposable scoreSubscription;
|
private IDisposable? scoreSubscription;
|
||||||
private CancellationTokenSource scoreOrderCancellationSource;
|
private CancellationTokenSource? scoreOrderCancellationSource;
|
||||||
|
|
||||||
private readonly UpdateableRank updateable;
|
private readonly UpdateableRank updateable;
|
||||||
|
|
||||||
@ -78,7 +76,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
localScoresChanged);
|
localScoresChanged);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
void localScoresChanged(IRealmCollection<ScoreInfo> sender, ChangeSet changes, Exception error)
|
void localScoresChanged(IRealmCollection<ScoreInfo> sender, ChangeSet? changes, Exception _)
|
||||||
{
|
{
|
||||||
// This subscription may fire from changes to linked beatmaps, which we don't care about.
|
// This subscription may fire from changes to linked beatmaps, which we don't care about.
|
||||||
// It's currently not possible for a score to be modified after insertion, so we can safely ignore callbacks with only modifications.
|
// It's currently not possible for a score to be modified after insertion, so we can safely ignore callbacks with only modifications.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user