Merge pull request #10004 from tschaub/revisions
Return a new simplified geometry after modification
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import Point from '../../../../src/ol/geom/Point.js';
|
||||
import {get as getProjection} from '../../../../src/ol/proj.js';
|
||||
|
||||
|
||||
describe('ol.geom.Point', function() {
|
||||
@@ -154,6 +155,42 @@ describe('ol.geom.Point', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('#simplifyTransformed()', function() {
|
||||
|
||||
it('returns the same result if called twice with the same arguments', function() {
|
||||
const geom = new Point([1, 2]);
|
||||
const source = getProjection('EPSG:4326');
|
||||
const dest = getProjection('EPSG:3857');
|
||||
const squaredTolerance = 0.5;
|
||||
const first = geom.simplifyTransformed(squaredTolerance, source, dest);
|
||||
const second = geom.simplifyTransformed(squaredTolerance, source, dest);
|
||||
expect(second).to.be(first);
|
||||
});
|
||||
|
||||
it('returns a different result if called with a different tolerance', function() {
|
||||
const geom = new Point([1, 2]);
|
||||
const source = getProjection('EPSG:4326');
|
||||
const dest = getProjection('EPSG:3857');
|
||||
const squaredTolerance = 0.5;
|
||||
const first = geom.simplifyTransformed(squaredTolerance, source, dest);
|
||||
const second = geom.simplifyTransformed(squaredTolerance * 2, source, dest);
|
||||
expect(second).not.to.be(first);
|
||||
});
|
||||
|
||||
it('returns a different result if called after geometry modification', function() {
|
||||
const geom = new Point([1, 2]);
|
||||
const source = getProjection('EPSG:4326');
|
||||
const dest = getProjection('EPSG:3857');
|
||||
const squaredTolerance = 0.5;
|
||||
const first = geom.simplifyTransformed(squaredTolerance, source, dest);
|
||||
|
||||
geom.setCoordinates([3, 4]);
|
||||
const second = geom.simplifyTransformed(squaredTolerance * 2, source, dest);
|
||||
expect(second).not.to.be(first);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#applyTransform()', function() {
|
||||
|
||||
let point, transform;
|
||||
|
||||
Reference in New Issue
Block a user