1
|
<html>
|
2
|
<head>
|
3
|
<script src="../lib/OpenLayers.js"></script>
|
4
|
<script type="text/javascript"><!--
|
5
|
var isMozilla = (navigator.userAgent.indexOf("compatible") == -1);
|
6
|
var layer;
|
7
|
|
8
|
function test_01_Layer_GeoRSS_constructor (t) {
|
9
|
t.plan( 5 );
|
10
|
layer = new OpenLayers.Layer.GeoRSS('Test Layer', "./georss.txt" );
|
11
|
t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
|
12
|
t.eq( layer.location, "./georss.txt", "layer.location is correct" );
|
13
|
var markers;
|
14
|
t.delay_call( 1, function() {
|
15
|
t.eq( layer.markers.length, 40, "marker length is correct" );
|
16
|
var ll = new OpenLayers.LonLat(-71.142197, 42.405696);
|
17
|
t.ok( layer.markers[0].lonlat.equals(ll), "lonlat on first marker is correct" );
|
18
|
t.eq( layer.name, "Crschmidt's Places At Platial", "Layer name is correct." );
|
19
|
} );
|
20
|
}
|
21
|
function test_02_Layer_GeoRSS_draw (t) {
|
22
|
// t.plan(5);
|
23
|
t.plan( 2 );
|
24
|
layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
|
25
|
t.ok( layer instanceof OpenLayers.Layer.GeoRSS, "new OpenLayers.Layer.GeoRSS returns object" );
|
26
|
var map = new OpenLayers.Map('map');
|
27
|
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
|
28
|
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
29
|
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
30
|
map.addLayer(baseLayer);
|
31
|
map.addLayer(layer);
|
32
|
t.delay_call( 1, function() {
|
33
|
map.setCenter(new OpenLayers.LonLat(0,0),0);
|
34
|
t.eq( map.layers[1].name, layer.name, "Layer name is correct" );
|
35
|
|
36
|
});;
|
37
|
}
|
38
|
function test_03_Layer_GeoRSS_events (t) {
|
39
|
t.plan( 4 );
|
40
|
layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
|
41
|
var map = new OpenLayers.Map('map');
|
42
|
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
|
43
|
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
44
|
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
45
|
map.addLayer(baseLayer);
|
46
|
map.addLayer(layer);
|
47
|
map.setCenter(new OpenLayers.LonLat(0,0),0);
|
48
|
var event = {};
|
49
|
t.delay_call( 1, function() {
|
50
|
t.ok(layer.markers[0].events, "First marker has an events object");
|
51
|
t.eq(layer.markers[0].events.listeners['click'].length, 1, "Marker events has one object");
|
52
|
layer.markers[0].events.triggerEvent('click', event);
|
53
|
t.eq(map.popups.length, 1, "Popup opened correctly");
|
54
|
layer.markers[1].events.triggerEvent('click', event);
|
55
|
t.eq(map.popups.length, 1, "1st popup gone, 2nd Popup opened correctly");
|
56
|
});
|
57
|
}
|
58
|
|
59
|
function test_99_Layer_GeoRSS_destroy (t) {
|
60
|
t.plan( 1 );
|
61
|
layer = new OpenLayers.Layer.GeoRSS('Test Layer', './georss.txt');
|
62
|
var map = new OpenLayers.Map('map');
|
63
|
map.addLayer(layer);
|
64
|
layer.destroy();
|
65
|
t.eq( layer.map, null, "layer.map is null after destroy" );
|
66
|
}
|
67
|
// -->
|
68
|
</script>
|
69
|
</head>
|
70
|
<body>
|
71
|
<div id="map" style="width:500px; height:500px"></div>
|
72
|
</body>
|
73
|
</html>
|