Skip to content

Commit 118a9f6

Browse files
committedDec 1, 2014
Add some missing exitQgis() calls to unit tests
Also ensure that compositions are deleted before exiting Qgis during tests.
1 parent 4fde34a commit 118a9f6

15 files changed

+17
-3
lines changed
 

‎tests/src/core/regression1141.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ void Regression1141::cleanupTestCase()
8888
//
8989
// Runs after all tests are done
9090
//
91+
QgsApplication::exitQgis();
9192
}
9293

9394

‎tests/src/core/testqgsatlascomposition.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ void TestQgsAtlasComposition::initTestCase()
106106

107107
void TestQgsAtlasComposition::cleanupTestCase()
108108
{
109+
delete mComposition;
109110
QgsApplication::exitQgis();
110111

111112
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";

‎tests/src/core/testqgscomposerhtml.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ void TestQgsComposerHtml::cleanupTestCase()
7272
myQTextStream << mReport;
7373
myFile.close();
7474
}
75+
QgsApplication::exitQgis();
7576
}
7677

7778
void TestQgsComposerHtml::init()

‎tests/src/core/testqgscomposerpaper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ void TestQgsComposerPaper::cleanupTestCase()
8888
myQTextStream << mReport;
8989
myFile.close();
9090
}
91+
QgsApplication::exitQgis();
9192
}
9293

9394
void TestQgsComposerPaper::init()

‎tests/src/core/testqgscomposerpicture.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ void TestQgsComposerPicture::cleanupTestCase()
9797
myQTextStream << mReport;
9898
myFile.close();
9999
}
100+
QgsApplication::exitQgis();
100101
}
101102

102103
void TestQgsComposerPicture::init()

‎tests/src/core/testqgscomposerrotation.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ void TestQgsComposerRotation::initTestCase()
100100

101101
void TestQgsComposerRotation::cleanupTestCase()
102102
{
103+
delete mComposition;
104+
103105
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
104106
QFile myFile( myReportFile );
105107
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )

‎tests/src/core/testqgscomposershapes.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void TestQgsComposerShapes::cleanupTestCase()
8383
myQTextStream << mReport;
8484
myFile.close();
8585
}
86+
QgsApplication::exitQgis();
8687
}
8788

8889
void TestQgsComposerShapes::init()

‎tests/src/core/testqgscomposertablev2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ void TestQgsComposerTableV2::cleanupTestCase()
130130
myQTextStream << mReport;
131131
myFile.close();
132132
}
133+
QgsApplication::exitQgis();
133134
}
134135

135136
void TestQgsComposerTableV2::init()

‎tests/src/core/testqgscomposerutils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ void TestQgsComposerUtils::initTestCase()
8484

8585
void TestQgsComposerUtils::cleanupTestCase()
8686
{
87-
QgsApplication::exitQgis();
88-
8987
delete mComposition;
9088

89+
QgsApplication::exitQgis();
90+
9191
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
9292
QFile myFile( myReportFile );
9393
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )

‎tests/src/core/testqgscomposition.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ void TestQgsComposition::cleanupTestCase()
7575
myQTextStream << mReport;
7676
myFile.close();
7777
}
78+
QgsApplication::exitQgis();
7879
}
7980

8081
void TestQgsComposition::init()

‎tests/src/core/testqgsdiagram.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class TestQgsDiagram: public QObject
109109
// will be called after the last testfunction was executed.
110110
void cleanupTestCase()
111111
{
112+
delete mComposition;
112113
QgsApplication::exitQgis();
113114
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
114115
QFile myFile( myReportFile );

‎tests/src/core/testqgsdiagramexpression.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ class TestQgsDiagramExpression: public QObject
114114
// will be called after the last testfunction was executed.
115115
void cleanupTestCase()
116116
{
117-
QgsApplication::exitQgis();
118117
QString myReportFile = QDir::tempPath() + QDir::separator() + "qgistest.html";
119118
QFile myFile( myReportFile );
120119
if ( myFile.open( QIODevice::WriteOnly | QIODevice::Append ) )
@@ -127,6 +126,7 @@ class TestQgsDiagramExpression: public QObject
127126
delete mComposerMap;
128127
delete mComposition;
129128
// delete mPointsLayer;
129+
QgsApplication::exitQgis();
130130
}
131131

132132
void init() {} // will be called before each testfunction is executed.

‎tests/src/core/testqgsstylev2.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ void TestStyleV2::cleanupTestCase()
9595
// don't save
9696
// mStyle->save();
9797
delete mStyle;
98+
QgsApplication::exitQgis();
9899
}
99100

100101
bool TestStyleV2::testValidColor( QgsVectorColorRampV2 *ramp, double value, QColor expected )

‎tests/src/core/testqgsvectorlayer.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class TestQgsVectorLayer: public QObject
163163
myFile.close();
164164
//QDesktopServices::openUrl( "file:///" + myReportFile );
165165
}
166+
QgsApplication::exitQgis();
166167

167168
}
168169
void init() {};// will be called before each testfunction is executed.

‎tests/src/gui/testqgsscalecombobox.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ void TestQgsScaleComboBox::initTestCase()
5151
void TestQgsScaleComboBox::cleanupTestCase()
5252
{
5353
delete s;
54+
QgsApplication::exitQgis();
5455
};
5556

5657
void TestQgsScaleComboBox::init()

0 commit comments

Comments
 (0)
Please sign in to comment.