|
28 | 28 | #include "qgsgeometryfollowboundariescheck.h"
|
29 | 29 | #include "qgsgeometrygapcheck.h"
|
30 | 30 | #include "qgsgeometryholecheck.h"
|
| 31 | +#include "qgsgeometrymissingvertexcheck.h" |
31 | 32 | #include "qgsgeometrylineintersectioncheck.h"
|
32 | 33 | #include "qgsgeometrylinelayerintersectioncheck.h"
|
33 | 34 | #include "qgsgeometrymultipartcheck.h"
|
@@ -81,6 +82,7 @@ class TestQgsGeometryChecks: public QObject
|
81 | 82 | void testDuplicateNodesCheck();
|
82 | 83 | void testFollowBoundariesCheck();
|
83 | 84 | void testGapCheck();
|
| 85 | + void testMissingVertexCheck(); |
84 | 86 | void testHoleCheck();
|
85 | 87 | void testLineIntersectionCheck();
|
86 | 88 | void testLineLayerIntersectionCheck();
|
@@ -530,6 +532,33 @@ void TestQgsGeometryChecks::testGapCheck()
|
530 | 532 | cleanupTestContext( context );
|
531 | 533 | }
|
532 | 534 |
|
| 535 | +void TestQgsGeometryChecks::testMissingVertexCheck() |
| 536 | +{ |
| 537 | + QTemporaryDir dir; |
| 538 | + QMap<QString, QString> layers; |
| 539 | + layers.insert( QStringLiteral( "missing_vertex.gpkg" ), QString() ); |
| 540 | + QgsGeometryCheckerContext *context = createTestContext( dir, layers ); |
| 541 | + |
| 542 | + // Test detection |
| 543 | + QList<QgsGeometryCheckError *> checkErrors; |
| 544 | + QStringList messages; |
| 545 | + |
| 546 | + QgsGeometryMissingVertexCheck check( context ); |
| 547 | + check.collectErrors( checkErrors, messages ); |
| 548 | + listErrors( checkErrors, messages ); |
| 549 | + |
| 550 | + const QString layerId = testContext.second.first()->layerId(); |
| 551 | + QVERIFY( searchCheckErrors( checkErrors, layerId, 0, QgsPointXY( 0.251153, -0.460895 ), QgsVertexId() ).size() == 1 ); |
| 552 | + QVERIFY( searchCheckErrors( checkErrors, layerId, 3, QgsPointXY( 0.257985, -0.932886 ), QgsVertexId() ).size() == 1 ); |
| 553 | + QVERIFY( searchCheckErrors( checkErrors, layerId, 5, QgsPointXY( 0.59781, -0.480033 ), QgsVertexId() ).size() == 1 ); |
| 554 | + QVERIFY( searchCheckErrors( checkErrors, layerId, 5, QgsPointXY( 0.605252, -0.664875 ), QgsVertexId() ).size() == 1 ); |
| 555 | + QVERIFY( searchCheckErrors( checkErrors, layerId, 4, QgsPointXY( 0.259197, -0.478311 ), QgsVertexId() ).size() == 1 ); |
| 556 | + |
| 557 | + QCOMPARE( checkErrors.size(), 5 ); |
| 558 | + |
| 559 | + cleanupTestContext( context ); |
| 560 | +} |
| 561 | + |
533 | 562 | void TestQgsGeometryChecks::testHoleCheck()
|
534 | 563 | {
|
535 | 564 | QTemporaryDir dir;
|
|
0 commit comments