Remove XML prolog from tests. Browsers can't seem to decide whether they like
it or not, and #1218 will cause the behavior to change across the board, most likely, so we'll just be slightly more accepting, since the XML prolog is almost definitely unlikely to not matter. git-svn-id: http://svn.openlayers.org/trunk/openlayers@5478 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -42,26 +42,31 @@
|
|||||||
var point = shell_start + serialize_geoms['point'] + shell_end;
|
var point = shell_start + serialize_geoms['point'] + shell_end;
|
||||||
data = parser.read(point);
|
data = parser.read(point);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, point, "Point geometry round trips correctly.");
|
t.eq(output, point, "Point geometry round trips correctly.");
|
||||||
|
|
||||||
var linestring = shell_start + serialize_geoms['linestring'] + shell_end;
|
var linestring = shell_start + serialize_geoms['linestring'] + shell_end;
|
||||||
data = parser.read(linestring);
|
data = parser.read(linestring);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, linestring, "Line geometry round trips correctly.");
|
t.eq(output, linestring, "Line geometry round trips correctly.");
|
||||||
|
|
||||||
var polygon = shell_start + serialize_geoms['polygon'] + shell_end;
|
var polygon = shell_start + serialize_geoms['polygon'] + shell_end;
|
||||||
data = parser.read(polygon);
|
data = parser.read(polygon);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, polygon, "Poly geometry round trips correctly.");
|
t.eq(output, polygon, "Poly geometry round trips correctly.");
|
||||||
|
|
||||||
var multipoint = shell_start + serialize_geoms['multipoint'] + shell_end;
|
var multipoint = shell_start + serialize_geoms['multipoint'] + shell_end;
|
||||||
data = parser.read(multipoint);
|
data = parser.read(multipoint);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, multipoint, "MultiPoint geometry round trips correctly.");
|
t.eq(output, multipoint, "MultiPoint geometry round trips correctly.");
|
||||||
|
|
||||||
var multilinestring = shell_start + serialize_geoms['multilinestring'] + shell_end;
|
var multilinestring = shell_start + serialize_geoms['multilinestring'] + shell_end;
|
||||||
data = parser.read(multilinestring);
|
data = parser.read(multilinestring);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, multilinestring, "MultiLine geometry round trips correctly.");
|
t.eq(output, multilinestring, "MultiLine geometry round trips correctly.");
|
||||||
}
|
}
|
||||||
function test_Format_GML_read_point_geom(t) {
|
function test_Format_GML_read_point_geom(t) {
|
||||||
@@ -288,30 +293,35 @@
|
|||||||
var point = shell_start + serialize_geoms_yx['point'] + shell_end;
|
var point = shell_start + serialize_geoms_yx['point'] + shell_end;
|
||||||
data = parser.read(point);
|
data = parser.read(point);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, point_xy, "Point geometry round trips correctly.");
|
t.eq(output, point_xy, "Point geometry round trips correctly.");
|
||||||
|
|
||||||
var linestring_xy = shell_start + serialize_geoms['linestring'] + shell_end;
|
var linestring_xy = shell_start + serialize_geoms['linestring'] + shell_end;
|
||||||
var linestring = shell_start + serialize_geoms_yx['linestring'] + shell_end;
|
var linestring = shell_start + serialize_geoms_yx['linestring'] + shell_end;
|
||||||
data = parser.read(linestring);
|
data = parser.read(linestring);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, linestring_xy, "Line geometry round trips correctly.");
|
t.eq(output, linestring_xy, "Line geometry round trips correctly.");
|
||||||
|
|
||||||
var polygon_xy = shell_start + serialize_geoms['polygon'] + shell_end;
|
var polygon_xy = shell_start + serialize_geoms['polygon'] + shell_end;
|
||||||
var polygon = shell_start + serialize_geoms_yx['polygon'] + shell_end;
|
var polygon = shell_start + serialize_geoms_yx['polygon'] + shell_end;
|
||||||
data = parser.read(polygon);
|
data = parser.read(polygon);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, polygon_xy, "Poly geometry round trips correctly.");
|
t.eq(output, polygon_xy, "Poly geometry round trips correctly.");
|
||||||
|
|
||||||
var multipoint_xy = shell_start + serialize_geoms['multipoint'] + shell_end;
|
var multipoint_xy = shell_start + serialize_geoms['multipoint'] + shell_end;
|
||||||
var multipoint = shell_start + serialize_geoms_yx['multipoint'] + shell_end;
|
var multipoint = shell_start + serialize_geoms_yx['multipoint'] + shell_end;
|
||||||
data = parser.read(multipoint);
|
data = parser.read(multipoint);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, multipoint_xy, "MultiPoint geometry round trips correctly.");
|
t.eq(output, multipoint_xy, "MultiPoint geometry round trips correctly.");
|
||||||
|
|
||||||
var multilinestring_xy = shell_start + serialize_geoms['multilinestring'] + shell_end;
|
var multilinestring_xy = shell_start + serialize_geoms['multilinestring'] + shell_end;
|
||||||
var multilinestring = shell_start + serialize_geoms_yx['multilinestring'] + shell_end;
|
var multilinestring = shell_start + serialize_geoms_yx['multilinestring'] + shell_end;
|
||||||
data = parser.read(multilinestring);
|
data = parser.read(multilinestring);
|
||||||
var output = parser.write(data);
|
var output = parser.write(data);
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, multilinestring_xy, "MultiLine geometry round trips correctly.");
|
t.eq(output, multilinestring_xy, "MultiLine geometry round trips correctly.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
var l = new OpenLayers.Geometry.LineString([point, point2]);
|
var l = new OpenLayers.Geometry.LineString([point, point2]);
|
||||||
var f = new OpenLayers.Feature.Vector(l);
|
var f = new OpenLayers.Feature.Vector(l);
|
||||||
var data = parser.write([f]);
|
var data = parser.write([f]);
|
||||||
|
var data = data.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(data, '<rss xmlns="http://backend.userland.com/rss2"><item><title></title><description></description><georss:line xmlns:georss="http://www.georss.org/georss">45.68 -111.04 45.68 -112.04</georss:line></item></rss>', 'GeoRSS serializes a line correctly');
|
t.eq(data, '<rss xmlns="http://backend.userland.com/rss2"><item><title></title><description></description><georss:line xmlns:georss="http://www.georss.org/georss">45.68 -111.04 45.68 -112.04</georss:line></item></rss>', 'GeoRSS serializes a line correctly');
|
||||||
}
|
}
|
||||||
function test_Format_GeoRSS_w3cgeo(t) {
|
function test_Format_GeoRSS_w3cgeo(t) {
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
if (OpenLayers.Util.getBrowserName() == "opera") {
|
if (OpenLayers.Util.getBrowserName() == "opera") {
|
||||||
expected_result = expected_result.replace(/>/g, ">");
|
expected_result = expected_result.replace(/>/g, ">");
|
||||||
}
|
}
|
||||||
|
var out = out.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(out, expected_result, "Output gave expected value");
|
t.eq(out, expected_result, "Output gave expected value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,6 +61,7 @@
|
|||||||
if (OpenLayers.Util.getBrowserName() == "opera") {
|
if (OpenLayers.Util.getBrowserName() == "opera") {
|
||||||
expected_result = expected_result.replace(/>/g, ">");
|
expected_result = expected_result.replace(/>/g, ">");
|
||||||
}
|
}
|
||||||
|
var out = out.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(out, expected_result, "Output gave expected value");
|
t.eq(out, expected_result, "Output gave expected value");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
var format = new OpenLayers.Format.KML(options);
|
var format = new OpenLayers.Format.KML(options);
|
||||||
var features = format.read(kmlExpected);
|
var features = format.read(kmlExpected);
|
||||||
var kmlOut = format.write(features);
|
var kmlOut = format.write(features);
|
||||||
|
var kmlOut = kmlOut.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(kmlOut, kmlExpected, "correctly writes an KML doc string");
|
t.eq(kmlOut, kmlExpected, "correctly writes an KML doc string");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,6 +84,7 @@
|
|||||||
feature = new OpenLayers.Feature.Vector(multi, {name: "test name"});
|
feature = new OpenLayers.Feature.Vector(multi, {name: "test name"});
|
||||||
output = format.write(feature);
|
output = format.write(feature);
|
||||||
expected = '<kml xmlns="http://earth.google.com/kml/2.0"><Folder><name>OpenLayers export</name><description>test output</description><Placemark><name>test name</name><description>No description available</description><MultiGeometry><Point><coordinates>0,1</coordinates></Point></MultiGeometry></Placemark></Folder></kml>';
|
expected = '<kml xmlns="http://earth.google.com/kml/2.0"><Folder><name>OpenLayers export</name><description>test output</description><Placemark><name>test name</name><description>No description available</description><MultiGeometry><Point><coordinates>0,1</coordinates></Point></MultiGeometry></Placemark></Folder></kml>';
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, expected, "multipoint correctly written");
|
t.eq(output, expected, "multipoint correctly written");
|
||||||
|
|
||||||
// test multilinestring
|
// test multilinestring
|
||||||
@@ -95,6 +97,7 @@
|
|||||||
feature = new OpenLayers.Feature.Vector(multi, {name: "test name"});
|
feature = new OpenLayers.Feature.Vector(multi, {name: "test name"});
|
||||||
output = format.write(feature);
|
output = format.write(feature);
|
||||||
expected = '<kml xmlns="http://earth.google.com/kml/2.0"><Folder><name>OpenLayers export</name><description>test output</description><Placemark><name>test name</name><description>No description available</description><MultiGeometry><LineString><coordinates>1,0 0,1</coordinates></LineString></MultiGeometry></Placemark></Folder></kml>';
|
expected = '<kml xmlns="http://earth.google.com/kml/2.0"><Folder><name>OpenLayers export</name><description>test output</description><Placemark><name>test name</name><description>No description available</description><MultiGeometry><LineString><coordinates>1,0 0,1</coordinates></LineString></MultiGeometry></Placemark></Folder></kml>';
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, expected, "multilinestring correctly written");
|
t.eq(output, expected, "multilinestring correctly written");
|
||||||
|
|
||||||
// test multipolygon
|
// test multipolygon
|
||||||
@@ -110,6 +113,7 @@
|
|||||||
feature = new OpenLayers.Feature.Vector(multi, {name: "test name"});
|
feature = new OpenLayers.Feature.Vector(multi, {name: "test name"});
|
||||||
output = format.write(feature);
|
output = format.write(feature);
|
||||||
expected = '<kml xmlns="http://earth.google.com/kml/2.0"><Folder><name>OpenLayers export</name><description>test output</description><Placemark><name>test name</name><description>No description available</description><MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>0,0 1,0 0,1 0,0</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry></Placemark></Folder></kml>';
|
expected = '<kml xmlns="http://earth.google.com/kml/2.0"><Folder><name>OpenLayers export</name><description>test output</description><Placemark><name>test name</name><description>No description available</description><MultiGeometry><Polygon><outerBoundaryIs><LinearRing><coordinates>0,0 1,0 0,1 0,0</coordinates></LinearRing></outerBoundaryIs></Polygon></MultiGeometry></Placemark></Folder></kml>';
|
||||||
|
var output = output.replace(/<\?[^>]*\?>/, ''); // Remove XML Prolog
|
||||||
t.eq(output, expected, "multilinestring correctly written");
|
t.eq(output, expected, "multilinestring correctly written");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user