Skip to content

Commit

Permalink
make sure we do not fail if OpenLayers.Projection.defaults has not be…
Browse files Browse the repository at this point in the history
…en set for a custom projection
  • Loading branch information
Bart van den Eijnden committed Nov 23, 2012
1 parent 1d3eb0e commit 663ba16
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/OpenLayers/Layer/WMS.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ OpenLayers.Layer.WMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
reverseAxisOrder: function() {
var projCode = this.projection.getCode();
return parseFloat(this.params.VERSION) >= 1.3 &&
!!(this.yx[projCode] || OpenLayers.Projection.defaults[projCode].yx);
!!(this.yx[projCode] || (OpenLayers.Projection.defaults[projCode] &&
OpenLayers.Projection.defaults[projCode].yx));
},

/**
Expand Down
20 changes: 20 additions & 0 deletions tests/Layer/WMS.html
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,26 @@
t.ok( layer.grid == null, "grid set to null");
}

function test_customProjection(t) {
t.plan(1);
var map = new OpenLayers.Map('map', {
units: 'm',
projection: new OpenLayers.Projection('EPSG:28992'),
maxExtent: new OpenLayers.Bounds(0, 300000, 300000, 6250000)
});
var layer = new OpenLayers.Layer.WMS(null, url, {layers: 'mylayer', version: '1.3.0'});
map.addLayer(layer);
var error = false;
try {
map.setCenter(new OpenLayers.LonLat(100000,300000), 5);
} catch(err) {
error = true;
}
t.ok(!error, "no error on getURL if layer has a custom projection and no defaults defined");
layer.destroy();
map.destroy();
}

function test_Layer_WMS_v13(t) {

t.plan(6);
Expand Down

0 comments on commit 663ba16

Please sign in to comment.