summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/default/src/mbgl/gfx/headless_frontend.cpp13
-rw-r--r--render-test/runner.cpp16
2 files changed, 22 insertions, 7 deletions
diff --git a/platform/default/src/mbgl/gfx/headless_frontend.cpp b/platform/default/src/mbgl/gfx/headless_frontend.cpp
index 0e97c40e49..f5e6b7f482 100644
--- a/platform/default/src/mbgl/gfx/headless_frontend.cpp
+++ b/platform/default/src/mbgl/gfx/headless_frontend.cpp
@@ -132,19 +132,24 @@ PremultipliedImage HeadlessFrontend::readStillImage() {
PremultipliedImage HeadlessFrontend::render(Map& map) {
PremultipliedImage result;
+ std::exception_ptr error;
- map.renderStill([&](std::exception_ptr error) {
- if (error) {
- std::rethrow_exception(error);
+ map.renderStill([&](std::exception_ptr e) {
+ if (e) {
+ error = e;
} else {
result = backend->readStillImage();
}
});
- while (!result.valid()) {
+ while (!result.valid() && !error) {
util::RunLoop::Get()->runOnce();
}
+ if (error) {
+ std::rethrow_exception(error);
+ }
+
return result;
}
diff --git a/render-test/runner.cpp b/render-test/runner.cpp
index 1aa347f1a8..dd6aef3a54 100644
--- a/render-test/runner.cpp
+++ b/render-test/runner.cpp
@@ -123,8 +123,11 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata) {
// wait
if (operationArray[0].GetString() == waitOp) {
- frontend.render(map);
-
+ try {
+ frontend.render(map);
+ } catch (const std::exception&) {
+ return false;
+ }
// sleep
} else if (operationArray[0].GetString() == sleepOp) {
mbgl::util::Timer sleepTimer;
@@ -400,7 +403,14 @@ bool TestRunner::run(TestMetadata& metadata) {
return false;
}
- return checkImage(frontend.render(map), metadata);
+ mbgl::PremultipliedImage image;
+ try {
+ image = frontend.render(map);
+ } catch (const std::exception&) {
+ return false;
+ }
+
+ return checkImage(std::move(image), metadata);
}
void TestRunner::reset() {