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 e66a878838.

Task-number: QTBUG-22461
Change-Id: If141a9e72e8faebc3fc46b94dab7b4b728a75292
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Friedemann Kleint 2020-02-24 13:33:00 +01:00
parent e59e5643b5
commit 3c4078ca02

View File

@ -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"));