mirror of
https://github.com/ppy/osu.git
synced 2025-03-10 21:40:34 +08:00
Add failing test
This commit is contained in:
parent
a659936c57
commit
306b30cb12
@ -317,6 +317,29 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddAssert("score multiplier = 1.20", () => this.ChildrenOfType<RankingInformationDisplay>().Single().ModMultiplier.Value, () => Is.EqualTo(1.2).Within(0.01));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangeSettingsButtonVisibleForHost()
|
||||
{
|
||||
AddStep("add playlist item", () =>
|
||||
{
|
||||
SelectedRoom.Value!.Playlist =
|
||||
[
|
||||
new PlaylistItem(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo)
|
||||
{
|
||||
RulesetID = new OsuRuleset().RulesetInfo.OnlineID
|
||||
}
|
||||
];
|
||||
});
|
||||
ClickButtonWhenEnabled<MultiplayerMatchSettingsOverlay.CreateOrUpdateButton>();
|
||||
|
||||
AddUntilStep("wait for join", () => RoomJoined);
|
||||
|
||||
AddUntilStep("button visible", () => this.ChildrenOfType<DrawableMatchRoom>().Single().ChangeSettingsButton?.Alpha, () => Is.GreaterThan(0));
|
||||
AddStep("join other user", void () => MultiplayerClient.AddUser(new APIUser { Id = PLAYER_1_ID }));
|
||||
AddStep("make other user host", () => MultiplayerClient.TransferHost(PLAYER_1_ID));
|
||||
AddAssert("button hidden", () => this.ChildrenOfType<DrawableMatchRoom>().Single().ChangeSettingsButton?.Alpha, () => Is.EqualTo(0));
|
||||
}
|
||||
|
||||
private partial class TestMultiplayerMatchSubScreen : MultiplayerMatchSubScreen
|
||||
{
|
||||
[Resolved(canBeNull: true)]
|
||||
|
@ -25,12 +25,13 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
set => selectedItem.Current = value;
|
||||
}
|
||||
|
||||
public Drawable? ChangeSettingsButton { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
|
||||
private readonly BindableWithCurrent<PlaylistItem?> selectedItem = new BindableWithCurrent<PlaylistItem?>();
|
||||
private readonly bool allowEdit;
|
||||
private Drawable? editButton;
|
||||
|
||||
public DrawableMatchRoom(Room room, bool allowEdit = true)
|
||||
: base(room)
|
||||
@ -45,7 +46,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
{
|
||||
if (allowEdit)
|
||||
{
|
||||
ButtonsContainer.Add(editButton = new PurpleRoundedButton
|
||||
ButtonsContainer.Add(ChangeSettingsButton = new PurpleRoundedButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
@ -73,8 +74,8 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
|
||||
private void updateRoomHost()
|
||||
{
|
||||
if (editButton != null)
|
||||
editButton.Alpha = Room.Host?.Equals(api.LocalUser.Value) == true ? 1 : 0;
|
||||
if (ChangeSettingsButton != null)
|
||||
ChangeSettingsButton.Alpha = Room.Host?.Equals(api.LocalUser.Value) == true ? 1 : 0;
|
||||
}
|
||||
|
||||
protected override UpdateableBeatmapBackgroundSprite CreateBackground() => base.CreateBackground().With(d =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user