Skip to content

Commit 71a2766

Browse files
committedMay 9, 2019
fix failing tests
1 parent ddb9d3a commit 71a2766

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
 

‎tests/src/app/testqgsvertextool.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ void TestQgsVertexTool::testAddVertexAtEndpoint()
387387
mouseMove( 1, 3 ); // first we need to move to the vertex
388388
mouseClick( 1, 3 + offsetInMapUnits, Qt::LeftButton );
389389
mouseClick( 2, 3, Qt::LeftButton );
390+
mouseClick( 2, 3, Qt::RightButton ); // we need a right click to stop adding new nodes
390391

391392
QCOMPARE( mLayerLine->undoStack()->index(), 2 );
392393
QCOMPARE( mLayerLine->getFeature( mFidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 1, 1 1, 1 3, 2 3)" ) );
@@ -401,6 +402,7 @@ void TestQgsVertexTool::testAddVertexAtEndpoint()
401402
mouseMove( 2, 1 ); // first we need to move to the vertex
402403
mouseClick( 2 + offsetInMapUnits, 1, Qt::LeftButton );
403404
mouseClick( 2, 2, Qt::LeftButton );
405+
mouseClick( 2, 2, Qt::RightButton ); // we need a right click to stop adding new nodes
404406

405407
QCOMPARE( mLayerLine->undoStack()->index(), 2 );
406408
QCOMPARE( mLayerLine->getFeature( mFidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 2, 2 1, 1 1, 1 3)" ) );
@@ -409,6 +411,25 @@ void TestQgsVertexTool::testAddVertexAtEndpoint()
409411
QCOMPARE( mLayerLine->undoStack()->index(), 1 );
410412

411413
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)" ) );
412433
}
413434

414435
void TestQgsVertexTool::testAddVertexDoubleClick()

0 commit comments

Comments
 (0)
Please sign in to comment.