| | 52 | |
|---|
| | 53 | function test_03_Layer_Markers_getMaxMarkersExtent(t) { |
|---|
| | 54 | t.plan( 4 ); |
|---|
| | 55 | |
|---|
| | 56 | var layer = {}; |
|---|
| | 57 | var ret = OpenLayers.Layer.Markers.prototype.getMaxMarkersExtent.apply(layer, []); |
|---|
| | 58 | t.eq(ret, null, "does not crash, returns null on layer with null 'this.markers'"); |
|---|
| | 59 | |
|---|
| | 60 | layer.markers = []; |
|---|
| | 61 | ret = OpenLayers.Layer.Markers.prototype.getMaxMarkersExtent.apply(layer, []); |
|---|
| | 62 | t.eq(ret, null, "returns null on layer with empty 'this.markers'"); |
|---|
| | 63 | |
|---|
| | 64 | layer.markers.push({ |
|---|
| | 65 | 'lonlat': new OpenLayers.LonLat(4,5) |
|---|
| | 66 | }); |
|---|
| | 67 | var expectedBounds = new OpenLayers.Bounds(4,5,4,5); |
|---|
| | 68 | ret = OpenLayers.Layer.Markers.prototype.getMaxMarkersExtent.apply(layer, []); |
|---|
| | 69 | t.ok(ret.equals(expectedBounds), "returns expected bounds with only one marker"); |
|---|
| | 70 | |
|---|
| | 71 | layer.markers.push({ |
|---|
| | 72 | 'lonlat': new OpenLayers.LonLat(1,2) |
|---|
| | 73 | }); |
|---|
| | 74 | var expectedBounds = new OpenLayers.Bounds(1,2,4,5); |
|---|
| | 75 | ret = OpenLayers.Layer.Markers.prototype.getMaxMarkersExtent.apply(layer, []); |
|---|
| | 76 | t.ok(ret.equals(expectedBounds), "returns expected bounds with multiple markers"); |
|---|
| | 77 | |
|---|
| | 78 | } |
|---|
| | 79 | |
|---|