Skip to content
Permalink
Browse files

Add unit tests that project ellipsoid survives the trip through the p…

…roject properties dialog

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

void testProjectPropertiesDirty();
void testEllipsoidChange();

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