Skip to content
Permalink
Browse files

Merge pull request #37587 from mhugent/max_symbol_size_unit_test

Add unit test for maximum symbol size in legend
  • Loading branch information
mhugent committed Jul 6, 2020
2 parents 7c89280 + afdfec3 commit 01b345c19974e61e6ca00a8d9b6a9e82edfd562b
@@ -141,6 +141,7 @@ class TestQgsLegendRenderer : public QObject
void testSpacing();
void testEffects();
void testBigMarker();
void testBigMarkerMaxSize();
void testOverrideSymbol();

void testRightAlignText();
@@ -496,6 +497,24 @@ void TestQgsLegendRenderer::testBigMarker()
QVERIFY( _verifyImage( testName, mReport ) );
}

void TestQgsLegendRenderer::testBigMarkerMaxSize()
{
QString testName = QStringLiteral( "legend_big_marker_max_size" );
QgsMarkerSymbol *sym = new QgsMarkerSymbol();
sym->setColor( Qt::red );
sym->setSize( sym->size() * 6 );
QgsCategorizedSymbolRenderer *catRenderer = dynamic_cast<QgsCategorizedSymbolRenderer *>( mVL3->renderer() );
QVERIFY( catRenderer );
catRenderer->updateCategorySymbol( 0, sym );

QgsLayerTreeModel legendModel( mRoot );
QgsLegendSettings settings;
settings.setMaxSymbolSize( 5 ); //restrict maximum size to 5 mm
_setStandardTestFont( settings, QStringLiteral( "Bold" ) );
_renderLegend( testName, &legendModel, settings );
QVERIFY( _verifyImage( testName, mReport ) );
}

void TestQgsLegendRenderer::testOverrideSymbol()
{
QString testName = QStringLiteral( "legend_override_symbol" );
Binary file not shown.

0 comments on commit 01b345c

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