From bde7f88eb3bbc69e0528cab118b698fa08600825 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 18 May 2021 14:23:22 -0700 Subject: [PATCH 1/6] Don't show warning screen when registering on dev server --- osu.Game/Overlays/AccountCreation/ScreenWarning.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index b2096968fe..ea5f1a6278 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -26,11 +26,14 @@ namespace osu.Game.Overlays.AccountCreation [Resolved(CanBeNull = true)] private IAPIProvider api { get; set; } + [Resolved] + private OsuGameBase game { get; set; } + private const string help_centre_url = "/help/wiki/Help_Centre#login"; public override void OnEntering(IScreen last) { - if (string.IsNullOrEmpty(api?.ProvidedUsername)) + if (string.IsNullOrEmpty(api?.ProvidedUsername) || game.UseDevelopmentServer) { this.FadeOut(); this.Push(new ScreenEntry()); From 4cc573690e7d366cf801a235c156350fda7a0261 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Tue, 18 May 2021 14:32:56 -0700 Subject: [PATCH 2/6] Move OsuGame out of load method --- osu.Game/Overlays/AccountCreation/ScreenWarning.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index ea5f1a6278..2605a0a6d6 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -26,8 +26,8 @@ namespace osu.Game.Overlays.AccountCreation [Resolved(CanBeNull = true)] private IAPIProvider api { get; set; } - [Resolved] - private OsuGameBase game { get; set; } + [Resolved(canBeNull: true)] + private OsuGame game { get; set; } private const string help_centre_url = "/help/wiki/Help_Centre#login"; @@ -44,7 +44,7 @@ namespace osu.Game.Overlays.AccountCreation } [BackgroundDependencyLoader(true)] - private void load(OsuColour colours, OsuGame game, TextureStore textures) + private void load(OsuColour colours, TextureStore textures) { if (string.IsNullOrEmpty(api?.ProvidedUsername)) return; From 85a3027f1ba4107bee90ee3d2c7492d93b1546f4 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 19 May 2021 13:58:41 -0700 Subject: [PATCH 3/6] Add failing test --- .../Visual/Online/TestSceneAccountCreationOverlay.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs index 3d65e7e4ba..b120a9b4db 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs @@ -1,12 +1,16 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Testing; using osu.Game.Overlays; +using osu.Game.Overlays.AccountCreation; +using osu.Game.Overlays.Settings; using osu.Game.Users; namespace osu.Game.Tests.Visual.Online @@ -51,6 +55,9 @@ namespace osu.Game.Tests.Visual.Online AddStep("show manually", () => accountCreation.Show()); AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible); + AddStep("click button", () => accountCreation.ChildrenOfType().Single().Click()); + AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType().Single().IsPresent); + AddStep("log back in", () => API.Login("dummy", "password")); AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden); } From 3da2cdfd05314d975cf3a979709646729b4bca13 Mon Sep 17 00:00:00 2001 From: Joseph Madamba Date: Wed, 19 May 2021 14:06:21 -0700 Subject: [PATCH 4/6] Fix nullref in test --- osu.Game/Overlays/AccountCreation/ScreenWarning.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index 2605a0a6d6..6efbf8896f 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays.AccountCreation public override void OnEntering(IScreen last) { - if (string.IsNullOrEmpty(api?.ProvidedUsername) || game.UseDevelopmentServer) + if (string.IsNullOrEmpty(api?.ProvidedUsername) || game?.UseDevelopmentServer == true) { this.FadeOut(); this.Push(new ScreenEntry()); From f1fd40dcca30d348cbdad21ded8f6cef557a4fb8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 May 2021 13:19:00 +0900 Subject: [PATCH 5/6] Fix test not working for various reasons --- .../Visual/Online/TestSceneAccountCreationOverlay.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs index b120a9b4db..437c5b07c9 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneAccountCreationOverlay.cs @@ -40,8 +40,6 @@ namespace osu.Game.Tests.Visual.Online [BackgroundDependencyLoader] private void load() { - API.Logout(); - localUser = API.LocalUser.GetBoundCopy(); localUser.BindValueChanged(user => { userPanelArea.Child = new UserGridPanel(user.NewValue) { Width = 200 }; }, true); } @@ -50,13 +48,13 @@ namespace osu.Game.Tests.Visual.Online public void TestOverlayVisibility() { AddStep("start hidden", () => accountCreation.Hide()); - AddStep("log out", API.Logout); + AddStep("log out", () => API.Logout()); AddStep("show manually", () => accountCreation.Show()); AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible); AddStep("click button", () => accountCreation.ChildrenOfType().Single().Click()); - AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType().Single().IsPresent); + AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType().SingleOrDefault()?.IsPresent == true); AddStep("log back in", () => API.Login("dummy", "password")); AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden); From 3c201fb8e78a2c04e541b03cd9b7a1435c98468e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 20 May 2021 13:20:35 +0900 Subject: [PATCH 6/6] Standardise `canBeNull` specification --- osu.Game/Overlays/AccountCreation/ScreenWarning.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index 6efbf8896f..3d46e9ed94 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.AccountCreation private OsuTextFlowContainer multiAccountExplanationText; private LinkFlowContainer furtherAssistance; - [Resolved(CanBeNull = true)] + [Resolved(canBeNull: true)] private IAPIProvider api { get; set; } [Resolved(canBeNull: true)]