Skip to content

Commit b9a1a6c

Browse files
committedNov 10, 2018
Add some notes to test, additional test with empty line
(cherry picked from commit d6aa46c)
1 parent 549db0a commit b9a1a6c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎tests/src/geometry_checker/testqgsgeometrychecks.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
#include "qgsgeometryselfintersectioncheck.h"
4141
#include "qgsgeometrysliverpolygoncheck.h"
4242
#include "qgsvectordataproviderfeaturepool.h"
43+
#include "qgsmultilinestring.h"
44+
#include "qgslinestring.h"
4345
#include "qgsproject.h"
4446
#include "qgsfeedback.h"
4547

@@ -927,11 +929,18 @@ void TestQgsGeometryChecks::testSelfContactCheck()
927929

928930
cleanupTestContext( testContext );
929931

932+
// https://issues.qgis.org/issues/20408
933+
// test with a linestring which collapses to an empty linestring
930934
QgsGeometryCheckContext context( 1, QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:3857" ) ), QgsCoordinateTransformContext() );
931935
QgsGeometrySelfContactCheck check2( &context, QVariantMap() );
932936
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))" ) );
933937
QList<QgsSingleGeometryCheckError *> errors = check2.processGeometry( g );
934938
QVERIFY( errors.isEmpty() );
939+
940+
// test with totally empty line
941+
qgsgeometry_cast< QgsMultiLineString * >( g.get() )->addGeometry( new QgsLineString() );
942+
errors = check2.processGeometry( g );
943+
QVERIFY( errors.isEmpty() );
935944
}
936945

937946
void TestQgsGeometryChecks::testSelfIntersectionCheck()

0 commit comments

Comments
 (0)
Please sign in to comment.