Pullup fix for zooms to branch. (Closes #1043) 4791:4792

git-svn-id: http://svn.openlayers.org/branches/openlayers/2.5@4795 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-10-03 20:42:35 +00:00
parent 6ecd34eaf0
commit c505d23c7b
9 changed files with 85 additions and 121 deletions

View File

@@ -43,33 +43,21 @@
var overviewZoom = control.ovmap.getZoom();
t.eq(overviewCenter.lon, -71, "Overviewmap center lon correct");
t.eq(overviewCenter.lat, 42, "Overviewmap center lat correct");
t.eq(overviewZoom, 9, "Overviewmap zoomcorrect");
t.eq(overviewZoom, 8, "Overviewmap zoomcorrect");
control.mapDivClick({'xy':new OpenLayers.Pixel(5,5)});
// There are box model issues that keep browsers from giving us
// identical results here. Test the normalized difference against
// a tolerance instead of testing equality.
function normalizedDiff(a, b) {
return Math.abs((a - b) / (a + b));
}
var tolerance = 1e-4;
var cent = map.getCenter();
t.ok(normalizedDiff(cent.lon, -71.00390625) < tolerance,
"Clicking on the Overview Map has the correct effect on map lon");
t.ok(normalizedDiff(cent.lat, 42.00390625) < tolerance,
"Clicking on the Overview Map has the correct effect on map lat");
t.eq(cent.lon, -71.3515625, "Clicking on the Overview Map has the correct effect on map lon");
t.eq(cent.lat, 42.17578125, "Clicking on the Overview Map has the correct effect on map lat");
control.rectMouseDown({'xy':new OpenLayers.Pixel(5,5), 'which':1});
control.rectMouseMove({'xy':new OpenLayers.Pixel(15,15), 'which':1});
control.rectMouseUp({'xy':new OpenLayers.Pixel(15,15), 'which':1});
var cent = map.getCenter();
t.ok(normalizedDiff(cent.lon, -70.83984375) < tolerance,
"Dragging on the Overview Map has the correct effect on map lon");
t.ok(normalizedDiff(cent.lat, 41.84765625) < tolerance,
"Dragging on the Overview Map has the correct effect on map lat");
t.eq(cent.lon, -71.2734375, "Dragging on the Overview Map has the correct effect on map lon");
t.eq(cent.lat, 42.09765625, "Dragging on the Overview Map has the correct effect on map lat");
map.setCenter(new OpenLayers.LonLat(0,0), 0);
var overviewCenter = control.ovmap.getCenter();