"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/src/core/testqgssvgmarker.cpp" between
QGIS-final-3_14_15.tar.gz and QGIS-final-3_14_16.tar.gz

About: QGIS (Quantum GIS) is a Geographic Information System that supports vector, raster, and database formats. Latest release (3.14.x series).

testqgssvgmarker.cpp  (QGIS-final-3_14_15):testqgssvgmarker.cpp  (QGIS-final-3_14_16)
skipping to change at line 65 skipping to change at line 65
void cleanup() {} // will be called after every testfunction. void cleanup() {} // will be called after every testfunction.
void svgMarkerSymbol(); void svgMarkerSymbol();
void bounds(); void bounds();
void boundsWidth(); void boundsWidth();
void bench(); void bench();
void aspectRatio(); void aspectRatio();
void dynamicSizeWithAspectRatio(); void dynamicSizeWithAspectRatio();
void dynamicWidthWithAspectRatio(); void dynamicWidthWithAspectRatio();
void dynamicAspectRatio(); void dynamicAspectRatio();
void resetDefaultAspectRatio();
private: private:
bool mTestHasError = false ; bool mTestHasError = false ;
bool imageCheck( const QString &type ); bool imageCheck( const QString &type );
QgsMapSettings mMapSettings; QgsMapSettings mMapSettings;
QgsVectorLayer *mpPointsLayer = nullptr; QgsVectorLayer *mpPointsLayer = nullptr;
QgsSvgMarkerSymbolLayer *mSvgMarkerLayer = nullptr; QgsSvgMarkerSymbolLayer *mSvgMarkerLayer = nullptr;
QgsMarkerSymbol *mMarkerSymbol = nullptr; QgsMarkerSymbol *mMarkerSymbol = nullptr;
QgsSingleSymbolRenderer *mSymbolRenderer = nullptr; QgsSingleSymbolRenderer *mSymbolRenderer = nullptr;
skipping to change at line 254 skipping to change at line 255
mSvgMarkerLayer->setSize( 20 ); mSvgMarkerLayer->setSize( 20 );
mSvgMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyHeight, QgsPr operty::fromExpression( QStringLiteral( "max(\"importance\" * 5, 10)" ) ) ); mSvgMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyHeight, QgsPr operty::fromExpression( QStringLiteral( "max(\"importance\" * 5, 10)" ) ) );
mSvgMarkerLayer->setFixedAspectRatio( 0.5 ); mSvgMarkerLayer->setFixedAspectRatio( 0.5 );
mSvgMarkerLayer->setStrokeWidth( 0.0 ); mSvgMarkerLayer->setStrokeWidth( 0.0 );
bool result = imageCheck( QStringLiteral( "svgmarker_dynamic_aspectratio" ) ); bool result = imageCheck( QStringLiteral( "svgmarker_dynamic_aspectratio" ) );
mSvgMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyHeight, QgsPr operty() ); mSvgMarkerLayer->setDataDefinedProperty( QgsSymbolLayer::PropertyHeight, QgsPr operty() );
QVERIFY( result ); QVERIFY( result );
} }
void TestQgsSvgMarkerSymbol::resetDefaultAspectRatio()
{
// default aspect ratio must be updated as SVG path is changed
QString svgPath = QgsSymbolLayerUtils::svgSymbolNameToPath( QStringLiteral( "/
amenity/amenity_bench.svg" ), QgsPathResolver() );
QgsSvgMarkerSymbolLayer layer( svgPath );
QCOMPARE( layer.defaultAspectRatio(), 1.0 );
QVERIFY( layer.preservedAspectRatio() );
// different aspect ratio
layer.setPath( mTestDataDir + "test_symbol_svg.svg" );
QGSCOMPARENEAR( layer.defaultAspectRatio(), 1.58258242005, 0.0001 );
QVERIFY( layer.preservedAspectRatio() );
layer.setPath( svgPath );
QCOMPARE( layer.defaultAspectRatio(), 1.0 );
QVERIFY( layer.preservedAspectRatio() );
layer.setFixedAspectRatio( 0.5 );
QCOMPARE( layer.defaultAspectRatio(), 1.0 );
QCOMPARE( layer.fixedAspectRatio(), 0.5 );
QVERIFY( !layer.preservedAspectRatio() );
layer.setPath( mTestDataDir + "test_symbol_svg.svg" );
QGSCOMPARENEAR( layer.defaultAspectRatio(), 1.58258242005, 0.0001 );
QCOMPARE( layer.fixedAspectRatio(), 0.5 );
QVERIFY( !layer.preservedAspectRatio() );
}
// //
// Private helper functions not called directly by CTest // Private helper functions not called directly by CTest
// //
bool TestQgsSvgMarkerSymbol::imageCheck( const QString &testType ) bool TestQgsSvgMarkerSymbol::imageCheck( const QString &testType )
{ {
//use the QgsRenderChecker test utility class to //use the QgsRenderChecker test utility class to
//ensure the rendered output matches our control image //ensure the rendered output matches our control image
mMapSettings.setExtent( mpPointsLayer->extent() ); mMapSettings.setExtent( mpPointsLayer->extent() );
mMapSettings.setOutputDpi( 96 ); mMapSettings.setOutputDpi( 96 );
 End of changes. 2 change blocks. 
0 lines changed or deleted 29 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)