Skip to content
Permalink
Browse files

Test with selection

  • Loading branch information
nyalldawson committed Jan 12, 2021
1 parent d525f88 commit bf56a6b6611c67e0b2c2843da0877382c29ee3f8
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/src/app/testqgsmaptoolscalefeature.cpp
@@ -47,6 +47,7 @@ class TestQgsMapToolScaleFeature: public QObject
void testScaleFeatureWithAnchor();
void testCancelManualAnchor();
void testScaleFeatureWithAnchorSetAfterStart();
void testScaleSelectedFeatures();

private:
QgisApp *mQgisApp = nullptr;
@@ -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.
You can’t perform that action at this time.