|
@@ -50,6 +50,7 @@ class TestQgsProject : public QObject |
|
|
void testEmbeddedLayerGroupFromQgz(); |
|
|
void projectSaveUser(); |
|
|
void testCrsExpressions(); |
|
|
void testCrsValidAfterReadingProjectFile(); |
|
|
}; |
|
|
|
|
|
void TestQgsProject::init() |
|
@@ -618,9 +619,38 @@ void TestQgsProject::testSetGetCrs() |
|
|
#else |
|
|
QCOMPARE( p.ellipsoid(), QStringLiteral( "bessel" ) ); |
|
|
#endif |
|
|
} |
|
|
|
|
|
crsChangedSpy.clear(); |
|
|
ellipsoidChangedSpy.clear(); |
|
|
void TestQgsProject::testCrsValidAfterReadingProjectFile() |
|
|
{ |
|
|
QgsProject p; |
|
|
QSignalSpy crsChangedSpy( &p, &QgsProject::crsChanged ); |
|
|
|
|
|
// - new project |
|
|
// - set CRS tp 4326, the crs changes |
|
|
// - save the project |
|
|
// - clear() |
|
|
// - load the project, the CRS should be 4326 |
|
|
QTemporaryDir dir; |
|
|
QVERIFY( dir.isValid() ); |
|
|
// on mac the returned path was not canonical and the resolver failed to convert paths properly |
|
|
QString dirPath = QFileInfo( dir.path() ).canonicalFilePath(); |
|
|
QString projectFilename = dirPath + "/project.qgs"; |
|
|
|
|
|
p.setCrs( QgsCoordinateReferenceSystem::fromEpsgId( 4326 ) ); |
|
|
|
|
|
QCOMPARE( crsChangedSpy.count(), 1 ); |
|
|
QCOMPARE( p.crs(), QgsCoordinateReferenceSystem::fromEpsgId( 4326 ) ); |
|
|
|
|
|
QVERIFY( p.write( projectFilename ) ); |
|
|
p.clear(); |
|
|
|
|
|
QCOMPARE( p.crs(), QgsCoordinateReferenceSystem() ); |
|
|
QCOMPARE( crsChangedSpy.count(), 1 ); |
|
|
|
|
|
QVERIFY( p.read( projectFilename ) ); |
|
|
QCOMPARE( p.crs(), QgsCoordinateReferenceSystem::fromEpsgId( 4326 ) ); |
|
|
QCOMPARE( crsChangedSpy.count(), 2 ); |
|
|
} |
|
|
|
|
|
void TestQgsProject::testCrsExpressions() |
|
|