summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Morris <michael.patrick.morris@gmail.com>2014-09-24 15:58:52 -0400
committerMike Morris <michael.patrick.morris@gmail.com>2014-09-24 15:58:52 -0400
commit3dec4933a9525b74c06d739adc4fdd9050b3f25f (patch)
treea28f772fabbb9ef5ccf95f56131ff5420f256add /test
parent9b6cff43011f7a9bb8ff19a28aa549126e96e160 (diff)
parent8a19896c3a0e450ba498281b8879eb86060fa0cb (diff)
downloadqtlocation-mapboxgl-3dec4933a9525b74c06d739adc4fdd9050b3f25f.tar.gz
Merge branch 'libuv010' into libuv-0.10-fix-context-shutdown
Conflicts: common/headless_view.cpp test/headless.cpp
Diffstat (limited to 'test')
-rw-r--r--test/headless.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/headless.cpp b/test/headless.cpp
index 9a4857dd1a..d4c4d6036e 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,20 +84,24 @@ 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]);
+ const unsigned int w = width * pixelRatio;
+ const unsigned int h = height * pixelRatio;
+
+ const std::unique_ptr<uint32_t[]> pixels(new uint32_t[w * h]);
+
map.view.make_active();
- glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
+ glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels.get());
map.view.make_inactive();
- 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);
}
}