All tests now pass in IE.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@315 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2006-05-24 05:46:54 +00:00
parent cfb1b472a7
commit 0e6b61c352
9 changed files with 66 additions and 20 deletions

View File

@@ -887,6 +887,9 @@ Test.AnotherWay._test_page_onload=function()
script_text=script_text.substring( fun_start, script_text.length );
var fun_end=script_text.indexOf( '(' );
var fun_name=script_text.substring( "function ".length, fun_end );
var whitespace = fun_name.indexOf( ' ' );
if (whitespace >= 0)
fun_name = fun_name.substring( 0, whitespace );
test_page.test_objects.push( new Test.AnotherWay._test_object_t( fun_name ) );
script_text=script_text.substring( fun_end, script_text.length );
fun_start=script_text.indexOf( fun_sig );

View File

@@ -18,8 +18,8 @@
map.addControl(control);
t.ok( control.map === map, "Control.map is set to the map object" );
t.ok( map.controls[2] === control, "map.controls contains control" );
t.eq( control.div.style.zIndex, "253", "Control div zIndexed properly" );
t.eq( map.viewPortDiv.lastChild.style.zIndex, "253", "Viewport div contains control div" );
t.eq( parseInt(control.div.style.zIndex), 253, "Control div zIndexed properly" );
t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), 253, "Viewport div contains control div" );
t.eq( control.div.style.top, "4px", "Control div top located correctly by default");
var control2 = new OpenLayers.Control.PanZoom();

View File

