public void TestJoinRoomWithPassword() { AddStep("create room", () => { roomManager.AddServerSideRoom(new Room { Name = { Value = "Test Room" }, Password = { Value = "password" }, Playlist = { new PlaylistItem { Beatmap ={ Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First(b => b.RulesetID == 0)).BeatmapInfo }, Ruleset ={ Value = new OsuRuleset().RulesetInfo }, } } }, API.LocalUser.Value); }); AddStep("refresh rooms", () => this.ChildrenOfType <LoungeSubScreen>().Single().UpdateFilter()); AddUntilStep("wait for room", () => this.ChildrenOfType <DrawableRoom>().Any()); AddStep("select room", () => InputManager.Key(Key.Down)); AddStep("join room", () => InputManager.Key(Key.Enter)); DrawableLoungeRoom.PasswordEntryPopover passwordEntryPopover = null; AddUntilStep("password prompt appeared", () => (passwordEntryPopover = InputManager.ChildrenOfType <DrawableLoungeRoom.PasswordEntryPopover>().FirstOrDefault()) != null); AddStep("enter password in text box", () => passwordEntryPopover.ChildrenOfType <TextBox>().First().Text = "password"); AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType <OsuButton>().First().TriggerClick()); AddUntilStep("wait for room open", () => this.ChildrenOfType <MultiplayerMatchSubScreen>().FirstOrDefault()?.IsLoaded == true); AddUntilStep("wait for join", () => roomManager.RoomJoined); }
public void TestFocusViaKeyboardCommit() { DrawableLoungeRoom.PasswordEntryPopover popover = null; AddAssert("search textbox has focus", () => checkFocus(searchTextBox)); AddStep("click room twice", () => { InputManager.MoveMouseTo(drawableRoom); InputManager.Click(MouseButton.Left); InputManager.Click(MouseButton.Left); }); AddUntilStep("wait for popover", () => (popover = InputManager.ChildrenOfType <DrawableLoungeRoom.PasswordEntryPopover>().SingleOrDefault()) != null); AddAssert("textbox has focus", () => checkFocus(popover.ChildrenOfType <OsuPasswordTextBox>().Single())); AddStep("enter password", () => popover.ChildrenOfType <OsuPasswordTextBox>().Single().Text = "password"); AddStep("commit via enter", () => InputManager.Key(Key.Enter)); AddAssert("popover has focus", () => checkFocus(popover)); AddStep("attempt another enter", () => InputManager.Key(Key.Enter)); AddAssert("popover still has focus", () => checkFocus(popover)); AddStep("unblock response", () => allowResponseCallback.Set()); AddUntilStep("wait for textbox refocus", () => checkFocus(popover.ChildrenOfType <OsuPasswordTextBox>().Single())); AddStep("press escape", () => InputManager.Key(Key.Escape)); AddStep("press escape", () => InputManager.Key(Key.Escape)); AddUntilStep("search textbox has focus", () => checkFocus(searchTextBox)); }
public void TestJoinRoomWithPasswordViaKeyboardOnly() { DrawableLoungeRoom.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 <DrawableLoungeRoom.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"); }
public void TestJoinRoomWithIncorrectPasswordViaButton() { DrawableLoungeRoom.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 <DrawableLoungeRoom.PasswordEntryPopover>().FirstOrDefault()) != null); AddStep("enter password in text box", () => passwordEntryPopover.ChildrenOfType <TextBox>().First().Text = "wrong"); AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType <OsuButton>().First().TriggerClick()); AddAssert("room not joined", () => loungeScreen.IsCurrentScreen()); AddUntilStep("password prompt still visible", () => passwordEntryPopover.State.Value == Visibility.Visible); AddAssert("textbox still focused", () => InputManager.FocusedDrawable is OsuPasswordTextBox); }