summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnand Thakker <anandthakker@users.noreply.github.com>2017-10-25 16:36:43 -0400
committerGitHub <noreply@github.com>2017-10-25 16:36:43 -0400
commit424ba0d9dec06b17741a8ac386e1ca77fc41a4d5 (patch)
tree4b5baabc1d422f37df24a1a27a2a2b3e9f01d13e
parentaad26419b4b196cec35d5b349ae3977782e8fa6d (diff)
downloadqtlocation-mapboxgl-424ba0d9dec06b17741a8ac386e1ca77fc41a4d5.tar.gz
Add support for 'sleep' operation in render tests (#10282)
Ports https://github.com/mapbox/mapbox-gl-js/commit/0069349550b263fdce9982d38183d9ab57ca7305
-rw-r--r--platform/node/test/suite_implementation.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/node/test/suite_implementation.js b/platform/node/test/suite_implementation.js
index 323f429bed..c5987538d0 100644
--- a/platform/node/test/suite_implementation.js
+++ b/platform/node/test/suite_implementation.js
@@ -90,6 +90,12 @@ module.exports = function (style, options, callback) {
applyOperations(operations.slice(1), callback);
});
+ } else if (operation[0] === 'sleep') {
+ // Prefer "wait", which renders until the map is loaded
+ // Use "sleep" when you need to test something that sidesteps the "loaded" logic
+ setTimeout(() => {
+ applyOperations(operations.slice(1), callback);
+ }, operation[1]);
} else if (operation[0] === 'addImage' || operation[0] === 'updateImage') {
var img = PNG.sync.read(fs.readFileSync(path.join(__dirname, '../../../mapbox-gl-js/test/integration', operation[2])));
const testOpts = (operation.length > 3) ? operation[3] : {};