summaryrefslogtreecommitdiff
path: root/test/style
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-11-19 15:30:19 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-11-19 17:16:54 +0200
commit8ac87ec5cb2374d212a31942ca19ce395704eb69 (patch)
tree9ec08c29e1a4f5e779f9c69ba7d96411f1c64f1d /test/style
parent9592e61288d071a7927c7cf99e7e5f3f97711642 (diff)
downloadqtlocation-mapboxgl-8ac87ec5cb2374d212a31942ca19ce395704eb69.tar.gz
Refactor util::fontStacks()
So that it does not downcast `Layer::Impl` instances. Also, an unneeded `std::vector` construction was removed from `Parser::fontStacks()`.
Diffstat (limited to 'test/style')
-rw-r--r--test/style/style_parser.test.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/test/style/style_parser.test.cpp b/test/style/style_parser.test.cpp
index 43b982c3b9..a18a9bbf57 100644
--- a/test/style/style_parser.test.cpp
+++ b/test/style/style_parser.test.cpp
@@ -11,6 +11,7 @@
#include <iostream>
#include <fstream>
+#include <set>
#include <dirent.h>
@@ -96,11 +97,12 @@ INSTANTIATE_TEST_CASE_P(StyleParser, StyleParserTest, ::testing::ValuesIn([] {
TEST(StyleParser, FontStacks) {
style::Parser parser;
parser.parse(util::read_file("test/fixtures/style_parser/font_stacks.json"));
- auto result = parser.fontStacks();
- ASSERT_EQ(3u, result.size());
- ASSERT_EQ(FontStack({"a"}), result[0]);
- ASSERT_EQ(FontStack({"a", "b"}), result[1]);
- ASSERT_EQ(FontStack({"a", "b", "c"}), result[2]);
+ std::set<mbgl::FontStack> expected;
+ expected.insert(FontStack({"a"}));
+ expected.insert(FontStack({"a", "b"}));
+ expected.insert(FontStack({"a", "b", "c"}));
+ std::set<mbgl::FontStack> result = parser.fontStacks();
+ ASSERT_EQ(expected, result);
}
TEST(StyleParser, FontStacksNoTextField) {
@@ -134,10 +136,11 @@ TEST(StyleParser, FontStacksCaseExpression) {
}
}]
})");
- auto result = parser.fontStacks();
- ASSERT_EQ(2u, result.size());
- ASSERT_EQ(FontStack({"Arial"}), result[0]);
- ASSERT_EQ(FontStack({"Helvetica"}), result[1]);
+ std::set<mbgl::FontStack> expected;
+ expected.insert(FontStack({"Arial"}));
+ expected.insert(FontStack({"Helvetica"}));
+ std::set<mbgl::FontStack> result = parser.fontStacks();
+ ASSERT_EQ(expected, result);
}
TEST(StyleParser, FontStacksMatchExpression) {
@@ -154,10 +157,11 @@ TEST(StyleParser, FontStacksMatchExpression) {
}
}]
})");
- auto result = parser.fontStacks();
- ASSERT_EQ(2u, result.size());
- ASSERT_EQ(FontStack({"Arial"}), result[0]);
- ASSERT_EQ(FontStack({"Helvetica"}), result[1]);
+ std::set<mbgl::FontStack> expected;
+ expected.insert(FontStack({"Arial"}));
+ expected.insert(FontStack({"Helvetica"}));
+ std::set<mbgl::FontStack> result = parser.fontStacks();
+ ASSERT_EQ(expected, result);
}
TEST(StyleParser, FontStacksStepExpression) {
@@ -174,10 +178,11 @@ TEST(StyleParser, FontStacksStepExpression) {
}
}]
})");
- auto result = parser.fontStacks();
- ASSERT_EQ(2u, result.size());
- ASSERT_EQ(FontStack({"Arial"}), result[0]);
- ASSERT_EQ(FontStack({"Helvetica"}), result[1]);
+ std::set<mbgl::FontStack> expected;
+ expected.insert(FontStack({"Arial"}));
+ expected.insert(FontStack({"Helvetica"}));
+ std::set<mbgl::FontStack> result = parser.fontStacks();
+ ASSERT_EQ(expected, result);
}
TEST(StyleParser, FontStacksGetExpression) {