Fix request image size caclulation

This commit is contained in:
Andreas Hocevar
2017-03-23 22:26:58 +01:00
parent 57e67e62bb
commit 28fb57ebeb
3 changed files with 16 additions and 2 deletions

View File

@@ -35,6 +35,19 @@ describe('ol.source.ImageWMS', function() {
expect(extentAspectRatio).to.roughlyEqual(imageAspectRatio, 1e-12);
});
it('uses correct WIDTH and HEIGHT for HiDPI devices', function() {
pixelRatio = 2;
options.serverType = 'geoserver';
var source = new ol.source.ImageWMS(options);
var image = source.getImage(extent, resolution, pixelRatio, projection);
var uri = new URL(image.src_);
var queryData = uri.searchParams;
var width = Number(queryData.get('WIDTH'));
var height = Number(queryData.get('HEIGHT'));
expect(width).to.be(400);
expect(height).to.be(400);
});
it('requests integer WIDTH and HEIGHT', function() {
options.ratio = 1.5;
var source = new ol.source.ImageWMS(options);