Skip to content
Permalink
Browse files

follow up tests

  • Loading branch information
3nids committed Jan 4, 2021
1 parent 2647fa8 commit 8d3ed863dc14dbd77ae8b50afc42697d62665526
@@ -106,7 +106,7 @@ void TestQgsDataDefinedSizeLegend::testBasic()
classes << QgsDataDefinedSizeLegend::SizeClass( 30., QStringLiteral( "30" ) );
settings.setClasses( classes );

QgsStringMap props;
QVariantMap props;
props[QStringLiteral( "name" )] = QStringLiteral( "circle" );
props[QStringLiteral( "color" )] = QStringLiteral( "200,255,200" );
props[QStringLiteral( "outline_color" )] = QStringLiteral( "0,255,0" );
@@ -141,7 +141,7 @@ void TestQgsDataDefinedSizeLegend::testCrowded()
classes << QgsDataDefinedSizeLegend::SizeClass( 18., QStringLiteral( "18" ) );
settings.setClasses( classes );

QgsStringMap props;
QVariantMap props;
props[QStringLiteral( "name" )] = QStringLiteral( "circle" );
props[QStringLiteral( "color" )] = QStringLiteral( "200,255,200" );
props[QStringLiteral( "outline_color" )] = QStringLiteral( "0,255,0" );
@@ -90,7 +90,7 @@ class TestQgsDiagram : public QObject
myPointFileInfo.completeBaseName(), QStringLiteral( "ogr" ) );

//we don't want to render the points themselves, just the diagrams
QgsStringMap symbolProps;
QVariantMap symbolProps;
symbolProps.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,0" ) );
symbolProps.insert( QStringLiteral( "outline_style" ), QStringLiteral( "no" ) );
QgsMarkerSymbol *symbol = QgsMarkerSymbol::createSimple( symbolProps );
@@ -307,7 +307,7 @@ class TestQgsDiagram : public QObject
ds.rotationOffset = 0;
ds.setShowAxis( true );

QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "width" ), QStringLiteral( "2" ) );
props.insert( QStringLiteral( "color" ), QStringLiteral( "#ff00ff" ) );
ds.setAxisLineSymbol( QgsLineSymbol::createSimple( props ) );
@@ -507,7 +507,7 @@ class TestQgsDiagram : public QObject
ds.setSpacing( 3 );
ds.setShowAxis( true );

QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "width" ), QStringLiteral( "2" ) );
props.insert( QStringLiteral( "color" ), QStringLiteral( "#ff00ff" ) );
ds.setAxisLineSymbol( QgsLineSymbol::createSimple( props ) );
@@ -563,7 +563,7 @@ class TestQgsDiagram : public QObject
ds.setSpacing( 3 );
ds.setShowAxis( true );

QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "width" ), QStringLiteral( "2" ) );
props.insert( QStringLiteral( "color" ), QStringLiteral( "#ff00ff" ) );
ds.setAxisLineSymbol( QgsLineSymbol::createSimple( props ) );
@@ -1011,7 +1011,7 @@ class TestQgsDiagram : public QObject
const QString filename = QStringLiteral( TEST_DATA_DIR ) + "/lines.shp";
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( filename, QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ) );

QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#487bb6" ) );
props.insert( QStringLiteral( "outline_width" ), QStringLiteral( "1" ) );
std::unique_ptr< QgsLineSymbol > symbol( QgsLineSymbol::createSimple( props ) );
@@ -110,7 +110,7 @@ void TestQgsDxfExport::init()
mPointLayerGeometryGenerator = new QgsVectorLayer( filename, QStringLiteral( "points" ), QStringLiteral( "ogr" ) );
QVERIFY( mPointLayerGeometryGenerator );

QgsStringMap ggProps;
QVariantMap ggProps;
ggProps.insert( QStringLiteral( "SymbolType" ), QStringLiteral( "Fill" ) );
ggProps.insert( QStringLiteral( "geometryModifier" ), QStringLiteral( "buffer( $geometry, 0.1 )" ) );
QgsSymbolLayer *ggSymbolLayer = QgsGeometryGeneratorSymbolLayer::create( ggProps );
@@ -2759,7 +2759,7 @@ void TestQgsLabelingEngine::testClipping()
const QString filename = QStringLiteral( TEST_DATA_DIR ) + "/lines.shp";
std::unique_ptr< QgsVectorLayer> vl2( new QgsVectorLayer( filename, QStringLiteral( "lines" ), QStringLiteral( "ogr" ) ) );

QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#487bb6" ) );
props.insert( QStringLiteral( "outline_width" ), QStringLiteral( "1" ) );
std::unique_ptr< QgsLineSymbol > symbol( QgsLineSymbol::createSimple( props ) );
@@ -436,7 +436,7 @@ void TestQgsLayerTree::testLegendSymbolCategorized()
QgsCategorizedSymbolRenderer *renderer = new QgsCategorizedSymbolRenderer();
renderer->setClassAttribute( QStringLiteral( "col1" ) );
renderer->setSourceSymbol( QgsSymbol::defaultSymbol( QgsWkbTypes::PointGeometry ) );
QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "color" ), QStringLiteral( "#ff0000" ) );
props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
renderer->addCategory( QgsRendererCategory( "a", QgsMarkerSymbol::createSimple( props ), QStringLiteral( "a" ) ) );
@@ -453,7 +453,7 @@ void TestQgsLayerTree::testLegendSymbolGraduated()
QgsGraduatedSymbolRenderer *renderer = new QgsGraduatedSymbolRenderer();
renderer->setClassAttribute( QStringLiteral( "col1" ) );
renderer->setSourceSymbol( QgsSymbol::defaultSymbol( QgsWkbTypes::PointGeometry ) );
QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "color" ), QStringLiteral( "#ff0000" ) );
props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
renderer->addClass( QgsRendererRange( 1, 2, QgsMarkerSymbol::createSimple( props ), QStringLiteral( "a" ) ) );
@@ -468,7 +468,7 @@ void TestQgsLayerTree::testLegendSymbolRuleBased()
{
//test retrieving/setting a rule based renderer's symbol through the legend node
QgsRuleBasedRenderer::Rule *root = new QgsRuleBasedRenderer::Rule( nullptr );
QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "color" ), QStringLiteral( "#ff0000" ) );
props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
root->appendChild( new QgsRuleBasedRenderer::Rule( QgsMarkerSymbol::createSimple( props ), 0, 0, QStringLiteral( "\"col1\"=1" ) ) );
@@ -567,7 +567,7 @@ void TestQgsLayerTree::testRendererLegend( QgsFeatureRenderer *renderer )
QCOMPARE( symbolList.at( 1 ).symbol()->color(), QColor( 255, 255, 0 ) );

//another test - check directly setting symbol at renderer
QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "color" ), QStringLiteral( "#00ffff" ) );
props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
renderer->setLegendSymbolItem( symbolList.at( 2 ).ruleKey(), QgsMarkerSymbol::createSimple( props ) );
@@ -128,7 +128,7 @@ void TestQgsLayoutAtlas::init()
mLayout->initializeDefaults();

// fix the renderer, fill with green
QgsStringMap props;
QVariantMap props;
props.insert( QStringLiteral( "color" ), QStringLiteral( "0,127,0" ) );
props.insert( QStringLiteral( "outline_color" ), QStringLiteral( "0,0,0" ) );
QgsFillSymbol *fillSymbol = QgsFillSymbol::createSimple( props );
@@ -156,7 +156,7 @@ void TestQgsLayoutAtlas::init()
mOverview->setExtent( QgsRectangle( 49670.718, 6415139.086, 699672.519, 7065140.887 ) );

// set the fill symbol of the overview map
QgsStringMap props2;
QVariantMap props2;
props2.insert( QStringLiteral( "color" ), QStringLiteral( "127,0,0,127" ) );
props2.insert( QStringLiteral( "outline_color" ), QStringLiteral( "0,0,0" ) );
QgsFillSymbol *fillSymbol2 = QgsFillSymbol::createSimple( props2 );
@@ -1323,7 +1323,7 @@ void TestQgsLegendRenderer::testDataDefinedSizeCollapsed()
vlDataDefinedSize->updateFields();
}

