Changeset 6402
- Timestamp:
- 02/28/08 17:46:43 (11 months ago)
- Files:
-
- sandbox/euzuro/pop/build/full.cfg (modified) (1 diff)
- sandbox/euzuro/pop/examples/fractional-zoom.html (modified) (3 diffs)
- sandbox/euzuro/pop/examples/mapguide.html (copied) (copied from trunk/openlayers/examples/mapguide.html)
- sandbox/euzuro/pop/examples/styles-unique.html (copied) (copied from trunk/openlayers/examples/styles-unique.html)
- sandbox/euzuro/pop/lib/OpenLayers.js (modified) (1 diff)
- sandbox/euzuro/pop/lib/OpenLayers/Control/OverviewMap.js (modified) (1 diff)
- sandbox/euzuro/pop/lib/OpenLayers/Control/PanZoomBar.js (modified) (2 diffs)
- sandbox/euzuro/pop/lib/OpenLayers/Format/WFS.js (modified) (1 diff)
- sandbox/euzuro/pop/lib/OpenLayers/Format/WMC.js (modified) (1 diff)
- sandbox/euzuro/pop/lib/OpenLayers/Format/WMC/v1.js (modified) (3 diffs)
- sandbox/euzuro/pop/lib/OpenLayers/Layer.js (modified) (2 diffs)
- sandbox/euzuro/pop/lib/OpenLayers/Layer/MapGuide.js (copied) (copied from trunk/openlayers/lib/OpenLayers/Layer/MapGuide.js)
- sandbox/euzuro/pop/lib/OpenLayers/Layer/Vector.js (modified) (2 diffs)
- sandbox/euzuro/pop/lib/OpenLayers/Map.js (modified) (6 diffs)
- sandbox/euzuro/pop/lib/OpenLayers/Popup.js (modified) (1 diff)
- sandbox/euzuro/pop/lib/OpenLayers/Renderer/SVG.js (modified) (2 diffs)
- sandbox/euzuro/pop/lib/OpenLayers/Rule.js (modified) (2 diffs)
- sandbox/euzuro/pop/lib/OpenLayers/Style.js (modified) (6 diffs)
- sandbox/euzuro/pop/lib/OpenLayers/StyleMap.js (modified) (1 diff)
- sandbox/euzuro/pop/lib/OpenLayers/Tween.js (modified) (5 diffs)
- sandbox/euzuro/pop/tests/Format/WMC/test_v1.html (copied) (copied from trunk/openlayers/tests/Format/WMC/test_v1.html)
- sandbox/euzuro/pop/tests/Format/test_XML.html (modified) (3 diffs)
- sandbox/euzuro/pop/tests/Layer/test_MapGuide.html (copied) (copied from trunk/openlayers/tests/Layer/test_MapGuide.html)
- sandbox/euzuro/pop/tests/Renderer/test_SVG.html (modified) (1 diff)
- sandbox/euzuro/pop/tests/Rule/test_Comparison.html (modified) (2 diffs)
- sandbox/euzuro/pop/tests/Tile/test_WFS.html (modified) (2 diffs)
- sandbox/euzuro/pop/tests/list-tests.html (modified) (2 diffs)
- sandbox/euzuro/pop/tests/manual/ajax.html (modified) (3 diffs)
- sandbox/euzuro/pop/tests/run-tests.html (modified) (1 diff)
- sandbox/euzuro/pop/tests/test_Layer.html (modified) (1 diff)
- sandbox/euzuro/pop/tests/test_Style.html (modified) (1 diff)
- sandbox/euzuro/pop/tests/test_Tween.html (modified) (1 diff)
- sandbox/euzuro/pop/tests/test_Util.html (modified) (1 diff)
- sandbox/euzuro/pop/tests/xml_eq.js (copied) (copied from trunk/openlayers/tests/xml_eq.js)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/euzuro/pop/build/full.cfg
r3601 r6402 14 14 Firebug/firebug.js 15 15 Firebug/firebugx.js 16 OpenLayers/Lang/de.js 17 OpenLayers/Lang/en-CA.js 18 OpenLayers/Lang/fr.js sandbox/euzuro/pop/examples/fractional-zoom.html
r6253 r6402 14 14 15 15 function init() { 16 map = new OpenLayers.Map('map'); 16 map = new OpenLayers.Map('map', 17 {controls: [new OpenLayers.Control.Navigation(), 18 new OpenLayers.Control.PanZoomBar()], 19 numZoomLevels: 10 }); 17 20 var wms = new OpenLayers.Layer.WMS( 18 21 "OpenLayers WMS", … … 23 26 24 27 map.events.register("moveend", null, displayZoom); 25 map.addControl( new OpenLayers.Control.LayerSwitcher() );26 28 27 29 map.zoomToMaxExtent(); … … 37 39 function update(input) { 38 40 map.fractionalZoom = input.checked; 41 map.zoomTo(Math.round(map.zoom)); 39 42 } 40 43 </script> sandbox/euzuro/pop/lib/OpenLayers.js
r6325 r6402 105 105 "OpenLayers/Layer/HTTPRequest.js", 106 106 "OpenLayers/Layer/Grid.js", 107 "OpenLayers/Layer/MapGuide.js", 107 108 "OpenLayers/Layer/MapServer.js", 108 109 "OpenLayers/Layer/MapServer/Untiled.js", sandbox/euzuro/pop/lib/OpenLayers/Control/OverviewMap.js
r6325 r6402 328 328 newTop)); 329 329 this.updateMapToRect(); 330 OpenLayers.Event.stop(evt);331 330 }, 332 331 sandbox/euzuro/pop/lib/OpenLayers/Control/PanZoomBar.js
r6253 r6402 242 242 var y = evt.xy.y; 243 243 var top = OpenLayers.Util.pagePosition(evt.object)[1]; 244 var levels = Math.floor((y - top)/this.zoomStopHeight); 245 this.map.zoomTo((this.map.getNumZoomLevels() -1) - levels); 244 var levels = (y - top)/this.zoomStopHeight; 245 var zoom = (this.map.getNumZoomLevels() - 1) - levels; 246 if(this.map.fractionalZoom) { 247 zoom = Math.min(Math.max(zoom, 0), this.map.getNumZoomLevels() - 1); 248 } else { 249 zoom = Math.floor(zoom); 250 } 251 this.map.zoomTo(zoom); 246 252 OpenLayers.Event.stop(evt); 247 253 }, … … 315 321 }); 316 322 var deltaY = this.zoomStart.y - evt.xy.y; 317 this.map.zoomTo(this.map.zoom + Math.round(deltaY/this.zoomStopHeight)); 323 var zoomLevel = this.map.zoom; 324 if (this.map.fractionalZoom) { 325 zoomLevel += deltaY/this.zoomStopHeight; 326 zoomLevel = Math.min(Math.max(zoomLevel, 0), 327 this.map.getNumZoomLevels() - 1); 328 } else { 329 zoomLevel += Math.round(deltaY/this.zoomStopHeight); 330 } 331 this.map.zoomTo(zoomLevel); 318 332 this.moveZoomBar(); 319 333 this.mouseDragStart = null; sandbox/euzuro/pop/lib/OpenLayers/Format/WFS.js
r6325 r6402 190 190 return false; 191 191 } 192 var deleteNode = this.createElementNS(this. featureNS, 'wfs:Delete');192 var deleteNode = this.createElementNS(this.wfsns, 'wfs:Delete'); 193 193 deleteNode.setAttribute("typeName", this.layerName); 194 194 sandbox/euzuro/pop/lib/OpenLayers/Format/WMC.js
r6253 r6402 88 88 var context = this.parser.read(data, options); 89 89 var map; 90 if(options.map instanceof OpenLayers.Map) { 91 map = this.mergeContextToMap(context, options.map); 90 if(options.map) { 91 this.context = context; 92 if(options.map instanceof OpenLayers.Map) { 93 map = this.mergeContextToMap(context, options.map); 94 } else { 95 map = this.contextToMap(context, options.map); 96 } 92 97 } else { 93 map = this.contextToMap(context, options.map); 98 // not documented as part of the API, provided as a non-API option 99 map = context; 94 100 } 95 101 return map; sandbox/euzuro/pop/lib/OpenLayers/Format/WMC/v1.js
r6136 r6402 123 123 childNode = children[i]; 124 124 if(childNode.nodeType == 1) { 125 prefix = (childNode.prefix == this.rootPrefix) ? 126 this.defaultPrefix : 127 this.getNamespacePrefix(childNode.namespaceURI); 125 prefix = this.getNamespacePrefix(childNode.namespaceURI); 128 126 local = childNode.nodeName.split(":").pop(); 129 127 processor = this["read_" + prefix + "_" + local]; … … 313 311 this.runChildNodes(style, node); 314 312 if(node.getAttribute("current") == "1") { 315 layerInfo.params.style = style.name; 313 // three style types to consider 314 // 1) linked SLD 315 // 2) inline SLD 316 // 3) named style 317 // running child nodes always gets name, optionally gets href or body 318 if(style.href) { 319 layerInfo.params.sld = style.href; 320 } else if(style.body) { 321 layerInfo.params.sld_body = style.body; 322 } else { 323 layerInfo.params.styles = style.name; 324 } 316 325 } 317 326 layerInfo.styles.push(style); 327 }, 328 329 /** 330 * Method: read_wmc_SLD 331 */ 332 read_wmc_SLD: function(style, node) { 333 this.runChildNodes(style, node); 334 // style either comes back with an href or a body property 335 }, 336 337 /** 338 * Method: read_sld_StyledLayerDescriptor 339 */ 340 read_sld_StyledLayerDescriptor: function(sld, node) { 341 var xml = OpenLayers.Format.XML.prototype.write.apply(this, [node]); 342 sld.body = xml; 318 343 }, 319 344 … … 732 757 "Style", null, {current: "1"} 733 758 ); 734 var name = layer.params["STYLES"] ? 735 layer.params["STYLES"] : this.defaultStyleName; 736 737 style.appendChild(this.createElementDefaultNS("Name", name)); 738 style.appendChild(this.createElementDefaultNS( 739 "Title", this.defaultStyleTitle 740 )); 759 760 // Style can come from one of three places (prioritized as below): 761 // 1) an SLD parameter 762 // 2) and SLD_BODY parameter 763 // 3) the STYLES parameter 764 765 if(layer.params["SLD"]) { 766 // create link from SLD parameter 767 var sld = this.createElementDefaultNS("SLD"); 768 var link = this.write_wmc_OnlineResource(layer.params["SLD"]); 769 sld.appendChild(link); 770 style.appendChild(sld); 771 } else if(layer.params["SLD_BODY"]) { 772 // include sld fragment from SLD_BODY parameter 773 var sld = this.createElementDefaultNS("SLD"); 774 var body = layer.params["SLD_BODY"]; 775 // read in body as xml doc - assume proper namespace declarations 776 var doc = OpenLayers.Format.XML.prototype.read.apply(this, [body]); 777 // append to StyledLayerDescriptor node 778 var imported = doc.documentElement; 779 if(sld.ownerDocument && sld.ownerDocument.importNode) { 780 imported = sld.ownerDocument.importNode(imported, true); 781 } 782 sld.appendChild(imported); 783 style.appendChild(sld); 784 } else { 785 // use name(s) from STYLES parameter 786 var name = layer.params["STYLES"] ? 787 layer.params["STYLES"] : this.defaultStyleName; 788 789 style.appendChild(this.createElementDefaultNS("Name", name)); 790 style.appendChild(this.createElementDefaultNS( 791 "Title", this.defaultStyleTitle 792 )); 793 } 741 794 node.appendChild(style); 742 795 return node; sandbox/euzuro/pop/lib/OpenLayers/Layer.js
r6253 r6402 716 716 717 717 // determine numZoomLevels if not already set on the layer 718 // this gives numZoomLevels assuming approximately base 2 scaling 718 719 if (confProps.minResolution != null && 719 720 this.options.numZoomLevels == undefined) { … … 728 729 var base = 2; 729 730 if(typeof confProps.minResolution == "number" && 730 this.options.numZoomLevels > 1) {731 confProps.numZoomLevels > 1) { 731 732 /** 732 * If numZoomLevels is explicitly set in the layer options, 733 * respect it. If numZoomLevels is not specified, we use 734 * exponential scaling with a base of 2. If numZoomLevels 735 * is specified, we use exponential scaling and determine the 736 * appropriate base so minResolution is reached. 733 * If maxResolution and minResolution are set (or related 734 * scale properties), we calculate the base for exponential 735 * scaling that starts at maxResolution and ends at 736 * minResolution in numZoomLevels steps. 737 737 */ 738 738 base = Math.pow( sandbox/euzuro/pop/lib/OpenLayers/Layer/Vector.js
r6325 r6402 151 151 152 152 // concatenate events specific to vector with those from the base 153 this.EVENT_TYPES = this.EVENT_TYPES.concat( 153 this.EVENT_TYPES = 154 OpenLayers.Layer.Vector.prototype.EVENT_TYPES.concat( 154 155 OpenLayers.Layer.prototype.EVENT_TYPES 155 156 ); … … 271 272 if (!dragging) { 272 273 this.renderer.root.style.visibility = "hidden"; 274 // force a reflow on gecko based browsers to actually hide the svg 275 if (navigator.userAgent.toLowerCase().indexOf("gecko") != -1) { 276 this.div.scrollLeft = this.div.scrollLeft; 277 } 273 278 274 279 this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + "px"; sandbox/euzuro/pop/lib/OpenLayers/Map.js
r6325 r6402 47 47 * 48 48 * Supported map event types: 49 * - *preaddlayer* triggered before a layer has been added. The event 50 * object will include a *layer* property that references the layer 51 * to be added. 49 52 * - *addlayer* triggered after a layer has been added. The event object 50 53 * will include a *layer* property that references the added layer. … … 75 78 */ 76 79 EVENT_TYPES: [ 77 " addlayer", "removelayer", "changelayer", "movestart", "move",78 "move end", "zoomend", "popupopen", "popupclose",80 "preaddlayer", "addlayer", "removelayer", "changelayer", "movestart", 81 "move", "moveend", "zoomend", "popupopen", "popupclose", 79 82 "addmarker", "removemarker", "clearmarkers", "mouseover", 80 83 "mouseout", "mousemove", "dragstart", "drag", "dragend", … … 316 319 */ 317 320 fallThrough: true, 321 322 /** 323 * Property: panTween 324 * {OpenLayers.Tween} Animated panning tween object, see panTo() 325 */ 326 panTween: null, 318 327 319 328 /** … … 733 742 } 734 743 } 744 745 this.events.triggerEvent("preaddlayer", {layer: layer}); 735 746 736 747 layer.div.className = "olLayerDiv"; … … 1439 1450 if (zoomChanged || centerChanged || !dragging) { 1440 1451 1441 if (! dragging && !noEvent) {1452 if (!this.dragging && !noEvent) { 1442 1453 this.events.triggerEvent("movestart"); 1443 1454 } … … 1512 1523 this.events.triggerEvent("moveend"); 1513 1524 } 1525 1526 // Store the map dragging state for later use 1527 this.dragging = !!dragging; 1528 1514 1529 }, 1515 1530 sandbox/euzuro/pop/lib/OpenLayers/Popup.js
r6390 r6402 289 289 updatePosition: function() { 290 290 if ((this.lonlat) && (this.map)) { 291 var px = this.map.getLayerPxFromLonLat(this.lonlat);292 if (px) {293 this.moveTo(px);294 }291 var px = this.map.getLayerPxFromLonLat(this.lonlat); 292 if (px) { 293 this.moveTo(px); 294 } 295 295 } 296 296 }, sandbox/euzuro/pop/lib/OpenLayers/Renderer/SVG.js
r6253 r6402 193 193 style = style || node._style; 194 194 options = options || node._options; 195 if (node._geometryClass == "OpenLayers.Geometry.Point") { 195 var x = node.getAttributeNS(null, "cx"); 196 // if x equals "", the node is outside the valid range 197 if (node._geometryClass == "OpenLayers.Geometry.Point" && x) { 196 198 if (style.externalGraphic) { 197 var x = parseFloat(node.getAttributeNS(null, "cx"));199 x = parseFloat(x); 198 200 var y = parseFloat(node.getAttributeNS(null, "cy")); 199 201 … … 338 340 node.setAttributeNS(null, "r", radius); 339 341 } else { 340 if (node.parentNode == this.root) {341 this.root.removeChild(node);342 }342 node.setAttributeNS(null, "cx", ""); 343 node.setAttributeNS(null, "cy", ""); 344 node.setAttributeNS(null, "r", 0); 343 345 } 344 346 sandbox/euzuro/pop/lib/OpenLayers/Rule.js
r6136 r6402 23 23 /** 24 24 * Property: context 25 * {Object} An optional object with properties that the rule and its26 * symbolizers' property values should be evaluatad against. If no27 * context is specified, feature.attributes will be used25 * {Object} An optional object with properties that the rule should be 26 * evaluatad against. If no context is specified, feature.attributes will 27 * be used. 28 28 */ 29 29 context: null, … … 41 41 /** 42 42 * Property: symbolizer 43 * {Object} Hash of styles for this rule. Contains hashes of feature44 * s tyles. Keys are one or more of ["Point", "Line", "Polygon"]43 * {Object} Symbolizer or hash of symbolizers for this rule. If hash of 44 * symbolizers, keys are one or more of ["Point", "Line", "Polygon"] 45 45 */ 46 46 symbolizer: null, sandbox/euzuro/pop/lib/OpenLayers/Style.js
r6253 r6402 42 42 43 43 /** 44 * Property: context 45 * {Object} An optional object with properties that symbolizers' property 46 * values should be evaluatad against. If no context is specified, 47 * feature.attributes will be used 48 */ 49 context: null, 50 51 /** 44 52 * Property: defaultStyle 45 53 * {Object} hash of style properties to use as default for merging … … 117 125 for(var i=0; i<rules.length; i++) { 118 126 rule = rules[i]; 119 context = rule.context;120 if (!context) {121 context = feature.attributes || feature.data;122 }123 127 // does the rule apply? 124 128 var applies = rule.evaluate(feature); … … 129 133 } else { 130 134 appliedRules = true; 131 this.applySymbolizer(rule, style, feature , context);135 this.applySymbolizer(rule, style, feature); 132 136 } 133 137 } … … 138 142 appliedRules = true; 139 143 for(var i=0; i<elseRules.length; i++) { 140 this.applySymbolizer(elseRules[i], style, feature , context);144 this.applySymbolizer(elseRules[i], style, feature); 141 145 } 142 146 } … … 159 163 * style - {Object} 160 164 * feature - {<OpenLayer.Feature.Vector>} 161 * context - {Object}162 165 * 163 166 * Returns: 164 167 * {Object} A style with new symbolizer applied. 165 168 */ 166 applySymbolizer: function(rule, style, feature , context) {169 applySymbolizer: function(rule, style, feature) { 167 170 var symbolizerPrefix = feature.geometry ? 168 171 this.getSymbolizerPrefix(feature.geometry) : 169 172 OpenLayers.Style.SYMBOLIZER_PREFIXES[0]; 170 173 171 var symbolizer = rule.symbolizer[symbolizerPrefix]; 172 174 var symbolizer = rule.symbolizer[symbolizerPrefix] || rule.symbolizer; 175 176 var context = this.context || feature.attributes || feature.data; 177 173 178 // merge the style with the current style 174 179 return this.createLiterals( … … 213 218 // check the default style 214 219 var style = this.defaultStyle; 215 for (var i in style) { 216 if (typeof style[i] == "string" && style[i].match(/\$\{\w+\}/)) { 217 propertyStyles[i] = true; 218 } 219 } 220 this.addPropertyStyles(propertyStyles, style); 220 221 221 222 // walk through all rules to check for properties in their symbolizer 222 223 var rules = this.rules; 223 var prefixes = OpenLayers.Style.SYMBOLIZER_PREFIXES;224 var symbolizer, value; 224 225 for (var i=0; i<rules.length; i++) { 225 for (var s=0; s<prefixes.length; s++) { 226 style = rules[i].symbolizer[prefixes[s]]; 227 for (var j in style) { 228 if (typeof style[j] == "string" && 229 style[j].match(/\$\{\w+\}/)) { 230 propertyStyles[j] = true; 231 } 226 var symbolizer = rules[i].symbolizer; 227 for (var key in symbolizer) { 228 value = symbolizer[key]; 229 if (typeof value == "object") { 230 // symbolizer key is "Point", "Line" or "Polygon" 231 this.addPropertyStyles(propertyStyles, value); 232 } else { 233 // symbolizer is a hash of style properties 234 this.addPropertyStyles(propertyStyles, symbolizer); 235 break; 232 236 } 237 } 238 } 239 return propertyStyles; 240 }, 241 242 /** 243 * Method: addPropertyStyles 244 * 245 * Parameters: 246 * propertyStyles - {Object} hash to add new property styles to. Will be 247 * modified inline 248 * symbolizer - {Object} search this symbolizer for property styles 249 * 250 * Returns: 251 * {Object} propertyStyles hash 252 */ 253 addPropertyStyles: function(propertyStyles, symbolizer) { 254 var property; 255 for (var key in symbolizer) { 256 property = symbolizer[key]; 257 if (typeof property == "string" && 258 property.match(/\$\{\w+\}/)) { 259 propertyStyles[key] = true; 233 260 } 234 261 } sandbox/euzuro/pop/lib/OpenLayers/StyleMap.js
r6253 r6402 111 111 this.styles[intent].createSymbolizer(feature)); 112 112 }, 113 114 /** 115 * Method: addUniqueValueRules 116 * Convenience method to create comparison rules for unique values of a 117 * property. The rules will be added to the style object for a specified 118 * rendering intent. This method is a shortcut for creating something like 119 * the "unique value legends" familiar from well known desktop GIS systems 120 * 121 * Parameters: 122 * renderIntent - {String} rendering intent to add the rules to 123 * property - {String} values of feature attributes to create the 124 * rules for 125 * symbolizers - {Object} Hash of symbolizers, keyed by the desired 126 * property values 127 */ 128 addUniqueValueRules: function(renderIntent, property, symbolizers) { 129 var rules = []; 130 for (var value in symbolizers) { 131 rules.push(new OpenLayers.Rule.Comparison({ 132 type: OpenLayers.Rule.Comparison.EQUAL_TO, 133 property: property, 134 value: value, 135 symbolizer: symbolizers[value]})); 136 } 137 this.styles[renderIntent].addRules(rules); 138 }, 113 139 114 140 CLASS_NAME: "OpenLayers.StyleMap" sandbox/euzuro/pop/lib/OpenLayers/Tween.js
r6136 r6402 59 59 interval: null, 60 60 61 /** 62 * Property: playing 63 * {Boolean} Tells if the easing is currently playing 64 */ 65 playing: false, 66 61 67 /** 62 68 * Constructor: OpenLayers.Tween … … 81 87 */ 82 88 start: function(begin, finish, duration, options) { 89 this.playing = true; 83 90 this.begin = begin; 84 91 this.finish = finish; … … 99 106 /** 100 107 * APIMethod: stop 101 * Stops the Tween, and calls the finish callback 108 * Stops the Tween, and calls the done callback 109 * Doesn't do anything if animation is already finished 102 110 */ 103 111 stop: function() { 112 if (!this.playing) { 113 return; 114 } 115 104 116 if (this.callbacks && this.callbacks.done) { 105 117 this.callbacks.done.call(this, this.finish); … … 107 119 window.clearInterval(this.interval); 108 120 this.interval = null; 121 this.playing = false; 109 122 }, 110 123 … … 134 147 if (this.callbacks && this.callbacks.done) { 135 148 this.callbacks.done.call(this, this.finish); 149 this.playing = false; 136 150 } 137 151 window.clearInterval(this.interval); sandbox/euzuro/pop/tests/Format/test_XML.html
r6136 r6402 44 44 45 45 var format = new OpenLayers.Format.XML(); 46 t.plan(format.xmldom ? 1 1 : 10);46 t.plan(format.xmldom ? 10 : 9); 47 47 48 48 var doc = format.read(text); … … 53 53 t.ok(doc.documentElement, 54 54 "ok to access doc.documentElement"); 55 t.eq(doc.documentElement.nodeName, "ol:root", 56 "doc root has the correct node name"); 57 t.eq(doc.documentElement.childNodes[1].firstChild.nodeValue, "junk2", 58 "second child of doc root has correct child node"); 55 t.xml_eq(doc.documentElement, text, 56 "doc.documentElement correctly read"); 59 57 60 58 // read can also be called on the prototype directly … … 66 64 t.ok(doc.documentElement, 67 65 "ok to access doc.documentElement"); 68 t.eq(doc.documentElement.nodeName, "ol:root", 69 "doc root has the correct node name"); 70 t.eq(doc.documentElement.childNodes[1].firstChild.nodeValue, "junk2", 71 "second child of doc root has correct child node"); 66 t.xml_eq(doc.documentElement, text, 67 "doc.documentElement correctly read"); 72 68 73 69 // where appropriate, make sure doc is loaded into xmldom property 74 70 if(format.xmldom) { 75 t.eq(format.xmldom.documentElement.childNodes[1].firstChild.nodeValue, 76 "junk2", 77 "second child of doc root has correct child node"); 71 t.xml_eq(format.xmldom.documentElement, text, 72 "xmldom.documentElement contains equivalent xml"); 78 73 } 74 75 // test equivalence with different namespace alias 76 var pre1 = 77 "<pre1:parent xmlns:pre1='http://namespace'>" + 78 "<pre1:child1>value2</pre1:child1>" + 79 "<pre1:child2 pre1:attr1='foo'>value2</pre1:child2>" + 80 "<pre1:child3 chicken:attr='hot' xmlns:chicken='http://soup'/>" + 81 "</pre1:parent>"; 82 var pre2 = 83 "<pre2:parent xmlns:pre2='http://namespace'>" + 84 "<pre2:child1>value2</pre2:child1>" + 85 "<pre2:child2 pre2:attr1='foo'>value2</pre2:child2>" + 86 "<pre2:child3 pea:attr='hot' xmlns:pea='http://soup'/>" + 87 "</pre2:parent>"; 88 var doc1 = format.read(pre1); 89 t.xml_eq(doc1.documentElement, pre2, "read correctly sets namespaces"); 90 79 91 } 80 92 sandbox/euzuro/pop/tests/Renderer/test_SVG.html
r6136 r6402 156 156 r.drawCircle(node, geometry, "blah_4000"); 157 157 158 t.eq(node.getAttributeNS(null, 'cx'), ' 2', "cx is correct");159 t.eq(node.getAttributeNS(null, 'cy'), ' -4', "cy is correct");160 t.eq(node.getAttributeNS(null, 'r'), ' 3', "r is correct");158 t.eq(node.getAttributeNS(null, 'cx'), '', "cx is correct"); 159 t.eq(node.getAttributeNS(null, 'cy'), '', "cy is correct"); 160 t.eq(node.getAttributeNS(null, 'r'), '0', "r is correct"); 161 161 } 162 162 sandbox/euzuro/pop/tests/Rule/test_Comparison.html
r6136 r6402 39 39 40 40 function test_Comparison_evaluate(t) { 41 t.plan( 3);41 t.plan(4); 42 42 43 43 var rule = new OpenLayers.Rule.Comparison({ … … 63 63 " evaluates to "+result.toString()+" correctly."); 64 64 } 65 rule.context = { 66 area: 4998 67 } 68 var result = rule.evaluate(); 69 t.eq(result, true, "evaluation against custom rule context works."); 65 70 } 66 71 </script> sandbox/euzuro/pop/tests/Tile/test_WFS.html
r6136 r6402 30 30 t.plan(2); 31 31 32 var tile = {33 'request': {}34 };35 36 OpenLayers.Tile.WFS.prototype.requestSuccess.apply(tile, []);37 38 t.ok(tile.request == null, "request property on tile set to null");32 var tile = { 33 'request': {} 34 }; 35 36 OpenLayers.Tile.WFS.prototype.requestSuccess.apply(tile, []); 37 38 t.ok(tile.request == null, "request property on tile set to null"); 39 39 40 40 var layer = {}; // bogus layer … … 52 52 53 53 function test_Tile_WFS_loadFeaturesForRegion(t) { 54 t.plan(9);55 56 var tile = {57 'url': {}58 };54 t.plan(9); 55 56 var tile = { 57 'url': {} 58 }; 59 59 60 var g_Success = {}; 60 var g_Success = {}; 61 61 62 var tLoadURL = OpenLayers.loadURL;63 OpenLayers.loadURL = function(url, params, caller, onComplete) {64 t.ok(url == tile.url, "tile's url correctly passed as 1st param to loadURL");65 t.ok(params == null, "null passed as 2nd param to loadURL");66 t.ok(caller == tile, "tile passed as 3rd param to loadURL");67 t.ok(onComplete == g_Success, "success param from loadFeaturesForRegion() passed as 4th param to loadURL");68 };69 70 //no running request -- 4 tests71 OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]);62 var tLoadURL = OpenLayers.loadURL; 63 OpenLayers.loadURL = function(url, params, caller, onComplete) { 64 t.ok(url == tile.url, "tile's url correctly passed as 1st param to loadURL"); 65 t.ok(params == null, "null passed as 2nd param to loadURL"); 66 t.ok(caller == tile, "tile passed as 3rd param to loadURL"); 67 t.ok(onComplete == g_Success, "success param from loadFeaturesForRegion() passed as 4th param to loadURL"); 68 }; 69 70 //no running request -- 4 tests 71 OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]); 72 72 73 //running request (cancelled) -- 4 tests + 1 test (for request abort)74 tile.request = {75 'transport': {76 'abort': function() {77 t.ok(true, "request aborted");78 }79 }80 };81 OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]);82 83 OpenLayers.loadURL = tLoadURL;73 //running request (cancelled) -- 4 tests + 1 test (for request abort) 74 tile.request = { 75 transport: { 76 'abort': function() { 77 t.ok(true, "request aborted"); 78 } 79 } 80 }; 81 OpenLayers.Tile.WFS.prototype.loadFeaturesForRegion.apply(tile, [g_Success]); 82 83 OpenLayers.loadURL = tLoadURL; 84 84 } 85 85 sandbox/euzuro/pop/tests/list-tests.html
r6325 r6402 33 33 <li>Format/test_WMC.html</li> 34 34 <li>Format/WMC/test_v1_1_0.html</li> 35 <li>Format/WMC/test_v1.html</li> 35 36 <li>Format/test_XML.html</li> 36 37 <li>test_Icon.html</li> … … 62 63 <li>Layer/test_Image.html</li> 63 64 <li>Layer/test_KaMap.html</li> 65 <li>Layer/test_MapGuide.html</li> 64 66 <li>Layer/test_MapServer.html</li> 65 67 <li>Layer/test_Markers.html</li> sandbox/euzuro/pop/tests/manual/ajax.html
r6136 r6402 23 23 function sendSynchronous(){ 24 24 var request = new OpenLayers.Ajax.Request(url, { 25 'asynchronous': false, 25 26 onComplete: function() { 26 27 document.getElementById('send_sync').value += 'request completed\n'; … … 31 32 function sendAsynchronous(){ 32 33 var request = new OpenLayers.Ajax.Request(url, { 33 'asynchronous': false,34 34 onComplete: function() {
