Additional tests for LineString

This commit is contained in:
Andreas Hocevar
2019-09-26 23:42:44 +02:00
parent 4f44280ec7
commit 99c56a1f08

View File

@@ -73,6 +73,12 @@ describe('ol.geom.LineString', function() {
expect(lineString.getStride()).to.be(2);
});
describe('#intersectsCoordinate', function() {
it('returns true for an intersecting coordinate', function() {
expect(lineString.intersectsCoordinate([1.5, 2.5])).to.be(true);
});
});
describe('#intersectsExtent', function() {
it('return false for non matching extent', function() {
@@ -89,6 +95,23 @@ describe('ol.geom.LineString', function() {
});
describe('#intersectsCoordinate', function() {
it('detects intersecting coordinates', function() {
expect(lineString.intersectsCoordinate([1, 2])).to.be(true);
});
});
describe('#getClosestPoint', function() {
it('uses existing vertices', function() {
const closestPoint = lineString.getClosestPoint([0.9, 1.8]);
expect(closestPoint).to.eql([1, 2]);
});
});
describe('#getCoordinateAt', function() {
it('return the first point when fraction is 0', function() {