[OpenLayers-Commits] r12249 - in trunk/openlayers/tests: Layer Tile
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Mon Aug 15 12:30:44 EDT 2011
Author: ahocevar
Date: 2011-08-15 09:30:43 -0700 (Mon, 15 Aug 2011)
New Revision: 12249
Modified:
trunk/openlayers/tests/Layer/ArcGIS93Rest.html
trunk/openlayers/tests/Layer/Image.html
trunk/openlayers/tests/Layer/MapServer.html
trunk/openlayers/tests/Layer/WMS.html
trunk/openlayers/tests/Tile/Image.html
Log:
Fixing tests after r12247 - img.src is now only available after a delay, because it is set in the load handler after setting a blank image as src. There is no need to check for img.src in layer tests, because this is asserted by Tile.Image tests (see #3419)
Modified: trunk/openlayers/tests/Layer/ArcGIS93Rest.html
===================================================================
--- trunk/openlayers/tests/Layer/ArcGIS93Rest.html 2011-08-15 16:26:34 UTC (rev 12248)
+++ trunk/openlayers/tests/Layer/ArcGIS93Rest.html 2011-08-15 16:30:43 UTC (rev 12249)
@@ -72,20 +72,15 @@
tParams = OpenLayers.Util.extend(tParams, {
FORMAT: "png", BBOX: "1,2,3,4", SIZE: "256,256", F: "image", BBOXSR: "4326", IMAGESR: "4326"
});
- t.eq( img.src,
+ t.eq( tile.url,
url + "?" + OpenLayers.Util.getParameterString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.frame.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.frame.style.left, "5px", "image top is set correctly via addtile" );
var firstChild = layer.div.firstChild.firstChild;
- if (!isMozilla)
- t.ok( true, "skipping element test outside of Mozilla");
- else
- t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
- t.eq( firstChild.src,
- url + "?" + OpenLayers.Util.getParameterString(tParams),
- "div first child is correct image object" );
+ t.eq( firstChild.nodeName.toLowerCase(), "img", "div first child is an image object" );
+ t.ok( firstChild == img, "div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
map.destroy();
}
@@ -302,55 +297,46 @@
var encodingHack = document.createElement("img");
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src no filter" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src no filter" );
layer.setLayerFilter('1', "MR_TOAD = 'FLYING'");
tParams["LAYERDEFS"] = "1:MR_TOAD = 'FLYING';";
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src one filter" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src one filter" );
layer.setLayerFilter('1', "MR_TOAD = 'NOT FLYING'");
tParams["LAYERDEFS"] = "1:MR_TOAD = 'NOT FLYING';";
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src change one filter" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src change one filter" );
layer.setLayerFilter('2', "true = false");
tParams["LAYERDEFS"] = "1:MR_TOAD = 'NOT FLYING';2:true = false;";
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src two filters" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src two filters" );
layer.setLayerFilter('99', "some_col > 5");
tParams["LAYERDEFS"] = "1:MR_TOAD = 'NOT FLYING';2:true = false;99:some_col > 5;";
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src three filters" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src three filters" );
layer.clearLayerFilter('2');
tParams["LAYERDEFS"] = "1:MR_TOAD = 'NOT FLYING';99:some_col > 5;";
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src removed middle filter" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src removed middle filter" );
layer.clearLayerFilter('2');
tParams["LAYERDEFS"] = "1:MR_TOAD = 'NOT FLYING';99:some_col > 5;";
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src removed missing filter (no change)" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src removed missing filter (no change)" );
layer.clearLayerFilter();
delete tParams["LAYERDEFS"];
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src removed all filters" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src removed all filters" );
layer.clearLayerFilter();
tile.draw();
- encodingHack.src = (url + "?" + OpenLayers.Util.getParameterString(tParams));
- t.eq( tile.imgDiv.src, encodingHack.src, "image src removed all (no) filters" );
+ t.eq( tile.url, url + "?" + OpenLayers.Util.getParameterString(tParams), "image src removed all (no) filters" );
}
Modified: trunk/openlayers/tests/Layer/Image.html
===================================================================
--- trunk/openlayers/tests/Layer/Image.html 2011-08-15 16:26:34 UTC (rev 12248)
+++ trunk/openlayers/tests/Layer/Image.html 2011-08-15 16:30:43 UTC (rev 12249)
@@ -77,11 +77,11 @@
t.eq(layer.tile.position.x,-42, "Tile x positioned correctly at maxextent");
t.eq(layer.tile.position.y,106, "Tile y positioned correctly at maxextent");
- t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
+ t.eq(layer.tile.url, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
map.zoomIn();
- t.eq(layer.tile.imgDiv.src, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
+ t.eq(layer.tile.url, "http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif", "URL is correct");
layer.setUrl('http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-180,-90,0,90&WIDTH=256&HEIGHT=256');
- t.eq(layer.tile.imgDiv.src, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-180,-90,0,90&WIDTH=256&HEIGHT=256", "URL is correct after setURL");
+ t.eq(layer.tile.url, "http://labs.metacarta.com/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-180,-90,0,90&WIDTH=256&HEIGHT=256", "URL is correct after setURL");
}
/******
*
Modified: trunk/openlayers/tests/Layer/MapServer.html
===================================================================
--- trunk/openlayers/tests/Layer/MapServer.html 2011-08-15 16:26:34 UTC (rev 12248)
+++ trunk/openlayers/tests/Layer/MapServer.html 2011-08-15 16:30:43 UTC (rev 12249)
@@ -53,20 +53,15 @@
imgy:128,
imgxy:[256,256]
});
- t.eq( img.src,
+ t.eq( tile.url,
url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
"image src is created correctly via addtile" );
t.eq( tile.frame.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.frame.style.left, "5px", "image top is set correctly via addtile" );
var firstChild = layer.div.firstChild.firstChild;
- if (!isMozilla)
- t.ok( true, "skipping element test outside of Mozilla");
- else
- t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
- t.eq( firstChild.src,
- url + "?" + OpenLayers.Util.getParameterString(tParams).replace(/,/g, "+"),
- "div first child is correct image object" );
+ t.eq( firstChild.nodeName.toLowerCase(), "img", "div first child is an image object" );
+ t.ok( firstChild == img, "div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
map.destroy();
}
Modified: trunk/openlayers/tests/Layer/WMS.html
===================================================================
--- trunk/openlayers/tests/Layer/WMS.html 2011-08-15 16:26:34 UTC (rev 12248)
+++ trunk/openlayers/tests/Layer/WMS.html 2011-08-15 16:30:43 UTC (rev 12249)
@@ -83,20 +83,15 @@
BBOX: [1,2,3,4],
WIDTH: "256", HEIGHT: "256"
});
- t.eq( img.src,
+ t.eq( tile.url,
layer.getFullRequestString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.frame.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.frame.style.left, "5px", "image top is set correctly via addtile" );
var firstChild = layer.div.firstChild.firstChild;
- if (!isMozilla)
- t.ok( true, "skipping element test outside of Mozilla");
- else
- t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
- t.eq( firstChild.src,
- layer.getFullRequestString(tParams),
- "div first child is correct image object" );
+ t.eq( firstChild.nodeName.toLowerCase(), "img", "div first child is an image object" );
+ t.ok( firstChild == img, "div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
map.destroy();
}
@@ -119,20 +114,15 @@
BBOX: "1,2,3,4",
WIDTH: "256", HEIGHT: "256"
});
- t.eq( img.src,
+ t.eq( tile.url,
layer.getFullRequestString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.frame.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.frame.style.left, "5px", "image top is set correctly via addtile" );
var firstChild = layer.div.firstChild.firstChild;
- if (!isMozilla)
- t.ok( true, "skipping element test outside of Mozilla");
- else
- t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
- t.eq( firstChild.src,
- layer.getFullRequestString(tParams),
- "div first child is correct image object" );
+ t.eq( firstChild.nodeName.toLowerCase(), "img", "div first child is an image object" );
+ t.ok( firstChild, img, "div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
map.destroy();
}
Modified: trunk/openlayers/tests/Tile/Image.html
===================================================================
--- trunk/openlayers/tests/Tile/Image.html 2011-08-15 16:26:34 UTC (rev 12248)
+++ trunk/openlayers/tests/Tile/Image.html 2011-08-15 16:30:43 UTC (rev 12249)
@@ -79,13 +79,17 @@
var bounds = new OpenLayers.Bounds(1,2,3,4);
tile = layer.addTile(bounds, position);
tile.renderTile();
- t.eq(tile.imgDiv.src, layer.getURL(bounds), "image src correct for async request");
- t.eq(tile.asyncRequestId, 1, "asyncRequestId correct after renderTile");
- tile.renderTile();
- t.eq(tile.asyncRequestId, 2, "asyncRequestId correct after subsequent renderTile");
- tile.destroy();
- layer.destroy();
- map.destroy();
+ t.delay_call(0.1, function() {
+ t.eq(tile.imgDiv.src, layer.getURL(bounds), "image src correct for async request");
+ t.eq(tile.asyncRequestId, 1, "asyncRequestId correct after renderTile");
+ tile.renderTile();
+ });
+ t.delay_call(0.2, function() {
+ t.eq(tile.asyncRequestId, 2, "asyncRequestId correct after subsequent renderTile");
+ tile.destroy();
+ layer.destroy();
+ map.destroy();
+ });
}
function test_Tile_Image_draw (t) {
@@ -131,9 +135,11 @@
SRS: "EPSG:4326", BBOX: [1,2,3,4],
WIDTH: String(size.w), HEIGHT: String(size.h)
};
- t.eq( img.src,
- "http://labs.metacarta.com/TESTURL?" + OpenLayers.Util.getParameterString(tParams),
- "tile.draw creates an image");
+ t.delay_call(0.1, function() {
+ t.eq( img.src,
+ "http://labs.metacarta.com/TESTURL?" + OpenLayers.Util.getParameterString(tParams),
+ "tile.draw creates an image");
+ });
t.eq( tile.imgDiv.style.width, "100%", "Image width is correct" );
t.eq( tile.imgDiv.style.height, "100%", "Image height is correct" );
@@ -164,31 +170,31 @@
SRS: "EPSG:4326", BBOX: "-181,-91,180,90",
WIDTH: "256", HEIGHT: "256"
};
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-90,180,90), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-181,-90,180,90"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-180,-90,180,90), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-180,-90,180,90"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering all of extent loads");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-80,-45,80,45), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-80,-45,80,45"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering small part of extent loads");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-95,185,95), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-95,185,95"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering more than all of extent loads");
@@ -196,31 +202,31 @@
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-90,-180,90), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-90,-180,90"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images against side of maxextent do load with displayOutsideMaxExtent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-181,-90,180,90), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-181,-90,180,90"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Images over edges of maxextent do load with displayOutsideMaxExtent set");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-180,-90,180,90), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-180,-90,180,90"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering all of extent loads with display outside max extent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-80,-45,80,45), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-80,-45,80,45"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering small part of extent loads with display outside max extent");
tile = new OpenLayers.Tile.Image(layer, position, new OpenLayers.Bounds(-185,-95,185,95), url, size);
tile.draw()
tParams = OpenLayers.Util.extend(tParams, {BBOX: "-185,-95,185,95"});
- t.eq(tile.imgDiv.src,
+ t.eq(tile.url,
"http://labs.metacarta.com/wms/vmap0?" + OpenLayers.Util.getParameterString(tParams),
"Image covering more than all of extent loads");
}
More information about the Commits
mailing list