public TestSceneAccountCreationOverlay()
        {
            Container userPanelArea;
            AccountCreationOverlay accountCreation;

            Children = new Drawable[]
            {
                api,
                accountCreation = new AccountCreationOverlay(),
                userPanelArea   = new Container
                {
                    Padding      = new MarginPadding(10),
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.TopRight,
                    Origin       = Anchor.TopRight,
                },
            };

            api.Logout();
            api.LocalUser.BindValueChanged(user => { userPanelArea.Child = new UserPanel(user.NewValue)
                                                     {
                                                         Width = 200
                                                     }; }, true);

            AddStep("show", () => accountCreation.Show());
            AddStep("logout", () => api.Logout());
        }
Ejemplo n.º 2
0
        public void TestOverlayVisibility()
        {
            AddStep("start hidden", () => accountCreation.Hide());
            AddStep("log out", API.Logout);

            AddStep("show manually", () => accountCreation.Show());
            AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible);

            AddStep("log back in", () => API.Login("dummy", "password"));
            AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden);
        }
        public void TestOverlayVisibility()
        {
            AddStep("start hidden", () => accountCreation.Hide());
            AddStep("log out", () => API.Logout());

            AddStep("show manually", () => accountCreation.Show());
            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"));
            AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden);
        }
Ejemplo n.º 4
0
 private void load(APIAccess api, OsuConfigManager config, AccountCreationOverlay accountCreation)
 {
     this.api         = api;
     Direction        = FillDirection.Vertical;
     Spacing          = new Vector2(0, 5);
     AutoSizeAxes     = Axes.Y;
     RelativeSizeAxes = Axes.X;
     Children         = new Drawable[]
     {
         username = new OsuTextBox
         {
             PlaceholderText          = "email address",
             RelativeSizeAxes         = Axes.X,
             Text                     = api?.ProvidedUsername ?? string.Empty,
             TabbableContentContainer = this
         },
         password = new OsuPasswordTextBox
         {
             PlaceholderText          = "password",
             RelativeSizeAxes         = Axes.X,
             TabbableContentContainer = this,
             OnCommit = (sender, newText) => performLogin()
         },
         new SettingsCheckbox
         {
             LabelText = "Remember email address",
             Bindable  = config.GetBindable <bool>(OsuSetting.SaveUsername),
         },
         new SettingsCheckbox
         {
             LabelText = "Stay signed in",
             Bindable  = config.GetBindable <bool>(OsuSetting.SavePassword),
         },
         new SettingsButton
         {
             Text   = "Sign in",
             Action = performLogin
         },
         new SettingsButton
         {
             Text   = "Register",
             Action = () =>
             {
                 RequestHide();
                 accountCreation.Show();
             }
         }
     };
 }
Ejemplo n.º 5
0
        private void load(OsuConfigManager config, AccountCreationOverlay accountCreation)
        {
            Direction        = FillDirection.Vertical;
            Spacing          = new Vector2(0, 5);
            AutoSizeAxes     = Axes.Y;
            RelativeSizeAxes = Axes.X;

            ErrorTextFlowContainer errorText;

            Children = new Drawable[]
            {
                username = new OsuTextBox
                {
                    PlaceholderText          = UsersStrings.LoginUsername.ToLower(),
                    RelativeSizeAxes         = Axes.X,
                    Text                     = api?.ProvidedUsername ?? string.Empty,
                    TabbableContentContainer = this
                },
                password = new OsuPasswordTextBox
                {
                    PlaceholderText          = UsersStrings.LoginPassword.ToLower(),
                    RelativeSizeAxes         = Axes.X,
                    TabbableContentContainer = this,
                },
                errorText = new ErrorTextFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                },
                new SettingsCheckbox
                {
                    LabelText = "Remember username",
                    Current   = config.GetBindable <bool>(OsuSetting.SaveUsername),
                },
                new SettingsCheckbox
                {
                    LabelText = "Stay signed in",
                    Current   = config.GetBindable <bool>(OsuSetting.SavePassword),
                },
                new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        shakeSignIn = new ShakeContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Child            = new SettingsButton
                            {
                                Text   = UsersStrings.LoginButton,
                                Action = performLogin
                            },
                        }
                    }
                },
                new SettingsButton
                {
                    Text   = "Register",
                    Action = () =>
                    {
                        RequestHide();
                        accountCreation.Show();
                    }
                }
            };

            password.OnCommit += (sender, newText) => performLogin();

            if (api?.LastLoginError?.Message is string error)
            {
                errorText.AddErrors(new[] { error });
            }
        }