fix the Layer.WMS setOpacity tests
This commit is contained in:
@@ -275,22 +275,29 @@
|
||||
t.plan( 5 );
|
||||
|
||||
var map = new OpenLayers.Map('map');
|
||||
map.projection = "xx";
|
||||
tUrl = "http://octo.metacarta.com/cgi-bin/mapserv";
|
||||
tParams = { layers: 'basic',
|
||||
format: 'image/png'};
|
||||
tOptions = { 'opacity': '0.5' };
|
||||
var tLayer = new OpenLayers.Layer.WMS(name, tUrl, tParams, tOptions);
|
||||
map.addLayer(tLayer);
|
||||
map.zoomToMaxExtent();
|
||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||
|
||||
var tile = tLayer.grid[0][0],
|
||||
tileImg = tile.imgDiv;
|
||||
|
||||
t.eq(tLayer.opacity, "0.5", "Opacity is set correctly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.5, "Opacity on tile is correct");
|
||||
tile.onImageLoad(); // simulate a 'load' image event
|
||||
t.eq(parseFloat(tileImg.style.opacity), 0.5, "Opacity on tile is correct");
|
||||
|
||||
tLayer.setOpacity("0.6");
|
||||
t.eq(tLayer.opacity, "0.6", "setOpacity works properly");
|
||||
t.eq(parseFloat(tLayer.div.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
|
||||
t.eq(parseFloat(tileImg.style.opacity), 0.6, "Opacity on tile is changed correctly");
|
||||
|
||||
var pixel = new OpenLayers.Pixel(5,6);
|
||||
var tile = tLayer.addTile(new OpenLayers.Bounds(1,2,3,4), pixel);
|
||||
tile.draw();
|
||||
tile.onImageLoad(); // simulate a 'load' image event
|
||||
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
|
||||
|
||||
map.destroy();
|
||||
|
||||
Reference in New Issue
Block a user