| 1 |
<html> |
|---|
| 2 |
<head> |
|---|
| 3 |
<script src="../../lib/OpenLayers.js"></script> |
|---|
| 4 |
<script type="text/javascript"> |
|---|
| 5 |
var map; |
|---|
| 6 |
function test_Control_NavToolbar_constructor (t) { |
|---|
| 7 |
t.plan( 4 ); |
|---|
| 8 |
control = new OpenLayers.Control.NavToolbar(); |
|---|
| 9 |
t.ok( control instanceof OpenLayers.Control.NavToolbar, "new OpenLayers.Control.NavToolbar returns object" ); |
|---|
| 10 |
t.eq( control.displayClass, "olControlNavToolbar", "displayClass is correct" ); |
|---|
| 11 |
t.ok( control.controls[0] instanceof OpenLayers.Control.Navigation, "NavToolbar contains Control.Navigation object" ); |
|---|
| 12 |
t.ok( control.controls[1] instanceof OpenLayers.Control.ZoomBox, "NavToolbar contains Control.ZoomBox object" ); |
|---|
| 13 |
} |
|---|
| 14 |
function test_Control_NavToolbar_addControl (t) { |
|---|
| 15 |
t.plan( 6 ); |
|---|
| 16 |
map = new OpenLayers.Map('map'); |
|---|
| 17 |
control = new OpenLayers.Control.NavToolbar(); |
|---|
| 18 |
t.ok( control instanceof OpenLayers.Control.NavToolbar, "new OpenLayers.Control.NavToolbar returns object" ); |
|---|
| 19 |
t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" ); |
|---|
| 20 |
map.addControl(control); |
|---|
| 21 |
t.ok( control.map === map, "Control.map is set to the map object" ); |
|---|
| 22 |
t.ok( map.controls[4] === control, "map.controls contains control" ); |
|---|
| 23 |
t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 7, "Control div zIndexed properly" ); |
|---|
| 24 |
t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 7, "Viewport div contains control div" ); |
|---|
| 25 |
// t.eq( control.div.style.top, "6px", "Control div top located correctly by default"); |
|---|
| 26 |
|
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
</script> |
|---|
| 30 |
</head> |
|---|
| 31 |
<body> |
|---|
| 32 |
<div id="map" style="width: 1024px; height: 512px;"/> |
|---|
| 33 |
</body> |
|---|
| 34 |
</html> |
|---|