Files
openlayers/tests/test_Layer_Text.html
Schuyler Erle 0e6b61c352 All tests now pass in IE.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@315 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2006-05-24 05:46:54 +00:00

54 lines
2.3 KiB
HTML

<html>
<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) {
t.plan( 6 );
layer = new OpenLayers.Layer.Text('Test Layer', 'data_Layer_Text_textfile.txt');
t.ok( layer instanceof OpenLayers.Layer.Text, "new OpenLayers.Layer.Text returns object" );
t.eq( layer.location, "data_Layer_Text_textfile.txt", "layer.location is correct" );
var markers;
t.delay_call( 1, function() {
t.eq( layer.markers.length, 1, "marker length is correct" );
t.eq( layer.markers[0].lonlat.lat, 10, "latitude on first marker is correct" );
t.eq( layer.markers[0].lonlat.lon, 20, "latitude on first marker is correct" );
t.eq( layer.markers[0].icon.url, 'http://boston.openguides.org/markers/ORANGE.png', "icon" );
} );
}
function test_02_Layer_Text_draw (t) {
t.plan(5);
layer = new OpenLayers.Layer.Text('Test Layer', 'data_Layer_Text_textfile.txt');
t.ok( layer instanceof OpenLayers.Layer.Text, "new OpenLayers.Layer.Text returns object" );
var map = new OpenLayers.Map('map');
map.addLayer(layer);
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);
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" )
});;
}
function test_99_Layer_Text_destroy (t) {
t.plan( 1 );
layer = new OpenLayers.Layer.Text('Test Layer');
var map = new OpenLayers.Map('map');
map.addLayer(layer);
layer.destroy();
t.eq( layer.map, null, "layer.map is null after destroy" );
}
// -->
</script>
</head>
<body>
<div id="map" style="width:500px; height:500px"></div>
</body>
</html>