Skip to content

Commit c1cf896

Browse files
committed
Fix invalid values for @map_extent_width/height (fix #15672)
1 parent e69dd9c commit c1cf896

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/core/qgsexpressioncontext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,8 @@ QgsExpressionContextScope* QgsExpressionContextUtils::mapSettingsScope( const Qg
779779
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_id", "canvas", true ) );
780780
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_rotation", mapSettings.rotation(), true ) );
781781
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_scale", mapSettings.scale(), true ) );
782-
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", mapSettings.extent().width(), true ) );
783-
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", mapSettings.extent().height(), true ) );
782+
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", mapSettings.visibleExtent().width(), true ) );
783+
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", mapSettings.visibleExtent().height(), true ) );
784784
QgsGeometry centerPoint = QgsGeometry::fromPoint( mapSettings.visibleExtent().center() );
785785
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_center", QVariant::fromValue( centerPoint ), true ) );
786786

tests/src/core/testqgs25drenderer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ bool TestQgs25DRenderer::imageCheck( const QString& theTestType )
146146
//use the QgsRenderChecker test utility class to
147147
//ensure the rendered output matches our control image
148148
mMapSettings.setExtent( mpPolysLayer->extent() );
149+
mMapSettings.setOutputSize( QSize( 400, 400 ) );
149150
mMapSettings.setOutputDpi( 96 );
150151
QgsExpressionContext context;
151152
context << QgsExpressionContextUtils::mapSettingsScope( mMapSettings );

0 commit comments

Comments
 (0)