Skip to content

Commit

Permalink
Add unit tests that project ellipsoid survives the trip through the p…
Browse files Browse the repository at this point in the history
…roject properties dialog

(test needs adapting for proj 6)
  • Loading branch information
nyalldawson committed Dec 17, 2019
1 parent 2cc64f9 commit 24d773c
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/src/app/testqgsprojectproperties.cpp
Expand Up @@ -38,6 +38,7 @@ class TestQgsProjectProperties : public QObject
void cleanup() {} // will be called after every testfunction.

void testProjectPropertiesDirty();
void testEllipsoidChange();

private:
QgisApp *mQgisApp = nullptr;
Expand Down Expand Up @@ -82,6 +83,49 @@ void TestQgsProjectProperties::testProjectPropertiesDirty()
QCOMPARE( QgsProject::instance()->isDirty(), false );
}

void TestQgsProjectProperties::testEllipsoidChange()
{
QgsProject::instance()->clear();
QgsProject::instance()->setCrs( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) ) );
QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "NONE" ) );

std::unique_ptr< QgsProjectProperties > pp = qgis::make_unique< QgsProjectProperties >( mQgisApp->mapCanvas() );
pp->apply();
pp.reset();
QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "NONE" ) );

QgsProject::instance()->setEllipsoid( QStringLiteral( "bessel" ) );
pp = qgis::make_unique< QgsProjectProperties >( mQgisApp->mapCanvas() );
pp->apply();
pp.reset();
QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "bessel" ) );

QgsProject::instance()->setEllipsoid( QStringLiteral( "IGNF:ELG052" ) );
pp = qgis::make_unique< QgsProjectProperties >( mQgisApp->mapCanvas() );
pp->apply();
pp.reset();
QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "IGNF:ELG052" ) );

QgsProject::instance()->setEllipsoid( QStringLiteral( "IGNF:ELG037" ) );
pp = qgis::make_unique< QgsProjectProperties >( mQgisApp->mapCanvas() );
pp->apply();
pp.reset();
QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "IGNF:ELG037" ) );

QgsProject::instance()->setEllipsoid( QStringLiteral( "NONE" ) );
pp = qgis::make_unique< QgsProjectProperties >( mQgisApp->mapCanvas() );
pp->apply();
pp.reset();
QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "NONE" ) );

QgsProject::instance()->setEllipsoid( QStringLiteral( "PARAMETER:55:66" ) );
pp = qgis::make_unique< QgsProjectProperties >( mQgisApp->mapCanvas() );
pp->apply();
pp.reset();
QCOMPARE( QgsProject::instance()->ellipsoid(), QStringLiteral( "PARAMETER:55:66" ) );

}

QGSTEST_MAIN( TestQgsProjectProperties )

#include "testqgsprojectproperties.moc"

0 comments on commit 24d773c

Please sign in to comment.