@@ -387,6 +387,7 @@ void TestQgsVertexTool::testAddVertexAtEndpoint()
387
387
mouseMove ( 1 , 3 ); // first we need to move to the vertex
388
388
mouseClick ( 1 , 3 + offsetInMapUnits, Qt::LeftButton );
389
389
mouseClick ( 2 , 3 , Qt::LeftButton );
390
+ mouseClick ( 2 , 3 , Qt::RightButton ); // we need a right click to stop adding new nodes
390
391
391
392
QCOMPARE ( mLayerLine ->undoStack ()->index (), 2 );
392
393
QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 1, 1 1, 1 3, 2 3)" ) );
@@ -401,6 +402,7 @@ void TestQgsVertexTool::testAddVertexAtEndpoint()
401
402
mouseMove ( 2 , 1 ); // first we need to move to the vertex
402
403
mouseClick ( 2 + offsetInMapUnits, 1 , Qt::LeftButton );
403
404
mouseClick ( 2 , 2 , Qt::LeftButton );
405
+ mouseClick ( 2 , 2 , Qt::RightButton ); // we need a right click to stop adding new nodes
404
406
405
407
QCOMPARE ( mLayerLine ->undoStack ()->index (), 2 );
406
408
QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 2, 2 1, 1 1, 1 3)" ) );
@@ -409,6 +411,25 @@ void TestQgsVertexTool::testAddVertexAtEndpoint()
409
411
QCOMPARE ( mLayerLine ->undoStack ()->index (), 1 );
410
412
411
413
QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 1, 1 1, 1 3)" ) );
414
+
415
+ // add three vertices at once
416
+
417
+ mouseMove ( 2 , 1 ); // first we need to move to the vertex
418
+ mouseClick ( 2 + offsetInMapUnits, 1 , Qt::LeftButton );
419
+ mouseClick ( 2 , 2 , Qt::LeftButton );
420
+ mouseClick ( 2 , 3 , Qt::LeftButton );
421
+ mouseClick ( 2 , 4 , Qt::LeftButton );
422
+ mouseClick ( 2 , 2 , Qt::RightButton ); // we need a right click to stop adding new nodes
423
+
424
+ QCOMPARE ( mLayerLine ->undoStack ()->index (), 4 );
425
+ QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 4, 2 3, 2 2, 2 1, 1 1, 1 3)" ) );
426
+
427
+ mLayerLine ->undoStack ()->undo ();
428
+ mLayerLine ->undoStack ()->undo ();
429
+ mLayerLine ->undoStack ()->undo ();
430
+ QCOMPARE ( mLayerLine ->undoStack ()->index (), 1 );
431
+
432
+ QCOMPARE ( mLayerLine ->getFeature ( mFidLineF1 ).geometry (), QgsGeometry::fromWkt ( " LINESTRING(2 1, 1 1, 1 3)" ) );
412
433
}
413
434
414
435
void TestQgsVertexTool::testAddVertexDoubleClick ()
0 commit comments