Skip to content

Commit

Permalink
Test with selection
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 12, 2021
1 parent d525f88 commit bf56a6b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/src/app/testqgsmaptoolscalefeature.cpp
Expand Up @@ -47,6 +47,7 @@ class TestQgsMapToolScaleFeature: public QObject
void testScaleFeatureWithAnchor();
void testCancelManualAnchor();
void testScaleFeatureWithAnchorSetAfterStart();
void testScaleSelectedFeatures();

private:
QgisApp *mQgisApp = nullptr;
Expand Down Expand Up @@ -211,6 +212,23 @@ void TestQgsMapToolScaleFeature::testScaleFeatureWithAnchorSetAfterStart()
mLayerBase->undoStack()->undo();
}

void TestQgsMapToolScaleFeature::testScaleSelectedFeatures()
{
TestQgsMapToolUtils utils( mScaleTool );
mLayerBase->selectAll();

// resize
utils.mouseClick( -2, -1, Qt::LeftButton, Qt::KeyboardModifiers(), true );
utils.mouseMove( -2.5, -0.5 );
utils.mouseClick( -2.5, -0.5, Qt::LeftButton, Qt::KeyboardModifiers(), true );

QCOMPARE( mLayerBase->getFeature( 1 ).geometry().asWkt( 2 ), QStringLiteral( "Polygon ((-2.54 -2.18, -2.54 -1, -1.36 -1, -1.36 -2.18, -2.54 -2.18))" ) );
QCOMPARE( mLayerBase->getFeature( 2 ).geometry().asWkt( 2 ), QStringLiteral( "Polygon ((1.12 1.12, 1.12 6.07, 2.3 6.07, 2.3 1.12, 1.12 1.12))" ) );

mLayerBase->removeSelection();
mLayerBase->undoStack()->undo();
}


QGSTEST_MAIN( TestQgsMapToolScaleFeature )
#include "testqgsmaptoolscalefeature.moc"

0 comments on commit bf56a6b

Please sign in to comment.