Add test to parse WFS with GML 2.1.2

This commit is contained in:
Florent gravin
2014-09-23 14:51:45 +02:00
parent f8e8653480
commit 82f267f0c5
2 changed files with 128 additions and 0 deletions

View File

@@ -50,6 +50,43 @@ describe('ol.format.WFS', function() {
});
describe('when parsing mapserver GML2 polygon', function() {
var features, feature, xml;
var config = {
'featureNS': 'http://mapserver.gis.umn.edu/mapserver',
'featureType': 'polygon',
'gmlFormat': new ol.format.GML.v2()
};
before(function(done) {
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
afterLoadText('spec/ol/format/wfs/polygonv2.xml', function(data) {
try {
xml = data;
features = new ol.format.WFS(config).readFeatures(xml);
} catch (e) {
done(e);
}
done();
});
});
it('creates 3 features', function() {
expect(features).to.have.length(3);
});
it('creates a polygon for My Polygon with hole', function() {
feature = features[0];
expect(feature.getId()).to.equal('1');
expect(feature.get('name')).to.equal('My Polygon with hole');
expect(feature.getGeometry()).to.be.an(ol.geom.MultiPolygon);
expect(feature.getGeometry().getFlatCoordinates()).
to.have.length(60);
});
});
describe('when parsing FeatureCollection', function() {
var response;
before(function(done) {
@@ -403,5 +440,7 @@ goog.require('ol.geom.MultiLineString');
goog.require('ol.geom.MultiPoint');
goog.require('ol.geom.MultiPolygon');
goog.require('ol.geom.Polygon');
goog.require('ol.format.GML');
goog.require('ol.format.GML.v2');
goog.require('ol.format.WFS');
goog.require('ol.proj');