Merge pull request #258 from bbinet/tilegrid-tilesizes
Add support for multiple tileSizes in the tilegrid
This commit is contained in:
@@ -68,6 +68,20 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('create with both origin and multiple origins', function() {
|
||||
it('throws an exception', function() {
|
||||
expect(function() {
|
||||
return new ol.tilegrid.TileGrid({
|
||||
resolutions: [100, 50, 25, 10],
|
||||
extent: extent,
|
||||
origins: [origin, origin, origin, origin],
|
||||
origin: origin,
|
||||
tileSize: tileSize
|
||||
});
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('create with too few origins', function() {
|
||||
it('throws an exception', function() {
|
||||
expect(function() {
|
||||
@@ -94,6 +108,59 @@ describe('ol.tilegrid.TileGrid', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('create with multiple tileSizes', function() {
|
||||
it('does not throw an exception', function() {
|
||||
expect(function() {
|
||||
return new ol.tilegrid.TileGrid({
|
||||
resolutions: [100, 50, 25, 10],
|
||||
extent: extent,
|
||||
tileSizes: [tileSize, tileSize, tileSize, tileSize],
|
||||
origin: origin
|
||||
});
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('create with both tileSize and multiple tileSizes', function() {
|
||||
it('throws an exception', function() {
|
||||
expect(function() {
|
||||
return new ol.tilegrid.TileGrid({
|
||||
resolutions: [100, 50, 25, 10],
|
||||
extent: extent,
|
||||
tileSizes: [tileSize, tileSize, tileSize, tileSize],
|
||||
tileSize: tileSize,
|
||||
origin: origin
|
||||
});
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('create with too few tileSizes', function() {
|
||||
it('throws an exception', function() {
|
||||
expect(function() {
|
||||
return new ol.tilegrid.TileGrid({
|
||||
resolutions: [100, 50, 25, 10],
|
||||
extent: extent,
|
||||
tileSizes: [tileSize, tileSize, tileSize],
|
||||
origin: origin
|
||||
});
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('create with too many tileSizes', function() {
|
||||
it('throws an exception', function() {
|
||||
expect(function() {
|
||||
return new ol.tilegrid.TileGrid({
|
||||
resolutions: [100, 50, 25, 10],
|
||||
extent: extent,
|
||||
tileSizes: [tileSize, tileSize, tileSize, tileSize, tileSize],
|
||||
origin: origin
|
||||
});
|
||||
}).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('createForProjection', function() {
|
||||
|
||||
it('allows easier creation of a tile grid', function() {
|
||||
|
||||
@@ -75,7 +75,8 @@ describe('ol.TileUrlFunction', function() {
|
||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||
var tileUrl = tileUrlFunction(tileCoord);
|
||||
var expected = 'http://wms?foo=bar&BBOX=-20037508.342789244' +
|
||||
'%2C20037508.342789244%2C0%2C40075016.68557849';
|
||||
'%2C20037508.342789244%2C0%2C40075016.68557849' +
|
||||
'&HEIGHT=256&WIDTH=256';
|
||||
expect(tileUrl).toEqual(expected);
|
||||
});
|
||||
it('creates expected URL respecting axis orientation', function() {
|
||||
@@ -85,7 +86,8 @@ describe('ol.TileUrlFunction', function() {
|
||||
var tileCoord = new ol.TileCoord(1, 0, 0);
|
||||
var tileUrl = tileUrlFunction(tileCoord);
|
||||
var expected = 'http://wms?foo=bar&BBOX=20037508.342789244' +
|
||||
'%2C-20037508.342789244%2C40075016.68557849%2C0';
|
||||
'%2C-20037508.342789244%2C40075016.68557849%2C0' +
|
||||
'&HEIGHT=256&WIDTH=256';
|
||||
expect(tileUrl).toEqual(expected);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user