Skip to content

Commit

Permalink
Add some notes to test, additional test with empty line
Browse files Browse the repository at this point in the history
(cherry picked from commit d6aa46c)
  • Loading branch information
nyalldawson committed Nov 10, 2018
1 parent 549db0a commit b9a1a6c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/src/geometry_checker/testqgsgeometrychecks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include "qgsgeometryselfintersectioncheck.h"
#include "qgsgeometrysliverpolygoncheck.h"
#include "qgsvectordataproviderfeaturepool.h"
#include "qgsmultilinestring.h"
#include "qgslinestring.h"
#include "qgsproject.h"
#include "qgsfeedback.h"

Expand Down Expand Up @@ -927,11 +929,18 @@ void TestQgsGeometryChecks::testSelfContactCheck()

cleanupTestContext( testContext );

// https://issues.qgis.org/issues/20408
// test with a linestring which collapses to an empty linestring
QgsGeometryCheckContext context( 1, QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3857" ) ), QgsCoordinateTransformContext() );
QgsGeometrySelfContactCheck check2( &context, QVariantMap() );
QgsGeometry g = QgsGeometry::fromWkt( QStringLiteral( "MultiLineString ((2988987 10262483, 2988983 10262480, 2988991 10262432, 2988990 10262419, 2988977 10262419, 2988976 10262420, 2988967 10262406, 2988970 10262421, 2988971 10262424),(2995620 10301368))" ) );
QList<QgsSingleGeometryCheckError *> errors = check2.processGeometry( g );
QVERIFY( errors.isEmpty() );

// test with totally empty line
qgsgeometry_cast< QgsMultiLineString * >( g.get() )->addGeometry( new QgsLineString() );
errors = check2.processGeometry( g );
QVERIFY( errors.isEmpty() );
}

void TestQgsGeometryChecks::testSelfIntersectionCheck()
Expand Down

0 comments on commit b9a1a6c

Please sign in to comment.