Skip to content

Commit 3dbe7f5

Browse files
committed
Decouple composer table tests
1 parent 27fb4dc commit 3dbe7f5

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

tests/src/core/testqgscomposertablev2.cpp

+21-22
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,28 @@ void TestQgsComposerTableV2::initTestCase()
9494
"ogr" );
9595
QgsMapLayerRegistry::instance()->addMapLayer( mVectorLayer );
9696

97-
//create composition with composer map
9897
mMapSettings.setLayers( QStringList() << mVectorLayer->id() );
9998
mMapSettings.setCrsTransformEnabled( false );
99+
100+
mReport = "<h1>Composer TableV2 Tests</h1>\n";
101+
}
102+
103+
void TestQgsComposerTableV2::cleanupTestCase()
104+
{
105+
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
106+
QFile myFile( myReportFile );
107+
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
108+
{
109+
QTextStream myQTextStream( &myFile );
110+
myQTextStream << mReport;
111+
myFile.close();
112+
}
113+
QgsApplication::exitQgis();
114+
}
115+
116+
void TestQgsComposerTableV2::init()
117+
{
118+
//create composition with composer map
100119
mComposition = new QgsComposition( mMapSettings );
101120
mComposition->setPaperSize( 297, 210 ); //A4 portrait
102121

@@ -118,31 +137,11 @@ void TestQgsComposerTableV2::initTestCase()
118137
mComposerAttributeTable->setContentFont( QgsFontUtils::getStandardTestFont() );
119138
mComposerAttributeTable->setHeaderFont( QgsFontUtils::getStandardTestFont() );
120139
mComposerAttributeTable->setBackgroundColor( Qt::yellow );
121-
122-
mReport = "<h1>Composer TableV2 Tests</h1>\n";
123-
}
124-
125-
void TestQgsComposerTableV2::cleanupTestCase()
126-
{
127-
delete mComposition;
128-
129-
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
130-
QFile myFile( myReportFile );
131-
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
132-
{
133-
QTextStream myQTextStream( &myFile );
134-
myQTextStream << mReport;
135-
myFile.close();
136-
}
137-
QgsApplication::exitQgis();
138-
}
139-
140-
void TestQgsComposerTableV2::init()
141-
{
142140
}
143141

144142
void TestQgsComposerTableV2::cleanup()
145143
{
144+
delete mComposition;
146145
}
147146

148147
void TestQgsComposerTableV2::attributeTableHeadings()

0 commit comments

Comments
 (0)