[core] Add unit test for tagged string's image sections

This commit is contained in:
Alexander Shalamov
2019-11-28 16:01:35 +02:00
parent 84ec379477
commit 60b61a08f4

View File

@@ -25,3 +25,20 @@ TEST(TaggedString, Trim) {
noTrim.trim();
EXPECT_EQ(noTrim.rawText(), u"no trim!");
}
TEST(TaggedString, ImageSections) {
TaggedString string;
string.addImageSection("image_name");
EXPECT_EQ(string.rawText(), u"\uE000");
EXPECT_TRUE(string.getSection(0).imageID);
EXPECT_EQ(*string.getSection(0).imageID, "image_name");
TaggedString maxSections;
for (std::size_t i = 0; i < 6401; ++i) {
maxSections.addImageSection(util::toString(i));
}
EXPECT_EQ(maxSections.getSections().size(), 6400u);
EXPECT_EQ(maxSections.getCharCodeAt(0), u'\uE000');
EXPECT_EQ(maxSections.getCharCodeAt(6399), u'\uF8FF');
}