Update tests
This commit is contained in:
@@ -6,6 +6,7 @@ describe('ol.format.WFS', function() {
|
|||||||
|
|
||||||
var features, feature;
|
var features, feature;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
proj4.defs['urn:x-ogc:def:crs:EPSG:4326'] = proj4.defs('EPSG:4326');
|
||||||
afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(xml) {
|
afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(xml) {
|
||||||
try {
|
try {
|
||||||
var config = {
|
var config = {
|
||||||
@@ -54,6 +55,10 @@ describe('ol.format.WFS', function() {
|
|||||||
describe('when parsing FeatureCollection', function() {
|
describe('when parsing FeatureCollection', function() {
|
||||||
var response;
|
var response;
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
proj4.defs('EPSG:28992', '+proj=sterea +lat_0=52.15616055555555 ' +
|
||||||
|
'+lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 ' +
|
||||||
|
'+ellps=bessel +towgs84=565.417,50.3319,465.552,-0.398957,0.343988,' +
|
||||||
|
'-1.8774,4.0725 +units=m +no_defs');
|
||||||
afterLoadText('spec/ol/format/wfs/boundedBy.xml',
|
afterLoadText('spec/ol/format/wfs/boundedBy.xml',
|
||||||
function(xml) {
|
function(xml) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -128,10 +128,10 @@ describe('ol.proj', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('allows new Proj4js projections to be defined', function() {
|
it('allows new Proj4js projections to be defined', function() {
|
||||||
Proj4js.defs['EPSG:21781'] =
|
proj4.defs('EPSG:21781',
|
||||||
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 ' +
|
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 ' +
|
||||||
'+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel ' +
|
'+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel ' +
|
||||||
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
|
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs');
|
||||||
var point = ol.proj.transform([7.439583333333333, 46.95240555555556],
|
var point = ol.proj.transform([7.439583333333333, 46.95240555555556],
|
||||||
'EPSG:4326', 'EPSG:21781');
|
'EPSG:4326', 'EPSG:21781');
|
||||||
expect(point[0]).to.roughlyEqual(600072.300, 1);
|
expect(point[0]).to.roughlyEqual(600072.300, 1);
|
||||||
@@ -139,17 +139,12 @@ describe('ol.proj', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('caches the new Proj4js projections given their srsCode', function() {
|
it('caches the new Proj4js projections given their srsCode', function() {
|
||||||
Proj4js.defs['EPSG:21781'] =
|
|
||||||
'+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 ' +
|
|
||||||
'+k_0=1 +x_0=600000 +y_0=200000 +ellps=bessel ' +
|
|
||||||
'+towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs';
|
|
||||||
var code = 'urn:ogc:def:crs:EPSG:21781';
|
var code = 'urn:ogc:def:crs:EPSG:21781';
|
||||||
var srsCode = 'EPSG:21781';
|
var srsCode = 'EPSG:21781';
|
||||||
|
proj4.defs[code] = proj4.defs[srsCode];
|
||||||
var proj = ol.proj.get(code);
|
var proj = ol.proj.get(code);
|
||||||
expect(ol.proj.proj4jsProjections_.hasOwnProperty(code)).to.be.ok();
|
|
||||||
expect(ol.proj.proj4jsProjections_.hasOwnProperty(srsCode)).to.be.ok();
|
|
||||||
var proj2 = ol.proj.get(srsCode);
|
var proj2 = ol.proj.get(srsCode);
|
||||||
expect(proj2).to.be(proj);
|
expect(ol.proj.equivalent(proj2, proj)).to.be(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('numerically estimates point scale at the equator', function() {
|
it('numerically estimates point scale at the equator', function() {
|
||||||
@@ -186,11 +181,9 @@ describe('ol.proj', function() {
|
|||||||
|
|
||||||
describe('ol.proj.getTransformFromProjections()', function() {
|
describe('ol.proj.getTransformFromProjections()', function() {
|
||||||
|
|
||||||
var sm = ol.proj.get('GOOGLE');
|
|
||||||
var gg = ol.proj.get('EPSG:4326');
|
|
||||||
|
|
||||||
it('returns a transform function', function() {
|
it('returns a transform function', function() {
|
||||||
var transform = ol.proj.getTransformFromProjections(sm, gg);
|
var transform = ol.proj.getTransformFromProjections(ol.proj.get('GOOGLE'),
|
||||||
|
ol.proj.get('EPSG:4326'));
|
||||||
expect(typeof transform).to.be('function');
|
expect(typeof transform).to.be('function');
|
||||||
|
|
||||||
var output = transform([-12000000, 5000000]);
|
var output = transform([-12000000, 5000000]);
|
||||||
@@ -200,7 +193,8 @@ describe('ol.proj', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('works for longer arrays', function() {
|
it('works for longer arrays', function() {
|
||||||
var transform = ol.proj.getTransformFromProjections(sm, gg);
|
var transform = ol.proj.getTransformFromProjections(ol.proj.get('GOOGLE'),
|
||||||
|
ol.proj.get('EPSG:4326'));
|
||||||
expect(typeof transform).to.be('function');
|
expect(typeof transform).to.be('function');
|
||||||
|
|
||||||
var output = transform([-12000000, 5000000, -12000000, 5000000]);
|
var output = transform([-12000000, 5000000, -12000000, 5000000]);
|
||||||
@@ -318,18 +312,10 @@ describe('ol.proj', function() {
|
|||||||
describe('ol.proj.Projection.prototype.getMetersPerUnit()', function() {
|
describe('ol.proj.Projection.prototype.getMetersPerUnit()', function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
Proj4js.defs['EPSG:26782'] =
|
proj4.defs('EPSG:26782',
|
||||||
'+proj=lcc +lat_1=29.3 +lat_2=30.7 +lat_0=28.66666666666667 ' +
|
'+proj=lcc +lat_1=29.3 +lat_2=30.7 +lat_0=28.66666666666667 ' +
|
||||||
'+lon_0=-91.33333333333333 +x_0=609601.2192024384 +y_0=0 ' +
|
'+lon_0=-91.33333333333333 +x_0=609601.2192024384 +y_0=0 ' +
|
||||||
'+ellps=clrk66 +datum=NAD27 +to_meter=0.3048006096012192 +no_defs';
|
'+ellps=clrk66 +datum=NAD27 +to_meter=0.3048006096012192 +no_defs');
|
||||||
ol.proj.configureProj4jsProjection({
|
|
||||||
code: 'EPSG:26782'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(function() {
|
|
||||||
ol.proj.proj4jsProjections_ = {};
|
|
||||||
delete Proj4js.defs['EPSG:26782'];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns value in meters', function() {
|
it('returns value in meters', function() {
|
||||||
@@ -344,26 +330,6 @@ describe('ol.proj', function() {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('ol.proj.configureProj4jsProjection()', function() {
|
|
||||||
|
|
||||||
beforeEach(function() {
|
|
||||||
ol.proj.proj4jsProjections_ = {};
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns a configured projection', function() {
|
|
||||||
var extent = [485869.5728, 76443.1884, 837076.5648, 299941.7864];
|
|
||||||
var epsg21781 = ol.proj.configureProj4jsProjection({
|
|
||||||
code: 'EPSG:21781',
|
|
||||||
extent: extent
|
|
||||||
});
|
|
||||||
expect(epsg21781.getCode()).to.eql('EPSG:21781');
|
|
||||||
expect(epsg21781.getExtent()).to.be(extent);
|
|
||||||
expect(epsg21781.getUnits()).to.be(ol.proj.Units.METERS);
|
|
||||||
expect(epsg21781.isGlobal()).to.not.be();
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user