Ensure we cannot set both origin and origins in the tilegrid
This commit is contained in:
@@ -58,6 +58,9 @@ ol.tilegrid.TileGrid = function(tileGridOptions) {
|
|||||||
this.origins_ = tileGridOptions.origins;
|
this.origins_ = tileGridOptions.origins;
|
||||||
goog.asserts.assert(this.origins_.length == this.resolutions_.length);
|
goog.asserts.assert(this.origins_.length == this.resolutions_.length);
|
||||||
}
|
}
|
||||||
|
goog.asserts.assert(
|
||||||
|
(goog.isNull(this.origin_) && !goog.isNull(this.origins_)) ||
|
||||||
|
(!goog.isNull(this.origin_) && goog.isNull(this.origins_)));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
|||||||
@@ -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() {
|
describe('create with too few origins', function() {
|
||||||
it('throws an exception', function() {
|
it('throws an exception', function() {
|
||||||
expect(function() {
|
expect(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user