1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 14:22:55 +08:00

Merge pull request #12857 from Joehuu/dev-register-no-warning

Don't show warning screen when registering on dev server
This commit is contained in:
Dean Herbert 2021-05-20 14:05:53 +09:00 committed by GitHub
commit 80a714a9c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 6 deletions

View File

@ -1,12 +1,16 @@
// 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.
using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.AccountCreation;
using osu.Game.Overlays.Settings;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Tests.Visual.Online namespace osu.Game.Tests.Visual.Online
@ -36,8 +40,6 @@ namespace osu.Game.Tests.Visual.Online
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
API.Logout();
localUser = API.LocalUser.GetBoundCopy(); localUser = API.LocalUser.GetBoundCopy();
localUser.BindValueChanged(user => { userPanelArea.Child = new UserGridPanel(user.NewValue) { Width = 200 }; }, true); localUser.BindValueChanged(user => { userPanelArea.Child = new UserGridPanel(user.NewValue) { Width = 200 }; }, true);
} }
@ -46,11 +48,14 @@ namespace osu.Game.Tests.Visual.Online
public void TestOverlayVisibility() public void TestOverlayVisibility()
{ {
AddStep("start hidden", () => accountCreation.Hide()); AddStep("start hidden", () => accountCreation.Hide());
AddStep("log out", API.Logout); AddStep("log out", () => API.Logout());
AddStep("show manually", () => accountCreation.Show()); AddStep("show manually", () => accountCreation.Show());
AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible); AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible);
AddStep("click button", () => accountCreation.ChildrenOfType<SettingsButton>().Single().Click());
AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType<ScreenWarning>().SingleOrDefault()?.IsPresent == true);
AddStep("log back in", () => API.Login("dummy", "password")); AddStep("log back in", () => API.Login("dummy", "password"));
AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden); AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden);
} }

View File

@ -23,14 +23,17 @@ namespace osu.Game.Overlays.AccountCreation
private OsuTextFlowContainer multiAccountExplanationText; private OsuTextFlowContainer multiAccountExplanationText;
private LinkFlowContainer furtherAssistance; private LinkFlowContainer furtherAssistance;
[Resolved(CanBeNull = true)] [Resolved(canBeNull: true)]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
[Resolved(canBeNull: true)]
private OsuGame game { get; set; }
private const string help_centre_url = "/help/wiki/Help_Centre#login"; private const string help_centre_url = "/help/wiki/Help_Centre#login";
public override void OnEntering(IScreen last) public override void OnEntering(IScreen last)
{ {
if (string.IsNullOrEmpty(api?.ProvidedUsername)) if (string.IsNullOrEmpty(api?.ProvidedUsername) || game?.UseDevelopmentServer == true)
{ {
this.FadeOut(); this.FadeOut();
this.Push(new ScreenEntry()); this.Push(new ScreenEntry());
@ -41,7 +44,7 @@ namespace osu.Game.Overlays.AccountCreation
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OsuColour colours, OsuGame game, TextureStore textures) private void load(OsuColour colours, TextureStore textures)
{ {
if (string.IsNullOrEmpty(api?.ProvidedUsername)) if (string.IsNullOrEmpty(api?.ProvidedUsername))
return; return;