Navigation Menu

Skip to content

Commit

Permalink
Add some missing exitQgis() calls to unit tests
Browse files Browse the repository at this point in the history
Also ensure that compositions are deleted before exiting
Qgis during tests.
  • Loading branch information
nyalldawson committed Dec 1, 2014
1 parent 4fde34a commit 118a9f6
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/src/core/regression1141.cpp
Expand Up @@ -88,6 +88,7 @@ void Regression1141::cleanupTestCase()
//
// Runs after all tests are done
//
QgsApplication::exitQgis();
}


Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsatlascomposition.cpp
Expand Up @@ -106,6 +106,7 @@ void TestQgsAtlasComposition::initTestCase()

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

QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgscomposerhtml.cpp
Expand Up @@ -72,6 +72,7 @@ void TestQgsComposerHtml::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerHtml::init()
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgscomposerpaper.cpp
Expand Up @@ -88,6 +88,7 @@ void TestQgsComposerPaper::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerPaper::init()
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgscomposerpicture.cpp
Expand Up @@ -97,6 +97,7 @@ void TestQgsComposerPicture::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerPicture::init()
Expand Down
2 changes: 2 additions & 0 deletions tests/src/core/testqgscomposerrotation.cpp
Expand Up @@ -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 ) )
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgscomposershapes.cpp
Expand Up @@ -83,6 +83,7 @@ void TestQgsComposerShapes::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerShapes::init()
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgscomposertablev2.cpp
Expand Up @@ -130,6 +130,7 @@ void TestQgsComposerTableV2::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposerTableV2::init()
Expand Down
4 changes: 2 additions & 2 deletions tests/src/core/testqgscomposerutils.cpp
Expand Up @@ -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 ) )
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgscomposition.cpp
Expand Up @@ -75,6 +75,7 @@ void TestQgsComposition::cleanupTestCase()
myQTextStream << mReport;
myFile.close();
}
QgsApplication::exitQgis();
}

void TestQgsComposition::init()
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsdiagram.cpp
Expand Up @@ -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 );
Expand Down
2 changes: 1 addition & 1 deletion tests/src/core/testqgsdiagramexpression.cpp
Expand Up @@ -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 ) )
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsstylev2.cpp
Expand Up @@ -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 )
Expand Down
1 change: 1 addition & 0 deletions tests/src/core/testqgsvectorlayer.cpp
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions tests/src/gui/testqgsscalecombobox.cpp
Expand Up @@ -51,6 +51,7 @@ void TestQgsScaleComboBox::initTestCase()
void TestQgsScaleComboBox::cleanupTestCase()
{
delete s;
QgsApplication::exitQgis();
};

void TestQgsScaleComboBox::init()
Expand Down

0 comments on commit 118a9f6

Please sign in to comment.