Merge branch '2.12'

This commit is contained in:
Éric Lemoine
2012-05-02 17:11:37 +02:00
9 changed files with 156 additions and 11 deletions
+30 -1
View File
@@ -1712,7 +1712,36 @@
t.eq(log[1], "move", "followed by move,");
t.eq(log[log.length-2], "move", "move again before we stop panning,");
t.eq(log[log.length-1], "moveend", "and moveend when we're done.");
}
function test_pan_no_anim_event_sequence(t) {
t.plan(4);
var log = [];
var map = new OpenLayers.Map("map");
map.addLayer(
new OpenLayers.Layer(null, {isBaseLayer: true})
);
map.setCenter(new OpenLayers.LonLat(0, 0), 5);
map.events.on({
"movestart": function() {
log.push("movestart");
},
"move": function() {
log.push("move");
},
"moveend": function() {
log.push("moveend");
}
});
map.pan(5,5, {animate: false});
t.eq(log.length, 3, "no more than 3 events happen.");
t.eq(log[0], "movestart", "pan sequence starts with movestart");
t.eq(log[1], "move", "followed by move,");
t.eq(log[2], "moveend", "and moveend when we're done.");
map.destroy();
}
// test if we can call updateSize before document.body is ready. updateOk
+91
View File
@@ -399,6 +399,97 @@
}
}
/*
* A series of tests to verify the dimensions and positions
* of the tile frame and img after draw.
* Written for https://github.com/openlayers/openlayers/issues/441
*/
function test_draw_without_gutter_without_frame(t) {
t.plan(5);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS('blank',
'../../img/blank.gif',
{layers: 'fake'},
{isBaseLayer: true});
map.addLayer(layer);
var tile = new OpenLayers.Tile.Image(
layer,
new OpenLayers.Pixel(6, 6),
new OpenLayers.Bounds(5, 45, 6, 46),
null,
new OpenLayers.Size(256, 256));
tile.draw();
t.eq(tile.frame, null, 'no frame');
t.eq(parseInt(tile.imgDiv.style.left, 10), 6, 'correct tile img left');
t.eq(parseInt(tile.imgDiv.style.top, 10), 6, 'correct tile img top');
t.eq(parseInt(tile.imgDiv.style.width, 10), 256, 'correct tile img width');
t.eq(parseInt(tile.imgDiv.style.height, 10), 256, 'correct tile img height');
map.destroy();
}
function test_draw_without_gutter_with_frame(t) {
t.plan(8);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS('blank',
'../../img/blank.gif',
{layers: 'fake'},
{isBaseLayer: true});
map.addLayer(layer);
layer.gutter = 1; // this is just for a frame to be created for
// the tile
var tile = new OpenLayers.Tile.Image(
layer,
new OpenLayers.Pixel(6, 6),
new OpenLayers.Bounds(5, 45, 6, 46),
null,
new OpenLayers.Size(256, 256));
layer.gutter = null;
tile.draw();
t.eq(parseInt(tile.frame.style.left, 10), 6, 'correct tile frame left');
t.eq(parseInt(tile.frame.style.top, 10), 6, 'correct tile frame top');
t.eq(parseInt(tile.frame.style.width, 10), 256, 'correct tile frame width');
t.eq(parseInt(tile.frame.style.height, 10), 256, 'correct tile frame height');
t.eq(parseInt(tile.imgDiv.style.left, 10), 0, 'correct tile img left');
t.eq(parseInt(tile.imgDiv.style.top, 10), 0, 'correct tile img top');
t.eq(parseInt(tile.imgDiv.style.width, 10), 100, 'correct tile img width');
t.eq(parseInt(tile.imgDiv.style.height, 10), 100, 'correct tile img height');
map.destroy();
}
function test_draw_with_gutter(t) {
t.plan(8);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.WMS('blank',
'../../img/blank.gif',
{layers: 'fake'},
{isBaseLayer: true, gutter: 15});
map.addLayer(layer);
var tile = new OpenLayers.Tile.Image(
layer,
new OpenLayers.Pixel(6, 6),
new OpenLayers.Bounds(5, 45, 6, 46),
null,
new OpenLayers.Size(256, 256));
tile.draw();
t.eq(parseInt(tile.frame.style.left, 10), 6, 'correct tile frame left');
t.eq(parseInt(tile.frame.style.top, 10), 6, 'correct tile frame top');
t.eq(parseInt(tile.frame.style.width, 10), 256, 'correct tile frame width');
t.eq(parseInt(tile.frame.style.height, 10), 256, 'correct tile frame height');
t.eq(parseInt(tile.imgDiv.style.left, 10), -5, 'correct tile img left');
t.eq(parseInt(tile.imgDiv.style.top, 10), -5, 'correct tile img top');
t.eq(parseInt(tile.imgDiv.style.width, 10), 111, 'correct tile img width');
t.eq(parseInt(tile.imgDiv.style.height, 10), 111, 'correct tile img height');
map.destroy();
}
</script>
</head>
<body>