diff options
author | Mike Morris <michael.patrick.morris@gmail.com> | 2014-09-24 15:40:08 -0400 |
---|---|---|
committer | Mike Morris <michael.patrick.morris@gmail.com> | 2014-09-24 15:40:08 -0400 |
commit | 8a19896c3a0e450ba498281b8879eb86060fa0cb (patch) | |
tree | b8faf9424efbec8314b6913147d94a6019987b86 /test | |
parent | c5a7738dd640604a523e6e069cba92940d502614 (diff) | |
parent | ee3e0827a20492ba0f91c5c5f60cf24b2e49cb32 (diff) | |
download | qtlocation-mapboxgl-8a19896c3a0e450ba498281b8879eb86060fa0cb.tar.gz |
Merge branch 'master' into libuv010
Diffstat (limited to 'test')
-rw-r--r-- | test/headless.cpp | 15 |
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); } } |