tst_QImageWriter: Use QTemporaryDir.
Create a temporary directory instead of writing to the test data directory or home path (Android). Change-Id: I6af583e5da91eefb603eaae179e7d789487dc626 Reviewed-by: aavit <eirik.aavitsland@theqtcompany.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
parent
f30b75e569
commit
bb5570082e
@ -89,6 +89,7 @@ private slots:
|
|||||||
|
|
||||||
void saveToTemporaryFile();
|
void saveToTemporaryFile();
|
||||||
private:
|
private:
|
||||||
|
QTemporaryDir m_temporaryDir;
|
||||||
QString prefix;
|
QString prefix;
|
||||||
QString writePrefix;
|
QString writePrefix;
|
||||||
};
|
};
|
||||||
@ -112,14 +113,11 @@ static void initializePadding(QImage *image)
|
|||||||
|
|
||||||
void tst_QImageWriter::initTestCase()
|
void tst_QImageWriter::initTestCase()
|
||||||
{
|
{
|
||||||
|
QVERIFY(m_temporaryDir.isValid());
|
||||||
prefix = QFINDTESTDATA("images/");
|
prefix = QFINDTESTDATA("images/");
|
||||||
if (prefix.isEmpty())
|
if (prefix.isEmpty())
|
||||||
QFAIL("Can't find images directory!");
|
QFAIL("Can't find images directory!");
|
||||||
#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_NO_SDK)
|
writePrefix = m_temporaryDir.path();
|
||||||
writePrefix = QDir::homePath();
|
|
||||||
#else
|
|
||||||
writePrefix = prefix;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Testing get/set functions
|
// Testing get/set functions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user