Skip to content

Commit

Permalink
[tests] Update composer effect tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 28, 2013
1 parent aa3e40a commit f3d5e0b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions tests/src/core/testqgscomposereffects.cpp
Expand Up @@ -41,6 +41,7 @@ class TestQgsComposerEffects: public QObject
QgsComposerShape* mComposerRect1;
QgsComposerShape* mComposerRect2;
QgsMapRenderer* mMapRenderer;
QString mReport;
};

void TestQgsComposerEffects::initTestCase()
Expand All @@ -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()
Expand All @@ -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 );
}
Expand All @@ -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 )
Expand Down

0 comments on commit f3d5e0b

Please sign in to comment.