diff options
author | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-03-04 08:58:23 +0200 |
---|---|---|
committer | Alexander Shalamov <alexander.shalamov@mapbox.com> | 2019-03-04 10:20:50 +0200 |
commit | 6802a2ec5c0bce57ac51462f123792f475c58419 (patch) | |
tree | 41b3c0c790b200ea0cda42363f255c250614c265 | |
parent | f72b2add0cf523ee1b69cffc03a24b1f18c0df74 (diff) | |
download | qtlocation-mapboxgl-6802a2ec5c0bce57ac51462f123792f475c58419.tar.gz |
[core] Add unit test for TaggedString
-rw-r--r-- | test/text/tagged_string.test.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/text/tagged_string.test.cpp b/test/text/tagged_string.test.cpp index 3c58ccd94b..de74126db8 100644 --- a/test/text/tagged_string.test.cpp +++ b/test/text/tagged_string.test.cpp @@ -4,6 +4,7 @@ #include <mbgl/text/tagged_string.hpp> using namespace mbgl; +using namespace std::literals; TEST(TaggedString, Trim) { TaggedString basic(u" \t\ntrim that and not this \n\t", SectionOptions(1.0f, 0)); @@ -25,3 +26,19 @@ TEST(TaggedString, Trim) { noTrim.trim(); EXPECT_EQ(noTrim.rawText(), u"no trim!"); } + +TEST(TaggedString, MultipleSections) { + TaggedString oneSection(u"One section", SectionOptions(1.0f, {})); + EXPECT_FALSE(oneSection.hasMultipleUniqueSections()); + + TaggedString twoSections; + twoSections.addSection(u"first section", 1.5f, {}); + twoSections.addSection(u"second section", 0.5f, {}); + EXPECT_FALSE(twoSections.hasMultipleUniqueSections()); + + TaggedString multipleSections(u"", SectionOptions(1.0f, {})); + multipleSections.addSection(u"title", 1.5f, {"DIN Offc Pro Bold"s, "Arial Unicode MS Bold"s}, {"header"s}); + multipleSections.addSection(u"content", 1.5f, {"DIN Offc Pro Italic"s, "Arial Unicode MS Regular"s}, {"footer"s}); + + EXPECT_TRUE(multipleSections.hasMultipleUniqueSections()); +} |