Added basic tests for Map, Layer, and Control base classes.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@14 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
5
tests/list-tests.html
Normal file
5
tests/list-tests.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<ul id="testlist">
|
||||
<li>test_Control.html</li>
|
||||
<li>test_Layer.html</li>
|
||||
<li>test_Map.html</li>
|
||||
</ul>
|
||||
18
tests/test_Control.html
Normal file
18
tests/test_Control.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script language="text/javascript"><!--
|
||||
var map;
|
||||
function test_01_Control_constructor (t) {
|
||||
t.plan( 1 );
|
||||
|
||||
control = new OpenLayers.Control();
|
||||
t.ok( control instanceof OpenLayers.Control, "new OpenLayers.Control returns object" );
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width: 1024px; height: 512px;"/>
|
||||
</body>
|
||||
</html>
|
||||
25
tests/test_Layer.html
Normal file
25
tests/test_Layer.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script language="text/javascript"><!--
|
||||
var layer;
|
||||
|
||||
function test_01_Layer_constructor (t) {
|
||||
t.plan( 2 );
|
||||
|
||||
layer = new OpenLayers.Layer('Test Layer');
|
||||
t.ok( layer instanceof OpenLayers.Layer, "new OpenLayers.Layer returns object" );
|
||||
t.eq( layer.name, "Test Layer", "layer.name is correct" );
|
||||
}
|
||||
|
||||
function test_99_Layer_destroy (t) {
|
||||
t.plan( 2 );
|
||||
layer.destroy();
|
||||
t.eq( layer.map, null, "layer.map is null after destroy" );
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
||||
33
tests/test_Map.html
Normal file
33
tests/test_Map.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../lib/OpenLayers.js"></script>
|
||||
<script language="text/javascript"><!--
|
||||
var map;
|
||||
function test_01_Map_constructor (t) {
|
||||
t.plan( 9 );
|
||||
|
||||
map = new OpenLayers.Map('map');
|
||||
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.controlDiv instanceof HTMLDivElement, "map.controlDiv 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.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" );
|
||||
}
|
||||
|
||||
function test_99_Map_destroy (t) {
|
||||
t.plan( 2 );
|
||||
map.destroy();
|
||||
t.eq( map.layers, null, "map.layers is null after destroy" );
|
||||
t.eq( map.controls, null, "map.controls is null after destroy" );
|
||||
}
|
||||
// -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width: 1024px; height: 512px;"/>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user