[core] Custom layers

This commit is contained in:
John Firebaugh
2015-12-08 14:30:42 -08:00
parent 0346cfd865
commit bde07c8f0e
17 changed files with 274 additions and 56 deletions

View File

@@ -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,