Files
MapLibreParticleLab/test/fixtures/util.hpp
John Firebaugh 86c8446d3a [core] Simplify asset:// implementation
* Move asset:// URL handling to DefaultFileSource.
* AssetFileSource implements FileSource interface and follows familiar implementation patterns.
* Move default implementation to platform/default, zip implementation to platform/android.
* Don't bother with modified / expires / etag -- assets are not cached so it doesn't matter.
* Don't bother with interleaving individual IO calls on the implementation thread. That adds a lot of complexity for very little benefit.
2016-01-13 13:40:31 -08:00

48 lines
992 B
C++

#ifndef MBGL_TEST_UTIL
#define MBGL_TEST_UTIL
#include <mbgl/util/image.hpp>
#include <chrono>
#include <cstdint>
#include <gtest/gtest.h>
#define SCOPED_TEST(name) \
static class name { \
bool completed = false; \
public: \
void finish() { EXPECT_FALSE(completed) << #name " was already completed."; completed = true; } \
~name() { if (!completed) ADD_FAILURE() << #name " didn't complete."; } \
} name;
namespace mbgl {
class Map;
namespace test {
class Server {
public:
Server(const char* executable);
~Server();
private:
int fd = -1;
};
uint64_t crc64(const char*, size_t);
uint64_t crc64(const std::string&);
PremultipliedImage render(Map&,
std::chrono::milliseconds timeout = std::chrono::milliseconds(1000));
void checkImage(const std::string& base,
const PremultipliedImage& actual,
double imageThreshold = 0,
double pixelThreshold = 0);
}
}
#endif