Skip to content

Commit

Permalink
[locator] Fix broken parsing of google maps URL Z values
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Jan 8, 2021
1 parent d73fd7c commit 0090dac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/locator/qgsinbuiltlocatorfilters.cpp
Expand Up @@ -1100,9 +1100,9 @@ void QgsGotoLocatorFilter::fetchResults( const QString &string, const QgsLocator

if ( okX && okY )
{
if ( match.captured( 2 ) == QChar( 'z' ) && scales.contains( params.at( 2 ).toInt() ) )
if ( match.captured( 2 ) == QChar( 'z' ) && scales.contains( static_cast<int>( params.at( 2 ).toDouble() ) ) )
{
scale = scales.value( params.at( 2 ).toInt() );
scale = scales.value( static_cast<int>( params.at( 2 ).toDouble() ) );
}
else if ( match.captured( 2 ) == QChar( 'm' ) )
{
Expand Down
2 changes: 1 addition & 1 deletion tests/src/app/testqgsapplocatorfilters.cpp
Expand Up @@ -391,7 +391,7 @@ void TestQgsAppLocatorFilters::testGoto()
QCOMPARE( results.at( 0 ).userData.toMap()[QStringLiteral( "scale" )].toDouble(), 22569.0 );

// Google Maps
results = gatherResults( &filter, QStringLiteral( "https://www.google.com/maps/@44.5546,6.4936,15z" ), QgsLocatorContext() );
results = gatherResults( &filter, QStringLiteral( "https://www.google.com/maps/@44.5546,6.4936,15.25z" ), QgsLocatorContext() );
QCOMPARE( results.count(), 1 );
QCOMPARE( results.at( 0 ).displayString, QObject::tr( "Go to 6.4936° 44.5546° at scale 1:22569 (EPSG:4326 - WGS 84)" ) );
QCOMPARE( results.at( 0 ).userData.toMap()[QStringLiteral( "point" )].value<QgsPointXY>(), QgsPointXY( 6.4936, 44.5546 ) );
Expand Down

0 comments on commit 0090dac

Please sign in to comment.