mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 11:37:28 +08:00
Update usages of Drawable.Click()
This commit is contained in:
parent
c76edd8887
commit
9b9dacf3fe
@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddAssert("Hitcircle button not clickable", () => !hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").Enabled.Value);
|
||||
AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint()));
|
||||
AddAssert("Hitcircle button is clickable", () => hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").Enabled.Value);
|
||||
AddStep("Change to hitcircle", () => hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").Click());
|
||||
AddStep("Change to hitcircle", () => hitObjectComposer.ChildrenOfType<EditorRadioButton>().First(d => d.Button.Label == "HitCircle").TriggerClick());
|
||||
AddAssert("Tool changed", () => hitObjectComposer.ChildrenOfType<ComposeBlueprintContainer>().First().CurrentTool is HitCircleCompositionTool);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
var lastAction = pauseOverlay.OnRetry;
|
||||
pauseOverlay.OnRetry = () => triggered = true;
|
||||
|
||||
getButton(1).Click();
|
||||
getButton(1).TriggerClick();
|
||||
pauseOverlay.OnRetry = lastAction;
|
||||
});
|
||||
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddAssert("has 2 rooms", () => container.Rooms.Count == 2);
|
||||
AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0));
|
||||
|
||||
AddStep("select first room", () => container.Rooms.First().Click());
|
||||
AddStep("select first room", () => container.Rooms.First().TriggerClick());
|
||||
AddAssert("first room selected", () => checkRoomSelected(RoomManager.Rooms.First()));
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
DrawableRoom.PasswordEntryPopover passwordEntryPopover = null;
|
||||
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 join room button", () => passwordEntryPopover.ChildrenOfType<OsuButton>().First().Click());
|
||||
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", () => client.Room != null);
|
||||
@ -373,7 +373,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("open mod overlay", () => this.ChildrenOfType<PurpleTriangleButton>().ElementAt(2).Click());
|
||||
AddStep("open mod overlay", () => this.ChildrenOfType<PurpleTriangleButton>().ElementAt(2).TriggerClick());
|
||||
|
||||
AddStep("invoke on back button", () => multiplayerScreen.OnBackButton());
|
||||
|
||||
@ -381,7 +381,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
AddAssert("dialog overlay is hidden", () => DialogOverlay.State.Value == Visibility.Hidden);
|
||||
|
||||
testLeave("lounge tab item", () => this.ChildrenOfType<BreadcrumbControl<IScreen>.BreadcrumbTabItem>().First().Click());
|
||||
testLeave("lounge tab item", () => this.ChildrenOfType<BreadcrumbControl<IScreen>.BreadcrumbTabItem>().First().TriggerClick());
|
||||
|
||||
testLeave("back button", () => multiplayerScreen.OnBackButton());
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
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 join room button", () => passwordEntryPopover.ChildrenOfType<OsuButton>().First().Click());
|
||||
AddStep("press join room button", () => passwordEntryPopover.ChildrenOfType<OsuButton>().First().TriggerClick());
|
||||
|
||||
AddAssert("room join requested", () => lastJoinedRoom == RoomManager.Rooms.First());
|
||||
AddAssert("room join password correct", () => lastJoinedPassword == "password");
|
||||
|
@ -53,7 +53,7 @@ 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<SettingsButton>().Single().Click());
|
||||
AddStep("click button", () => accountCreation.ChildrenOfType<SettingsButton>().Single().TriggerClick());
|
||||
AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType<ScreenWarning>().SingleOrDefault()?.IsPresent == true);
|
||||
|
||||
AddStep("log back in", () => API.Login("dummy", "password"));
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("Show", () => overlay.Show());
|
||||
AddUntilStep("Show More button is visible", () => showMoreButton?.Alpha == 1);
|
||||
setUpNewsResponse(responseWithNoCursor, "Set up no cursor response");
|
||||
AddStep("Click Show More", () => showMoreButton?.Click());
|
||||
AddStep("Click Show More", () => showMoreButton?.TriggerClick());
|
||||
AddUntilStep("Show More button is hidden", () => showMoreButton?.Alpha == 0);
|
||||
}
|
||||
|
||||
|
@ -32,19 +32,19 @@ namespace osu.Game.Tests.Visual.Online
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("click button", () => button.Click());
|
||||
AddStep("click button", () => button.TriggerClick());
|
||||
|
||||
AddAssert("action fired once", () => fireCount == 1);
|
||||
AddAssert("is in loading state", () => button.IsLoading);
|
||||
|
||||
AddStep("click button", () => button.Click());
|
||||
AddStep("click button", () => button.TriggerClick());
|
||||
|
||||
AddAssert("action not fired", () => fireCount == 1);
|
||||
AddAssert("is in loading state", () => button.IsLoading);
|
||||
|
||||
AddUntilStep("wait for loaded", () => !button.IsLoading);
|
||||
|
||||
AddStep("click button", () => button.Click());
|
||||
AddStep("click button", () => button.TriggerClick());
|
||||
|
||||
AddAssert("action fired twice", () => fireCount == 2);
|
||||
AddAssert("is in loading state", () => button.IsLoading);
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("Log in", logIn);
|
||||
AddStep("User comment", () => addVotePill(getUserComment()));
|
||||
AddAssert("Background is transparent", () => votePill.Background.Alpha == 0);
|
||||
AddStep("Click", () => votePill.Click());
|
||||
AddStep("Click", () => votePill.TriggerClick());
|
||||
AddAssert("Not loading", () => !votePill.IsLoading);
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("Log in", logIn);
|
||||
AddStep("Random comment", () => addVotePill(getRandomComment()));
|
||||
AddAssert("Background is visible", () => votePill.Background.Alpha == 1);
|
||||
AddStep("Click", () => votePill.Click());
|
||||
AddStep("Click", () => votePill.TriggerClick());
|
||||
AddAssert("Loading", () => votePill.IsLoading);
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("Hide login overlay", () => login.Hide());
|
||||
AddStep("Log out", API.Logout);
|
||||
AddStep("Random comment", () => addVotePill(getRandomComment()));
|
||||
AddStep("Click", () => votePill.Click());
|
||||
AddStep("Click", () => votePill.TriggerClick());
|
||||
AddAssert("Login overlay is visible", () => login.State.Value == Visibility.Visible);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
|
||||
AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms[0]));
|
||||
|
||||
AddStep("select last room", () => roomsContainer.Rooms[^1].Click());
|
||||
AddStep("select last room", () => roomsContainer.Rooms[^1].TriggerClick());
|
||||
|
||||
AddUntilStep("first room is masked", () => !checkRoomVisible(roomsContainer.Rooms[0]));
|
||||
AddUntilStep("last room is not masked", () => checkRoomVisible(roomsContainer.Rooms[^1]));
|
||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("start match", () => match.ChildrenOfType<PlaylistsReadyButton>().First().Click());
|
||||
AddStep("start match", () => match.ChildrenOfType<PlaylistsReadyButton>().First().TriggerClick());
|
||||
AddUntilStep("player loader loaded", () => Stack.CurrentScreen is PlayerLoader);
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
{
|
||||
var resetButton = settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First();
|
||||
|
||||
resetButton.Click();
|
||||
resetButton.TriggerClick();
|
||||
});
|
||||
|
||||
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
||||
@ -189,7 +189,7 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
{
|
||||
var resetButton = panel.ChildrenOfType<ResetButton>().First();
|
||||
|
||||
resetButton.Click();
|
||||
resetButton.TriggerClick();
|
||||
});
|
||||
|
||||
AddUntilStep("restore button hidden", () => settingsKeyBindingRow.ChildrenOfType<RestoreDefaultValueButton<bool>>().First().Alpha == 0);
|
||||
|
@ -94,10 +94,10 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
AddAssert("selected mod matches", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.Value == 1.2);
|
||||
|
||||
AddStep("deselect", () => modSelect.DeselectAllButton.Click());
|
||||
AddStep("deselect", () => modSelect.DeselectAllButton.TriggerClick());
|
||||
AddAssert("selected mods empty", () => SelectedMods.Value.Count == 0);
|
||||
|
||||
AddStep("reselect", () => modSelect.GetModButton(osuModDoubleTime).Click());
|
||||
AddStep("reselect", () => modSelect.GetModButton(osuModDoubleTime).TriggerClick());
|
||||
AddAssert("selected mod has default value", () => (SelectedMods.Value.Single() as OsuModDoubleTime)?.SpeedChange.IsDefault == true);
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
|
||||
AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod));
|
||||
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
||||
AddStep("open Customisation", () => modSelect.CustomiseButton.Click());
|
||||
AddStep("open Customisation", () => modSelect.CustomiseButton.TriggerClick());
|
||||
AddStep("deselect mod", () => modSelect.SelectMod(testCustomisableMod));
|
||||
AddAssert("controls hidden", () => modSelect.ModSettingsContainer.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
@ -40,6 +40,6 @@ namespace osu.Game.Tournament.Tests.Screens
|
||||
() => this.ChildrenOfType<TeamScore>().All(score => score.Alpha == (visible ? 1 : 0)));
|
||||
|
||||
private void toggleWarmup()
|
||||
=> AddStep("toggle warmup", () => this.ChildrenOfType<TourneyButton>().First().Click());
|
||||
=> AddStep("toggle warmup", () => this.ChildrenOfType<TourneyButton>().First().TriggerClick());
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Add(receptor = new Receptor());
|
||||
}
|
||||
|
||||
receptor.OnBackPressed = () => button.Click();
|
||||
receptor.OnBackPressed = () => button.TriggerClick();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
},
|
||||
};
|
||||
|
||||
Action = () => playButton.Click();
|
||||
Action = () => playButton.TriggerClick();
|
||||
Playing.ValueChanged += playing => progress.FadeTo(playing.NewValue ? 1 : 0, 100);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,7 @@ namespace osu.Game.Overlays.Chat.Tabs
|
||||
switch (e.Button)
|
||||
{
|
||||
case MouseButton.Middle:
|
||||
CloseButton.Click();
|
||||
CloseButton.TriggerClick();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Overlays.Comments
|
||||
if (commitButton.IsBlocked.Value)
|
||||
return;
|
||||
|
||||
commitButton.Click();
|
||||
commitButton.TriggerClick();
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -218,7 +218,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
/// <summary>
|
||||
/// Programmatically clicks the first <see cref="PopupDialogOkButton"/>.
|
||||
/// </summary>
|
||||
public void PerformOkAction() => Buttons.OfType<PopupDialogOkButton>().First().Click();
|
||||
public void PerformOkAction() => Buttons.OfType<PopupDialogOkButton>().First().TriggerClick();
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
@ -265,7 +265,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
if (!actionInvoked && content.IsPresent)
|
||||
// In the case a user did not choose an action before a hide was triggered, press the last button.
|
||||
// This is presumed to always be a sane default "cancel" action.
|
||||
buttonsContainer.Last().Click();
|
||||
buttonsContainer.Last().TriggerClick();
|
||||
|
||||
content.FadeOut(EXIT_DURATION, Easing.InSine);
|
||||
}
|
||||
@ -273,7 +273,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
private void pressButtonAtIndex(int index)
|
||||
{
|
||||
if (index < Buttons.Count())
|
||||
Buttons.Skip(index).First().Click();
|
||||
Buttons.Skip(index).First().TriggerClick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Overlays
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Select:
|
||||
CurrentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.Click();
|
||||
CurrentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -404,11 +404,11 @@ namespace osu.Game.Overlays.Mods
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Number1:
|
||||
DeselectAllButton.Click();
|
||||
DeselectAllButton.TriggerClick();
|
||||
return true;
|
||||
|
||||
case Key.Number2:
|
||||
CloseButton.Click();
|
||||
CloseButton.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
if (action == Hotkey)
|
||||
{
|
||||
Click();
|
||||
TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
Parent.Click();
|
||||
Parent.TriggerClick();
|
||||
return base.OnClick(e);
|
||||
}
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
if (buttonsTopLevel.Any(b => e.Key == b.TriggerKey))
|
||||
{
|
||||
logo?.Click();
|
||||
logo?.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -226,7 +226,7 @@ namespace osu.Game.Screens.Menu
|
||||
return goBack();
|
||||
|
||||
case GlobalAction.Select:
|
||||
logo?.Click();
|
||||
logo?.TriggerClick();
|
||||
return true;
|
||||
|
||||
default:
|
||||
@ -248,7 +248,7 @@ namespace osu.Game.Screens.Menu
|
||||
return true;
|
||||
|
||||
case ButtonSystemState.Play:
|
||||
backButton.Click();
|
||||
backButton.TriggerClick();
|
||||
return true;
|
||||
|
||||
default:
|
||||
@ -268,11 +268,11 @@ namespace osu.Game.Screens.Menu
|
||||
return true;
|
||||
|
||||
case ButtonSystemState.TopLevel:
|
||||
buttonsTopLevel.First().Click();
|
||||
buttonsTopLevel.First().TriggerClick();
|
||||
return false;
|
||||
|
||||
case ButtonSystemState.Play:
|
||||
buttonsPlay.First().Click();
|
||||
buttonsPlay.First().TriggerClick();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +262,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.Select:
|
||||
Click();
|
||||
TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -42,12 +42,12 @@ namespace osu.Game.Screens.Play
|
||||
/// <summary>
|
||||
/// Action that is invoked when <see cref="GlobalAction.Back"/> is triggered.
|
||||
/// </summary>
|
||||
protected virtual Action BackAction => () => InternalButtons.Children.LastOrDefault()?.Click();
|
||||
protected virtual Action BackAction => () => InternalButtons.Children.LastOrDefault()?.TriggerClick();
|
||||
|
||||
/// <summary>
|
||||
/// Action that is invoked when <see cref="GlobalAction.Select"/> is triggered.
|
||||
/// </summary>
|
||||
protected virtual Action SelectAction => () => InternalButtons.Selected?.Click();
|
||||
protected virtual Action SelectAction => () => InternalButtons.Selected?.TriggerClick();
|
||||
|
||||
public abstract string Header { get; }
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private SkinnableSound pauseLoop;
|
||||
|
||||
protected override Action BackAction => () => InternalButtons.Children.First().Click();
|
||||
protected override Action BackAction => () => InternalButtons.Children.First().TriggerClick();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
|
@ -148,7 +148,7 @@ namespace osu.Game.Screens.Play
|
||||
if (!button.Enabled.Value)
|
||||
return false;
|
||||
|
||||
button.Click();
|
||||
button.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
if (action == Hotkey)
|
||||
{
|
||||
Click();
|
||||
TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select
|
||||
return false;
|
||||
}
|
||||
|
||||
Click();
|
||||
TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace osu.Game.Screens.Select.Options
|
||||
|
||||
if (found != null)
|
||||
{
|
||||
found.Click();
|
||||
found.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user