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