Skip to content
Permalink
Browse files

Followup 7d600bd, proper fix for failing labeling engine test

When labelFeatures is called outside of the renderering loop,
we need to make sure the renderer is prepared by calling
startRender.
  • Loading branch information
nyalldawson committed Nov 23, 2015
1 parent ffebfd9 commit f1458434fbadf8dd9b1caa45244f22f565f0a69a
@@ -257,6 +257,9 @@ QList<QgsLabelFeature*> QgsVectorLayerLabelProvider::labelFeatures( QgsRenderCon
if ( !prepare( ctx, attrNames ) )
return QList<QgsLabelFeature*>();

if ( mRenderer )
mRenderer->startRender( ctx, mFields );

QgsRectangle layerExtent = ctx.extent();
if ( mSettings.ct )
layerExtent = mSettings.ct->transformBoundingBox( ctx.extent(), QgsCoordinateTransform::ReverseTransform );
@@ -278,6 +281,9 @@ QList<QgsLabelFeature*> QgsVectorLayerLabelProvider::labelFeatures( QgsRenderCon
registerFeature( fet, ctx, obstacleGeometry.data() );
}

if ( mRenderer )
mRenderer->stopRender( ctx );

return mLabels;
}

@@ -243,8 +243,7 @@ QgsSymbolV2* QgsCategorizedSymbolRendererV2::originalSymbolForFeature( QgsFeatur
QVariant value;
if ( mAttrNum == -1 )
{
if ( !mExpression.data() )
return 0;
Q_ASSERT( mExpression.data() );

value = mExpression->evaluate( &context.expressionContext() );
}
@@ -142,7 +142,7 @@ void TestQgsLabelingEngineV2::testBasic()

vl->setCustomProperty( "labeling/enabled", false );

QVERIFY( imageCheck( "labeling_basic_loop", img2, 0 ) );
QVERIFY( imageCheck( "labeling_basic", img2, 0 ) );
}


Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit f145843

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