summaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-08-29 12:00:08 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-09-06 14:29:22 -0700
commitfe2a26225f3746381b36ad8b6c6a3ce7727bf655 (patch)
tree62507ffd6a28654a377469d35e21719ff7a12fdc /test/src
parent3a48c60813b18c092c8d8d75c80a318bdd8859bb (diff)
downloadqtlocation-mapboxgl-fe2a26225f3746381b36ad8b6c6a3ce7727bf655.tar.gz
[core, ios, android, qt] Observe style layer mutations rather than requiring SDKs to use Map::update
This paves the way for updates to filter and layout properties to trigger a source reload, without each SDK having to participate in the implementation.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/mbgl/test/stub_layer_observer.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/src/mbgl/test/stub_layer_observer.hpp b/test/src/mbgl/test/stub_layer_observer.hpp
new file mode 100644
index 0000000000..500103055d
--- /dev/null
+++ b/test/src/mbgl/test/stub_layer_observer.hpp
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <mbgl/style/layer_observer.hpp>
+
+using namespace mbgl;
+using namespace mbgl::style;
+
+/**
+ * An implementation of style::LayerObserver that forwards all methods to dynamically-settable lambas.
+ */
+class StubLayerObserver : public style::LayerObserver {
+public:
+ void onLayerFilterChanged(Layer& layer) override {
+ if (layerFilterChanged) layerFilterChanged(layer);
+ }
+
+ void onLayerPaintPropertyChanged(Layer& layer) override {
+ if (layerPaintPropertyChanged) layerPaintPropertyChanged(layer);
+ }
+
+ void onLayerLayoutPropertyChanged(Layer& layer) override {
+ if (layerLayoutPropertyChanged) layerLayoutPropertyChanged(layer);
+ }
+
+ std::function<void (Layer&)> layerFilterChanged;
+ std::function<void (Layer&)> layerPaintPropertyChanged;
+ std::function<void (Layer&)> layerLayoutPropertyChanged;
+};