Allow getMetersPerUnit to work without units identifier (see #814)

This commit is contained in:
Tim Schaub
2013-06-24 11:34:16 -06:00
parent f697450523
commit d10eff97a2
3 changed files with 35 additions and 1 deletions

View File

@@ -313,11 +313,31 @@ describe('ol.proj', function() {
describe('ol.Projection.prototype.getMetersPerUnit()', function() {
beforeEach(function() {
Proj4js.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'];
});
it('returns value in meters', function() {
var epsg4326 = ol.proj.get('EPSG:4326');
expect(epsg4326.getMetersPerUnit()).to.eql(111194.87428468118);
});
it('works for proj4js projections without units', function() {
var epsg26782 = ol.proj.get('EPSG:26782');
expect(epsg26782.getMetersPerUnit()).to.eql(0.3048006096012192);
});
});
describe('ol.proj.configureProj4jsProjection()', function() {