Skip to content

Commit ce2a84d

Browse files
committedNov 18, 2015
Followup 2ac5933 with more data defined fixes
2ac5933 fixed the regression in 2.12, but there were more underlying issues from <2.8 causing sub symbols with data defined properties to be ignored. Add some tests. (refs #13707) (cherry-picked from 9e84fca)
1 parent 6bb6929 commit ce2a84d

File tree

14 files changed

+411
-10
lines changed

14 files changed

+411
-10
lines changed
 

‎python/core/symbology-ng/qgsfillsymbollayerv2.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,8 @@ class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2
457457
virtual double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext& context ) const;
458458
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
459459
virtual Qt::PenStyle dxfPenStyle() const;
460+
461+
QSet<QString> usedAttributes() const;
460462
};
461463

462464
/** \ingroup core

‎python/core/symbology-ng/qgssymbolv2.sip

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,11 @@ class QgsSymbolV2
160160

161161
QSet<QString> usedAttributes() const;
162162

163+
/** Returns whether the symbol utilises any data defined properties.
164+
* @note added in QGIS 2.12
165+
*/
166+
bool hasDataDefinedProperties() const;
167+
163168
void setLayer( const QgsVectorLayer* layer );
164169
const QgsVectorLayer* layer() const;
165170

‎src/core/symbology-ng/qgsfillsymbollayerv2.cpp

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,6 +1701,14 @@ Qt::PenStyle QgsImageFillSymbolLayer::dxfPenStyle() const
17011701
#endif //0
17021702
}
17031703

1704+
QSet<QString> QgsImageFillSymbolLayer::usedAttributes() const
1705+
{
1706+
QSet<QString> attr = QgsFillSymbolLayerV2::usedAttributes();
1707+
if ( mOutline )
1708+
attr.unite( mOutline->usedAttributes() );
1709+
return attr;
1710+
}
1711+
17041712

17051713
//QgsSVGFillSymbolLayer
17061714

@@ -2319,7 +2327,7 @@ QgsSymbolV2* QgsLinePatternFillSymbolLayer::subSymbol()
23192327

23202328
QSet<QString> QgsLinePatternFillSymbolLayer::usedAttributes() const
23212329
{
2322-
QSet<QString> attr = QgsFillSymbolLayerV2::usedAttributes();
2330+
QSet<QString> attr = QgsImageFillSymbolLayer::usedAttributes();
23232331
if ( mFillLineSymbol )
23242332
attr.unite( mFillLineSymbol->usedAttributes() );
23252333
return attr;
@@ -2875,7 +2883,8 @@ QString QgsLinePatternFillSymbolLayer::ogrFeatureStyleWidth( double widthScaleFa
28752883
void QgsLinePatternFillSymbolLayer::applyDataDefinedSettings( QgsSymbolV2RenderContext &context )
28762884
{
28772885
if ( !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_LINEANGLE ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISTANCE )
2878-
&& !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_LINEWIDTH ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR ) )
2886+
&& !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_LINEWIDTH ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_COLOR )
2887+
&& ( !mFillLineSymbol || !mFillLineSymbol->hasDataDefinedProperties() ) )
28792888
{
28802889
return; //no data defined settings
28812890
}
@@ -3288,14 +3297,12 @@ bool QgsPointPatternFillSymbolLayer::setSubSymbol( QgsSymbolV2* symbol )
32883297

32893298
void QgsPointPatternFillSymbolLayer::applyDataDefinedSettings( QgsSymbolV2RenderContext &context )
32903299
{
3291-
#if 0
3292-
// TODO: enable but check also if mMarkerSymbol has data defined properties
32933300
if ( !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISTANCE_X ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISTANCE_Y )
3294-
&& !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISPLACEMENT_X ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISPLACEMENT_Y ) )
3301+
&& !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISPLACEMENT_X ) && !hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISPLACEMENT_Y )
3302+
&& ( !mMarkerSymbol || !mMarkerSymbol->hasDataDefinedProperties() ) )
32953303
{
32963304
return;
32973305
}
3298-
#endif
32993306

