Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[core] Add unit test for TaggedString
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshalamov committed Feb 11, 2019
1 parent 58ade74 commit 6e9f7f2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/text/tagged_string.test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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, {}));
Expand All @@ -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());
}

0 comments on commit 6e9f7f2

Please sign in to comment.