From 6e9f7f227d22986eb095009b95e3aef946d2db28 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Sun, 10 Feb 2019 20:48:02 +0200 Subject: [PATCH] [core] Add unit test for TaggedString --- test/text/tagged_string.test.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/text/tagged_string.test.cpp b/test/text/tagged_string.test.cpp index da1141f00b5..36ef7afe02a 100644 --- a/test/text/tagged_string.test.cpp +++ b/test/text/tagged_string.test.cpp @@ -4,6 +4,7 @@ #include using namespace mbgl; +using namespace std::literals; TEST(TaggedString, Trim) { TaggedString basic(u" \t\ntrim that and not this \n\t", SectionOptions(1.0f, {})); @@ -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()); +}