summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Shalamov <alexander.shalamov@mapbox.com>2019-11-28 16:01:35 +0200
committerAlexander Shalamov <alexander.shalamov@mapbox.com>2019-12-02 12:08:37 +0200
commit11aa11958db123892ea950b9009876979b8db27b (patch)
tree66b545a46bf5f428675898804d9ca71af61e0106
parent38f1e8b1da3c21683ddd56986874f7535d3ea6be (diff)
downloadqtlocation-mapboxgl-11aa11958db123892ea950b9009876979b8db27b.tar.gz
[core] Add unit test for tagged string's image sections
-rw-r--r--test/text/tagged_string.test.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/text/tagged_string.test.cpp b/test/text/tagged_string.test.cpp
index ebf10c47f4..e22284541c 100644
--- a/test/text/tagged_string.test.cpp
+++ b/test/text/tagged_string.test.cpp
@@ -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');
+} \ No newline at end of file