summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/headless.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/headless.cpp b/test/headless.cpp
index e1bdbdc061..3837beb9a0 100644
--- a/test/headless.cpp
+++ b/test/headless.cpp
@@ -92,13 +92,25 @@ TEST_P(HeadlessTest, render) {
map.setLonLatZoom(longitude, latitude, zoom);
map.setBearing(bearing);
+
// Run the loop. It will terminate when we don't have any further listeners.
map.run();
const unsigned int w = width * pixelRatio;
const unsigned int h = height * pixelRatio;
- const std::string image = util::compress_png(w, h, view.readPixels().get(), true);
+ auto pixels = view.readPixels();
+
+ const int stride = w * 4;
+ auto tmp = std::unique_ptr<char[]>(new char[stride]());
+ char *rgba = reinterpret_cast<char *>(pixels.get());
+ for (int i = 0, j = height - 2; i < j; i++, j--) {
+ memcpy(tmp.get(), rgba + i * stride, stride);
+ memcpy(rgba + i * stride, rgba + j * stride, stride);
+ memcpy(rgba + j * stride, tmp.get(), stride);
+ }
+
+ const std::string image = util::compress_png(w, h, pixels.get());
util::write_file(actual_image, image);
}
}