Skip to content

Commit

Permalink
Expand size of recent CRS history to 30 items
Browse files Browse the repository at this point in the history
Because I'm sure I'm not the only one who regularly works with
more than 10 CRSes...
  • Loading branch information
nyalldawson committed Sep 23, 2020
1 parent 6b0fc7b commit 1c3347a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -3603,8 +3603,8 @@ void QgsCoordinateReferenceSystem::pushRecentCoordinateReferenceSystem( const Qg
recent.removeAll( crs );
recent.insert( 0, crs );

// trim to max 10 items
recent = recent.mid( 0, 10 );
// trim to max 30 items
recent = recent.mid( 0, 30 );
QStringList authids;
authids.reserve( recent.size() );
QStringList proj;
Expand Down
5 changes: 3 additions & 2 deletions tests/src/core/testqgscoordinatereferencesystem.cpp
Expand Up @@ -1564,13 +1564,13 @@ void TestQgsCoordinateReferenceSystem::recentProjections()
QCOMPARE( recent.at( 1 ).authid(), QStringLiteral( "EPSG:3111" ) );
QCOMPARE( recent.at( 2 ).authid(), QStringLiteral( "EPSG:4326" ) );

// list should be truncated after 10 entries
// list should be truncated after 30 entries
for ( int i = 32510; i < 32550; ++i )
{
QgsCoordinateReferenceSystem::pushRecentCoordinateReferenceSystem( QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:%1" ).arg( i ) ) );
}
recent = QgsCoordinateReferenceSystem::recentCoordinateReferenceSystems();
QCOMPARE( recent.size(), 10 );
QCOMPARE( recent.size(), 30 );
QCOMPARE( recent.at( 0 ).authid(), QStringLiteral( "EPSG:32549" ) );
QCOMPARE( recent.at( 1 ).authid(), QStringLiteral( "EPSG:32548" ) );
QCOMPARE( recent.at( 2 ).authid(), QStringLiteral( "EPSG:32547" ) );
Expand All @@ -1581,6 +1581,7 @@ void TestQgsCoordinateReferenceSystem::recentProjections()
QCOMPARE( recent.at( 7 ).authid(), QStringLiteral( "EPSG:32542" ) );
QCOMPARE( recent.at( 8 ).authid(), QStringLiteral( "EPSG:32541" ) );
QCOMPARE( recent.at( 9 ).authid(), QStringLiteral( "EPSG:32540" ) );
QCOMPARE( recent.constLast().authid(), QStringLiteral( "EPSG:32520" ) );
}

void TestQgsCoordinateReferenceSystem::displayIdentifier()
Expand Down

0 comments on commit 1c3347a

Please sign in to comment.