summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2014-09-24 15:40:08 -0400
committerMike Morris <michael.patrick.morris@gmail.com>2014-09-24 15:40:08 -0400
commit8a19896c3a0e450ba498281b8879eb86060fa0cb (patch)
treeb8faf9424efbec8314b6913147d94a6019987b86 /test
parentc5a7738dd640604a523e6e069cba92940d502614 (diff)
parentee3e0827a20492ba0f91c5c5f60cf24b2e49cb32 (diff)
downloadqtlocation-mapboxgl-8a19896c3a0e450ba498281b8879eb86060fa0cb.tar.gz
Merge branch 'master' into libuv010
Diffstat (limited to 'test')
-rw-r--r--test/headless.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/test/headless.cpp b/test/headless.cpp
index 4299fd79b9..3cc2607e47 100644
--- a/test/headless.cpp
+++ b/test/headless.cpp
@@ -65,6 +65,8 @@ TEST_P(HeadlessTest, render) {
const double longitude = value.HasMember("center") ? value["center"][rapidjson::SizeType(1)].GetDouble() : 0;
const unsigned int width = value.HasMember("width") ? value["width"].GetUint() : 512;
const unsigned int height = value.HasMember("height") ? value["height"].GetUint() : 512;
+ const unsigned int pixelRatio = value.HasMember("pixelRatio") ? value["pixelRatio"].GetUint() : 1;
+
std::vector<std::string> classes;
if (value.HasMember("classes")) {
const rapidjson::Value &js_classes = value["classes"];
@@ -82,18 +84,21 @@ TEST_P(HeadlessTest, render) {
map.setStyleJSON(style, base_directory);
map.setAppliedClasses(classes);
- view.resize(width, height);
- map.resize(width, height);
+ view.resize(width, height, pixelRatio);
+ map.resize(width, height, pixelRatio);
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 std::unique_ptr<uint32_t[]> pixels(new uint32_t[width * height]);
- glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
+ const unsigned int w = width * pixelRatio;
+ const unsigned int h = height * pixelRatio;
+
+ const std::unique_ptr<uint32_t[]> pixels(new uint32_t[w * h]);
+ glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
- const std::string image = util::compress_png(width, height, pixels.get(), true);
+ const std::string image = util::compress_png(w, h, pixels.get(), true);
util::write_file(actual_image, image);
}
}