QgsStringMap props;
QVariantMap props;
props[QStringLiteral( "name" )] = QStringLiteral( "circle" );
props[QStringLiteral( "color" )] = QStringLiteral( "200,200,200" );
props[QStringLiteral( "outline_color" )] = QStringLiteral( "0,0,0" );
@@ -133,7 +133,7 @@ void TestQgsLineFillSymbol::lineFillSymbol()
{
mReport += QLatin1String( "<h2>Line fill symbol renderer test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "width" ), QStringLiteral( "1" ) );
properties.insert( QStringLiteral( "capstyle" ), QStringLiteral( "flat" ) );
@@ -181,7 +181,7 @@ void TestQgsLineFillSymbol::dataDefinedSubSymbol()
{
mReport += QLatin1String( "<h2>Line fill symbol data defined sub symbol test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "width" ), QStringLiteral( "1" ) );
properties.insert( QStringLiteral( "capstyle" ), QStringLiteral( "flat" ) );
@@ -152,7 +152,7 @@ void TestQgsMarkerLineSymbol::pointNumInterval()
QgsSingleSymbolRenderer *r = new QgsSingleSymbolRenderer( lineSymbol );

// make sub-symbol
QgsStringMap props;
QVariantMap props;
props[QStringLiteral( "color" )] = QStringLiteral( "255,0,0" );
props[QStringLiteral( "size" )] = QStringLiteral( "2" );
props[QStringLiteral( "outline_style" )] = QStringLiteral( "no" );
@@ -181,7 +181,7 @@ void TestQgsMarkerLineSymbol::pointNumVertex()
QgsSingleSymbolRenderer *r = new QgsSingleSymbolRenderer( lineSymbol );

// make sub-symbol
QgsStringMap props;
QVariantMap props;
props[QStringLiteral( "color" )] = QStringLiteral( "255,0,0" );
props[QStringLiteral( "size" )] = QStringLiteral( "2" );
props[QStringLiteral( "outline_style" )] = QStringLiteral( "no" );
@@ -57,18 +57,18 @@ class DummyPaintEffect : public QgsPaintEffect
{}
QString type() const override { return QStringLiteral( "Dummy" ); }
QgsPaintEffect *clone() const override { return new DummyPaintEffect( mProp1, mProp2 ); }
static QgsPaintEffect *create( const QgsStringMap &props ) { return new DummyPaintEffect( props[QStringLiteral( "testProp" )], props[QStringLiteral( "testProp2" )] ); }
QgsStringMap properties() const override
static QgsPaintEffect *create( const QVariantMap &props ) { return new DummyPaintEffect( props[QStringLiteral( "testProp" )].toString(), props[QStringLiteral( "testProp2" )].toString() ); }
QVariantMap properties() const override
{
QgsStringMap props;
QVariantMap props;
props[QStringLiteral( "testProp" )] = mProp1;
props[QStringLiteral( "testProp2" )] = mProp2;
return props;
}
void readProperties( const QgsStringMap &props ) override
void readProperties( const QVariantMap &props ) override
{
mProp1 = props[QStringLiteral( "testProp" )];
mProp2 = props[QStringLiteral( "testProp2" )];
mProp1 = props[QStringLiteral( "testProp" )].toString();
mProp2 = props[QStringLiteral( "testProp2" )].toString();
}

QString prop1() { return mProp1; }
@@ -317,7 +317,7 @@ void TestQgsPaintEffect::drawSource()
delete cloneCast;

//read/write
QgsStringMap props = effect->properties();
QVariantMap props = effect->properties();
QgsPaintEffect *readEffect = QgsDrawSourceEffect::create( props );
QgsDrawSourceEffect *readCast = dynamic_cast<QgsDrawSourceEffect * >( readEffect );
QVERIFY( readCast );
@@ -391,7 +391,7 @@ void TestQgsPaintEffect::blur()
delete cloneCast;

//read/write
QgsStringMap props = effect->properties();
QVariantMap props = effect->properties();
QgsPaintEffect *readEffect = QgsBlurEffect::create( props );
QgsBlurEffect *readCast = dynamic_cast<QgsBlurEffect * >( readEffect );
QVERIFY( readCast );
@@ -484,7 +484,7 @@ void TestQgsPaintEffect::dropShadow()
delete cloneCast;

//read/write
QgsStringMap props = effect->properties();
QVariantMap props = effect->properties();
QgsPaintEffect *readEffect = QgsDropShadowEffect::create( props );
QgsDropShadowEffect *readCast = dynamic_cast<QgsDropShadowEffect * >( readEffect );
QVERIFY( readCast );
@@ -586,7 +586,7 @@ void TestQgsPaintEffect::glow()
delete cloneCast;

//read/write
QgsStringMap props = effect->properties();
QVariantMap props = effect->properties();
QgsPaintEffect *readEffect = QgsOuterGlowEffect::create( props );
QgsOuterGlowEffect *readCast = dynamic_cast<QgsOuterGlowEffect * >( readEffect );
QVERIFY( readCast );
@@ -701,7 +701,7 @@ void TestQgsPaintEffect::transform()
clone.reset( nullptr );

//read/write
QgsStringMap props = effect->properties();
QVariantMap props = effect->properties();
std::unique_ptr< QgsPaintEffect > readEffect( QgsTransformEffect::create( props ) );
QgsTransformEffect *readCast = dynamic_cast<QgsTransformEffect * >( readEffect.get() );
QVERIFY( readCast );
@@ -30,9 +30,9 @@ class DummyPaintEffect : public QgsPaintEffect
DummyPaintEffect() = default;
QString type() const override { return QStringLiteral( "Dummy" ); }
QgsPaintEffect *clone() const override { return new DummyPaintEffect(); }
static QgsPaintEffect *create( const QgsStringMap & ) { return new DummyPaintEffect(); }
QgsStringMap properties() const override { return QgsStringMap(); }
void readProperties( const QgsStringMap &props ) override { Q_UNUSED( props ); }
static QgsPaintEffect *create( const QVariantMap & ) { return new DummyPaintEffect(); }
QVariantMap properties() const override { return QVariantMap(); }
void readProperties( const QVariantMap &props ) override { Q_UNUSED( props ); }
protected:
void draw( QgsRenderContext &context ) override { Q_UNUSED( context ); }
};
@@ -86,7 +86,7 @@ void TestQgsPaintEffectRegistry::metadata()
QCOMPARE( metadata.visibleName(), QString( "display name" ) );

//test creating effect from metadata
QgsStringMap map;
QVariantMap map;
QgsPaintEffect *effect = metadata.createPaintEffect( map );
QVERIFY( effect );
DummyPaintEffect *dummyEffect = dynamic_cast<DummyPaintEffect *>( effect );
@@ -134,7 +134,7 @@ void TestQgsPointPatternFillSymbol::pointPatternFillSymbol()
{
mReport += QLatin1String( "<h2>Point pattern fill symbol renderer test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
properties.insert( QStringLiteral( "name" ), QStringLiteral( "circle" ) );
@@ -149,7 +149,7 @@ void TestQgsPointPatternFillSymbol::pointPatternFillSymbolVector()
{
mReport += QLatin1String( "<h2>Point pattern fill symbol renderer test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
properties.insert( QStringLiteral( "name" ), QStringLiteral( "circle" ) );
@@ -195,7 +195,7 @@ void TestQgsPointPatternFillSymbol::offsettedPointPatternFillSymbol()
{
mReport += QLatin1String( "<h2>Offsetted point pattern fill symbol renderer test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
properties.insert( QStringLiteral( "name" ), QStringLiteral( "circle" ) );
@@ -222,7 +222,7 @@ void TestQgsPointPatternFillSymbol::offsettedPointPatternFillSymbolVector()
{
mReport += QLatin1String( "<h2>Offsetted point pattern fill symbol renderer test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
properties.insert( QStringLiteral( "name" ), QStringLiteral( "circle" ) );
@@ -251,7 +251,7 @@ void TestQgsPointPatternFillSymbol::dataDefinedSubSymbol()
{
mReport += QLatin1String( "<h2>Point pattern symbol data defined sub symbol test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
properties.insert( QStringLiteral( "name" ), QStringLiteral( "circle" ) );
@@ -267,7 +267,7 @@ void TestQgsPointPatternFillSymbol::zeroSpacedPointPatternFillSymbol()
{
mReport += QLatin1String( "<h2>Zero distance point pattern fill symbol renderer test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
properties.insert( QStringLiteral( "name" ), QStringLiteral( "circle" ) );
@@ -286,7 +286,7 @@ void TestQgsPointPatternFillSymbol::zeroSpacedPointPatternFillSymbolVector()
{
mReport += QLatin1String( "<h2>Zero distance point pattern fill symbol renderer test</h2>\n" );

QgsStringMap properties;
QVariantMap properties;
properties.insert( QStringLiteral( "color" ), QStringLiteral( "0,0,0,255" ) );
properties.insert( QStringLiteral( "outline_color" ), QStringLiteral( "#000000" ) );
properties.insert( QStringLiteral( "name" ), QStringLiteral( "circle" ) );

0 comments on commit 8d3ed86

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