diff options
Diffstat (limited to 'platform/node/test/suite_implementation.js')
-rw-r--r-- | platform/node/test/suite_implementation.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/platform/node/test/suite_implementation.js b/platform/node/test/suite_implementation.js index bde8acde18..3abf4136c4 100644 --- a/platform/node/test/suite_implementation.js +++ b/platform/node/test/suite_implementation.js @@ -30,16 +30,17 @@ module.exports = function (style, options, callback) { callback(new Error('timed out after 20 seconds')); }, 20000); - options.center = style.center; - options.zoom = style.zoom; - options.bearing = style.bearing; - options.pitch = style.pitch; options.debug = { tileBorders: options.debug, collision: options.collisionDebug, overdraw: options.showOverdrawInspector, }; + options.center = style.center || [0, 0]; + options.zoom = style.zoom || 0; + options.bearing = style.bearing || 0; + options.pitch = style.pitch || 0; + map.load(style); applyOperations(options.operations, function() { @@ -60,16 +61,22 @@ module.exports = function (style, options, callback) { callback(); } else if (operation[0] === 'wait') { - var wait = function() { - if (map.loaded()) { - applyOperations(operations.slice(1), callback); - } else { - map.render(options, wait); - } - }; - wait(); + map.render(options, function () { + applyOperations(operations.slice(1), callback); + }); } else { + // Ensure that the next `map.render(options)` does not overwrite this change. + if (operation[0] === 'setCenter') { + options.center = operation[1]; + } else if (operation[0] === 'setZoom') { + options.zoom = operation[1]; + } else if (operation[0] === 'setBearing') { + options.bearing = operation[1]; + } else if (operation[0] === 'setPitch') { + options.pitch = operation[1]; + } + map[operation[0]].apply(map, operation.slice(1)); applyOperations(operations.slice(1), callback); } |