Skip to content
Permalink
Browse files

Invalidate crs cache after adding a new user CRS

Refs #17257
  • Loading branch information
nyalldawson committed Nov 13, 2017
1 parent e0b2c27 commit 39851f4474b71a598ac9bcbf76a1084d1fe68c2f
Showing with 10 additions and 0 deletions.
  1. +2 −0 src/core/qgscoordinatereferencesystem.cpp
  2. +8 −0 tests/src/core/testqgscoordinatereferencesystem.cpp
@@ -1714,6 +1714,8 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
}
else
returnId = -1;

invalidateCache();
return returnId;
}

@@ -106,6 +106,7 @@ void TestQgsCoordinateReferenceSystem::initTestCase()
//
// init QGIS's paths - true means that all path will be inited from prefix
QgsApplication::init( mTempFolder );
QgsApplication::createDatabase();
QgsApplication::initQgis();
QgsApplication::showSettings();

@@ -820,6 +821,13 @@ void TestQgsCoordinateReferenceSystem::saveAsUserCrs()

long newId = userCrs.saveAsUserCrs( QStringLiteral( "babies first projection" ) );
QCOMPARE( newId, static_cast< long >( USER_CRS_START_ID ) );
QCOMPARE( userCrs.srsid(), newId );

// new CRS with same definition, check that it's matched to user crs
QgsCoordinateReferenceSystem userCrs2 = QgsCoordinateReferenceSystem::fromProj4( madeUpProjection );
QVERIFY( userCrs2.isValid() );
QCOMPARE( userCrs2.toProj4(), madeUpProjection );
QCOMPARE( userCrs2.srsid(), userCrs.srsid() );
}

QGSTEST_MAIN( TestQgsCoordinateReferenceSystem )

0 comments on commit 39851f4

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