Skip to content
Permalink
Browse files

Fix invalid values for @map_extent_width/height (fix #15672)

(cherry-picked from c1cf896)
  • Loading branch information
nyalldawson committed Oct 12, 2016
1 parent b40b491 commit 3c43bb5ebf13ecbde26a5a55e0eaa1c45c6a69c1
Showing with 3 additions and 2 deletions.
  1. +2 −2 src/core/qgsexpressioncontext.cpp
  2. +1 −0 tests/src/core/testqgs25drenderer.cpp
@@ -759,8 +759,8 @@ QgsExpressionContextScope* QgsExpressionContextUtils::mapSettingsScope( const Qg
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_id", "canvas", true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_rotation", mapSettings.rotation(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_scale", mapSettings.scale(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", mapSettings.extent().width(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", mapSettings.extent().height(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_width", mapSettings.visibleExtent().width(), true ) );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_height", mapSettings.visibleExtent().height(), true ) );
QgsGeometry* centerPoint = QgsGeometry::fromPoint( mapSettings.visibleExtent().center() );
scope->addVariable( QgsExpressionContextScope::StaticVariable( "map_extent_center", QVariant::fromValue( *centerPoint ), true ) );
delete centerPoint;
@@ -146,6 +146,7 @@ bool TestQgs25DRenderer::imageCheck( const QString& theTestType )
//use the QgsRenderChecker test utility class to
//ensure the rendered output matches our control image
mMapSettings.setExtent( mpPolysLayer->extent() );
mMapSettings.setOutputSize( QSize( 400, 400 ) );
mMapSettings.setOutputDpi( 96 );
QgsExpressionContext context;
context << QgsExpressionContextUtils::mapSettingsScope( mMapSettings );

0 comments on commit 3c43bb5

Please sign in to comment.
You can’t perform that action at this time.