Transformed

This commit is contained in:
Tim Schaub
2017-12-11 16:29:33 -07:00
parent 1cdb6a66f0
commit 7f47883c48
737 changed files with 22216 additions and 21609 deletions
+25 -27
View File
@@ -1,7 +1,5 @@
goog.require('ol.source.ImageWMS');
goog.require('ol.proj');
import _ol_source_ImageWMS_ from '../../../../src/ol/source/ImageWMS.js';
import _ol_proj_ from '../../../../src/ol/proj.js';
describe('ol.source.ImageWMS', function() {
@@ -10,7 +8,7 @@ describe('ol.source.ImageWMS', function() {
beforeEach(function() {
extent = [10, 20, 30, 40];
pixelRatio = 1;
projection = ol.proj.get('EPSG:4326');
projection = _ol_proj_.get('EPSG:4326');
resolution = 0.1;
options = {
params: {
@@ -33,7 +31,7 @@ describe('ol.source.ImageWMS', function() {
it('returns the expected image URL', function() {
options.ratio = 1.5;
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var image = source.getImage([10, 20, 30.1, 39.9], resolution, pixelRatio, projection);
var uri = new URL(image.src_);
var queryData = uri.searchParams;
@@ -46,7 +44,7 @@ describe('ol.source.ImageWMS', function() {
it('uses correct WIDTH and HEIGHT for HiDPI devices', function() {
pixelRatio = 2;
options.serverType = 'geoserver';
var source = new ol.source.ImageWMS(options);
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;
@@ -58,7 +56,7 @@ describe('ol.source.ImageWMS', function() {
it('requests integer WIDTH and HEIGHT', function() {
options.ratio = 1.5;
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var image = source.getImage([10, 20, 30.1, 39.9], resolution, pixelRatio, projection);
var uri = new URL(image.src_);
var queryData = uri.searchParams;
@@ -69,7 +67,7 @@ describe('ol.source.ImageWMS', function() {
});
it('sets WIDTH and HEIGHT to match the aspect ratio of BBOX', function() {
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var image = source.getImage(extent, resolution, pixelRatio, projection);
var uri = new URL(image.src_);
expect(uri.protocol).to.be('http:');
@@ -93,7 +91,7 @@ describe('ol.source.ImageWMS', function() {
it('sets the SRS query value instead of CRS if version < 1.3', function() {
options.params.VERSION = '1.2';
var source = new ol.source.ImageWMS(options);
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;
@@ -104,7 +102,7 @@ describe('ol.source.ImageWMS', function() {
it('allows various parameters to be overridden', function() {
options.params.FORMAT = 'image/jpeg';
options.params.TRANSPARENT = false;
var source = new ol.source.ImageWMS(options);
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;
@@ -114,7 +112,7 @@ describe('ol.source.ImageWMS', function() {
it('does not add a STYLES= option if one is specified', function() {
options.params.STYLES = 'foo';
var source = new ol.source.ImageWMS(options);
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;
@@ -122,8 +120,8 @@ describe('ol.source.ImageWMS', function() {
});
it('changes the BBOX order for EN axis orientations', function() {
var source = new ol.source.ImageWMS(options);
projection = ol.proj.get('CRS:84');
var source = new _ol_source_ImageWMS_(options);
projection = _ol_proj_.get('CRS:84');
var image = source.getImage(extent, resolution, pixelRatio, projection);
var uri = new URL(image.src_);
var queryData = uri.searchParams;
@@ -132,7 +130,7 @@ describe('ol.source.ImageWMS', function() {
it('uses EN BBOX order if version < 1.3', function() {
options.params.VERSION = '1.1.0';
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var image =
source.getImage(extent, resolution, pixelRatio, projection);
var uri = new URL(image.src_);
@@ -142,7 +140,7 @@ describe('ol.source.ImageWMS', function() {
it('sets MAP_RESOLUTION when the server is MapServer', function() {
options.serverType = 'mapserver';
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
pixelRatio = 2;
var image = source.getImage(extent, resolution, pixelRatio, projection);
var uri = new URL(image.src_);
@@ -152,7 +150,7 @@ describe('ol.source.ImageWMS', function() {
it('sets FORMAT_OPTIONS when the server is GeoServer', function() {
options.serverType = 'geoserver';
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
pixelRatio = 2;
var image = source.getImage(extent, resolution, pixelRatio, projection);
var uri = new URL(image.src_);
@@ -162,7 +160,7 @@ describe('ol.source.ImageWMS', function() {
it('extends FORMAT_OPTIONS if it is already present', function() {
options.serverType = 'geoserver';
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
options.params.FORMAT_OPTIONS = 'param1:value1';
pixelRatio = 2;
var image = source.getImage(extent, resolution, pixelRatio, projection);
@@ -174,7 +172,7 @@ describe('ol.source.ImageWMS', function() {
it('rounds FORMAT_OPTIONS to an integer when the server is GeoServer',
function() {
options.serverType = 'geoserver';
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
pixelRatio = 1.325;
var image =
source.getImage(extent, resolution, pixelRatio, projection);
@@ -185,7 +183,7 @@ describe('ol.source.ImageWMS', function() {
it('sets DPI when the server is QGIS', function() {
options.serverType = 'qgis';
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
pixelRatio = 2;
var image = source.getImage(extent, resolution, pixelRatio, projection);
var uri = new URL(image.src_);
@@ -196,7 +194,7 @@ describe('ol.source.ImageWMS', function() {
it('creates an image with a custom imageLoadFunction', function() {
var imageLoadFunction = sinon.spy();
options.imageLoadFunction = imageLoadFunction;
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var image = source.getImage(extent, resolution, pixelRatio, projection);
image.load();
expect(imageLoadFunction).to.be.called();
@@ -205,7 +203,7 @@ describe('ol.source.ImageWMS', function() {
it('returns same image for consecutive calls with same args', function() {
var extent = [10.01, 20, 30.01, 40];
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var image1 = source.getImage(extent, resolution, pixelRatio, projection);
var image2 = source.getImage(extent, resolution, pixelRatio, projection);
expect(image1).to.equal(image2);
@@ -213,7 +211,7 @@ describe('ol.source.ImageWMS', function() {
it('returns same image for calls with similar extents', function() {
options.ratio = 1.5;
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var extent = [10.01, 20, 30.01, 40];
var image1 = source.getImage(extent, resolution, pixelRatio, projection);
extent = [10.01, 20.1, 30.01, 40.1];
@@ -223,7 +221,7 @@ describe('ol.source.ImageWMS', function() {
it('calculates correct image size with ratio', function() {
options.ratio = 1.5;
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var extent = [10, 5, 30, 45];
source.getImage(extent, resolution, pixelRatio, projection);
expect(source.imageSize_).to.eql([300, 600]);
@@ -234,7 +232,7 @@ describe('ol.source.ImageWMS', function() {
describe('#getGetFeatureInfoUrl', function() {
it('returns the expected GetFeatureInfo URL', function() {
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var url = source.getGetFeatureInfoUrl(
[20, 30], resolution, projection,
{INFO_FORMAT: 'text/plain'});
@@ -262,7 +260,7 @@ describe('ol.source.ImageWMS', function() {
});
it('returns the expected GetFeatureInfo URL when source\'s projection is different from the parameter', function() {
var source = new ol.source.ImageWMS(optionsReproj);
var source = new _ol_source_ImageWMS_(optionsReproj);
var url = source.getGetFeatureInfoUrl(
[20, 30], resolution, projection,
{INFO_FORMAT: 'text/plain'});
@@ -290,7 +288,7 @@ describe('ol.source.ImageWMS', function() {
});
it('sets the QUERY_LAYERS param as expected', function() {
var source = new ol.source.ImageWMS(options);
var source = new _ol_source_ImageWMS_(options);
var url = source.getGetFeatureInfoUrl(
[20, 30], resolution, projection,
{INFO_FORMAT: 'text/plain', QUERY_LAYERS: 'foo,bar'});