Update tests
This commit is contained in:
@@ -128,10 +128,10 @@ describe('ol.proj', 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 ' +
|
||||
'+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],
|
||||
'EPSG:4326', 'EPSG:21781');
|
||||
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() {
|
||||
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 srsCode = 'EPSG:21781';
|
||||
proj4.defs[code] = proj4.defs[srsCode];
|
||||
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);
|
||||
expect(proj2).to.be(proj);
|
||||
expect(ol.proj.equivalent(proj2, proj)).to.be(true);
|
||||
});
|
||||
|
||||
it('numerically estimates point scale at the equator', function() {
|
||||
@@ -186,11 +181,9 @@ describe('ol.proj', 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() {
|
||||
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');
|
||||
|
||||
var output = transform([-12000000, 5000000]);
|
||||
@@ -200,7 +193,8 @@ describe('ol.proj', 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');
|
||||
|
||||
var output = transform([-12000000, 5000000, -12000000, 5000000]);
|
||||
@@ -318,18 +312,10 @@ describe('ol.proj', function() {
|
||||
describe('ol.proj.Projection.prototype.getMetersPerUnit()', 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 ' +
|
||||
'+lon_0=-91.33333333333333 +x_0=609601.2192024384 +y_0=0 ' +
|
||||
'+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'];
|
||||
'+ellps=clrk66 +datum=NAD27 +to_meter=0.3048006096012192 +no_defs');
|
||||
});
|
||||
|
||||
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