summaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-09-01 15:07:17 +0300
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-04-14 13:44:08 -0700
commit204c7fee032bf8509747046b43a788366a189ae7 (patch)
tree8719b7ab8838bea52babd8bf42f2234ddc43dc9a /test/src
parent18d8e80f52345a13236ae1da99b5866e7643f85b (diff)
downloadqtlocation-mapboxgl-204c7fee032bf8509747046b43a788366a189ae7.tar.gz
[core] Render from the main thread
Do not create a thread for the MapContext anymore.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/mbgl/test/mock_view.hpp3
-rw-r--r--test/src/mbgl/test/util.cpp14
2 files changed, 10 insertions, 7 deletions
diff --git a/test/src/mbgl/test/mock_view.hpp b/test/src/mbgl/test/mock_view.hpp
index e608545da5..50ae466d19 100644
--- a/test/src/mbgl/test/mock_view.hpp
+++ b/test/src/mbgl/test/mock_view.hpp
@@ -18,10 +18,7 @@ public:
void activate() override {};
void deactivate() override {};
- void notify() override {};
void invalidate() override {}
- void beforeRender() override {}
- void afterRender() override {}
};
}
diff --git a/test/src/mbgl/test/util.cpp b/test/src/mbgl/test/util.cpp
index ca2282a4b5..4021fd89b1 100644
--- a/test/src/mbgl/test/util.cpp
+++ b/test/src/mbgl/test/util.cpp
@@ -5,6 +5,7 @@
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/chrono.hpp>
+#include <mbgl/util/run_loop.hpp>
#include <mapbox/pixelmatch.hpp>
@@ -86,11 +87,16 @@ Server::~Server() {
}
PremultipliedImage render(Map& map) {
- std::promise<PremultipliedImage> promise;
- map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) {
- promise.set_value(std::move(image));
+ PremultipliedImage result;
+ map.renderStill([&result](std::exception_ptr, PremultipliedImage&& image) {
+ result = std::move(image);
});
- return promise.get_future().get();
+
+ while (!result.size()) {
+ util::RunLoop::Get()->runOnce();
+ }
+
+ return result;
}
void checkImage(const std::string& base,