Skip to content
Permalink
Browse files

Expand tests

  • Loading branch information
nyalldawson committed Mar 19, 2020
1 parent 880874b commit 73efe6474670c0b3476a023ba37d425dc8fb2fac
Showing with 35 additions and 0 deletions.
  1. +35 −0 tests/src/core/testqgslayoutpicture.cpp
@@ -37,6 +37,8 @@ class TestQgsLayoutPicture : public QObject
void cleanup();// will be called after every testfunction.

void pictureRender();
void pictureRaster();
void pictureSvg();
void pictureRotation(); //test if picture pictureRotation is functioning
void pictureItemRotation(); //test if composer picture item rotation is functioning

@@ -131,6 +133,39 @@ void TestQgsLayoutPicture::pictureRender()
mLayout->removeItem( mPicture );
}

void TestQgsLayoutPicture::pictureRaster()
{
QgsLayout l( QgsProject::instance() );
l.initializeDefaults();
QgsLayoutItemPicture *p = new QgsLayoutItemPicture( &l );
p->setPicturePath( mPngImage, QgsLayoutItemPicture::FormatRaster );
p->attemptSetSceneRect( QRectF( 70, 70, 100, 100 ) );
p->setFrameEnabled( true );

l.addLayoutItem( p );

QgsLayoutChecker checker( QStringLiteral( "composerpicture_render" ), &l );
checker.setControlPathPrefix( QStringLiteral( "composer_picture" ) );
QVERIFY( checker.testLayout( mReport, 0, 0 ) );
}

void TestQgsLayoutPicture::pictureSvg()
{
QgsLayout l( QgsProject::instance() );
l.initializeDefaults();
QgsLayoutItemPicture *p = new QgsLayoutItemPicture( &l );
p->setResizeMode( QgsLayoutItemPicture::Zoom );
p->setPicturePath( mSvgImage, QgsLayoutItemPicture::FormatSVG );
p->attemptSetSceneRect( QRectF( 70, 70, 100, 100 ) );
p->setFrameEnabled( true );

l.addLayoutItem( p );

QgsLayoutChecker checker( QStringLiteral( "composerpicture_svg_zoom" ), &l );
checker.setControlPathPrefix( QStringLiteral( "composer_picture" ) );
QVERIFY( checker.testLayout( mReport, 0, 0 ) );
}

void TestQgsLayoutPicture::pictureRotation()
{
//test picture rotation

0 comments on commit 73efe64

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