1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 18:27:26 +08:00

Add coverage of local echo messages performing automatic scrolling

This commit is contained in:
Dean Herbert 2021-02-02 15:46:26 +09:00
parent 3670bd40c2
commit b3105fb292

View File

@ -217,6 +217,33 @@ namespace osu.Game.Tests.Visual.Online
checkScrolledToBottom(); checkScrolledToBottom();
} }
[Test]
public void TestLocalEchoMessageResetsScroll()
{
fillChat();
sendMessage();
checkScrolledToBottom();
AddStep("User scroll up", () =>
{
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre);
InputManager.PressButton(MouseButton.Left);
InputManager.MoveMouseTo(chatDisplay.ScreenSpaceDrawQuad.Centre + new Vector2(0, chatDisplay.ScreenSpaceDrawQuad.Height));
InputManager.ReleaseButton(MouseButton.Left);
});
checkNotScrolledToBottom();
sendMessage();
checkNotScrolledToBottom();
sendLocalMessage();
checkScrolledToBottom();
sendMessage();
checkScrolledToBottom();
}
private void fillChat() private void fillChat()
{ {
AddStep("fill chat", () => AddStep("fill chat", () =>
@ -243,6 +270,15 @@ namespace osu.Game.Tests.Visual.Online
})); }));
} }
private void sendLocalMessage()
{
AddStep("send local echo", () => testChannel.AddLocalEcho(new LocalEchoMessage()
{
Sender = longUsernameUser,
Content = "This is a local echo message.",
}));
}
private void checkScrolledToBottom() => private void checkScrolledToBottom() =>
AddUntilStep("is scrolled to bottom", () => chatDisplay.ScrolledToBottom); AddUntilStep("is scrolled to bottom", () => chatDisplay.ScrolledToBottom);