Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix failing tests
  • Loading branch information
olivierdalang committed May 9, 2019
1 parent ddb9d3a commit 71a2766
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/src/app/testqgsvertextool.cpp
Expand Up @@ -387,6 +387,7 @@ void TestQgsVertexTool::testAddVertexAtEndpoint()
mouseMove( 1, 3 ); // first we need to move to the vertex
mouseClick( 1, 3 + offsetInMapUnits, Qt::LeftButton );
mouseClick( 2, 3, Qt::LeftButton );
mouseClick( 2, 3, Qt::RightButton ); // we need a right click to stop adding new nodes

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

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

QCOMPARE( mLayerLine->getFeature( mFidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 1, 1 1, 1 3)" ) );

// add three vertices at once

mouseMove( 2, 1 ); // first we need to move to the vertex
mouseClick( 2 + offsetInMapUnits, 1, Qt::LeftButton );
mouseClick( 2, 2, Qt::LeftButton );
mouseClick( 2, 3, Qt::LeftButton );
mouseClick( 2, 4, Qt::LeftButton );
mouseClick( 2, 2, Qt::RightButton ); // we need a right click to stop adding new nodes

QCOMPARE( mLayerLine->undoStack()->index(), 4 );
QCOMPARE( mLayerLine->getFeature( mFidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 4, 2 3, 2 2, 2 1, 1 1, 1 3)" ) );

mLayerLine->undoStack()->undo();
mLayerLine->undoStack()->undo();
mLayerLine->undoStack()->undo();
QCOMPARE( mLayerLine->undoStack()->index(), 1 );

QCOMPARE( mLayerLine->getFeature( mFidLineF1 ).geometry(), QgsGeometry::fromWkt( "LINESTRING(2 1, 1 1, 1 3)" ) );
}

void TestQgsVertexTool::testAddVertexDoubleClick()
Expand Down

0 comments on commit 71a2766

Please sign in to comment.