Do not require an extent for global projections

This commit is contained in:
Andreas Hocevar
2015-04-21 08:47:36 +02:00
parent 4f8dca92ba
commit 40feabc3c8
5 changed files with 61 additions and 7 deletions

View File

@@ -138,6 +138,46 @@ describe('ol.proj', function() {
});
});
describe('canWrapX()', function() {
it('requires an extent for allowing wrapX', function() {
var proj = new ol.proj.Projection({
code: 'foo',
global: true
});
expect(proj.canWrapX()).to.be(false);
proj.setExtent([1, 2, 3, 4]);
expect(proj.canWrapX()).to.be(true);
proj = new ol.proj.Projection({
code: 'foo',
global: true,
extent: [1, 2, 3, 4]
});
expect(proj.canWrapX()).to.be(true);
proj.setExtent(null);
expect(proj.canWrapX()).to.be(false);
});
it('requires global to be true for allowing wrapX', function() {
var proj = new ol.proj.Projection({
code: 'foo',
extent: [1, 2, 3, 4]
});
expect(proj.canWrapX()).to.be(false);
proj.setGlobal(true);
expect(proj.canWrapX()).to.be(true);
proj = new ol.proj.Projection({
code: 'foo',
global: true,
extent: [1, 2, 3, 4]
});
expect(proj.canWrapX()).to.be(true);
proj.setGlobal(false);
expect(proj.canWrapX()).to.be(false);
});
});
describe('transformExtent()', function() {
it('transforms an extent given projection identifiers', function() {