Merge branch 'master' of https://github.com/openlayers/openlayers into vendor-prefixes

This commit is contained in:
Gregers Gram Rygg
2012-06-24 02:38:05 +02:00
92 changed files with 1201 additions and 447 deletions
+17
View File
@@ -14,6 +14,23 @@
"olControlOverviewMap", "displayClass is correct" );
}
function test_divs_title(t) {
t.plan(2);
control = new OpenLayers.Control.OverviewMap({
maximizeTitle: "maximize title",
minimizeTitle: "minimize title"
});
map = new OpenLayers.Map('map', {
layers: [new OpenLayers.Layer("layer", {isBaseLayer: true})],
controls: [control]
});
map.zoomToMaxExtent();
t.eq(control.maximizeDiv.title, "maximize title", "maximizeDiv.title is correct");
t.eq(control.minimizeDiv.title, "minimize title", "minimizeDiv.title is correct");
map.destroy();
}
function test_setMap(t) {
t.plan(4);
+25
View File
@@ -33,6 +33,31 @@
map.addControl(control2, new OpenLayers.Pixel(100,100));
t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
}
function test_draw(t) {
t.plan(3);
map = new OpenLayers.Map('map', {controls:[]});
var layer = new OpenLayers.Layer.WMS("Test Layer",
"http://octo.metacarta.com/cgi-bin/mapserv?",
{map: "/mapdata/vmap_wms.map", layers: "basic"});
map.addLayer(layer);
map.zoomToMaxExtent();
control = new OpenLayers.Control.PanZoomBar();
map.addControl(control);
t.eq(control.zoombarDiv.style.height, '176px', "Bar's height is correct.");
map.baseLayer.wrapDateLine = true;
control.redraw();
t.eq(control.zoombarDiv.style.height, '154px', "Bar's height is correct after minZoom restriction.");
map.div.style.width = "512px";
map.updateSize();
t.eq(control.zoombarDiv.style.height, '165px', "Bar's height is correct after resize and minZoom restriction.");
map.div.style.width = "1024px";
map.destroy();
}
function test_Control_PanZoomBar_clearDiv(t) {
t.plan(2);
+40
View File
@@ -558,6 +558,46 @@
t.eq(layer1.renderer.getRenderLayerId(), layer1.id,
"Root container moved correctly when control is destroyed and layers was an array parameter");
}
function test_unselectAll(t) {
t.plan(2);
var layer = new OpenLayers.Layer.Vector();
var control = new OpenLayers.Control.SelectFeature(layer);
var feature1 = new OpenLayers.Feature.Vector();
feature1.id = 1;
var feature2 = new OpenLayers.Feature.Vector();
feature2.id = 2;
var feature3 = new OpenLayers.Feature.Vector();
feature3.id = 3;
var feature4 = new OpenLayers.Feature.Vector();
feature4.id = 4;
layer.addFeatures([feature1, feature2, feature3, feature4]);
control.select(feature1);
control.select(feature2);
control.select(feature3);
control.select(feature4);
layer.events.on({
featureunselected: function(e) {
// we change the selectedFeatures array while
// unselectAll is iterating over that array.
if(feature2.layer) {
layer.removeFeatures([feature2]);
}
}
});
control.unselectAll({except: feature3});
t.eq(layer.selectedFeatures.length, 1,
'unselectAll unselected all but one');
t.eq(layer.selectedFeatures[0].id, 3,
'the remaining selected features is the one expected');
}
</script>
</head>
+13 -8
View File
@@ -104,13 +104,18 @@
t.plan(7);
var layer = new OpenLayers.Layer.Vector("foo", {
var layer1 = new OpenLayers.Layer.Vector("foo", {
maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
isBaseLayer: true
});
var control = new OpenLayers.Control.Split({layer: layer});
var layer2 = new OpenLayers.Layer.Vector("bar", {
maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
isBaseLayer: false
});
var control = new OpenLayers.Control.Split({layer: layer1});
var map = new OpenLayers.Map("map");
map.addLayer(layer);
map.addLayer(layer1);
map.addLayer(layer2);
map.zoomToMaxExtent();
map.addControl(control);
@@ -124,17 +129,17 @@
t.eq(control.handler.active, false, "sketch handler deactivated");
// set a source layer
control.setSource(layer);
control.setSource(layer2);
// activate and check that listeners are registered
control.activate();
t.ok(layer.events.listeners.sketchcomplete, "sketchcomplete listener registered");
t.ok(layer.events.listeners.afterfeaturemodified, "afterfeaturemodified listener registered");
t.ok(layer2.events.listeners.sketchcomplete, "sketchcomplete listener registered");
t.ok(layer2.events.listeners.afterfeaturemodified, "afterfeaturemodified listener registered");
// deactivate and confirm no draw related events
control.deactivate();
t.eq(layer.events.listeners.sketchcomplete.length, 0, "no sketchcomplete listeners");
t.eq(layer.events.listeners.afterfeaturemodified.length, 0, "no afterfeaturemodified listeners");
t.eq(layer2.events.listeners.sketchcomplete.length, 0, "no sketchcomplete listeners");
t.eq(layer2.events.listeners.afterfeaturemodified.length, 0, "no afterfeaturemodified listeners");
map.destroy();
}
+52
View File
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<script src="../OLLoader.js"></script>
<script type="text/javascript">
function test_constructor(t) {
t.plan(4);
var control = new OpenLayers.Control.ZoomBox();
t.ok(control instanceof OpenLayers.Control, "instance of Control");
t.ok(control instanceof OpenLayers.Control.ZoomBox, "instance of ZoomBox");
t.eq(control.displayClass, "olControlZoomBox", "displayClass");
control.destroy();
control = new OpenLayers.Control.ZoomBox({
zoomOnClick: false
});
t.eq(control.zoomOnClick, false, "zoomOnClick");
control.destroy();
}
function test_zoomBox(t) {
t.plan(4);
var map = new OpenLayers.Map("map", {
layers: [new OpenLayers.Layer("", {isBaseLayer: true})],
center: [0, 0],
zoom: 1
});
var control = new OpenLayers.Control.ZoomBox();
map.addControl(control);
control.zoomBox(new OpenLayers.Pixel(50, 60));
t.eq(map.getZoom(), 2, "zoomed on click");
control.zoomOnClick = false;
control.zoomBox(new OpenLayers.Pixel(-50, -60));
t.eq(map.getZoom(), 2, "not zoomed with zoomOnClick set to false");
map.zoomToMaxExtent();
control.zoomBox(new OpenLayers.Bounds(128, 64, 256, 128));
t.eq(map.getCenter().toShortString(), "-45, 22.5", "centered to box center");
t.eq(map.getZoom(), 3, "zoomed to box extent");
map.destroy();
}
</script>
</head>
<body>
<div id="map" style="width: 512px; height: 256px;"/>
</body>
</html>
+8 -3
View File
@@ -198,14 +198,19 @@ var cases = {
])
])
]),
"v2/box-coord.xml": new OpenLayers.Bounds(1, 2, 3, 4),
"v2/box-coordinates.xml": new OpenLayers.Bounds(1, 2, 3, 4)
"v2/box-coordinates.xml": new OpenLayers.Bounds(1, 2, 3, 4),
"v3/linestring3d.xml": new OpenLayers.Geometry.LineString([
new OpenLayers.Geometry.Point(1, 2, 3),
new OpenLayers.Geometry.Point(4, 5, 6)
])
};
// cases for v3 use the same geometries
// some cases for v3 use the same geometries
OpenLayers.Util.extend(cases, {
"v3/point.xml": cases["v2/point-coordinates.xml"],
"v3/linestring.xml": cases["v2/linestring-coordinates.xml"],
+7 -2
View File
@@ -10,8 +10,8 @@
"v2/linestring-coord.xml", "v2/linestring-coordinates.xml",
"v2/multipoint-coord.xml", "v2/multipoint-coordinates.xml",
"v2/multilinestring-coord.xml", "v2/multilinestring-coordinates.xml",
"v3/point.xml", "v3/linestring.xml", "v3/curve.xml",
"v3/polygon.xml", "v3/surface.xml",
"v3/point.xml", "v3/linestring.xml", "v3/linestring3d.xml",
"v3/curve.xml", "v3/polygon.xml", "v3/surface.xml",
"v3/multipoint-singular.xml", "v3/multipoint-plural.xml",
"v3/multilinestring-singular.xml", "v3/multilinestring-plural.xml",
"v3/multicurve-singular.xml", "v3/multicurve-curve.xml",
@@ -332,6 +332,11 @@
<gml:posList>1 2 3 4</gml:posList>
</gml:LineString>
--></div>
<div id="v3/linestring3d.xml"><!--
<gml:LineString xmlns:gml="http://www.opengis.net/gml" srsName="foo" srsDimension="3">
<gml:posList>1 2 3 4 5 6</gml:posList>
</gml:LineString>
--></div>
<div id="v3/curve.xml"><!--
<gml:Curve xmlns:gml="http://www.opengis.net/gml" srsName="foo">
<gml:segments>
+3 -3
View File
@@ -236,13 +236,13 @@
var f = new OpenLayers.Format.KML();
t.eq(f.read(f.write(feature))[0].attributes.name, feature.id, "placemark name from feature.id");
feature.attributes.name = "placemark name from attributes.name";
t.eq(f.read(f.write(feature))[0].attributes.name, feature.attributes.name, "placemark name from attributes.name");
feature.style = {
label: "placemark name from style.label"
};
t.eq(f.read(f.write(feature))[0].attributes.name, feature.style.label, "placemark name from style.label");
feature.attributes.name = "placemark name from attributes.name";
t.eq(f.read(f.write(feature))[0].attributes.name, feature.attributes.name, "placemark name from attributes.name");
}
function test_Format_KML_linestring_projected(t) {
t.plan(1);
+17 -1
View File
@@ -374,8 +374,24 @@
// GeoServer example above
}
function test_read_exception(t) {
t.plan(1);
var text =
'<?xml version="1.0" encoding="UTF-8"?>' +
'<ows:ExceptionReport version="1.0.0"' +
' xsi:schemaLocation="http://www.opengis.net/ows http://localhost:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows">' +
' <ows:Exception exceptionCode="NoApplicableCode">' +
' <ows:ExceptionText>Could not find type: {http://geonode.org/}_map_4_annotations</ows:ExceptionText>' +
' </ows:Exception>' +
'</ows:ExceptionReport>';
var format = new OpenLayers.Format.WFSDescribeFeatureType();
var obj = format.read(text);
t.ok(!!obj.error, "Error reported correctly");
}
</script>
</head>
<body>
</body>
</html>
</html>
+11 -1
View File
@@ -4,7 +4,7 @@
<script type="text/javascript">
function test_read_WPSDescribeProcess(t) {
t.plan(16);
t.plan(17);
var parser = new OpenLayers.Format.WPSDescribeProcess();
var text =
@@ -109,6 +109,13 @@
' </Supported>' +
' </ComplexOutput>' +
' </Output>' +
' <Output>' +
' <ows:Identifier>literal</ows:Identifier>' +
' <ows:Title>literal output</ows:Title>' +
' <LiteralOutput>' +
' <ows:DataType ows:reference="http://www.w3.org/TR/xmlschema-2/#integer">integer</ows:DataType>'+
' </LiteralOutput>' +
' </Output>' +
' </ProcessOutputs>' +
' </ProcessDescription>' +
'</wps:ProcessDescriptions>';
@@ -135,6 +142,9 @@
t.eq(result.complexOutput["supported"].formats["text/xml; subtype=gml/3.1.1"], true, "processOutputs supported format read correctly [1/2]");
t.eq(result.complexOutput["supported"].formats["application/wkt"], true, "processOutputs supported format read correctly [1/2]");
var literalresult = buffer.processOutputs[1];
t.eq(literalresult.literalOutput.dataType, "integer", "processOutputs supported data type read corectly");
text = '<?xml version="1.0" encoding="UTF-8"?>' +
'<wps:ProcessDescriptions service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0"' +
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en"' +
+20 -10
View File
@@ -309,12 +309,12 @@
responseForm: {
responseDocument: {
storeExecuteResponse: true,
output: {
outputs: [{
asReference: true,
identifier: 'BufferedPolygon',
title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.'
}
}]
}
}
});
@@ -349,6 +349,11 @@
' <ows:Title>Area serviced by playground.</ows:Title>' +
' <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract>' +
' </wps:Output>' +
' <wps:Output>' +
' <ows:Identifier>literal</ows:Identifier>' +
' <ows:Title/>' +
' <ows:Abstract/>' +
' </wps:Output>' +
' </wps:ResponseDocument>' +
' </wps:ResponseForm>' +
'</wps:Execute>';
@@ -381,12 +386,17 @@
storeExecuteResponse: true,
lineage: true,
status: true,
output: {
asReference: true,
identifier: 'BufferedPolygon',
title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.'
}
outputs: [
{
asReference: true,
identifier: 'BufferedPolygon',
title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.'
},
{
identifier: 'literal'
}
]
}
}
});
@@ -461,12 +471,12 @@
responseForm: {
responseDocument: {
storeExecuteResponse: true,
output: {
outputs: [{
asReference: true,
identifier: 'BufferedPolygon',
title: 'Area serviced by playground.',
'abstract': 'Area within which most users of this playground will live.'
}
}]
}
}
});
+10 -6
View File
@@ -123,7 +123,7 @@
}
function test_Handler_setEvent(t) {
t.plan(4);
t.plan(5);
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control();
map.addControl(control);
@@ -135,7 +135,8 @@
xy: new OpenLayers.Pixel(Math.random(), Math.random()),
altKey: (Math.random() > 0.5),
shiftKey: (Math.random() > 0.5),
ctrlKey: (Math.random() > 0.5)
ctrlKey: (Math.random() > 0.5),
metaKey: (Math.random() > 0.5)
}
map.events.triggerEvent("click", testEvent);
t.ok(handler.evt.xy.x == testEvent.xy.x &&
@@ -147,6 +148,8 @@
"handler.evt.shiftKey correct");
t.eq(handler.evt.ctrlKey, testEvent.ctrlKey,
"handler.evt.ctrlKey correct");
t.eq(handler.evt.metaKey, testEvent.metaKey,
"handler.evt.metaKey correct");
}
function test_Handler_destroy(t) {
@@ -173,7 +176,7 @@
}
function test_Handler_checkModifiers(t) {
t.plan(26);
t.plan(62);
var handler = new OpenLayers.Handler({});
handler.keyMask = null;
var proceed = handler.checkModifiers({});
@@ -192,7 +195,8 @@
MOD_NONE: null,
MOD_SHIFT: "shiftKey",
MOD_CTRL: "ctrlKey",
MOD_ALT: "altKey"
MOD_ALT: "altKey",
MOD_META: "metaKey"
}
var proceed, evt, value, c, k;
for(c in constants) {
@@ -220,8 +224,8 @@
* is OpenLayers.Handler.MOD_SHIFT, checkModifiers should return
* true.
*/
var constants = ["MOD_SHIFT", "MOD_CTRL", "MOD_ALT"];
var keys = ["shiftKey", "ctrlKey", "altKey"];
var constants = ["MOD_SHIFT", "MOD_CTRL", "MOD_ALT", "MOD_META"];
var keys = ["shiftKey", "ctrlKey", "altKey", "metaKey"];
var proceed, evt, c1, c2, k1, k2;
for(var i=0; i<constants.length-1; ++i) {
c1 = constants[i];
-3
View File
@@ -56,7 +56,6 @@
handler.setMap(map);
handler.activate();
var delta = 120;
if (window.opera && window.opera.version() < 9.2) delta = -delta;
handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta});
t.ok(pass, "evt.xy was set even without a mouse move");
}
@@ -108,7 +107,6 @@
var activated = handler.activate();
var delta = 120;
if (window.opera && window.opera.version() < 9.2) delta = -delta;
handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta});
handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta});
t.delay_call(1, function() {
@@ -138,7 +136,6 @@
var delta = 120;
// generate 20 scroll up in non cumulative mode
if (window.opera && window.opera.version() < 9.2) delta = -delta;
for (var i=0; i < 20; i++) {
handler.onWheelEvent({'target':map.layers[0].div, wheelDelta: delta});
}
+81 -17
View File
@@ -1362,7 +1362,7 @@
t.plan(5);
// set up
var map = new OpenLayers.Map('map', {
resolutions: [32, 16, 8, 4, 2, 1]
});
@@ -1375,28 +1375,28 @@
map.zoomTo(1);
t.delay_call(1, function() {
// Mark one tile loaded, to see if back buffer removal gets scheduled.
layer.grid[1][1].onImageLoad();
t.ok(layer.backBuffer.parentNode === layer.div,
'[a] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId !== null,
'[a] back buffer scheduled for removal');
t.ok(layer.backBuffer.parentNode === layer.div,
'[a] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId !== null,
'[a] back buffer scheduled for removal');
var backBuffer = layer.backBuffer;
var backBuffer = layer.backBuffer;
map.zoomTo(2);
map.zoomTo(2);
t.ok(layer.backBuffer !== backBuffer,
'[b] a new back buffer was created');
t.ok(layer.backBuffer.parentNode === layer.div,
'[b] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId === null,
'[b] back buffer no longer scheduled for removal');
t.ok(layer.backBuffer !== backBuffer,
'[b] a new back buffer was created');
t.ok(layer.backBuffer.parentNode === layer.div,
'[b] back buffer is a child of layer div');
t.ok(layer.backBufferTimerId === null,
'[b] back buffer no longer scheduled for removal');
// tear down
// tear down
map.destroy();
});
map.destroy();
}
function test_getGridData(t) {
@@ -1523,6 +1523,70 @@
map.destroy();
}
function test_removeExcessTiles(t) {
t.plan(15);
/*
* Set up
*/
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Grid('name', '/url',
{}, {isBaseLayer: true});
map.addLayer(layer);
function newTile(id) {
var t = new OpenLayers.Tile(layer,
new OpenLayers.Pixel(1, 1),
new OpenLayers.Bounds(1, 1, 1, 1));
t._id = id;
return t;
}
layer.grid = [
[newTile(1), newTile(2), newTile(3)],
[newTile(4), newTile(5)],
[newTile(6), newTile(7), newTile(8)]
];
// create a clone to be able to test whether
// tiles have been destroyed or not
var grid = [
layer.grid[0].slice(),
layer.grid[1].slice(),
layer.grid[2].slice()
];
/*
* Test
*/
layer.removeExcessTiles(2, 2);
t.eq(layer.grid.length, 2, 'grid has two rows');
t.eq(layer.grid[0].length, 2, 'row #1 has two columns');
t.eq(layer.grid[0][0]._id, 1, 'row #1 col #1 includes expected tile');
t.eq(layer.grid[0][1]._id, 2, 'row #1 col #2 includes expected tile');
t.eq(layer.grid[1].length, 2, 'row #2 has two columns');
t.eq(layer.grid[1][0]._id, 4, 'row #2 col #1 includes expected tile');
t.eq(layer.grid[1][1]._id, 5, 'row #2 col #2 includes expected tile');
t.ok(grid[0][0].events != null, 'tile 0,0 not destroyed');
t.ok(grid[0][1].events != null, 'tile 0,1 not destroyed');
t.ok(grid[0][2].events == null, 'tile 0,2 destroyed');
t.ok(grid[1][0].events != null, 'tile 1,0 not destroyed');
t.ok(grid[1][1].events != null, 'tile 1,1 not destroyed');
t.ok(grid[2][0].events == null, 'tile 2,0 destroyed');
t.ok(grid[2][1].events == null, 'tile 2,1 destroyed');
t.ok(grid[2][2].events == null, 'tile 2,2 destroyed');
/*
* Tear down
*/
map.destroy();
}
</script>
</head>
+5 -2
View File
@@ -748,7 +748,7 @@
function test_Map_double_addLayer(t) {
t.plan(2);
map = new OpenLayers.Map($('map'));
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS('Test Layer',
"http://octo.metacarta.com/cgi-bin/mapserv",
{map: '/mapdata/vmap_wms.map', layers: 'basic', format: 'image/jpeg'}
@@ -2047,7 +2047,7 @@
}
function test_adjustZoom(t) {
t.plan(4);
t.plan(5);
var map = new OpenLayers.Map({
div: 'map',
layers: [
@@ -2062,6 +2062,9 @@
t.eq(map.adjustZoom(9), 9, "valid zoom maintained");
t.eq(map.adjustZoom(1), 2, "zoom adjusted to not exceed world width");
map.fractionalZoom = true;
t.eq(map.adjustZoom(1).toPrecision(3), "1.29", "zoom adjusted to match world width");
map.moveTo([16, 48], 0);
t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom");
+5 -11
View File
@@ -114,7 +114,7 @@
}
function test_Tile_Image_draw (t) {
t.plan(8);
t.plan(7);
var map = new OpenLayers.Map('map');
@@ -139,16 +139,10 @@
//this should trigger a "loadstart" event
tile.draw();
var img = tile.imgDiv;
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( tile.imgDiv instanceof HTMLElement, "tile.draw creates an image");
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( img instanceof HTMLImageElement, "tile.draw creates an image");
var tParams = {
SERVICE: "WMS", VERSION: "1.1.1",
REQUEST: "GetMap", STYLES: "",
@@ -159,7 +153,7 @@
var expected = new Image();
expected.src = "../../img/blank.gif?" + OpenLayers.Util.getParameterString(tParams)
t.delay_call(0.1, function() {
t.eq( img.src, expected.src, "tile.draw creates an image");
t.eq( tile.imgDiv.src, expected.src, "tile.draw creates an image");
});
t.eq( tile.imgDiv.style.width, "5%", "Image width is correct" );
t.eq( tile.imgDiv.style.height, "6%", "Image height is correct" );
@@ -178,7 +172,7 @@
var size = new OpenLayers.Size(5,6);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"../../img/blank.gif", {layers: 'basic'}, {reproject:false, encodeBBOX: true});
"../../img/blank.gif", {layers: 'basic'}, {encodeBBOX: true});
map.addLayer(layer);
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-90,-180,90), url, size);
tile.draw()
@@ -266,14 +260,14 @@
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size);
tile.draw();
tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true);
t.delay_call( 1, function() { t.eq(tile.imgDiv.style.visibility, "hidden", "Tile image is invisible.") } );
t.delay_call( 1, function() { t.ok(!tile.imgDiv, "Reference to tile image removed.") } );
var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"../../img/blank.gif", {layers: 'basic'}, {'alpha':true});
map.addLayer(layer);
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-90,-85,-90,85), url, size);
tile.draw();
tile.moveTo(new OpenLayers.Bounds(-185,-90,-180,-80), new OpenLayers.Pixel(-180,-85), true)
t.delay_call( 1, function() { t.eq(tile.imgDiv.style.visibility, "hidden", "Alpha tile image is invisible.") } );
t.delay_call( 1, function() { t.ok(!tile.imgDiv, "Reference to alpha tile image removed.") } );
}
-9
View File
@@ -1,10 +1,6 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script>
var custom$ = function() {};
window.$ = custom$;
</script>
<script>
var OpenLayers = [
"OpenLayers/BaseTypes/Class.js",
@@ -77,11 +73,6 @@
t.eq(OpenLayers.Util.isArray(testArray), true, "isArray works");
}
function test_$(t) {
t.plan(1);
t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");
}
function test_Util_getImagesLocation (t) {
t.plan( 1 );
t.ok( OpenLayers.Util.getImagesLocation(), "../img/",
+20
View File
@@ -0,0 +1,20 @@
<html>
<head>
<script>
var custom$ = function() {};
window.$ = custom$;
</script>
<script src="../OLLoader.js"></script>
<script src="../../lib/deprecated.js"></script>
<script>
function test_$(t) {
t.plan(1);
t.ok($ === custom$, "OpenLayers doesn't clobber existing definition of $.");
}
</script>
</head>
<body>
</body>
</html>
+2
View File
@@ -49,6 +49,7 @@
<li>Control/PanPanel.html</li>
<li>Control/SLDSelect.html</li>
<li>Control/Zoom.html</li>
<li>Control/ZoomBox.html</li>
<li>Events.html</li>
<li>Events/buttonclick.html</li>
<li>Extras.html</li>
@@ -231,6 +232,7 @@
<li>Kinetic.html</li>
<li>Util.html</li>
<li>deprecated/Ajax.html</li>
<li>deprecated/Util.html</li>
<li>deprecated/BaseTypes/Class.html</li>
<li>deprecated/BaseTypes/Element.html</li>
<li>deprecated/Control/MouseToolbar.html</li>
+54
View File
@@ -39,10 +39,64 @@ function run() {
else {
out.innerHTML += "<br/>height Fail: " + size + ", " + height;
}
// To use the same syntax as in "\tests"
var t = {eq: function(a, b, msg) {
if (a == b) {
out.innerHTML += "<br/>ok " + msg;
}
else {
out.innerHTML += "<br/><span style=\"color:red\">Fail (" + a + " not eq " + b + "): " + msg + "<span>";
}
}
};
var text = (new Array(10)).join("foo foo foo <br>"),
content = "<div>" + text + "</div>";
var testName,
finalSize,
initialSize = OpenLayers.Util.getRenderedDimensions(content, null);
// containerElement option on absolute position with width and height
testName = "Absolute with w&h: ";
var optionAbsDiv ={
containerElement: document.getElementById("absoluteDiv")
};
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv);
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
t.eq(finalSize.h, initialSize.h,
testName + "initial height " + initialSize.h + "px is maintained");
testName = "Absolute with w&h (set height): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv);
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
testName = "Absolute with w&h (set width): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv);
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
// containerElement option on absolute position without width and height
testName = "Absolute without w&h: ";
var optionAbsDiv00 ={
containerElement: document.getElementById("absoluteDiv00")
};
finalSize = OpenLayers.Util.getRenderedDimensions(content, null, optionAbsDiv00);
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
t.eq(finalSize.h, initialSize.h,
testName + "initial height " + initialSize.h + "px is maintained");
testName = "Absolute without w&h (set height): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {h: 15}, optionAbsDiv00);
t.eq(finalSize.h, 15, testName + "got the fixed height to 15px");
t.eq(finalSize.w, initialSize.w,
testName + "initial width " + initialSize.w + "px is maintained");
testName = "Absolute without w&h (set width): ";
finalSize = OpenLayers.Util.getRenderedDimensions(content, {w: 20}, optionAbsDiv00);
t.eq(finalSize.w, 20, testName + "got the fixed width to 20px");
}
</script>
</head>
<body onload="run()">
<div id="out"></div>
<div id="absoluteDiv" style="position:absolute; left:10px; width:500px; height: 500px"></div>
<div id="absoluteDiv00" style="position:absolute; left:10px;"></div>
</body>
</html>