Commit the part of #664 for map resize changes, with a regression test to

boot. Thanks for the patch, Tim.


git-svn-id: http://svn.openlayers.org/trunk/openlayers@3076 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-04-14 05:34:52 +00:00
parent 75d2dac1cb
commit 115fc7462b
3 changed files with 50 additions and 1 deletions

View File

@@ -202,7 +202,18 @@ OpenLayers.Layer.WFS.prototype =
}
}
},
/**
* Call the onMapResize method of the appropriate parent class.
*/
onMapResize: function() {
if(this.vectorMode) {
OpenLayers.Layer.Vector.prototype.onMapResize.apply(this, arguments);
} else {
OpenLayers.Layer.Markers.prototype.onMapResize.apply(this, arguments);
}
},
/**
* @param {Object} obj
*

37
tests/Layer/test_WFS.html Normal file
View File

@@ -0,0 +1,37 @@
<html>
<head>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var name = "Vector Layer";
function test_01_Layer_WFS_constructor(t) {
t.plan(3);
var layer = new OpenLayers.Layer.WFS(name, "url", {});
t.ok(layer instanceof OpenLayers.Layer.WFS, "new OpenLayers.Layer.Vector returns correct object" );
t.eq(layer.name, name, "layer name is correctly set");
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
}
function test_02_Layer_WFS_mapresizevector(t) {
t.plan(2);
var map = new OpenLayers.Map("map");
map.addLayer(new OpenLayers.Layer.WMS("WMS", "url", {}));
var layer = new OpenLayers.Layer.WFS(name, "url", {});
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
map.addLayer(layer);
setSize = false;
layer.renderer.setSize = function() { setSize = true; }
layer.onMapResize();
t.eq(setSize, true, "Renderer resize called on map size change.");
}
// -->
</script>
</head>
<body>
<div id="map" style="width:500px;height:550px"></div>
</body>
</html>

View File

@@ -42,6 +42,7 @@
<li>Layer/test_MapServer_Untiled.html</li>
<li>Layer/test_Text.html</li>
<li>Layer/test_WMS.html</li>
<li>Layer/test_WFS.html</li>
<li>Layer/test_TMS.html</li>
<li>Layer/test_Vector.html</li>
<li>Layer/test_GML.html</li>