Skip to content
Permalink
Browse files

[tests] Update composer effect tests

  • Loading branch information
nyalldawson committed Dec 28, 2013
1 parent aa3e40a commit f3d5e0b270da517db6f4d9c6d8034d5ca030e4e8
@@ -41,6 +41,7 @@ class TestQgsComposerEffects: public QObject
QgsComposerShape* mComposerRect1;
QgsComposerShape* mComposerRect2;
QgsMapRenderer* mMapRenderer;
QString mReport;
};

void TestQgsComposerEffects::initTestCase()
@@ -62,11 +63,21 @@ void TestQgsComposerEffects::initTestCase()
mComposerRect2->setShapeType( QgsComposerShape::Rectangle );
mComposition->addComposerShape( mComposerRect2 );

mReport = "<h1>Composer Effects Tests</h1>\n";
}

void TestQgsComposerEffects::cleanupTestCase()
{
delete mComposition;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
{
QTextStream myQTextStream( &myFile );
myQTextStream << mReport;
myFile.close();
}
}

void TestQgsComposerEffects::init()
@@ -83,9 +94,8 @@ void TestQgsComposerEffects::blend_modes()
{
mComposerRect2->setBlendMode( QPainter::CompositionMode_Multiply );

QgsCompositionChecker checker( "Composer effects blending", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composereffects" + QDir::separator() + "composereffect_blend.png" ) );
QVERIFY( checker.testComposition() );
QgsCompositionChecker checker( "composereffects_blend", mComposition );
QVERIFY( checker.testComposition( mReport) );
// reset blending
mComposerRect2->setBlendMode( QPainter::CompositionMode_SourceOver );
}
@@ -94,9 +104,8 @@ void TestQgsComposerEffects::transparency()
{
mComposerRect2->setTransparency( 50 );

QgsCompositionChecker checker( "Composer item transparency", mComposition, QString( QString( TEST_DATA_DIR ) + QDir::separator() +
"control_images" + QDir::separator() + "expected_composereffects" + QDir::separator() + "composereffect_transparency.png" ) );
QVERIFY( checker.testComposition() );
QgsCompositionChecker checker( "composereffects_transparency", mComposition );
QVERIFY( checker.testComposition( mReport ) );
}

QTEST_MAIN( TestQgsComposerEffects )

0 comments on commit f3d5e0b

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