Skip to content
Permalink
Browse files

Add some missing exitQgis() calls to unit tests

Also ensure that compositions are deleted before exiting
Qgis during tests.
  • Loading branch information
nyalldawson committed Dec 1, 2014
1 parent 4fde34a commit 118a9f63dc61c9c97d427d083e2e07e698babc22
@@ -88,6 +88,7 @@ void Regression1141::cleanupTestCase()
//
// Runs after all tests are done
//
QgsApplication::exitQgis();
}


@@ -106,6 +106,7 @@ void TestQgsAtlasComposition::initTestCase()

void TestQgsAtlasComposition::cleanupTestCase()
{
delete mComposition;
QgsApplication::exitQgis();

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
@@ -72,6 +72,7 @@ void TestQgsComposerHtml::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerHtml::init()
@@ -88,6 +88,7 @@ void TestQgsComposerPaper::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerPaper::init()
@@ -97,6 +97,7 @@ void TestQgsComposerPicture::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerPicture::init()
@@ -100,6 +100,8 @@ void TestQgsComposerRotation::initTestCase()

void TestQgsComposerRotation::cleanupTestCase()
{
delete mComposition;

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@@ -83,6 +83,7 @@ void TestQgsComposerShapes::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerShapes::init()
@@ -130,6 +130,7 @@ void TestQgsComposerTableV2::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerTableV2::init()
@@ -84,10 +84,10 @@ void TestQgsComposerUtils::initTestCase()

void TestQgsComposerUtils::cleanupTestCase()
{
QgsApplication::exitQgis();

delete mComposition;

QgsApplication::exitQgis();

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@@ -75,6 +75,7 @@ void TestQgsComposition::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposition::init()
@@ -109,6 +109,7 @@ class TestQgsDiagram: public QObject
// will be called after the last testfunction was executed.
void cleanupTestCase()
{
delete mComposition;
QgsApplication::exitQgis();
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
@@ -114,7 +114,6 @@ class TestQgsDiagramExpression: public QObject
// will be called after the last testfunction was executed.
void cleanupTestCase()
{
QgsApplication::exitQgis();
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
QFile myFile( myReportFile );
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@@ -127,6 +126,7 @@ class TestQgsDiagramExpression: public QObject
delete mComposerMap;
delete mComposition;
// delete mPointsLayer;
QgsApplication::exitQgis();
}

void init() {} // will be called before each testfunction is executed.
@@ -95,6 +95,7 @@ void TestStyleV2::cleanupTestCase()
// don't save
// mStyle->save();
delete mStyle;
QgsApplication::exitQgis();
}

bool TestStyleV2::testValidColor( QgsVectorColorRampV2 *ramp, double value, QColor expected )
@@ -163,6 +163,7 @@ class TestQgsVectorLayer: public QObject
myFile.close();
//QDesktopServices::openUrl( "file:///" + myReportFile );
}
QgsApplication::exitQgis();

}
void init() {};// will be called before each testfunction is executed.
@@ -51,6 +51,7 @@ void TestQgsScaleComboBox::initTestCase()
void TestQgsScaleComboBox::cleanupTestCase()
{
delete s;
QgsApplication::exitQgis();
};

void TestQgsScaleComboBox::init()

0 comments on commit 118a9f6

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