summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-11-19 11:39:54 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-11-19 14:39:52 +0200
commit15e1d354886421df1ebc6e7222355e8fc9909740 (patch)
tree4585cefa216306ff5bbe2e436376066d15e43077
parent986465e015132dccb5812583b4b1d05083ed9db6 (diff)
downloadqtlocation-mapboxgl-15e1d354886421df1ebc6e7222355e8fc9909740.tar.gz
[core] Add Style.SourceImplsOrder test
-rw-r--r--test/style/style.test.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp
index 72f74d3b01..b9e19d5a85 100644
--- a/test/style/style.test.cpp
+++ b/test/style/style.test.cpp
@@ -103,3 +103,25 @@ TEST(Style, RemoveSourceInUse) {
EXPECT_EQ(log->count(logMessage), 1u);
}
+
+TEST(Style, SourceImplsOrder) {
+ util::RunLoop loop;
+ StubFileSource fileSource;
+ Style::Impl style{fileSource, 1.0};
+
+ style.addSource(std::make_unique<VectorSource>("c", "mapbox://mapbox.mapbox-terrain-v2"));
+ style.addSource(std::make_unique<VectorSource>("b", "mapbox://mapbox.mapbox-terrain-v2"));
+ style.addSource(std::make_unique<VectorSource>("a", "mapbox://mapbox.mapbox-terrain-v2"));
+
+ auto sources = style.getSources();
+ ASSERT_EQ(3u, sources.size());
+ EXPECT_EQ("c", sources[0]->getID());
+ EXPECT_EQ("b", sources[1]->getID());
+ EXPECT_EQ("a", sources[2]->getID());
+
+ const auto& sourceImpls = *style.getSourceImpls();
+ ASSERT_EQ(3u, sourceImpls.size());
+ EXPECT_EQ("a", sourceImpls[0]->id);
+ EXPECT_EQ("b", sourceImpls[1]->id);
+ EXPECT_EQ("c", sourceImpls[2]->id);
+}