1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Remove nullable disable

This commit is contained in:
Layendan 2024-07-21 23:46:04 -07:00
parent 6bb562db14
commit 6a4872faa8
4 changed files with 12 additions and 20 deletions

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
@ -18,7 +16,7 @@ namespace osu.Game.Tests.Visual.Ranking
{
public partial class TestSceneCollectionButton : OsuManualInputManagerTestScene
{
private CollectionButton collectionButton;
private CollectionButton? collectionButton;
private readonly BeatmapInfo beatmapInfo = new BeatmapInfo { OnlineID = 88 };
[SetUpSteps]
@ -43,7 +41,7 @@ namespace osu.Game.Tests.Visual.Ranking
{
AddStep("click collection button", () =>
{
InputManager.MoveMouseTo(collectionButton);
InputManager.MoveMouseTo(collectionButton!);
InputManager.Click(MouseButton.Left);
});
@ -59,7 +57,7 @@ namespace osu.Game.Tests.Visual.Ranking
AddStep("click collection button", () =>
{
InputManager.MoveMouseTo(collectionButton);
InputManager.MoveMouseTo(collectionButton!);
InputManager.Click(MouseButton.Left);
});

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Testing;
@ -17,7 +15,7 @@ namespace osu.Game.Tests.Visual.Ranking
{
public partial class TestSceneFavouriteButton : OsuTestScene
{
private FavouriteButton favourite;
private FavouriteButton? favourite;
private readonly BeatmapSetInfo beatmapSetInfo = new BeatmapSetInfo { OnlineID = 88 };
private readonly BeatmapSetInfo invalidBeatmapSetInfo = new BeatmapSetInfo();
@ -83,7 +81,7 @@ namespace osu.Game.Tests.Visual.Ranking
private void checkEnabled(bool expected)
{
AddAssert("is " + (expected ? "enabled" : "disabled"), () => favourite.Enabled.Value == expected);
AddAssert("is " + (expected ? "enabled" : "disabled"), () => favourite!.Enabled.Value == expected);
}
}
}

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -27,19 +25,19 @@ namespace osu.Game.Screens.Ranking
private readonly SpriteIcon icon;
public readonly BeatmapSetInfo BeatmapSetInfo;
private APIBeatmapSet beatmapSet;
private APIBeatmapSet? beatmapSet;
private readonly Bindable<BeatmapSetFavouriteState> current;
private PostBeatmapFavouriteRequest favouriteRequest;
private PostBeatmapFavouriteRequest? favouriteRequest;
private readonly LoadingLayer loading;
private readonly IBindable<APIUser> localUser = new Bindable<APIUser>();
[Resolved]
private IAPIProvider api { get; set; }
private IAPIProvider api { get; set; } = null!;
[Resolved]
private OsuColour colours { get; set; }
private OsuColour colours { get; set; } = null!;
public FavouriteButton(BeatmapSetInfo beatmapSetInfo)
{
@ -102,6 +100,9 @@ namespace osu.Game.Screens.Ranking
private void toggleFavouriteStatus()
{
if (beatmapSet == null)
return;
Enabled.Value = false;
loading.Show();
@ -144,9 +145,6 @@ namespace osu.Game.Screens.Ranking
private void updateState()
{
if (current?.Value == null)
return;
if (current.Value.Favourited)
{
background.Colour = colours.Green;