mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Allow confirming room password by pressing Enter
This commit is contained in:
parent
738d321788
commit
db9cf443c7
@ -80,6 +80,22 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddAssert("room join password correct", () => lastJoinedPassword == "password");
|
AddAssert("room join password correct", () => lastJoinedPassword == "password");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestJoinRoomWithPasswordViaKeyboardOnly()
|
||||||
|
{
|
||||||
|
DrawableRoom.PasswordEntryPopover passwordEntryPopover = null;
|
||||||
|
|
||||||
|
AddStep("add room", () => RoomManager.AddRooms(1, withPassword: true));
|
||||||
|
AddStep("select room", () => InputManager.Key(Key.Down));
|
||||||
|
AddStep("attempt join room", () => InputManager.Key(Key.Enter));
|
||||||
|
AddUntilStep("password prompt appeared", () => (passwordEntryPopover = InputManager.ChildrenOfType<DrawableRoom.PasswordEntryPopover>().FirstOrDefault()) != null);
|
||||||
|
AddStep("enter password in text box", () => passwordEntryPopover.ChildrenOfType<TextBox>().First().Text = "password");
|
||||||
|
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||||
|
|
||||||
|
AddAssert("room join requested", () => lastJoinedRoom == RoomManager.Rooms.First());
|
||||||
|
AddAssert("room join password correct", () => lastJoinedPassword == "password");
|
||||||
|
}
|
||||||
|
|
||||||
private void onRoomJoined(Room room, string password)
|
private void onRoomJoined(Room room, string password)
|
||||||
{
|
{
|
||||||
lastJoinedRoom = room;
|
lastJoinedRoom = room;
|
||||||
|
@ -390,6 +390,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
Schedule(() => GetContainingInputManager().ChangeFocus(passwordTextbox));
|
Schedule(() => GetContainingInputManager().ChangeFocus(passwordTextbox));
|
||||||
|
passwordTextbox.OnCommit += (_, __) => JoinRequested?.Invoke(room, passwordTextbox.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user