From 3c4078ca02cc438dbe668c4a3819d54134ac75b5 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 24 Feb 2020 13:33:00 +0100 Subject: [PATCH] tst_QSettings: Fix leaking registry key On Windows, the test was leaking a registry key HKEY_CURRENT_USER\Software\tst_QSettings_trailingWhitespace Fix by using .ini-Format in the temporary directory created by the test. Amends e66a878838f17a0626b0b10b340b1ca4dba56cc1. Task-number: QTBUG-22461 Change-Id: If141a9e72e8faebc3fc46b94dab7b4b728a75292 Reviewed-by: Thiago Macieira --- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 0f07ba4bb2..57bab115bb 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -2331,14 +2331,15 @@ void tst_QSettings::testRegistry32And64Bit() void tst_QSettings::trailingWhitespace() { + const QString path = settingsPath("trailingWhitespace"); { - QSettings s("tst_QSettings_trailingWhitespace"); + QSettings s(path, QSettings::IniFormat); s.setValue("trailingSpace", "x "); s.setValue("trailingTab", "x\t"); s.setValue("trailingNewline", "x\n"); } { - QSettings s("tst_QSettings_trailingWhitespace"); + QSettings s(path, QSettings::IniFormat); QCOMPARE(s.value("trailingSpace").toString(), QLatin1String("x ")); QCOMPARE(s.value("trailingTab").toString(), QLatin1String("x\t")); QCOMPARE(s.value("trailingNewline").toString(), QLatin1String("x\n"));