summaryrefslogtreecommitdiff
path: root/test/headless.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-10-22 15:14:21 +0200
committerKonstantin Käfer <mail@kkaefer.com>2014-10-22 15:14:21 +0200
commit905c4294be495d15591885a2438ca0b8abc8decf (patch)
tree851a94849eb7a1f3269b91de6054846cfbda722b /test/headless.cpp
parentc6e4cf2f80216c7139b6587dcd6d919080aef20d (diff)
parent8954b3971f5cb90dc4b18e61b58ea6e41c54fffe (diff)
downloadqtlocation-mapboxgl-905c4294be495d15591885a2438ca0b8abc8decf.tar.gz
Merge branch 'libuv-0.10-headless-display' into mason
Conflicts: common/http_request_baton_curl.cpp include/mbgl/map/map.hpp include/mbgl/util/uv_detail.hpp scripts/travis_before_install.sh setup-libraries.sh src/map/map.cpp src/storage/file_request_baton.cpp src/storage/http_request.cpp src/util/uv-messenger.c
Diffstat (limited to 'test/headless.cpp')
-rw-r--r--test/headless.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/headless.cpp b/test/headless.cpp
index 3255cff062..02dd0165ec 100644
--- a/test/headless.cpp
+++ b/test/headless.cpp
@@ -10,6 +10,7 @@
#include <rapidjson/stringbuffer.h>
#include "../common/headless_view.hpp"
+#include "../common/headless_display.hpp"
#include "./fixtures/fixture_log.hpp"
@@ -22,6 +23,8 @@ const std::string base_directory = []{
return fn + "/node_modules/mapbox-gl-test-suite/";
}();
+auto display_ = std::make_shared<mbgl::HeadlessDisplay>();
+
class HeadlessTest : public ::testing::TestWithParam<std::string> {};
TEST_P(HeadlessTest, render) {
@@ -78,7 +81,7 @@ TEST_P(HeadlessTest, render) {
}
}
- HeadlessView view;
+ HeadlessView view(display_);
Map map(view);
map.setStyleJSON(style, base_directory);
@@ -95,10 +98,7 @@ TEST_P(HeadlessTest, render) {
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(w, h, pixels.get(), true);
+ const std::string image = util::compress_png(w, h, view.readPixels().get(), true);
util::write_file(actual_image, image);
}
}