diff options
author | David Faure <faure@kde.org> | 2020-08-30 23:41:48 +0200 |
---|---|---|
committer | David Faure <faure@kde.org> | 2020-08-30 23:42:08 +0200 |
commit | 0804a38b5f2c74185e0a8a1f399938bfc4fa6dcd (patch) | |
tree | 809e6cdab209db091a0d4832c34e31bf35ba3793 /autotests/test_kconf_update.cpp | |
parent | eeb2bbeff7f1ee74b907d92acb0eae6a65590ad7 (diff) | |
download | kconfig-0804a38b5f2c74185e0a8a1f399938bfc4fa6dcd.tar.gz kconfig-0804a38b5f2c74185e0a8a1f399938bfc4fa6dcd.tar.bz2 |
Port from QSharedPointer to unique_ptr. There's no sharing going on here.
NO_CHANGELOG
Diffstat (limited to 'autotests/test_kconf_update.cpp')
-rw-r--r-- | autotests/test_kconf_update.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/autotests/test_kconf_update.cpp b/autotests/test_kconf_update.cpp index 13cde111..52292083 100644 --- a/autotests/test_kconf_update.cpp +++ b/autotests/test_kconf_update.cpp @@ -6,6 +6,8 @@ */ #include "test_kconf_update.h" +#include <memory> + // Qt #include <QFile> #include <QDir> @@ -50,9 +52,9 @@ static QString readFile(const QString &path) return ret; } -static QTemporaryFile *writeUpdFile(const QString &content) +static std::unique_ptr<QTemporaryFile> writeUpdFile(const QString &content) { - QTemporaryFile *file = new QTemporaryFile(QDir::tempPath() + QLatin1String("/test_kconf_update_XXXXXX.upd")); + std::unique_ptr<QTemporaryFile> file{new QTemporaryFile(QDir::tempPath() + QLatin1String("/test_kconf_update_XXXXXX.upd"))}; bool ok = file->open(); Q_UNUSED(ok) // silence warnings Q_ASSERT(ok); @@ -326,7 +328,7 @@ void TestKConfUpdate::test() writeFile(oldConfPath, oldConfContent); QCOMPARE(readFile(oldConfPath), oldConfContent); - QSharedPointer<QTemporaryFile> updFile(writeUpdFile(updContent)); + std::unique_ptr<QTemporaryFile> updFile(writeUpdFile(updContent)); runKConfUpdate(updFile->fileName()); QString updateInfo = QStringLiteral("%1:%2") @@ -611,7 +613,7 @@ void TestKConfUpdate::testScript() // Prepend the Version and Id= field to the upd content updContent = QStringLiteral("Version=5\nId=%1\n").arg(QTest::currentDataTag()) + updContent; - QSharedPointer<QTemporaryFile> updFile(writeUpdFile(updContent)); + std::unique_ptr<QTemporaryFile> updFile(writeUpdFile(updContent)); const QString scriptDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kconf_update"; QVERIFY(QDir().mkpath(scriptDir)); |