From bf33bd0703955b89ed240f6561e62d648dd6707d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Tue, 29 Sep 2020 10:51:24 +0200 Subject: [PATCH] Add Modify test for identical line segments of same geometry --- test/spec/ol/interaction/modify.test.js | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/spec/ol/interaction/modify.test.js b/test/spec/ol/interaction/modify.test.js index 26e74ade28..1cb46ba5b4 100644 --- a/test/spec/ol/interaction/modify.test.js +++ b/test/spec/ol/interaction/modify.test.js @@ -398,6 +398,33 @@ describe('ol.interaction.Modify', function () { }); }); + describe('vertex insertion', function () { + it('only inserts one vertex per geometry', function () { + const lineFeature = new Feature({ + geometry: new LineString([ + [-10, -10], + [10, 10], + [-10, -10], + [10, 10], + ]), + }); + features.length = 0; + features.push(lineFeature); + + const modify = new Modify({ + features: new Collection(features), + }); + map.addInteraction(modify); + + // Click on line + simulateEvent('pointermove', 0, 0, null, 0); + simulateEvent('pointerdown', 0, 0, null, 0); + simulateEvent('pointerup', 0, 0, null, 0); + + expect(lineFeature.getGeometry().getCoordinates().length).to.equal(5); + }); + }); + describe('circle modification', function () { it('changes the circle radius and center', function () { const circleFeature = new Feature(new Circle([10, 10], 20));