Refactor channel scrolling container to handle manual scrolls resiliently

This commit is contained in:
Salman Ahmed
2022-03-04 23:23:58 +03:00
parent 4de66bb1c6
commit 5b3ffb12b7
3 changed files with 49 additions and 18 deletions

View File

@ -207,7 +207,28 @@ namespace osu.Game.Tests.Visual.Online
}
[Test]
public void TestUserScrollOverride()
public void TestOverrideChatScrolling()
{
fillChat();
sendMessage();
checkScrolledToBottom();
AddStep("Scroll to start", () => chatDisplay.ScrollContainer.ScrollToStart());
checkNotScrolledToBottom();
sendMessage();
checkNotScrolledToBottom();
AddStep("Scroll to bottom", () => chatDisplay.ScrollContainer.ScrollToEnd());
checkScrolledToBottom();
sendMessage();
checkScrolledToBottom();
}
[Test]
public void TestOverrideChatScrollingByUser()
{
fillChat();
@ -314,9 +335,9 @@ namespace osu.Game.Tests.Visual.Online
{
}
protected DrawableChannel DrawableChannel => InternalChildren.OfType<DrawableChannel>().First();
public DrawableChannel DrawableChannel => InternalChildren.OfType<DrawableChannel>().First();
protected UserTrackingScrollContainer ScrollContainer => (UserTrackingScrollContainer)((Container)DrawableChannel.Child).Child;
public UserTrackingScrollContainer ScrollContainer => (UserTrackingScrollContainer)((Container)DrawableChannel.Child).Child;
public FillFlowContainer FillFlow => (FillFlowContainer)ScrollContainer.Child;