summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-09-24 12:32:23 +0300
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-09-26 11:47:34 +0200
commit2ed81bbaaeecab12ea50813275269a3b1778f8ea (patch)
tree38b2ad27135371878140e48aa85f5e6dd81dcad1 /test
parentae3a02babe557867b115ad69bb83ae3da2cfe43f (diff)
downloadqtlocation-mapboxgl-2ed81bbaaeecab12ea50813275269a3b1778f8ea.tar.gz
[core] Trigger Update::RecalculateStyle when toggling layer visibility
Diffstat (limited to 'test')
-rw-r--r--test/style/style.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/style/style.cpp b/test/style/style.cpp
index ff03e3c2cc..41f12f6ff7 100644
--- a/test/style/style.cpp
+++ b/test/style/style.cpp
@@ -3,6 +3,7 @@
#include <mbgl/style/style.hpp>
#include <mbgl/style/source_impl.hpp>
+#include <mbgl/style/layer.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/run_loop.hpp>
@@ -25,13 +26,25 @@ TEST(Style, UnusedSource) {
style.cascade(now, MapMode::Still);
style.recalculate(0, now, MapMode::Still);
- Source *usedSource = style.getSource("usedsource");
+ Source* usedSource = style.getSource("usedsource");
EXPECT_TRUE(usedSource);
EXPECT_TRUE(usedSource->baseImpl->isLoaded());
- Source *unusedSource = style.getSource("unusedsource");
+ Source* unusedSource = style.getSource("unusedsource");
EXPECT_TRUE(unusedSource);
EXPECT_FALSE(unusedSource->baseImpl->isLoaded());
+
+ Layer* unusedLayer = style.getLayer("unusedlayervisibility");
+ EXPECT_TRUE(unusedLayer);
+
+ unusedLayer->setVisibility(mbgl::style::VisibilityType::Visible);
+
+ style.relayout();
+ EXPECT_FALSE(unusedSource->baseImpl->isLoaded());
+
+ // Style loads sources upon request when recalculating style.
+ style.recalculate(0, now, MapMode::Still);
+ EXPECT_TRUE(unusedSource->baseImpl->isLoaded());
}
TEST(Style, UnusedSourceActiveViaClassUpdate) {