tst_QNetworkReply: Fix repetitive invocation of cleanup().

Move the code from cleanup() into a separate cleanupTestData()
and call this from initTestData() and cleanup(). Remove slot init().

Change-Id: I4e7b5b89197ed0aa50f46f730e9c1d9c59749614
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
This commit is contained in:
Friedemann Kleint 2015-10-23 09:50:52 +02:00
parent 1e8863e39d
commit a69c0bb38e
1 changed files with 6 additions and 8 deletions

View File

@ -200,8 +200,7 @@ protected Q_SLOTS:
void nestedEventLoops_slot();
private Q_SLOTS:
void init();
void cleanup();
void cleanup() { cleanupTestData(); }
void initTestCase();
void cleanupTestCase();
@ -485,6 +484,8 @@ private Q_SLOTS:
// NOTE: This test must be last!
void parentingRepliesToTheApp();
private:
void cleanupTestData();
QString testDataDir;
};
@ -1492,6 +1493,8 @@ void tst_QNetworkReply::initTestCase()
echoProcessDir = QFINDTESTDATA("echo");
QVERIFY2(!echoProcessDir.isEmpty(), qPrintable(
QString::fromLatin1("Couldn't find echo dir starting from %1.").arg(QDir::currentPath())));
cleanupTestData();
}
void tst_QNetworkReply::cleanupTestCase()
@ -1507,12 +1510,7 @@ void tst_QNetworkReply::cleanupTestCase()
#endif
}
void tst_QNetworkReply::init()
{
cleanup();
}
void tst_QNetworkReply::cleanup()
void tst_QNetworkReply::cleanupTestData()
{
QFile file(testFileName);
QVERIFY(!file.exists() || file.remove());