From 4abc2054771ca9c7246a7c8c96dc9ae0499f1e56 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Thu, 2 May 2024 08:46:03 +1000 Subject: [PATCH] =?UTF-8?q?Revert=20"add=20test=20for=20add=20part=20to=20?= =?UTF-8?q?geometry=20less=20features=20on=20single=20geometry=20ty?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b6f929e5d5f9734a18dba35abae863b88e7ed7fd. --- tests/src/app/testqgsmaptooladdpart.cpp | 54 ------------------------- 1 file changed, 54 deletions(-) diff --git a/tests/src/app/testqgsmaptooladdpart.cpp b/tests/src/app/testqgsmaptooladdpart.cpp index 6915440a68b1..a8bd798c944f 100644 --- a/tests/src/app/testqgsmaptooladdpart.cpp +++ b/tests/src/app/testqgsmaptooladdpart.cpp @@ -42,7 +42,6 @@ class TestQgsMapToolAddPart: public QObject void testAddPart(); void testAddPartClockWise(); - void testAddPartToSingleGeometryLess(); private: QPoint mapToPoint( double x, double y ); @@ -222,58 +221,5 @@ void TestQgsMapToolAddPart::testAddPartClockWise() const QString wkt = "MultiPolygon (((2 2, 4 2, 4 4, 2 4)),((5 5, 5 5, 6 5, 6 6, 5 6, 5 5)),((15 15, 16 15, 16 16, 15 16, 15 15)))"; QCOMPARE( mLayerMultiPolygon->getFeature( 1 ).geometry().asWkt(), wkt ); } - -void TestQgsMapToolAddPart::testAddPartToSingleGeometryLess() -{ - QMap> geomTypes; - geomTypes.insert( {"Point"}, {QgsPoint( 0, 0 )} ); - geomTypes.insert( {"LineString", "CompoundCurve"}, {QgsPoint( 0, 0 ), QgsPoint( 1, 1 )} ); - geomTypes.insert( {"Polygon", "CurvePolygon"}, {QgsPoint( 0, 0 ), QgsPoint( 1, 0 ), QgsPoint( 1, 1 ), QgsPoint( 0, 1 )} ); - - - for ( auto it = geomTypes.constBegin(); it != geomTypes.constEnd(); it++ ) - { - for ( const QString &geomType : it.key() ) - { - QgsVectorLayer *vl = new QgsVectorLayer( QStringLiteral( "%1?crs=EPSG:3946" ).arg( geomType ), QStringLiteral( "layer" ), QStringLiteral( "memory" ) ); - QVERIFY( vl->isValid() ); - QgsProject::instance()->addMapLayers( QList() << vl ); - - vl->startEditing(); - QgsFeature f; - vl->dataProvider()->addFeatures( QgsFeatureList() << f ); - QCOMPARE( vl->featureCount(), ( long )1 ); - QVERIFY( vl->getFeature( 1 ).geometry().isNull() ); - - mCanvas->setCurrentLayer( vl ); - vl->select( 1 ); - - QCOMPARE( mCanvas->mapSettings().outputSize(), QSize( 512, 512 ) ); - QCOMPARE( mCanvas->mapSettings().visibleExtent(), QgsRectangle( 0, 0, 8, 8 ) ); - - std::unique_ptr< QgsMapMouseEvent > event; - for ( const QgsPoint &point : it.value() ) - { - event.reset( new QgsMapMouseEvent( - mCanvas, - QEvent::MouseButtonRelease, - mapToPoint( point.x(), point.y() ), - Qt::LeftButton - ) ); - mCaptureTool->cadCanvasReleaseEvent( event.get() ); - } - event.reset( new QgsMapMouseEvent( - mCanvas, - QEvent::MouseButtonRelease, - mapToPoint( 0, 0 ), - Qt::RightButton - ) ); - mCaptureTool->cadCanvasReleaseEvent( event.get() ); - - QVERIFY2( ! vl->getFeature( 1 ).geometry().isNull(), QString( "failed for %1" ).arg( geomType ).toLocal8Bit().data() ); - } - } -} - QGSTEST_MAIN( TestQgsMapToolAddPart ) #include "testqgsmaptooladdpart.moc"