Skip to content

Commit

Permalink
Update tests for [email protected]
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Feb 3, 2025
1 parent a1b9c18 commit f5a8c60
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 16 deletions.
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"mocha": "^11.1.0",
"nanoassert": "^2.0.0",
"pmtiles-protocol": "^1.0.1",
"proj4": "^2.15.0",
"puppeteer": "^23.10.4",
"rollup": "^2.70.2",
"rollup-plugin-terser": "^7.0.2",
Expand Down
31 changes: 15 additions & 16 deletions test/apply.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ import Point from 'ol/geom/Point.js';
import LayerGroup from 'ol/layer/Group.js';
import VectorLayer from 'ol/layer/Vector.js';
import VectorTileLayer from 'ol/layer/VectorTile.js';
import {
METERS_PER_UNIT,
Projection,
addProjection,
get as getProjection,
toLonLat,
} from 'ol/proj.js';
import {register} from 'ol/proj/proj4.js';
import {METERS_PER_UNIT, get as getProjection, toLonLat} from 'ol/proj.js';
import RasterSource from 'ol/source/Raster.js';
import TileSource from 'ol/source/Tile.js';
import VectorSource from 'ol/source/Vector.js';
import VectorTileSource from 'ol/source/VectorTile.js';
import proj4 from 'proj4';
import should from 'should';
import {
apply,
Expand All @@ -31,6 +27,14 @@ import backgroundStyle from './fixtures/background.json';
delete brightV9.sprite;

describe('ol-mapbox-style', function () {
before(function () {
proj4.defs(
'EPSG:31287',
'PROJCS["MGI / Austria Lambert",GEOGCS["MGI",DATUM["Militar-Geographische_Institut",SPHEROID["Bessel 1841",6377397.155,299.1528128,AUTHORITY["EPSG","7004"]],AUTHORITY["EPSG","6312"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4312"]],PROJECTION["Lambert_Conformal_Conic_2SP"],PARAMETER["latitude_of_origin",47.5],PARAMETER["central_meridian",13.3333333333333],PARAMETER["standard_parallel_1",49],PARAMETER["standard_parallel_2",46],PARAMETER["false_easting",400000],PARAMETER["false_northing",400000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["Northing",NORTH],AXIS["Easting",EAST],AUTHORITY["EPSG","31287"]]',
);
register(proj4);
});

describe('apply', function () {
let target;

Expand Down Expand Up @@ -305,15 +309,10 @@ describe('ol-mapbox-style', function () {
});

it('sets the correct GeoJON data projection for custom projections', function (done) {
const epsg31287 = new Projection({
code: 'EPSG:31287',
extent: [
121983.868598955, 285075.189779654, 694938.749394035,
575854.254725608,
],
units: 'm',
});
addProjection(epsg31287);
const epsg31287 = getProjection('EPSG:31287');
epsg31287.setExtent([
121983.868598955, 285075.189779654, 694938.749394035, 575854.254725608,
]);
const geojson = {
'type': 'FeatureCollection',
'features': [
Expand Down

0 comments on commit f5a8c60

Please sign in to comment.