Add ability to load long comment trees in CommentsContainer

This commit is contained in:
Andrei Zavatski
2020-02-10 15:43:11 +03:00
parent 6a38f4d13d
commit 26afe0f31e
9 changed files with 420 additions and 213 deletions

View File

@ -58,8 +58,8 @@ namespace osu.Game.Tests.Visual.Online
}
});
AddStep("load comments", () => createPage(comment_bundle));
AddStep("load empty comments", () => createPage(empty_comment_bundle));
AddStep("load comments", () => createPage(getCommentBundle()));
AddStep("load empty comments", () => createPage(getEmptyCommentBundle()));
}
private void createPage(CommentBundle commentBundle)
@ -71,13 +71,12 @@ namespace osu.Game.Tests.Visual.Online
});
}
private static readonly CommentBundle empty_comment_bundle = new CommentBundle
private CommentBundle getEmptyCommentBundle() => new CommentBundle
{
Comments = new List<Comment>(),
Total = 0,
};
private static readonly CommentBundle comment_bundle = new CommentBundle
private CommentBundle getCommentBundle() => new CommentBundle
{
Comments = new List<Comment>
{
@ -90,6 +89,33 @@ namespace osu.Game.Tests.Visual.Online
VotesCount = 5
},
new Comment
{
Id = 100,
Message = "This comment has \"load replies\" button because it has unloaded replies",
LegacyName = "TestUser1100",
CreatedAt = DateTimeOffset.Now,
VotesCount = 5,
RepliesCount = 2,
},
new Comment
{
Id = 111,
Message = "This comment has \"Show More\" button because it has unloaded replies, but some of them are loaded",
LegacyName = "TestUser1111",
CreatedAt = DateTimeOffset.Now,
VotesCount = 100,
RepliesCount = 2,
},
new Comment
{
Id = 112,
ParentId = 111,
Message = "I'm here to make my parent work",
LegacyName = "someone",
CreatedAt = DateTimeOffset.Now,
VotesCount = 2,
},
new Comment
{
Id = 2,
Message = "This comment has been deleted :( but visible for admins",
@ -155,8 +181,6 @@ namespace osu.Game.Tests.Visual.Online
Username = "Good_Admin"
}
},
TopLevelCount = 4,
Total = 7
};
}
}