summaryrefslogtreecommitdiff
path: root/test/fixtures
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-12-08 14:30:42 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-09 13:51:28 -0800
commitbde07c8f0edcc890efd7fd6993f5309d6881c402 (patch)
tree38464b4f291551d0cece8505941c3763e70bc3ab /test/fixtures
parent0346cfd865b7f26e92561efdc3fca458c88800e5 (diff)
downloadqtlocation-mapboxgl-bde07c8f0edcc890efd7fd6993f5309d6881c402.tar.gz
[core] Custom layers
Diffstat (limited to 'test/fixtures')
-rw-r--r--test/fixtures/custom_layer/basic/expected.pngbin0 -> 1684 bytes
-rw-r--r--test/fixtures/util.cpp18
-rw-r--r--test/fixtures/util.hpp7
3 files changed, 25 insertions, 0 deletions
diff --git a/test/fixtures/custom_layer/basic/expected.png b/test/fixtures/custom_layer/basic/expected.png
new file mode 100644
index 0000000000..9d3f38f3e1
--- /dev/null
+++ b/test/fixtures/custom_layer/basic/expected.png
Binary files differ
diff --git a/test/fixtures/util.cpp b/test/fixtures/util.cpp
index c3ce1b7efb..8c46338817 100644
--- a/test/fixtures/util.cpp
+++ b/test/fixtures/util.cpp
@@ -1,5 +1,6 @@
#include "util.hpp"
+#include <mbgl/map/map.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
@@ -12,12 +13,21 @@
#pragma GCC diagnostic pop
#include <csignal>
+#include <future>
#include <unistd.h>
namespace mbgl {
namespace test {
+std::string getFileSourceRoot() {
+#ifdef MBGL_ASSET_ZIP
+ return "test/fixtures/annotations/assets.zip";
+#else
+ return "";
+#endif
+}
+
pid_t startServer(const char *executable) {
int pipefd[2];
@@ -85,6 +95,14 @@ uint64_t crc64(const std::string& str) {
return crc64(str.data(), str.size());
}
+PremultipliedImage render(Map& map) {
+ std::promise<PremultipliedImage> promise;
+ map.renderStill([&](std::exception_ptr, PremultipliedImage&& image) {
+ promise.set_value(std::move(image));
+ });
+ return promise.get_future().get();
+}
+
void checkImage(const std::string& base,
const PremultipliedImage& actual,
double imageThreshold,
diff --git a/test/fixtures/util.hpp b/test/fixtures/util.hpp
index 16edfbace3..8dc02eb054 100644
--- a/test/fixtures/util.hpp
+++ b/test/fixtures/util.hpp
@@ -16,13 +16,20 @@
} name;
namespace mbgl {
+
+class Map;
+
namespace test {
+
+std::string getFileSourceRoot();
pid_t startServer(const char *executable);
void stopServer(pid_t pid);
uint64_t crc64(const char*, size_t);
uint64_t crc64(const std::string&);
+
+PremultipliedImage render(Map&);
void checkImage(const std::string& base,
const PremultipliedImage& actual,