Skip to content

Commit

Permalink
Decouple composer table tests
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Jun 17, 2015
1 parent 27fb4dc commit 3dbe7f5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
43 changes: 21 additions & 22 deletions tests/src/core/testqgscomposertablev2.cpp
Expand Up @@ -94,9 +94,28 @@ void TestQgsComposerTableV2::initTestCase()
"ogr" );
QgsMapLayerRegistry::instance()->addMapLayer( mVectorLayer );

//create composition with composer map
mMapSettings.setLayers( QStringList() << mVectorLayer->id() );
mMapSettings.setCrsTransformEnabled( false );

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

void TestQgsComposerTableV2::cleanupTestCase()
{
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();
}
QgsApplication::exitQgis();
}

void TestQgsComposerTableV2::init()
{
//create composition with composer map
mComposition = new QgsComposition( mMapSettings );
mComposition->setPaperSize( 297, 210 ); //A4 portrait

Expand All @@ -118,31 +137,11 @@ void TestQgsComposerTableV2::initTestCase()
mComposerAttributeTable->setContentFont( QgsFontUtils::getStandardTestFont() );
mComposerAttributeTable->setHeaderFont( QgsFontUtils::getStandardTestFont() );
mComposerAttributeTable->setBackgroundColor( Qt::yellow );

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

void TestQgsComposerTableV2::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();
}
QgsApplication::exitQgis();
}

void TestQgsComposerTableV2::init()
{
}

void TestQgsComposerTableV2::cleanup()
{
delete mComposition;
}

void TestQgsComposerTableV2::attributeTableHeadings()
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3dbe7f5

Please sign in to comment.