"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/src/core/testqgssvgcache.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).

testqgssvgcache.cpp  (QGIS-final-3_14_15):testqgssvgcache.cpp  (QGIS-final-3_14_16)
skipping to change at line 58 skipping to change at line 58
void init() {} // will be called before each testfunction is executed. void init() {} // will be called before each testfunction is executed.
void cleanup() {} // will be called after every testfunction. void cleanup() {} // will be called after every testfunction.
void fillCache(); void fillCache();
void broken(); void broken();
void threadSafePicture(); void threadSafePicture();
void threadSafeImage(); void threadSafeImage();
void changeImage(); //check that cache is updated if svg source file changes void changeImage(); //check that cache is updated if svg source file changes
void base64(); void base64();
void replaceParams(); void replaceParams();
void aspectRatio(); void aspectRatio();
void noViewBox();
}; };
void TestQgsSvgCache::initTestCase() void TestQgsSvgCache::initTestCase()
{ {
QgsApplication::init(); QgsApplication::init();
QgsApplication::initQgis(); QgsApplication::initQgis();
mReport += "<h1>QgsSvgCache Tests</h1>\n"; mReport += "<h1>QgsSvgCache Tests</h1>\n";
} }
skipping to change at line 346 skipping to change at line 347
// test rendering SVGs with manual aspect ratio // test rendering SVGs with manual aspect ratio
QgsSvgCache cache; QgsSvgCache cache;
bool inCache = false; bool inCache = false;
const QString originalImage = TEST_DATA_DIR + QStringLiteral( "/test_symbol_sv g.svg" ); const QString originalImage = TEST_DATA_DIR + QStringLiteral( "/test_symbol_sv g.svg" );
QImage img = cache.svgAsImage( originalImage, 200, QColor( 0, 0, 0 ), QColor( 0, 0, 0 ), 1.0, QImage img = cache.svgAsImage( originalImage, 200, QColor( 0, 0, 0 ), QColor( 0, 0, 0 ), 1.0,
1.0, inCache, 0.5 ); 1.0, inCache, 0.5 );
QVERIFY( imageCheck( QStringLiteral( "svgcache_aspect_ratio" ), img, 30 ) ); QVERIFY( imageCheck( QStringLiteral( "svgcache_aspect_ratio" ), img, 30 ) );
} }
void TestQgsSvgCache::noViewBox()
{
// if a source SVG has no viewbox but it does have width/height, use that as a
backup so that
// we can correctly determine the svg's aspect ratio
const QString originalImage = TEST_DATA_DIR + QStringLiteral( "/svg/no_viewbox
.svg" );
QgsSvgCache cache;
double size = 12;
const QColor fill = QColor( 0, 0, 0 );
const QColor stroke = QColor( 0, 0, 0 );
double strokeWidth = 1;
double widthScaleFactor = 1;
QSizeF viewBoxSize = cache.svgViewboxSize( originalImage, size, fill, stroke,
strokeWidth, widthScaleFactor );
QGSCOMPARENEAR( viewBoxSize.width(), 1.329267, 0.0001 );
QGSCOMPARENEAR( viewBoxSize.height(), 6.358467, 0.0001 );
}
bool TestQgsSvgCache::imageCheck( const QString &testName, QImage &image, int mi smatchCount ) bool TestQgsSvgCache::imageCheck( const QString &testName, QImage &image, int mi smatchCount )
{ {
//draw background //draw background
QImage imageWithBackground( image.width(), image.height(), QImage::Format_RGB3 2 ); QImage imageWithBackground( image.width(), image.height(), QImage::Format_RGB3 2 );
QgsRenderChecker::drawBackground( &imageWithBackground ); QgsRenderChecker::drawBackground( &imageWithBackground );
QPainter painter( &imageWithBackground ); QPainter painter( &imageWithBackground );
painter.drawImage( 0, 0, image ); painter.drawImage( 0, 0, image );
painter.end(); painter.end();
mReport += "<h2>" + testName + "</h2>\n"; mReport += "<h2>" + testName + "</h2>\n";
 End of changes. 2 change blocks. 
0 lines changed or deleted 20 lines changed or added

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