Merge pull request #18442 from jai-x/new-chat-announce-channel

Display Announce type channels separately in new chat overlay
This commit is contained in:
Dean Herbert
2022-05-30 16:53:15 +09:00
committed by GitHub
4 changed files with 88 additions and 33 deletions

View File

@ -87,7 +87,7 @@ namespace osu.Game.Tests.Visual.Online
{
leaveText.Text = $"OnRequestLeave: {channel.Name}";
leaveText.FadeOutFromOne(1000, Easing.InQuint);
selected.Value = null;
selected.Value = channelList.ChannelListingChannel;
channelList.RemoveChannel(channel);
};
@ -112,6 +112,12 @@ namespace osu.Game.Tests.Visual.Online
for (int i = 0; i < 10; i++)
channelList.AddChannel(createRandomPrivateChannel());
});
AddStep("Add Announce Channels", () =>
{
for (int i = 0; i < 2; i++)
channelList.AddChannel(createRandomAnnounceChannel());
});
}
[Test]
@ -170,5 +176,16 @@ namespace osu.Game.Tests.Visual.Online
Username = $"test user {id}",
});
}
private Channel createRandomAnnounceChannel()
{
int id = RNG.Next(0, 10000);
return new Channel
{
Name = $"Announce {id}",
Type = ChannelType.Announce,
Id = id,
};
}
}
}

View File

@ -455,6 +455,7 @@ namespace osu.Game.Tests.Visual.Online
[Test]
public void TestKeyboardNextChannel()
{
Channel announceChannel = createAnnounceChannel();
Channel pmChannel1 = createPrivateChannel();
Channel pmChannel2 = createPrivateChannel();
@ -464,6 +465,7 @@ namespace osu.Game.Tests.Visual.Online
channelManager.JoinChannel(testChannel2);
channelManager.JoinChannel(pmChannel1);
channelManager.JoinChannel(pmChannel2);
channelManager.JoinChannel(announceChannel);
chatOverlay.Show();
});
@ -477,6 +479,9 @@ namespace osu.Game.Tests.Visual.Online
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
AddUntilStep("PM Channel 2 displayed", () => channelIsVisible && currentDrawableChannel?.Channel == pmChannel2);
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
AddUntilStep("Announce channel displayed", () => channelIsVisible && currentDrawableChannel?.Channel == announceChannel);
AddStep("Press document next keys", () => InputManager.Keys(PlatformAction.DocumentNext));
waitForChannel1Visible();
}
@ -548,6 +553,17 @@ namespace osu.Game.Tests.Visual.Online
});
}
private Channel createAnnounceChannel()
{
int id = RNG.Next(0, 10000);
return new Channel
{
Name = $"Announce {id}",
Type = ChannelType.Announce,
Id = id,
};
}
private class TestChatOverlayV2 : ChatOverlayV2
{
public bool SlowLoading { get; set; }