From 0804a38b5f2c74185e0a8a1f399938bfc4fa6dcd Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 30 Aug 2020 23:41:48 +0200 Subject: Port from QSharedPointer to unique_ptr. There's no sharing going on here. NO_CHANGELOG --- autotests/test_kconf_update.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'autotests/test_kconf_update.cpp') 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 + // Qt #include #include @@ -50,9 +52,9 @@ static QString readFile(const QString &path) return ret; } -static QTemporaryFile *writeUpdFile(const QString &content) +static std::unique_ptr writeUpdFile(const QString &content) { - QTemporaryFile *file = new QTemporaryFile(QDir::tempPath() + QLatin1String("/test_kconf_update_XXXXXX.upd")); + std::unique_ptr 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 updFile(writeUpdFile(updContent)); + std::unique_ptr 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 updFile(writeUpdFile(updContent)); + std::unique_ptr updFile(writeUpdFile(updContent)); const QString scriptDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/kconf_update"; QVERIFY(QDir().mkpath(scriptDir)); -- cgit v1.2.1