summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-04 13:39:30 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2016-10-10 16:06:43 +0000
commit76f53791a198dac7634d4aedb774ed3a86d47c97 (patch)
treef0101b29b4afee339cf8d22b7a4e9f07862a3732 /tests
parentf90d6445a078de264de292f117c87677f831f768 (diff)
tst_QSettings: Don't assume the presence of a key means isWritable
The previous sync() of the specific scope and domain may have failed due to not having the necessary permissions, but the saved value may still be cached, so we need to check both. This was observed on macOS Sierra, where a failed sync() will result in marking the CFPrefsPlistSource as read-only, eg: 2016-10-04 13:14:11.713271 tst_qsettings[88537:767733] [User Defaults] attempt to set <private> for key in <private> in read-only (due to a previous failed write) preferences domain CFPrefsPlistSource<0x6180000e1780> (Domain: org.software.KillerAPP, User: kCFPreferencesAnyUser, ByHost: Yes, Container: (null)) Change-Id: I8976c1c4acfe2cb0d5510298d5c585faca9607f6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/io/qsettings/tst_qsettings.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
index b98b48c5c1..dadf4b612e 100644
--- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
+++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
@@ -3014,7 +3014,7 @@ void tst_QSettings::isWritable()
QSettings s2(format, QSettings::SystemScope, "software.org", "Something Different");
QSettings s3(format, QSettings::SystemScope, "foo.org", "Something Different");
- if (s1.contains("foo")) {
+ if (s1.status() == QSettings::NoError && s1.contains("foo")) {
#if defined(Q_OS_MACX)
QVERIFY(s1.isWritable());
if (format == QSettings::NativeFormat) {