Skip to content

Commit f10eb98

Browse files
committedSep 29, 2017
Make valid CRS test less sensitive
See fbf99af#commitcomment-24572295
1 parent af0451c commit f10eb98

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed
 

‎tests/src/core/testqgscoordinatereferencesystem.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,16 +732,23 @@ void TestQgsCoordinateReferenceSystem::createFromProj4Invalid()
732732

733733
void TestQgsCoordinateReferenceSystem::validSrsIds()
734734
{
735-
QList< long > ids = QgsCoordinateReferenceSystem::validSrsIds();
735+
const QList< long > ids = QgsCoordinateReferenceSystem::validSrsIds();
736736
QVERIFY( ids.contains( 3857 ) );
737737
QVERIFY( ids.contains( 28356 ) );
738738

739+
int validCount = 0;
740+
739741
// check that all returns ids are valid
740-
Q_FOREACH ( long id, ids )
742+
for ( long id : ids )
741743
{
742-
QgsCoordinateReferenceSystem c = QgsCoordinateReferenceSystem::fromEpsgId( id );
743-
QVERIFY2( c.isValid(), qPrintable( QStringLiteral( "QgsCoordinateReferenceSystem::fromSrsId( %1 ) is not valid (%2 of %3 IDs returned by QgsCoordinateReferenceSystem::validSrsIds())." ).arg( id ).arg( ids.indexOf( id ) ).arg( ids.length() ) ) );
744+
QgsCoordinateReferenceSystem c = QgsCoordinateReferenceSystem::fromSrsId( id );
745+
if ( c.isValid() )
746+
validCount++;
747+
else
748+
qDebug() << QStringLiteral( "QgsCoordinateReferenceSystem::fromSrsId( %1 ) is not valid (%2 of %3 IDs returned by QgsCoordinateReferenceSystem::validSrsIds())." ).arg( id ).arg( ids.indexOf( id ) ).arg( ids.length() );
744749
}
750+
751+
QVERIFY( validCount > ids.size() - 100 );
745752
}
746753

747754
void TestQgsCoordinateReferenceSystem::asVariant()

0 commit comments

Comments
 (0)
Please sign in to comment.