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)

(cherry picked from commit 24d773c)
  • Loading branch information
nyalldawson committed Dec 13, 2019
1 parent d1e53f1 commit 5177b7a7224c2905cc75b450f852a64e14bdcfb6
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 5177b7a

Please sign in to comment.
You can’t perform that action at this time.