From 6802a2ec5c0bce57ac51462f123792f475c58419 Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Mon, 4 Mar 2019 08:58:23 +0200 Subject: [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 3c58ccd94b..de74126db8 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, 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()); +} -- cgit v1.2.1