| 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"); |
|---|
| 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 | |
|---|