add support for specifying the GeoRSS popup size as an option to the layer.

Default behavior stays the same, but you can now specify popupSize as a layer
option to the GeoRSS constructor. (Closes #883)


git-svn-id: http://svn.openlayers.org/trunk/openlayers@4041 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-08-25 07:42:11 +00:00
parent b9a1287a5f
commit f2ef59264a
2 changed files with 59 additions and 1 deletions

View File

@@ -80,6 +80,56 @@
t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
});
}
function test_Layer_GeoRSS_popups (t) {
t.plan( 8 );
layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt);
var map = new OpenLayers.Map('map');
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
"http://octo.metacarta.com/cgi-bin/mapserv?",
{map: "/mapdata/vmap_wms.map", layers: "basic"});
map.addLayer(baseLayer);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0),0);
var event = {};
t.delay_call( 1, function() {
t.ok(layer.markers[0].events, "First marker has an events object");
t.eq(layer.markers[0].events.listeners['click'].length, 1, "Marker events has one object");
layer.markers[0].events.triggerEvent('click', event);
t.eq(map.popups.length, 1, "Popup opened correctly");
t.eq(map.popups[0].size.w, 250, "Popup sized correctly x");
t.eq(map.popups[0].size.h, 120, "Popup sized correctly y");
layer.markers[1].events.triggerEvent('click', event);
t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
t.eq(map.popups[0].size.w, 250, "Popup sized correctly x");
t.eq(map.popups[0].size.h, 120, "Popup sized correctly y");
});
}
function test_Layer_GeoRSS_resizedPopups(t) {
layer = new OpenLayers.Layer.GeoRSS('Test Layer', georss_txt, {'popupSize': new OpenLayers.Size(200,100)});
t.plan( 8 );
var map = new OpenLayers.Map('map');
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
"http://octo.metacarta.com/cgi-bin/mapserv?",
{map: "/mapdata/vmap_wms.map", layers: "basic"});
map.addLayer(baseLayer);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0),0);
var event = {};
t.delay_call( 1, function() {
t.ok(layer.markers[0].events, "First marker has an events object");
t.eq(layer.markers[0].events.listeners['click'].length, 1, "Marker events has one object");
layer.markers[0].events.triggerEvent('click', event);
t.eq(map.popups.length, 1, "Popup opened correctly");
t.eq(map.popups[0].size.w, 200, "Popup sized correctly x");
t.eq(map.popups[0].size.h, 100, "Popup sized correctly y");
map.popups[0].size.w=300;
layer.markers[1].events.triggerEvent('click', event);
t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
t.eq(map.popups[0].size.w, 200, "Popup sized correctly x");
t.eq(map.popups[0].size.h, 100, "Popup sized correctly y");
});
}
function test_04_Layer_GeoRSS_icon(t) {
t.plan( 3 );