diff --git a/tests/src/core/geometry/testqgsgeometry.cpp b/tests/src/core/geometry/testqgsgeometry.cpp index 63d50c140dd..6fe37f090e1 100644 --- a/tests/src/core/geometry/testqgsgeometry.cpp +++ b/tests/src/core/geometry/testqgsgeometry.cpp @@ -2597,13 +2597,17 @@ void TestQgsGeometry::snappedToGrid() QCOMPARE( snapped->asWkt( 5 ), QStringLiteral( "LineStringZM (68 415 10 60, 27 505 20 50, 27 406 40 30)" ) ); // with removal of redundant vertices - curve = QgsGeometry::fromWkt( "LineString( 68.1 415.2, 27.1 505.2, 27.1 406.2 )" ); - curve.densifyByCount( 10 ); + curve = QgsGeometry::fromWkt( "LineString( 68.1 415.2, 68.1 505.2, 27.1 505.2 )" ); + curve = curve.densifyByCount( 10 ); + // no removal of redundant vertices + snapped.reset( curve.constGet()->snappedToGrid( 1, 1, 0, 0, false ) ); + QCOMPARE( snapped->nCoordinates(), 23 ); + // removal of redundant vertices snapped.reset( curve.constGet()->snappedToGrid( 1, 1, 0, 0, true ) ); - QCOMPARE( snapped->asWkt( 5 ), QStringLiteral( "LineString (68 415, 27 505, 27 406)" ) ); - curve.densifyByCount( 1000 ); + QCOMPARE( snapped->asWkt( 5 ), QStringLiteral( "LineString (68 415, 68 505, 27 505)" ) ); + curve = curve.densifyByCount( 1000 ); snapped.reset( curve.constGet()->snappedToGrid( 1, 1, 0, 0, true ) ); - QCOMPARE( snapped->asWkt( 5 ), QStringLiteral( "LineString (68 415, 27 505, 27 406)" ) ); + QCOMPARE( snapped->asWkt( 5 ), QStringLiteral( "LineString (68 415, 68 505, 27 505)" ) ); } //compound curve