From 15e1d354886421df1ebc6e7222355e8fc9909740 Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Tue, 19 Nov 2019 11:39:54 +0200 Subject: [PATCH] [core] Add Style.SourceImplsOrder test --- test/style/style.test.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/style/style.test.cpp b/test/style/style.test.cpp index 72f74d3b0..b9e19d5a8 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("c", "mapbox://mapbox.mapbox-terrain-v2")); + style.addSource(std::make_unique("b", "mapbox://mapbox.mapbox-terrain-v2")); + style.addSource(std::make_unique("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); +}