diff options
Diffstat (limited to 'test/include/mbgl/test/util.hpp')
-rw-r--r-- | test/include/mbgl/test/util.hpp | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/include/mbgl/test/util.hpp b/test/include/mbgl/test/util.hpp new file mode 100644 index 0000000000..911f2073b5 --- /dev/null +++ b/test/include/mbgl/test/util.hpp @@ -0,0 +1,44 @@ +#ifndef MBGL_TEST_UTIL +#define MBGL_TEST_UTIL + +#include <mbgl/util/image.hpp> +#include <mbgl/util/chrono.hpp> + +#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; +}; + +PremultipliedImage render(Map&); + +void checkImage(const std::string& base, + const PremultipliedImage& actual, + double imageThreshold = 0, + double pixelThreshold = 0); + +} +} + +#endif |