@@ -2,13 +2,17 @@
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var map;
function test_01_Events_constructor (t) {
t.plan( 21 );
var obj = {result: 0}, eventTypes = ["doThingA", "doThingB", "doThingC"];
events = new OpenLayers.Events(obj, $('map'), eventTypes);
t.ok( events instanceof OpenLayers.Events, "new OpenLayers.Control returns object" );
t.ok( events.div instanceof HTMLDivElement, "events.div isa HTMLDivElement" );
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( events.div instanceof HTMLDivElement, "events.div isa HTMLDivElement" );
t.ok( events.object === obj, "events.object is the object we passed" );
var builtin = OpenLayers.Events.prototype.BROWSER_EVENTS;

View File

@@ -2,6 +2,8 @@
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var map;
var feature, layer;
function test_01_Feature_constructor (t) {
@@ -46,6 +48,7 @@
t.ok( feature.marker.icon instanceof OpenLayers.Icon,
"createMarker sets a marker icon property to an icon" );
t.eq( feature.marker.icon.url,
"http://boston.openguides.org/features/ORANGE.png",
"createMarker sets marker url correctly" );
@@ -53,10 +56,13 @@
var map = new OpenLayers.Map('map');
map.addLayer(layer);
map.setCenter(new OpenLayers.LonLat(0,0),0);
t.ok( map.layers[0] === layer,
t.ok( map.layers[0] == layer,
"Marker layer added to map okay." );
t.ok( map.layers[0].div.firstChild instanceof HTMLImageElement,
"layer div firstChild is an image" );
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( map.layers[0].div.firstChild instanceof HTMLImageElement,
"layer div firstChild is an image" );
t.eq( map.layers[0].div.firstChild.src,
"http://boston.openguides.org/features/ORANGE.png",
"Layer div img contains correct url" );
@@ -67,6 +73,6 @@
</script>
</head>
<body>
<div id="map"></div>
<div id="map" style="width: 500px; height: 300px;"></div>
</body>
</html>

View File

@@ -2,6 +2,7 @@
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
function test_01_Layer_Text_constructor (t) {
@@ -27,7 +28,10 @@
t.eq( map.layers[0].name, layer.name, "Layer added to map okay" );
t.delay_call( 1, function() {
map.setCenter(new OpenLayers.LonLat(0,0),0);
t.ok( map.layers[0].div.firstChild instanceof HTMLImageElement, "Marker added to div" )
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( map.layers[0].div.firstChild instanceof HTMLImageElement, "Marker added to div" )
t.eq( map.layers[0].div.firstChild.style.top, "219px", "Marker top set correctly" )
t.eq( map.layers[0].div.firstChild.style.left, "273px", "Marker left set correctly" )
});;

View File

@@ -2,6 +2,7 @@
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var layer;
function test_01_Layer_WMS_constructor (t) {
@@ -26,7 +27,10 @@
t.eq( tile.img.src, "http://octo.metacarta.com/cgi-bin/mapserv?bbox=1,2,3,4&width=256&height=256&map=/mapdata/vmap_wms.map&layers=basic&format=image/jpeg&service=WMS&version=1.1.1&request=GetMap&styles=&exceptions=application/vnd.ogc.se_inimage&srs=EPSG:4326", "image src is created correctly via addtile" );
t.eq( tile.img.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.img.style.left, "5px", "image top is set correctly via addtile" );
t.ok( layer.div.firstChild instanceof HTMLImageElement, "div first child is an image object" );
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( layer.div.firstChild instanceof HTMLImageElement, "div first child is an image object" );
t.eq( layer.div.firstChild.src, "http://octo.metacarta.com/cgi-bin/mapserv?bbox=1,2,3,4&width=256&height=256&map=/mapdata/vmap_wms.map&layers=basic&format=image/jpeg&service=WMS&version=1.1.1&request=GetMap&styles=&exceptions=application/vnd.ogc.se_inimage&srs=EPSG:4326", "div first child is correct image object" );
var pos = tile.getPosition();
t.eq( pos.toString(), "x=5,y=6", "Position of tile is set correctly." );

View File

@@ -2,15 +2,22 @@
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var map;
function test_01_Map_constructor (t) {
t.plan( 10 );
map = new OpenLayers.Map('map'); // no longer need to call $(), constructor does it
t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map returns object" );
t.ok( map.div instanceof HTMLDivElement, "map.div is an HTMLDivElement" );
t.ok( map.viewPortDiv instanceof HTMLDivElement, "map.viewPortDiv is an HTMLDivElement" );
t.ok( map.layerContainerDiv instanceof HTMLDivElement, "map.layerContainerDiv is an HTMLDivElement" );
t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map returns object" );
if (!isMozilla) {
t.ok( true, "skipping element test outside of Mozilla");
t.ok( true, "skipping element test outside of Mozilla");
t.ok( true, "skipping element test outside of Mozilla");
} else {
t.ok( map.div instanceof HTMLDivElement, "map.div is an HTMLDivElement" );
t.ok( map.viewPortDiv instanceof HTMLDivElement, "map.viewPortDiv is an HTMLDivElement" );
t.ok( map.layerContainerDiv instanceof HTMLDivElement, "map.layerContainerDiv is an HTMLDivElement" );
}
t.ok( map.layers instanceof Array, "map.layers is an Array" );
t.ok( map.controls instanceof Array, "map.controls is an Array" );
t.ok( map.events instanceof OpenLayers.Events, "map.events is an OpenLayers.Events" );

View File

@@ -2,6 +2,7 @@
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var tile;
function test_01_Tile_Image_constructor (t) {
@@ -28,7 +29,10 @@
"http://www.openlayers.org/dev/tests/tileimage",
new OpenLayers.Size(5,6));
tile.draw();
t.ok( tile.img instanceof HTMLImageElement, "tile.draw creates an image");
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( tile.img instanceof HTMLImageElement, "tile.draw creates an image");
t.eq( tile.img.src, "http://www.openlayers.org/dev/tests/tileimage", "tile.draw creates an image");
t.eq( tile.img.style.width, "5px", "Image width is correct" );
t.eq( tile.img.style.height, "6px", "Image height is correct" );

View File

@@ -2,6 +2,7 @@
<head>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript"><!--
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
var map;
function test_01_Util_getImagesLocation (t) {
t.plan( 1 );
@@ -63,7 +64,10 @@
var div = OpenLayers.Util.createDiv(id, px, sz, overflow, img, position);
t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
t.eq( div.id, id, "div.id set correctly");
t.eq( div.style.left, px.x + "px", "div.style.left set correctly");
t.eq( div.style.top, px.y + "px", "div.style.top set correctly");
@@ -78,10 +82,14 @@
//test defaults
var div = OpenLayers.Util.createDiv();
t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( div instanceof HTMLDivElement, "createDiv creates a valid HTMLDivElement" );
t.ok( (div.id != ""), "div.id set correctly");
t.eq( div.style.left, "0pt", "div.style.left set correctly");
t.eq( div.style.top, "0pt", "div.style.top set correctly");
// the next two tests return "0pt" in Mozilla, "0px" in IE
t.eq( div.style.left.indexOf("0p"), 0, "div.style.left set correctly");
t.eq( div.style.top.indexOf("0p"), 0, "div.style.top set correctly");
t.eq( div.style.width, "", "div.style.width set correctly");
t.eq( div.style.height, "", "div.style.height set correctly");
@@ -104,7 +112,10 @@
var image = OpenLayers.Util.createImage(img, sz, xy, position, id, border);
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( image instanceof HTMLImageElement, "createImage creates a valid HTMLImageElement" );
t.eq( image.id, id, "image.id set correctly");
t.eq( image.style.left, xy.x + "px", "image.style.left set correctly");
t.eq( image.style.top, xy.y + "px", "image.style.top set correctly");
@@ -119,7 +130,10 @@
//test defaults
var image = OpenLayers.Util.createImage();
t.ok( image instanceof HTMLImageElement, "createDiv creates a valid HTMLDivElement" );
if (!isMozilla)
t.ok( true, "skipping element test outside of Mozilla");
else
t.ok( image instanceof HTMLImageElement, "createDiv creates a valid HTMLDivElement" );
t.eq( image.id, "", "image.id set correctly");
t.eq( image.style.left, "", "image.style.left set correctly");
t.eq( image.style.top, "", "image.style.top set correctly");