Tag RC4 release.

git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.4-rc4@3178 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-05-24 14:55:48 +00:00
parent 3c6cd6f559
commit 07d333cc79
109 changed files with 542 additions and 419 deletions

View File

@@ -0,0 +1,34 @@
<html>
<head>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
function test_Format_GeoRSS_constructor(t) {
t.plan(4);
var options = {'foo': 'bar'};
var format = new OpenLayers.Format.GeoRSS(options);
t.ok(format instanceof OpenLayers.Format.GeoRSS,
"new OpenLayers.Format.GeoRSS returns object" );
t.eq(format.foo, "bar", "constructor sets options correctly");
t.eq(typeof format.read, "function", "format has a read function");
t.eq(typeof format.write, "function", "format has a write function");
}
function test_Format_GeoRSS_serializeline(t) {
t.plan(1);
var parser = new OpenLayers.Format.GeoRSS();
var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
var point2 = new OpenLayers.Geometry.Point(-112.04, 45.68);
var l = new OpenLayers.Geometry.LineString([point, point2]);
var f = new OpenLayers.Feature.Vector(l);
var data = parser.write([f]);
t.eq(data.firstChild.childNodes[2].firstChild.nodeValue, '45.68 -111.04 45.68 -112.04 ', 'GeoRSS serializes a line correctly');
}
// -->
</script>
</head>
<body>
</body>
</html>

View File

