Skip to content

Commit

Permalink
[processing] Add autoincremental field test
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Mar 15, 2016
1 parent 5607ae3 commit e888d6d
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://ogr.maptools.org/ autoincrement_field.xsd"
xmlns:ogr="http://ogr.maptools.org/"
xmlns:gml="http://www.opengis.net/gml">
<gml:boundedBy>
<gml:Box>
<gml:coord><gml:X>0</gml:X><gml:Y>-5</gml:Y></gml:coord>
<gml:coord><gml:X>8</gml:X><gml:Y>3</gml:Y></gml:coord>
</gml:Box>
</gml:boundedBy>

<gml:featureMember>
<ogr:autoincrement_field fid="points.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>0</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
<gml:featureMember>
<ogr:autoincrement_field fid="points.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3,3</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>1</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
<gml:featureMember>
<ogr:autoincrement_field fid="points.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>2</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
<gml:featureMember>
<ogr:autoincrement_field fid="points.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>3</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
<gml:featureMember>
<ogr:autoincrement_field fid="points.4">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4,1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>4</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
<gml:featureMember>
<ogr:autoincrement_field fid="points.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-5</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>5</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
<gml:featureMember>
<ogr:autoincrement_field fid="points.6">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>6</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
<gml:featureMember>
<ogr:autoincrement_field fid="points.7">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>7</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
<gml:featureMember>
<ogr:autoincrement_field fid="points.8">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:AUTO>8</ogr:AUTO>
</ogr:autoincrement_field>
</gml:featureMember>
</ogr:FeatureCollection>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0">
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/>
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="autoincrement_field" type="ogr:autoincrement_field_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="autoincrement_field_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="AUTO" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:integer">
<xs:totalDigits value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
11 changes: 11 additions & 0 deletions python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,14 @@ tests:
compare:
geometry:
precision: 7
- algorithm: qgis:addautoincrementalfield
name: Add autoincremental field
params:
INPUT:
name: points.gml
type: vector
results:
OUTPUT:
name: expected/autoincrement_field.gml
type: vector

0 comments on commit e888d6d

Please sign in to comment.