Merge pull request #684 from CartoDB/fix-buffersize-undefined-in-mapconfig

Fix buffersize undefined in mapconfig instantiation
This commit is contained in:
Daniel 2017-05-18 16:33:31 +02:00 committed by GitHub
commit c6ee2eac62
2 changed files with 22 additions and 1 deletions

View File

@ -11,6 +11,10 @@ MapConfigBufferSizeAdapter.prototype.getMapConfig = function (user, requestMapCo
this.formats.forEach(function (format) { this.formats.forEach(function (format) {
if (Number.isFinite(context.templateParams.buffersize[format])) { if (Number.isFinite(context.templateParams.buffersize[format])) {
if (requestMapConfig.buffersize === undefined) {
requestMapConfig.buffersize = {};
}
requestMapConfig.buffersize[format] = context.templateParams.buffersize[format]; requestMapConfig.buffersize[format] = context.templateParams.buffersize[format];
} }
}); });

View File

@ -396,7 +396,24 @@ describe('buffer size per format for named maps w/o placeholders', function () {
assert: function (tile, callback) { assert: function (tile, callback) {
assert.utfgridEqualsFile(tile, this.fixturePath, 2, callback); assert.utfgridEqualsFile(tile, this.fixturePath, 2, callback);
} }
},
{
desc: 'should get png tile using buffer-size 0' +
' overriden by template params with no buffersize in mapconfig',
coords: { z: 7, x: 64, y: 48 },
format: 'png',
placeholders: {
buffersize: {
png: 0
} }
},
fixturePath: './test/fixtures/buffer-size/tile-7.64.48-buffer-size-0.png',
template: createBufferSizeTemplate('named-no-buffer-size-mapconfig-png-0', undefined, {}),
assert: function (tile, callback) {
assert.imageIsSimilarToFile(tile, this.fixturePath, IMAGE_TOLERANCE_PER_MIL, callback);
}
},
]; ];
testCases.forEach(function (test) { testCases.forEach(function (test) {