@@ -5,37 +5,53 @@
var points = [];
for(var i=0; i<12; ++i) {
points.push(new OpenLayers.Geometry.Point(Math.random() * 100,
Math.random() * 100));
points.push(new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Point(Math.random() * 100,
Math.random() * 100))
);
}
var multipoint = new OpenLayers.Geometry.MultiPoint([
points[0], points[1], points[2]
]);
var multipoint = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.MultiPoint([
points[0].geometry, points[1].geometry, points[2].geometry
])
);
var linestrings = [
new OpenLayers.Geometry.LineString([points[0], points[1], points[2]]),
new OpenLayers.Geometry.LineString([points[3], points[4], points[5]])
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString([points[0].geometry, points[1].geometry, points[2].geometry])
),
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString([points[3].geometry, points[4].geometry, points[5].geometry])
)
];
var multilinestring = new OpenLayers.Geometry.MultiLineString([
linestrings[0], linestrings[1]
]);
var multilinestring = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.MultiLineString([
linestrings[0].geometry, linestrings[1].geometry
])
);
var rings = [
new OpenLayers.Geometry.LinearRing([points[0], points[1], points[2]]),
new OpenLayers.Geometry.LinearRing([points[3], points[4], points[5]]),
new OpenLayers.Geometry.LinearRing([points[6], points[7], points[8]]),
new OpenLayers.Geometry.LinearRing([points[9], points[10], points[11]])
new OpenLayers.Geometry.LinearRing([points[0].geometry, points[1].geometry, points[2].geometry]),
new OpenLayers.Geometry.LinearRing([points[3].geometry, points[4].geometry, points[5].geometry]),
new OpenLayers.Geometry.LinearRing([points[6].geometry, points[7].geometry, points[8].geometry]),
new OpenLayers.Geometry.LinearRing([points[9].geometry, points[10].geometry, points[11].geometry])
];
var polygons = [
new OpenLayers.Geometry.Polygon([rings[0], rings[1]]),
new OpenLayers.Geometry.Polygon([rings[2], rings[3]])
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon([rings[0], rings[1]])
),
new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.Polygon([rings[2], rings[3]])
)
];
var multipolygon = new OpenLayers.Geometry.MultiPolygon([
polygons[0], polygons[1]
]);
var multipolygon = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.MultiPolygon([
polygons[0].geometry, polygons[1].geometry
])
);
var collection = [points[0], linestrings[0]];
@@ -53,74 +69,74 @@
function test_Format_WKT_write(t) {
t.plan(7);
var format = new OpenLayers.Format.WKT();
// test a point
t.eq(format.write(points[0]),
"POINT(" + points[0].x + " " + points[0].y + ")",
"POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")",
"format correctly writes Point WKT");
// test a multipoint
t.eq(format.write(multipoint),
"MULTIPOINT(" + points[0].x + " " + points[0].y + "," +
points[1].x + " " + points[1].y + "," +
points[2].x + " " + points[2].y + ")",
"MULTIPOINT(" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].geometry.x + " " + points[2].geometry.y + ")",
"format correctly writes MultiPoint WKT");
// test a linestring
t.eq(format.write(linestrings[0]),
"LINESTRING(" + points[0].x + " " + points[0].y + "," +
points[1].x + " " + points[1].y + "," +
points[2].x + " " + points[2].y + ")",
"LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].geometry.x + " " + points[2].geometry.y + ")",
"format correctly writes LineString WKT");
// test a multilinestring
t.eq(format.write(multilinestring),
"MULTILINESTRING((" + points[0].x + " " + points[0].y + "," +
points[1].x + " " + points[1].y + "," +
points[2].x + " " + points[2].y + ")," +
"(" + points[3].x + " " + points[3].y + "," +
points[4].x + " " + points[4].y + "," +
points[5].x + " " + points[5].y + "))",
"MULTILINESTRING((" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].geometry.x + " " + points[2].geometry.y + ")," +
"(" + points[3].geometry.x + " " + points[3].geometry.y + "," +
points[4].geometry.x + " " + points[4].geometry.y + "," +
points[5].geometry.x + " " + points[5].geometry.y + "))",
"format correctly writes MultiLineString WKT");
// test a polygon
t.eq(format.write(polygons[0]),
"POLYGON((" + points[0].x + " " + points[0].y + "," +
points[1].x + " " + points[1].y + "," +
points[2].x + " " + points[2].y + "," +
points[0].x + " " + points[0].y + ")," +
"(" + points[3].x + " " + points[3].y + "," +
points[4].x + " " + points[4].y + "," +
points[5].x + " " + points[5].y + "," +
points[3].x + " " + points[3].y + "))",
"POLYGON((" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].geometry.x + " " + points[2].geometry.y + "," +
points[0].geometry.x + " " + points[0].geometry.y + ")," +
"(" + points[3].geometry.x + " " + points[3].geometry.y + "," +
points[4].geometry.x + " " + points[4].geometry.y + "," +
points[5].geometry.x + " " + points[5].geometry.y + "," +
points[3].geometry.x + " " + points[3].geometry.y + "))",
"format correctly writes Polygon WKT");
// test a multipolygon
t.eq(format.write(multipolygon),
"MULTIPOLYGON(((" + points[0].x + " " + points[0].y + "," +
points[1].x + " " + points[1].y + "," +
points[2].x + " " + points[2].y + "," +
points[0].x + " " + points[0].y + ")," +
"(" + points[3].x + " " + points[3].y + "," +
points[4].x + " " + points[4].y + "," +
points[5].x + " " + points[5].y + "," +
points[3].x + " " + points[3].y + "))," +
"((" + points[6].x + " " + points[6].y + "," +
points[7].x + " " + points[7].y + "," +
points[8].x + " " + points[8].y + "," +
points[6].x + " " + points[6].y + ")," +
"(" + points[9].x + " " + points[9].y + "," +
points[10].x + " " + points[10].y + "," +
points[11].x + " " + points[11].y + "," +
points[9].x + " " + points[9].y + ")))",
"MULTIPOLYGON(((" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].geometry.x + " " + points[2].geometry.y + "," +
points[0].geometry.x + " " + points[0].geometry.y + ")," +
"(" + points[3].geometry.x + " " + points[3].geometry.y + "," +
points[4].geometry.x + " " + points[4].geometry.y + "," +
points[5].geometry.x + " " + points[5].geometry.y + "," +
points[3].geometry.x + " " + points[3].geometry.y + "))," +
"((" + points[6].geometry.x + " " + points[6].geometry.y + "," +
points[7].geometry.x + " " + points[7].geometry.y + "," +
points[8].geometry.x + " " + points[8].geometry.y + "," +
points[6].geometry.x + " " + points[6].geometry.y + ")," +
"(" + points[9].geometry.x + " " + points[9].geometry.y + "," +
points[10].geometry.x + " " + points[10].geometry.y + "," +
points[11].geometry.x + " " + points[11].geometry.y + "," +
points[9].geometry.x + " " + points[9].geometry.y + ")))",
"format correctly writes MultiPolygon WKT");
// test a geometrycollection
t.eq(format.write(collection),
"GEOMETRYCOLLECTION(POINT(" + points[0].x + " " + points[0].y + ")," +
"LINESTRING(" + points[0].x + " " + points[0].y + "," +
points[1].x + " " + points[1].y + "," +
points[2].x + " " + points[2].y + "))",
"GEOMETRYCOLLECTION(POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")," +
"LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].geometry.x + " " + points[2].geometry.y + "))",
"format correctly writes GeometryCollection WKT");
}
@@ -134,35 +150,35 @@
*/
// test a point
t.ok(points[0].equals(format.read(format.write(points[0]))),
t.ok(points[0].geometry.equals(format.read(format.write(points[0])).geometry),
"format correctly reads Point WKT");
// test a multipoint
t.ok(multipoint.equals(format.read(format.write(multipoint))),
t.ok(multipoint.geometry.equals(format.read(format.write(multipoint)).geometry),
"format correctly reads MultiPoint WKT");
// test a linestring
t.ok(linestrings[0].equals(format.read(format.write(linestrings[0]))),
t.ok(linestrings[0].geometry.equals(format.read(format.write(linestrings[0])).geometry),
"format correctly reads LineString WKT");
// test a multilinestring
t.ok(multilinestring.equals(format.read(format.write(multilinestring))),
t.ok(multilinestring.geometry.equals(format.read(format.write(multilinestring)).geometry),
"format correctly reads MultiLineString WKT");
// test a polygon
t.ok(polygons[0].equals(format.read(format.write(polygons[0]))),
t.ok(polygons[0].geometry.equals(format.read(format.write(polygons[0])).geometry),
"format correctly reads Polygon WKT");
// test a multipolygon
t.ok(multipolygon.equals(format.read(format.write(multipolygon))),
t.ok(multipolygon.geometry.equals(format.read(format.write(multipolygon)).geometry),
"format correctly reads MultiPolygon WKT");
// test a geometrycollection
t.eq(format.write(collection),
"GEOMETRYCOLLECTION(POINT(" + points[0].x + " " + points[0].y + ")," +
"LINESTRING(" + points[0].x + " " + points[0].y + "," +
points[1].x + " " + points[1].y + "," +
points[2].x + " " + points[2].y + "))",
"GEOMETRYCOLLECTION(POINT(" + points[0].geometry.x + " " + points[0].geometry.y + ")," +
"LINESTRING(" + points[0].geometry.x + " " + points[0].geometry.y + "," +
points[1].geometry.x + " " + points[1].geometry.y + "," +
points[2].geometry.x + " " + points[2].geometry.y + "))",
"format correctly writes GeometryCollection WKT");
}

View File

@@ -187,8 +187,9 @@
layer = new OpenLayers.Layer.WMS(name, url, params);
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
map.setCenter(new OpenLayers.LonLat(0,0), 10);
//grab a reference to one of the tiles
var tile = layer.grid[1][1];
t.eq( tile.imgDiv.className, "olTileImage", "Tile has an image" );

View File

@@ -188,13 +188,14 @@
map.setCenter(new OpenLayers.LonLat(0,0), 5);
var tile = layer.grid[0][0];
t.ok(tile.layer.imageSize.equals(tile.size),
"zero size gutter doesn't change image size");
t.ok(tile.layer.imageOffset.equals(new OpenLayers.Pixel(0, 0)),
"zero size gutter doesn't affect image offset");
var zero_gutter_bounds = tile.bounds;
map.destroy();
var gutter = 15;
@@ -209,8 +210,7 @@
t.ok(tile.layer.imageOffset.equals(new OpenLayers.Pixel(-gutter, -gutter)),
"gutter properly sets image offset");
t.ok(tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)),
t.ok(tile.bounds.equals(zero_gutter_bounds),
"gutter doesn't affect tile bounds");
map.destroy();

View File

@@ -17,6 +17,7 @@
<li>Geometry/test_Rectangle.html</li>
<li>Geometry/test_Surface.html</li>
<li>test_Format.html</li>
<li>Format/test_GeoRSS.html</li>
<li>Format/test_GML.html</li>
<li>Format/test_WKT.html</li>
<li>test_Icon.html</li>
@@ -38,7 +39,7 @@
<li>Layer/test_Image.html</li>
<li>Layer/test_KaMap.html</li>
<li>Layer/test_Markers.html</li>
<li>Layer/test_Multimap.html</li>
<li>Layer/test_MultiMap.html</li>
<li>Layer/test_MapServer.html</li>
<li>Layer/test_MapServer_Untiled.html</li>
<li>Layer/test_Text.html</li>
@@ -58,6 +59,5 @@
<li>Control/test_PanZoomBar.html</li>
<li>Control/test_Permalink.html</li>
<li>Control/test_Scale.html</li>
<li>test_Format.html</li>
<li>test_Map.html</li>
</ul>

View File

@@ -336,34 +336,48 @@
function test_01_Map_defaultTheme(t) {
t.plan(5);
var head = document.getElementsByTagName('head')[0];
var nodeCount = head.childNodes.length;
var links = document.getElementsByTagName('link');
map = new OpenLayers.Map('map');
var lastNode = head.childNodes[head.childNodes.length - 1];
t.eq(nodeCount + 1, head.childNodes.length, "by default, a node is added to document head" );
t.eq(lastNode.tagName, "LINK", "node added is a link element");
t.eq(lastNode.rel, "stylesheet", "node added has rel set to stylesheet");
t.eq(lastNode.type, "text/css", "node added has type set to text/css");
t.ok(OpenLayers.Util.isEquivalentUrl(map.theme, lastNode.href), "node added has href equivalent to map.theme");
var gotNodes = 0;
var themeNode = null;
for(var i=0; i<links.length; ++i) {
if(OpenLayers.Util.isEquivalentUrl(map.theme, links.item(i).href)) {
gotNodes += 1;
themeNode = links.item(i);
}
}
t.eq(gotNodes, 1, "by default, a single link node is added to document");
t.ok(themeNode != null, "a link node with the theme href was added");
t.eq(themeNode.rel, "stylesheet", "node added has rel set to stylesheet");
t.eq(themeNode.type, "text/css", "node added has type set to text/css");
// reconstruct the map to prove that another link is not added
map = new OpenLayers.Map('map');
t.eq(links.length, document.getElementsByTagName('link').length,
"calling the map constructor twice with the same theme doesn't add duplicate link nodes");
}
function test_01_Map_customTheme(t) {
t.plan(5);
var head = document.getElementsByTagName('head')[0];
var nodeCount = head.childNodes.length;
var options = {theme: 'foo'};
var customTheme = 'foo';
var options = {theme: customTheme};
map = new OpenLayers.Map('map', options);
var lastNode = head.childNodes[head.childNodes.length - 1];
t.eq(nodeCount + 1, head.childNodes.length, "with custom theme, a node is added to document head" );
t.eq(lastNode.tagName, "LINK", "node added is a link element");
t.eq(lastNode.rel, "stylesheet", "node added has rel set to stylesheet");
t.eq(lastNode.type, "text/css", "node added has type set to text/css");
t.ok(OpenLayers.Util.isEquivalentUrl(map.theme, lastNode.href), "node added has href equivalent to map.theme");
var links = document.getElementsByTagName('link');
var gotNodes = 0;
var themeNode = null;
for(var i=0; i<links.length; ++i) {
if(OpenLayers.Util.isEquivalentUrl(map.theme, links.item(i).href)) {
gotNodes += 1;
themeNode = links.item(i);
}
}
t.eq(map.theme, customTheme, "map theme is properly set");
t.eq(gotNodes, 1, "with custom theme, a single link node is added to document");
t.ok(themeNode != null, "a link node with the theme href was added");
t.eq(themeNode.rel, "stylesheet", "node added has rel set to stylesheet");
t.eq(themeNode.type, "text/css", "node added has type set to text/css");
}
function test_01_Map_noTheme(t) {
t.plan(1);

View File

@@ -80,7 +80,7 @@
t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly");
var contentDiv = popup.div.childNodes[0];
var contentDiv = popup.div.childNodes[0].childNodes[0];
t.eq(contentDiv.className, "olPopupContent", "correct content div className");
t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");