From 6bc0bf8640cc4eaffe0889fbb424758f67f6baab Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Fri, 6 Nov 2020 10:32:39 +0000 Subject: [PATCH] Test reading XY and empty Z coordinates --- test/spec/ol/format/kml.test.js | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/spec/ol/format/kml.test.js b/test/spec/ol/format/kml.test.js index 8df3ea6e99..0fe434e3f6 100644 --- a/test/spec/ol/format/kml.test.js +++ b/test/spec/ol/format/kml.test.js @@ -468,6 +468,54 @@ describe('ol.format.KML', function () { expect(g.get('altitudeMode')).to.be('absolute'); }); + it('can read XY coordinates', function () { + const text = + '' + + ' ' + + ' ' + + ' 1,2 3,4' + + ' 0' + + ' 1' + + ' absolute' + + ' ' + + ' ' + + ''; + const fs = format.readFeatures(text); + expect(fs).to.have.length(1); + const f = fs[0]; + expect(f).to.be.an(Feature); + const g = f.getGeometry(); + expect(g).to.be.an(LineString); + expect(g.getCoordinates()).to.eql([ + [1, 2, 0], + [3, 4, 0], + ]); + }); + + it('can read empty Z coordinates', function () { + const text = + '' + + ' ' + + ' ' + + ' 1,2, 3,4,' + + ' 0' + + ' 1' + + ' absolute' + + ' ' + + ' ' + + ''; + const fs = format.readFeatures(text); + expect(fs).to.have.length(1); + const f = fs[0]; + expect(f).to.be.an(Feature); + const g = f.getGeometry(); + expect(g).to.be.an(LineString); + expect(g.getCoordinates()).to.eql([ + [1, 2, 0], + [3, 4, 0], + ]); + }); + it('can write XY LineString geometries', function () { const layout = 'XY'; const lineString = new LineString(