diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-06-08 21:49:48 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@theqtcompany.com> | 2015-06-14 15:19:31 +0000 |
commit | 61ca116a2eaf8a275803524ade494ace6b9cb812 (patch) | |
tree | 96eb327d81ee7681d3742fcb9adac597dbfff10f /src/testlib/qtestcase.h | |
parent | d3379cee8a81afaf0f0691d248a399c69025a68f (diff) |
QTest: Make qExtractTestData() return the created QTemporaryDirv5.5.0-rc1
... and enable auto-deletion on it.
This allows users of the function to get rid of their own
cleanup code. They just need to keep the shared pointer alive
for as long as they need it.
Drive-by changes:
- replaced QStringLiterals that were only used as the rhs of op+
- replaced an instance of mid() used as the rhs of op+ with midRef()
- enabled NRVO
Change-Id: I161d39461e020c9e8d473c0810dea2109fe0d62d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/testlib/qtestcase.h')
-rw-r--r-- | src/testlib/qtestcase.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 2c6a94faa1..f24283b65e 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -40,6 +40,8 @@ #include <QtCore/qnamespace.h> #include <QtCore/qmetatype.h> #include <QtCore/qtypetraits.h> +#include <QtCore/qsharedpointer.h> +#include <QtCore/qtemporarydir.h> #include <string.h> @@ -250,7 +252,7 @@ namespace QTest Q_TESTLIB_EXPORT void ignoreMessage(QtMsgType type, const QRegularExpression &messagePattern); #endif - Q_TESTLIB_EXPORT QString qExtractTestData(const QString &dirName); + Q_TESTLIB_EXPORT QSharedPointer<QTemporaryDir> qExtractTestData(const QString &dirName); Q_TESTLIB_EXPORT QString qFindTestData(const char* basepath, const char* file = 0, int line = 0, const char* builddir = 0); Q_TESTLIB_EXPORT QString qFindTestData(const QString& basepath, const char* file = 0, int line = 0, const char* builddir = 0); |