Skip to content

Commit

Permalink
add test for QgsMapToolEdit
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti committed Apr 30, 2021
1 parent fc18428 commit f66d4b0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/src/gui/testqgsmaptooledit.cpp
Expand Up @@ -35,6 +35,7 @@ class TestQgsMapToolEdit : public QObject
void cleanup(); // will be called after every testfunction.

void checkDefaultZValue();
void checkDefaultMValue();

private:
QgsMapCanvas *mCanvas = nullptr;
Expand Down Expand Up @@ -76,5 +77,19 @@ void TestQgsMapToolEdit::checkDefaultZValue()
QCOMPARE( tool->defaultZValue(), z_value_for_test );
}

void TestQgsMapToolEdit::checkDefaultMValue()
{
QgsSettings settings;
settings.remove( QStringLiteral( "/qgis/digitizing/default_m_value" ) );

QgsMapToolEdit *tool = new QgsMapToolEdit( mCanvas );
QCOMPARE( tool->defaultMValue(), Qgis::DEFAULT_M_COORDINATE );

double m_value_for_test = Qgis::DEFAULT_M_COORDINATE + 1;
settings.setValue( QStringLiteral( "/qgis/digitizing/default_m_value" ), m_value_for_test );

QCOMPARE( tool->defaultMValue(), m_value_for_test );
}

QGSTEST_MAIN( TestQgsMapToolEdit )
#include "testqgsmaptooledit.moc"

0 comments on commit f66d4b0

Please sign in to comment.