Do not transform tile coordinates for tileUrlFunction

This commit is contained in:
Andreas Hocevar
2015-06-18 09:09:21 +02:00
parent 2249c82ac2
commit af319c259b
19 changed files with 58 additions and 308 deletions
+4 -4
View File
@@ -30,16 +30,16 @@ describe('ol.TileUrlFunction', function() {
describe('createFromTemplate', function() {
it('creates expected URL', function() {
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{x}/{y}');
expect(tileUrl([3, 2, 1])).to.eql('3/2/1');
expect(tileUrl([3, 2, -2])).to.eql('3/2/1');
expect(tileUrl(null)).to.be(undefined);
});
it('accepts {-y} placeholder', function() {
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{x}/{-y}');
expect(tileUrl([3, 2, 2])).to.eql('3/2/5');
expect(tileUrl([3, 2, -3])).to.eql('3/2/5');
});
it('replaces multiple placeholder occurrences', function() {
var tileUrl = ol.TileUrlFunction.createFromTemplate('{z}/{z}{x}{y}');
expect(tileUrl([3, 2, 1])).to.eql('3/321');
expect(tileUrl([3, 2, -2])).to.eql('3/321');
});
});
@@ -51,7 +51,7 @@ describe('ol.TileUrlFunction', function() {
'http://tile-3/{z}/{x}/{y}'
];
var tileUrlFunction = ol.TileUrlFunction.createFromTemplates(templates);
var tileCoord = [3, 2, 1];
var tileCoord = [3, 2, -2];
sinon.stub(ol.tilecoord, 'hash', function() { return 3; });
expect(tileUrlFunction(tileCoord)).to.eql('http://tile-1/3/2/1');