33003307
double distanceX = mDistanceX;
33013308
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_DISTANCE_X ) )
@@ -3331,7 +3338,7 @@ double QgsPointPatternFillSymbolLayer::estimateMaxBleed() const
33313338

33323339
QSet<QString> QgsPointPatternFillSymbolLayer::usedAttributes() const
33333340
{
3334-
QSet<QString> attributes = QgsSymbolLayerV2::usedAttributes();
3341+
QSet<QString> attributes = QgsImageFillSymbolLayer::usedAttributes();
33353342

33363343
if ( mMarkerSymbol )
33373344
attributes.unite( mMarkerSymbol->usedAttributes() );
@@ -3457,9 +3464,7 @@ bool QgsCentroidFillSymbolLayerV2::setSubSymbol( QgsSymbolV2* symbol )
34573464

34583465
QSet<QString> QgsCentroidFillSymbolLayerV2::usedAttributes() const
34593466
{
3460-
QSet<QString> attributes;
3461-
3462-
attributes.unite( QgsSymbolLayerV2::usedAttributes() );
3467+
QSet<QString> attributes = QgsFillSymbolLayerV2::usedAttributes();
34633468

34643469
if ( mMarker )
34653470
attributes.unite( mMarker->usedAttributes() );

‎src/core/symbology-ng/qgsfillsymbollayerv2.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,8 @@ class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2
571571
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const override;
572572
virtual Qt::PenStyle dxfPenStyle() const override;
573573

574+
QSet<QString> usedAttributes() const override;
575+
574576
protected:
575577
QBrush mBrush;
576578
double mNextAngle; // mAngle / data defined angle

‎src/core/symbology-ng/qgssymbolv2.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,16 @@ QSet<QString> QgsSymbolV2::usedAttributes() const
490490
return attributes;
491491
}
492492

493+
bool QgsSymbolV2::hasDataDefinedProperties() const
494+
{
495+
Q_FOREACH ( QgsSymbolLayerV2* layer, mLayers )
496+
{
497+
if ( layer->hasDataDefinedProperties() )
498+
return true;
499+
}
500+
return false;
501+
}
502+
493503
////////////////////
494504

495505

‎src/core/symbology-ng/qgssymbolv2.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,11 @@ class CORE_EXPORT QgsSymbolV2
217217

218218
QSet<QString> usedAttributes() const;
219219

220+
/** Returns whether the symbol utilises any data defined properties.
221+
* @note added in QGIS 2.12
222+
*/
223+
bool hasDataDefinedProperties() const;
224+
220225
//! @note the layer will be NULL after stopRender
221226
void setLayer( const QgsVectorLayer* layer ) { mLayer = layer; }
222227
const QgsVectorLayer* layer() const { return mLayer; }

‎tests/src/core/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ ADD_QGIS_TEST(invertedpolygontest testqgsinvertedpolygonrenderer.cpp )
134134
ADD_QGIS_TEST(labelingenginev2 testqgslabelingenginev2.cpp)
135135
ADD_QGIS_TEST(layertree testqgslayertree.cpp)
136136
ADD_QGIS_TEST(legendrenderertest testqgslegendrenderer.cpp )
137+
ADD_QGIS_TEST(linefillsymboltest testqgslinefillsymbol.cpp )
137138
ADD_QGIS_TEST(maplayerstylemanager testqgsmaplayerstylemanager.cpp )
138139
ADD_QGIS_TEST(maplayertest testqgsmaplayer.cpp)
139140
# ADD_QGIS_TEST(maprendererjobtest testmaprendererjob.cpp )
@@ -147,6 +148,7 @@ ADD_QGIS_TEST(painteffectregistrytest testqgspainteffectregistry.cpp)
147148
ADD_QGIS_TEST(painteffecttest testqgspainteffect.cpp)
148149
ADD_QGIS_TEST(pallabelingtest testqgspallabeling.cpp)
149150
ADD_QGIS_TEST(pointlocatortest testqgspointlocator.cpp )
151+
ADD_QGIS_TEST(pointpatternfillsymboltest testqgspointpatternfillsymbol.cpp )
150152
ADD_QGIS_TEST(pointtest testqgspoint.cpp)
151153
ADD_QGIS_TEST(projecttest testqgsproject.cpp)
152154
ADD_QGIS_TEST(qgistest testqgis.cpp)
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
/***************************************************************************
2+
testqgslinefillsymbol.cpp
3+
-------------------------
4+
Date : Nov 2015
5+
Copyright : (C) 2015 by Nyall Dawson
6+
Email : nyall dot dawson at gmail dot com
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
#include <QtTest/QtTest>
16+
#include <QObject>
17+
#include <QString>
18+
#include <QStringList>
19+
#include <QApplication>
20+
#include <QFileInfo>
21+
#include <QDir>
22+
#include <QDesktopServices>
23+
24+
//qgis includes...
25+
#include <qgsmaprenderer.h>
26+
#include <qgsmaplayer.h>
27+
#include <qgsvectorlayer.h>
28+
#include <qgsapplication.h>
29+
#include <qgsproviderregistry.h>
30+
#include <qgsmaplayerregistry.h>
31+
#include <qgssymbolv2.h>
32+
#include <qgssinglesymbolrendererv2.h>
33+
#include <qgsfillsymbollayerv2.h>
34+
#include "qgslinesymbollayerv2.h"
35+
#include "qgsdatadefined.h"
36+
37+
//qgis test includes
38+
#include "qgsrenderchecker.h"
39+
40+
/** \ingroup UnitTests
41+
* This is a unit test for line fill symbol types.
42+
*/
43+
class TestQgsLineFillSymbol : public QObject
44+
{
45+
Q_OBJECT
46+
47+
public:
48+
TestQgsLineFillSymbol()
49+
: mTestHasError( false )
50+
, mpPolysLayer( 0 )
51+
, mLineFill( 0 )
52+
, mFillSymbol( 0 )
53+
, mSymbolRenderer( 0 )
54+
{}
55+
56+
private slots:
57+
void initTestCase();// will be called before the first testfunction is executed.
58+
void cleanupTestCase();// will be called after the last testfunction was executed.
59+
void init() {} // will be called before each testfunction is executed.
60+
void cleanup() {} // will be called after every testfunction.
61+
62+
void lineFillSymbol();
63+
void dataDefinedSubSymbol();
64+
65+
private:
66+
bool mTestHasError;
67+
68+
bool imageCheck( const QString& theType );
69+
QgsMapSettings mMapSettings;
70+
QgsVectorLayer * mpPolysLayer;
71+
QgsLinePatternFillSymbolLayer* mLineFill;
72+
QgsFillSymbolV2* mFillSymbol;
73+
QgsSingleSymbolRendererV2* mSymbolRenderer;
74+
QString mTestDataDir;
75+
QString mReport;
76+
};
77+
78+
79+
void TestQgsLineFillSymbol::initTestCase()
80+
{
81+
mTestHasError = false;
82+
// init QGIS's paths - true means that all path will be inited from prefix
83+
QgsApplication::init();
84+
QgsApplication::initQgis();
85+
QgsApplication::showSettings();
86+
87+
//create some objects that will be used in all tests...
88+
QString myDataDir( TEST_DATA_DIR ); //defined in CmakeLists.txt
89+
mTestDataDir = myDataDir + '/';
90+
91+
//
92+
//create a poly layer that will be used in all tests...
93+
//
94+
QString myPolysFileName = mTestDataDir + "polys.shp";
95+
QFileInfo myPolyFileInfo( myPolysFileName );
96+
mpPolysLayer = new QgsVectorLayer( myPolyFileInfo.filePath(),
97+
myPolyFileInfo.completeBaseName(), "ogr" );
98+
99+
QgsVectorSimplifyMethod simplifyMethod;
100+
simplifyMethod.setSimplifyHints( QgsVectorSimplifyMethod::NoSimplification );
101+
mpPolysLayer->setSimplifyMethod( simplifyMethod );
102+
103+
// Register the layer with the registry
104+
QgsMapLayerRegistry::instance()->addMapLayers(
105+
QList<QgsMapLayer *>() << mpPolysLayer );
106+
107+
//setup gradient fill
108+
mLineFill = new QgsLinePatternFillSymbolLayer();
109+
mFillSymbol = new QgsFillSymbolV2();
110+
mFillSymbol->changeSymbolLayer( 0, mLineFill );
111+
mSymbolRenderer = new QgsSingleSymbolRendererV2( mFillSymbol );
112+
mpPolysLayer->setRendererV2( mSymbolRenderer );
113+
114+
// We only need maprender instead of mapcanvas
115+
// since maprender does not require a qui
116+
// and is more light weight
117+
//
118+
mMapSettings.setLayers( QStringList() << mpPolysLayer->id() );
119+
mReport += "<h1>Gradient Renderer Tests</h1>\n";
120+
121+
}
122+
void TestQgsLineFillSymbol::cleanupTestCase()
123+
{
124+
QString myReportFile = QDir::tempPath() + "/qgistest.html";
125+
QFile myFile( myReportFile );
126+
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
127+
{
128+
QTextStream myQTextStream( &myFile );
129+
myQTextStream << mReport;
130+
myFile.close();
131+
}
132+
133+
QgsApplication::exitQgis();
134+
}
135+
136+
void TestQgsLineFillSymbol::lineFillSymbol()
137+
{
138+
mReport += "<h2>Line fill symbol renderer test</h2>\n";
139+
140+
QgsStringMap properties;
141+
properties.insert( "color", "0,0,0,255" );
142+
properties.insert( "width", "0.3" );
143+
properties.insert( "capstyle", "flat" );
144+
QgsLineSymbolV2* lineSymbol = QgsLineSymbolV2::createSimple( properties );
145+
146+
mLineFill->setSubSymbol( lineSymbol );
147+
QVERIFY( imageCheck( "symbol_linefill" ) );
148+
}
149+
150+
void TestQgsLineFillSymbol::dataDefinedSubSymbol()
151+
{
152+
mReport += "<h2>Line fill symbol data defined sub symbol test</h2>\n";
153+
154+
QgsStringMap properties;
155+
properties.insert( "color", "0,0,0,255" );
156+
properties.insert( "width", "0.3" );
157+
properties.insert( "capstyle", "flat" );
158+
QgsLineSymbolV2* lineSymbol = QgsLineSymbolV2::createSimple( properties );
159+
lineSymbol->symbolLayer( 0 )->setDataDefinedProperty( "color", new QgsDataDefined( QString( "if(\"Name\" ='Lake','#ff0000','#ff00ff')" ) ) );
160+
mLineFill->setSubSymbol( lineSymbol );
161+
QVERIFY( imageCheck( "datadefined_subsymbol" ) );
162+
}
163+
164+
//
165+
// Private helper functions not called directly by CTest
166+
//
167+
168+
169+
bool TestQgsLineFillSymbol::imageCheck( const QString& theTestType )
170+
{
171+
//use the QgsRenderChecker test utility class to
172+
//ensure the rendered output matches our control image
173+
mMapSettings.setExtent( mpPolysLayer->extent() );
174+
mMapSettings.setOutputDpi( 96 );
175+
QgsRenderChecker myChecker;
176+
myChecker.setControlPathPrefix( "symbol_linefill" );
177+
myChecker.setControlName( "expected_" + theTestType );
178+
myChecker.setMapSettings( mMapSettings );
179+
bool myResultFlag = myChecker.runTest( theTestType );
180+
mReport += myChecker.report();
181+
return myResultFlag;
182+
}
183+
184+
QTEST_MAIN( TestQgsLineFillSymbol )
185+
#include "testqgslinefillsymbol.moc"
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
/***************************************************************************
2+
testqgspointpatternfillsymbol.cpp
3+
---------------------------------
4+
Date : Nov 2015
5+
Copyright : (C) 2015 by Nyall Dawson
6+
Email : nyall dot dawson at gmail dot com
7+
***************************************************************************
8+
* *
9+
* This program is free software; you can redistribute it and/or modify *
10+
* it under the terms of the GNU General Public License as published by *
11+
* the Free Software Foundation; either version 2 of the License, or *
12+
* (at your option) any later version. *
13+
* *
14+
***************************************************************************/
15+
#include <QtTest/QtTest>
16+
#include <QObject>
17+
#include <QString>
18+
#include <QStringList>
19+
#include <QApplication>
20+
#include <QFileInfo>
21+
#include <QDir>
22+
#include <QDesktopServices>
23+
24+
//qgis includes...
25+
#include <qgsmaprenderer.h>
26+
#include <qgsmaplayer.h>
27+
#include <qgsvectorlayer.h>
28+
#include <qgsapplication.h>
29+
#include <qgsproviderregistry.h>
30+
#include <qgsmaplayerregistry.h>
31+
#include <qgssymbolv2.h>
32+
#include <qgssinglesymbolrendererv2.h>
33+
#include <qgsfillsymbollayerv2.h>
34+
#include "qgslinesymbollayerv2.h"
35+
#include "qgsdatadefined.h"
36+
37+
//qgis test includes
38+
#include "qgsrenderchecker.h"
39+
40+
/** \ingroup UnitTests
41+
* This is a unit test for point pattern fill symbol types.
42+
*/
43+
class TestQgsPointPatternFillSymbol : public QObject
44+
{
45+
Q_OBJECT
46+
47+
public:
48+
TestQgsPointPatternFillSymbol()
49+
: mTestHasError( false )
50+
, mpPolysLayer( 0 )
51+
, mPointPatternFill( 0 )
52+
, mFillSymbol( 0 )
53+
, mSymbolRenderer( 0 )
54+
{}
55+
56+
private slots:
57+
void initTestCase();// will be called before the first testfunction is executed.
58+
void cleanupTestCase();// will be called after the last testfunction was executed.
59+
void init() {} // will be called before each testfunction is executed.
60+
void cleanup() {} // will be called after every testfunction.
61+
62+
void pointPatternFillSymbol();
63+
void dataDefinedSubSymbol();
64+
65+
private:
66+
bool mTestHasError;
67+
68+
bool imageCheck( const QString& theType );
69+
QgsMapSettings mMapSettings;
70+
QgsVectorLayer * mpPolysLayer;
71+
QgsPointPatternFillSymbolLayer* mPointPatternFill;
72+
QgsFillSymbolV2* mFillSymbol;
73+
QgsSingleSymbolRendererV2* mSymbolRenderer;
74+
QString mTestDataDir;
75+
QString mReport;
76+
};
77+
78+
79+
void TestQgsPointPatternFillSymbol::initTestCase()
80+
{
81+
mTestHasError = false;
82+
// init QGIS's paths - true means that all path will be inited from prefix
83+
QgsApplication::init();
84+
QgsApplication::initQgis();
85+
QgsApplication::showSettings();
86+
87+
//create some objects that will be used in all tests...
88+
QString myDataDir( TEST_DATA_DIR ); //defined in CmakeLists.txt
89+
mTestDataDir = myDataDir + '/';
90+
91+
//
92+
//create a poly layer that will be used in all tests...
93+
//
94+
QString myPolysFileName = mTestDataDir + "polys.shp";
95+
QFileInfo myPolyFileInfo( myPolysFileName );
96+
mpPolysLayer = new QgsVectorLayer( myPolyFileInfo.filePath(),
97+
myPolyFileInfo.completeBaseName(), "ogr" );
98+
99+
QgsVectorSimplifyMethod simplifyMethod;
100+
simplifyMethod.setSimplifyHints( QgsVectorSimplifyMethod::NoSimplification );
101+
mpPolysLayer->setSimplifyMethod( simplifyMethod );
102+
103+
// Register the layer with the registry
104+
QgsMapLayerRegistry::instance()->addMapLayers(
105+
QList<QgsMapLayer *>() << mpPolysLayer );
106+
107+
//setup gradient fill
108+
mPointPatternFill = new QgsPointPatternFillSymbolLayer();
109+
mFillSymbol = new QgsFillSymbolV2();
110+
mFillSymbol->changeSymbolLayer( 0, mPointPatternFill );
111+
mSymbolRenderer = new QgsSingleSymbolRendererV2( mFillSymbol );
112+
mpPolysLayer->setRendererV2( mSymbolRenderer );
113+
114+
// We only need maprender instead of mapcanvas
115+
// since maprender does not require a qui
116+
// and is more light weight
117+
//
118+
mMapSettings.setLayers( QStringList() << mpPolysLayer->id() );
119+
mReport += "<h1>Gradient Renderer Tests</h1>\n";
120+
121+
}
122+
void TestQgsPointPatternFillSymbol::cleanupTestCase()
123+
{
124+
QString myReportFile = QDir::tempPath() + "/qgistest.html";
125+
QFile myFile( myReportFile );
126+
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
127+
{
128+
QTextStream myQTextStream( &myFile );
129+
myQTextStream << mReport;
130+
myFile.close();
131+
}
132+
133+
QgsApplication::exitQgis();
134+
}
135+
136+
void TestQgsPointPatternFillSymbol::pointPatternFillSymbol()
137+
{
138+
mReport += "<h2>Point pattern fill symbol renderer test</h2>\n";
139+
140+
QgsStringMap properties;
141+
properties.insert( "color", "0,0,0,255" );
142+
properties.insert( "name", "circle" );
143+
properties.insert( "size", "5.0" );
144+
QgsMarkerSymbolV2* pointSymbol = QgsMarkerSymbolV2::createSimple( properties );
145+
146+
mPointPatternFill->setSubSymbol( pointSymbol );
147+
QVERIFY( imageCheck( "symbol_pointfill" ) );
148+
}
149+
150+
void TestQgsPointPatternFillSymbol::dataDefinedSubSymbol()
151+
{
152+
mReport += "<h2>Point pattern symbol data defined sub symbol test</h2>\n";
153+
154+
QgsStringMap properties;
155+
properties.insert( "color", "0,0,0,255" );
156+
properties.insert( "name", "circle" );
157+
properties.insert( "size", "5.0" );
158+
QgsMarkerSymbolV2* pointSymbol = QgsMarkerSymbolV2::createSimple( properties );
159+
pointSymbol->symbolLayer( 0 )->setDataDefinedProperty( "color", new QgsDataDefined( QString( "if(\"Name\" ='Lake','#ff0000','#ff00ff')" ) ) );
160+
mPointPatternFill->setSubSymbol( pointSymbol );
161+
QVERIFY( imageCheck( "datadefined_subsymbol" ) );
162+
}
163+
164+
//
165+
// Private helper functions not called directly by CTest
166+
//
167+
168+
169+
bool TestQgsPointPatternFillSymbol::imageCheck( const QString& theTestType )
170+
{
171+
//use the QgsRenderChecker test utility class to
172+
//ensure the rendered output matches our control image
173+
mMapSettings.setExtent( mpPolysLayer->extent() );
174+
mMapSettings.setOutputDpi( 96 );
175+
QgsRenderChecker myChecker;
176+
myChecker.setControlPathPrefix( "symbol_pointpatternfill" );
177+
myChecker.setControlName( "expected_" + theTestType );
178+
myChecker.setMapSettings( mMapSettings );
179+
bool myResultFlag = myChecker.runTest( theTestType );
180+
mReport += myChecker.report();
181+
return myResultFlag;
182+
}
183+
184+
QTEST_MAIN( TestQgsPointPatternFillSymbol )
185+
#include "testqgspointpatternfillsymbol.moc"

0 commit comments

Comments
 (0)
Please sign in to comment.