OpenLayers OpenLayers

Changeset 6632

Show
Ignore:
Timestamp:
03/27/08 03:32:58 (10 months ago)
Author:
euzuro
Message:

svn merge -r6579:HEAD

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sandbox/euzuro/pop/lib/OpenLayers/Renderer/SVG.js

    r6579 r6632  
    6363     */ 
    6464    supported: function() { 
    65         var svgFeature = "http://www.w3.org/TR/SVG11/feature#SVG"; 
     65        var svgFeature = "http://www.w3.org/TR/SVG11/feature#"; 
    6666        return (document.implementation &&  
    67                 (document.implementation.hasFeature("org.w3c.svg", "1.0") ||  
    68                  document.implementation.hasFeature(svgFeature, "1.1"))); 
     67           (document.implementation.hasFeature("org.w3c.svg", "1.0") ||  
     68            document.implementation.hasFeature(svgFeature + "SVG", "1.1") ||  
     69            document.implementation.hasFeature(svgFeature + "BasicStructure", "1.1") )); 
    6970    },     
    7071 
  • sandbox/euzuro/pop/tests/Control/test_ScaleLine.html

    r6253 r6632  
    11<html> 
    22<head> 
     3  <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA9XNhd8q0UdwNC7YSO4YZghSPUCi5aRYVveCcVYxzezM4iaj_gxQ9t-UajFL70jfcpquH5l1IJ-Zyyw'></script> 
    34  <script src="../../lib/OpenLayers.js"></script> 
    45  <script type="text/javascript"> 
     6  var validkey = (window.location.protocol == "file:") || 
     7                 (window.location.host == "localhost") || 
     8                 (window.location.host == "openlayers.org"); 
    59 
    610    function test_initialize(t) { 
     
    105109 
    106110    function test_respectZoom (t) { 
    107         t.plan(5); 
    108  
     111        if(validkey) { 
     112            t.plan( 4 ); 
     113        } else { 
     114            t.plan( 3 ); 
     115        } 
    109116        // ok, switch the units we use for zoomed in values.  This will test that we're both 
    110117        //   correctly respecting all specified parameters and that we're switching to the  
     
    117124        map.zoomTo(0); 
    118125        map.addControl(control); 
    119         t.eq(control.div.firstChild.innerHTML, "5000 mi", "top scale respects constructor parameter."); 
    120         t.eq(control.div.lastChild.innerHTML, "10000 km", "bottom scale respects constructor parameter."); 
    121         map.zoomIn(); 
    122         map.zoomIn(); 
    123         map.zoomIn(); 
    124         map.zoomIn(); 
    125         map.zoomIn(); 
    126         map.zoomIn(); 
    127         map.zoomIn(); 
    128         map.zoomIn(); 
    129         map.zoomIn(); 
    130         map.zoomIn(); 
    131         map.zoomIn(); 
     126        var widthIsOk = true; 
     127        for (var i=0; i<map.numZoomLevels && widthIsOk; i++) { 
     128            map.zoomTo(i); 
     129            var w1 = parseInt(control.eTop.style.width); 
     130            var w2 = parseInt(control.eBottom.style.width); 
     131            widthIsOk = w1 <= control.maxWidth && w2 <= control.maxWidth; 
     132        } 
     133        t.ok(widthIsOk, "respects maxWidth at all zoom levels in dd"); 
    132134         
    133         t.eq(control.div.firstChild.innerHTML, "10000 ft", "top scale zooms in & respects constructor parameter."); 
    134         t.eq(control.div.lastChild.innerHTML, "5000 m", "bottom scale zooms in & respects constructor parameter."); 
     135        widthIsOk = true; 
     136        control.maxWidth = 200; 
     137        for (var i=0; i<map.numZoomLevels && widthIsOk; i++) { 
     138            map.zoomTo(i); 
     139            var w1 = parseInt(control.eTop.style.width); 
     140            var w2 = parseInt(control.eBottom.style.width); 
     141            widthIsOk = w1 <= control.maxWidth && w2 <= control.maxWidth; 
     142        } 
     143        t.ok(widthIsOk, "respects modified maxWidth at all zoom levels in dd"); 
     144 
     145        if (validkey) { 
     146            var map = new OpenLayers.Map('map'); 
     147            var layer = new OpenLayers.Layer.Google('Goog Layer'); 
     148            var control = new OpenLayers.Control.ScaleLine({topOutUnits : "mi", bottomOutUnits: "km", topInUnits: 'ft', bottomInUnits: 'm'}); 
     149            map.addLayer(layer); 
     150            map.zoomTo(0); 
     151            map.addControl(control); 
     152            var widthIsOk = true; 
     153            for (var i=0; i<map.numZoomLevels && widthIsOk; i++) { 
     154                map.zoomTo(i); 
     155                var w1 = parseInt(control.eTop.style.width); 
     156                var w2 = parseInt(control.eBottom.style.width); 
     157                widthIsOk = w1 <= control.maxWidth && w2 <= control.maxWidth; 
     158            } 
     159            t.ok(widthIsOk, "respects maxWidth at all zoom levels in m"); 
     160        } else { 
     161            t.debug_print("Google tests can't be run from " + 
     162                          window.location.host);           
     163        } 
     164 
     165        var map = new OpenLayers.Map('map'); 
     166        var layer = new OpenLayers.Layer.Google('Goog Layer'); 
     167        map.addLayer(layer); 
     168         
    135169        map.destroy(); 
    136170    }