From 5279134935e858e6fa8565c936b17e88d7bded50 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 21 Jan 2014 10:35:01 +0100 Subject: Reuse one QCollator instance for QString::localeAwareCompare Constructing a QCollator is somewhat expensive, and made localeAwareCompare really slow. As QCollator (at least with the ICU implementation) is not thread safe, use one collator per thread. This speeds up collation of a long list of strings by a factor of 250 for the test case in the bug below. Task-number: QTBUG-36149 Change-Id: I645cdc3546347d1dcc7a03b7563b628c7f756944 Reviewed-by: Thiago Macieira Reviewed-by: Konstantin Ritt --- tests/auto/corelib/tools/qstring/tst_qstring.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 629a095f9d..5655d9f529 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -4876,10 +4876,8 @@ void tst_QString::localeAwareCompare() DWORD oldLcid = GetUserDefaultLCID(); SetUserDefaultLCID(locale); QCOMPARE(locale, GetUserDefaultLCID()); -#elif defined (Q_OS_MAC) - QSKIP("Setting the locale is not supported on OS X (you can set the C locale, but that won't affect CFStringCompare which is used to compare strings)"); -#elif defined(QT_USE_ICU) - QLocale::setDefault(QLocale(locale)); +#elif defined (Q_OS_MAC) || defined(QT_USE_ICU) + QSKIP("Setting the locale is not supported on OS X or ICU (you can set the C locale, but that won't affect localeAwareCompare)"); #else if (!locale.isEmpty()) { const char *newLocale = setlocale(LC_ALL, locale.toLatin1()); -- cgit v1.2.3 From 5ee07bf6919dda0c9a192adedc9fc4512b7bba36 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Wed, 26 Mar 2014 13:52:09 +0100 Subject: Mark some tests as XFAIL on QNX Extending this to stock QNX as well since it is not BlackBerry 10 specific. - tst_QNumeric::floatDistance() - tst_QNumeric::floatDistance_double() - tst_QtJson::testNumbers_2() - tst_QtJson::toJsonLargeNumericValues() - tst_QtJson::parseNumbers() Task-number: QTBUG-37066 Change-Id: If0e5d4fbefac5e8a0efed8ef8b1b7655ff6e7766 Reviewed-by: Fabian Bumberger --- tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp | 4 ++-- tests/auto/corelib/json/tst_qtjson.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp index 79df4b7055..0b4f0e3c4b 100644 --- a/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp +++ b/tests/auto/corelib/global/qnumeric/tst_qnumeric.cpp @@ -167,7 +167,7 @@ void tst_QNumeric::floatDistance() QFETCH(float, val1); QFETCH(float, val2); QFETCH(quint32, expectedDistance); -#ifdef Q_OS_BLACKBERRY +#ifdef Q_OS_QNX QEXPECT_FAIL("denormal", "See QTBUG-37094", Continue); #endif QCOMPARE(qFloatDistance(val1, val2), expectedDistance); @@ -214,7 +214,7 @@ void tst_QNumeric::floatDistance_double() QFETCH(double, val1); QFETCH(double, val2); QFETCH(quint64, expectedDistance); -#ifdef Q_OS_BLACKBERRY +#ifdef Q_OS_QNX QEXPECT_FAIL("denormal", "See QTBUG-37094", Continue); #endif QCOMPARE(qFloatDistance(val1, val2), expectedDistance); diff --git a/tests/auto/corelib/json/tst_qtjson.cpp b/tests/auto/corelib/json/tst_qtjson.cpp index 2f75ad631f..a17fe7561a 100644 --- a/tests/auto/corelib/json/tst_qtjson.cpp +++ b/tests/auto/corelib/json/tst_qtjson.cpp @@ -347,7 +347,7 @@ void tst_QtJson::testNumbers_2() QJsonDocument jDocument2(QJsonDocument::fromJson(ba)); for (int power = 0; power <= 1075; power++) { floatValues_1[power] = jDocument2.object().value(QString::number(power)).toDouble(); -#ifdef Q_OS_BLACKBERRY +#ifdef Q_OS_QNX if (power >= 970) QEXPECT_FAIL("", "See QTBUG-37066", Abort); #endif @@ -1346,7 +1346,7 @@ void tst_QtJson::toJsonLargeNumericValues() " ]\n" "}\n"; -#ifdef Q_OS_BLACKBERRY +#ifdef Q_OS_QNX QEXPECT_FAIL("", "See QTBUG-37066", Continue); #endif QCOMPARE(json, expected); @@ -1354,7 +1354,7 @@ void tst_QtJson::toJsonLargeNumericValues() QJsonDocument doc; doc.setObject(object); json = doc.toJson(); -#ifdef Q_OS_BLACKBERRY +#ifdef Q_OS_QNX QEXPECT_FAIL("", "See QTBUG-37066", Continue); #endif QCOMPARE(json, expected); @@ -1758,7 +1758,7 @@ void tst_QtJson::parseNumbers() json += numbers[i].str; json += " ]"; QJsonDocument doc = QJsonDocument::fromJson(json); -#ifdef Q_OS_BLACKBERRY +#ifdef Q_OS_QNX if (0 == QString::compare(numbers[i].str, "1.1e-308")) QEXPECT_FAIL("", "See QTBUG-37066", Abort); #endif -- cgit v1.2.3 From eab7efd1ee0475fd331774ccc99ee92c816f588c Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Thu, 20 Mar 2014 17:47:25 +0100 Subject: Stabilize tst_QProcess::softExitInSlots() This test takes more than 5000ms to finish some times, so waiting for 10000ms should be enough to make it more stable on all platforms. ../tst_qprocess.cpp:1072 :: [gui app] QTestLib: This test case check ("proc.waitedForFinished") failed because the requested timeout (5000 ms) was too short, 6150 ms would have been sufficient this time. Change-Id: I266ad0e65bf3c84e73b7ca6543dc15335dad4c99 Reviewed-by: Fabian Bumberger --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index f5aa2c2412..b67166272b 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -1069,7 +1069,7 @@ void tst_QProcess::softExitInSlots() SoftExitProcess proc(i); proc.writeAfterStart("OLEBOLE", 8); // include the \0 proc.start(appName); - QTRY_VERIFY(proc.waitedForFinished); + QTRY_VERIFY_WITH_TIMEOUT(proc.waitedForFinished, 10000); QCOMPARE(proc.state(), QProcess::NotRunning); } } -- cgit v1.2.3 From 9a9feab102019d810a1120ef9953c15b48f24640 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 26 Mar 2014 09:17:27 +0100 Subject: Check for administrative rights in tst_qsettings. Introduce function checking whether the system settings in native format can be written to. If not, default to user scope or skip the respective tests instead of failing. Task-number: QTBUG-37822 Change-Id: I330aff9b79bb22254216f022af807e010bc8e8ba Reviewed-by: Andrew Knight --- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 138 +++++++++++++++------- 1 file changed, 97 insertions(+), 41 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 42c360f2d8..12c89b1cf4 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -73,10 +73,30 @@ Q_DECLARE_METATYPE(QSettings::Format) QT_FORWARD_DECLARE_CLASS(QSettings) +static inline bool canWriteNativeSystemSettings() +{ +#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) + HKEY key; + const LONG result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software", 0, KEY_WRITE, &key); + if (result == ERROR_SUCCESS) + RegCloseKey(key); + else + qErrnoWarning(result, "RegOpenKeyEx failed"); + return result == ERROR_SUCCESS; +#else // Q_OS_WIN && !Q_OS_WINRT + return true; +#endif +} + +static const char insufficientPermissionSkipMessage[] = "Insufficient permissions for this test."; + class tst_QSettings : public QObject { Q_OBJECT +public: + tst_QSettings() : m_canWriteNativeSystemSettings(canWriteNativeSystemSettings()) {} + public slots: void initTestCase(); void init(); @@ -145,6 +165,9 @@ private slots: void testByteArray_data(); void testByteArray(); + +private: + const bool m_canWriteNativeSystemSettings; }; // Testing get/set functions @@ -259,6 +282,8 @@ static void populateWithFormats() void tst_QSettings::initTestCase() { + if (!m_canWriteNativeSystemSettings) + qWarning("The test is not running with administrative rights. Some tests will be skipped."); QSettings::Format custom1 = QSettings::registerFormat("custom1", readCustom1File, writeCustom1File); QSettings::Format custom2 = QSettings::registerFormat("custom2", readCustom2File, writeCustom2File #ifndef QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER @@ -276,17 +301,19 @@ void tst_QSettings::init() #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) QSettings("HKEY_CURRENT_USER\\Software\\software.org", QSettings::NativeFormat).clear(); - QSettings("HKEY_LOCAL_MACHINE\\Software\\software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\other.software.org", QSettings::NativeFormat).clear(); - QSettings("HKEY_LOCAL_MACHINE\\Software\\other.software.org", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\foo", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\bar", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\bat", QSettings::NativeFormat).clear(); QSettings("HKEY_CURRENT_USER\\Software\\baz", QSettings::NativeFormat).clear(); - QSettings("HKEY_LOCAL_MACHINE\\Software\\foo", QSettings::NativeFormat).clear(); - QSettings("HKEY_LOCAL_MACHINE\\Software\\bar", QSettings::NativeFormat).clear(); - QSettings("HKEY_LOCAL_MACHINE\\Software\\bat", QSettings::NativeFormat).clear(); - QSettings("HKEY_LOCAL_MACHINE\\Software\\baz", QSettings::NativeFormat).clear(); + if (m_canWriteNativeSystemSettings) { + QSettings("HKEY_LOCAL_MACHINE\\Software\\software.org", QSettings::NativeFormat).clear(); + QSettings("HKEY_LOCAL_MACHINE\\Software\\other.software.org", QSettings::NativeFormat).clear(); + QSettings("HKEY_LOCAL_MACHINE\\Software\\foo", QSettings::NativeFormat).clear(); + QSettings("HKEY_LOCAL_MACHINE\\Software\\bar", QSettings::NativeFormat).clear(); + QSettings("HKEY_LOCAL_MACHINE\\Software\\bat", QSettings::NativeFormat).clear(); + QSettings("HKEY_LOCAL_MACHINE\\Software\\baz", QSettings::NativeFormat).clear(); + } if (QDir(settingsPath()).exists()) { #if defined(Q_OS_WINCE) removePath(settingsPath()); @@ -334,6 +361,9 @@ void tst_QSettings::ctor() { QFETCH(QSettings::Format, format); + if (!m_canWriteNativeSystemSettings && format == QSettings::NativeFormat) + QSKIP(insufficientPermissionSkipMessage); + { QSettings settings1(format, QSettings::UserScope, "software.org", "KillerAPP"); QSettings settings2(format, QSettings::UserScope, "software.org"); @@ -1263,43 +1293,55 @@ void tst_QSettings::remove() QSettings settings1(QSettings::UserScope, "software.org", "KillerAPP"); QSettings settings2(QSettings::UserScope, "software.org"); - QSettings settings3(QSettings::SystemScope, "software.org", "KillerAPP"); - QSettings settings4(QSettings::SystemScope, "software.org"); - settings4.setValue("key 1", "doodah"); - settings3.setValue("key 1", "blah"); + QScopedPointer settings3; + QScopedPointer settings4; + + if (m_canWriteNativeSystemSettings) { + settings3.reset(new QSettings(QSettings::SystemScope, "software.org", "KillerAPP")); + settings4.reset(new QSettings(QSettings::SystemScope, "software.org")); + settings3->setValue("key 1", "blah"); + settings4->setValue("key 1", "doodah"); + } + settings2.setValue("key 1", "whoa"); settings1.setValue("key 1", "gurgle"); QCOMPARE(settings1.value("key 1").toString(), QString("gurgle")); QCOMPARE(settings2.value("key 1").toString(), QString("whoa")); #if !defined(Q_OS_BLACKBERRY) - QCOMPARE(settings3.value("key 1").toString(), QString("blah")); - QCOMPARE(settings4.value("key 1").toString(), QString("doodah")); + if (m_canWriteNativeSystemSettings) { + QCOMPARE(settings3->value("key 1").toString(), QString("blah")); + QCOMPARE(settings4->value("key 1").toString(), QString("doodah")); + } settings1.remove("key 1"); QCOMPARE(settings1.value("key 1").toString(), QString("whoa")); QCOMPARE(settings2.value("key 1").toString(), QString("whoa")); - QCOMPARE(settings3.value("key 1").toString(), QString("blah")); - QCOMPARE(settings4.value("key 1").toString(), QString("doodah")); + if (m_canWriteNativeSystemSettings) { + QCOMPARE(settings3->value("key 1").toString(), QString("blah")); + QCOMPARE(settings4->value("key 1").toString(), QString("doodah")); + } - settings2.remove("key 1"); - QCOMPARE(settings1.value("key 1").toString(), QString("blah")); - QCOMPARE(settings2.value("key 1").toString(), QString("doodah")); - QCOMPARE(settings3.value("key 1").toString(), QString("blah")); - QCOMPARE(settings4.value("key 1").toString(), QString("doodah")); - - settings3.remove("key 1"); - QCOMPARE(settings1.value("key 1").toString(), QString("doodah")); - QCOMPARE(settings2.value("key 1").toString(), QString("doodah")); - QCOMPARE(settings3.value("key 1").toString(), QString("doodah")); - QCOMPARE(settings4.value("key 1").toString(), QString("doodah")); - - settings4.remove("key 1"); - QVERIFY(!settings1.contains("key 1")); - QVERIFY(!settings2.contains("key 1")); - QVERIFY(!settings3.contains("key 1")); - QVERIFY(!settings4.contains("key 1")); + if (m_canWriteNativeSystemSettings) { + settings2.remove("key 1"); + QCOMPARE(settings1.value("key 1").toString(), QString("blah")); + QCOMPARE(settings2.value("key 1").toString(), QString("doodah")); + QCOMPARE(settings3->value("key 1").toString(), QString("blah")); + QCOMPARE(settings4->value("key 1").toString(), QString("doodah")); + + settings3->remove("key 1"); + QCOMPARE(settings1.value("key 1").toString(), QString("doodah")); + QCOMPARE(settings2.value("key 1").toString(), QString("doodah")); + QCOMPARE(settings3->value("key 1").toString(), QString("doodah")); + QCOMPARE(settings4->value("key 1").toString(), QString("doodah")); + + settings4->remove("key 1"); + QVERIFY(!settings1.contains("key 1")); + QVERIFY(!settings2.contains("key 1")); + QVERIFY(!settings3->contains("key 1")); + QVERIFY(!settings4->contains("key 1")); + } #else settings1.remove("key 1"); QCOMPARE(settings2.value("key 1").toString(), QString("whoa")); @@ -1315,13 +1357,18 @@ void tst_QSettings::remove() settings1.clear(); settings2.clear(); - settings3.clear(); - settings4.clear(); + if (m_canWriteNativeSystemSettings) { + settings3->clear(); + settings4->clear(); + } settings1.sync(); settings2.sync(); - settings3.sync(); - settings4.sync(); + + if (m_canWriteNativeSystemSettings) { + settings3->sync(); + settings4->sync(); + } /* Check that recursive removes work correctly when some of the @@ -1556,6 +1603,9 @@ void tst_QSettings::setFallbacksEnabled() { QFETCH(QSettings::Format, format); + if (!m_canWriteNativeSystemSettings && format == QSettings::NativeFormat) + QSKIP(insufficientPermissionSkipMessage); + QSettings settings1(format, QSettings::UserScope, "software.org", "KillerAPP"); QSettings settings2(format, QSettings::UserScope, "software.org"); QSettings settings3(format, QSettings::SystemScope, "software.org", "KillerAPP"); @@ -2771,8 +2821,10 @@ void tst_QSettings::childGroups() { QFETCH(QSettings::Format, format); + const QSettings::Scope scope = m_canWriteNativeSystemSettings ? QSettings::SystemScope : QSettings::UserScope; + { - QSettings settings(format, QSettings::SystemScope, "software.org"); + QSettings settings(format, scope, "software.org"); settings.setValue("alpha", "1"); settings.setValue("alpha/a", "2"); settings.setValue("alpha/b", "3"); @@ -2789,7 +2841,7 @@ void tst_QSettings::childGroups() for (int pass = 0; pass < 3; ++pass) { QConfFile::clearCache(); - QSettings settings(format, QSettings::SystemScope, "software.org"); + QSettings settings(format, scope, "software.org"); settings.setFallbacksEnabled(false); if (pass == 1) { settings.value("gamma/d"); @@ -2837,8 +2889,10 @@ void tst_QSettings::childKeys() { QFETCH(QSettings::Format, format); + const QSettings::Scope scope = m_canWriteNativeSystemSettings ? QSettings::SystemScope : QSettings::UserScope; + { - QSettings settings(format, QSettings::SystemScope, "software.org"); + QSettings settings(format, scope, "software.org"); settings.setValue("alpha", "1"); settings.setValue("alpha/a", "2"); settings.setValue("alpha/b", "3"); @@ -2855,7 +2909,7 @@ void tst_QSettings::childKeys() for (int pass = 0; pass < 3; ++pass) { QConfFile::clearCache(); - QSettings settings(format, QSettings::SystemScope, "software.org"); + QSettings settings(format, scope, "software.org"); settings.setFallbacksEnabled(false); if (pass == 1) { settings.value("gamma/d"); @@ -2907,15 +2961,17 @@ void tst_QSettings::allKeys() allKeys << "alpha" << "alpha/a" << "alpha/b" << "alpha/c" << "beta" << "gamma" << "gamma/d" << "gamma/d/e" << "gamma/f/g" << "omicron/h/i/j/x" << "omicron/h/i/k/y" << "zeta/z"; + const QSettings::Scope scope = m_canWriteNativeSystemSettings ? QSettings::SystemScope : QSettings::UserScope; + { - QSettings settings(format, QSettings::SystemScope, "software.org"); + QSettings settings(format, scope, "software.org"); for (int i = 0; i < allKeys.size(); ++i) settings.setValue(allKeys.at(i), QString::number(i + 1)); } for (int pass = 0; pass < 3; ++pass) { QConfFile::clearCache(); - QSettings settings(format, QSettings::SystemScope, "software.org"); + QSettings settings(format, scope, "software.org"); settings.setFallbacksEnabled(false); if (pass == 1) { -- cgit v1.2.3 From dd453adbe7611900ff20ee77141229c01fe1bc98 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Wed, 26 Feb 2014 15:32:01 +0100 Subject: Mac: make FSEvents-based QFileSystemWatcherEngine more robust. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Record the last event ID with every callback. This event ID is passed to FSEventStreamCreate when restarting the stream, so the watcher will receive all events that occurred since invalidating the previous stream. - Never start with kFSEventStreamEventIdSinceNow, because this will generate a (bogus) soft-assert in FSEventStreamFlushSync in CarbonCore when no event occurred since stream creation. The last globally generated event ID is used instead to simulate the "now". - Do not dispose and recreate the stream in the callback, but use a queued signal-slot connection to schedule this on thread that owns the watcher. Change-Id: I02f5a845d9e27f9853ed97925ab9c7a5bc0dede1 Reviewed-by: Eike Ziller Reviewed-by: Morten Johan Sørvig --- tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index b681cec802..a58c7dfb4b 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -324,6 +324,9 @@ void tst_QFileSystemWatcher::watchDirectory() fileName = changedSpy.at(1).at(0).toString(); QCOMPARE(fileName, testDir.absolutePath()); + // flush pending signals (like the one from the rmdir above) + timer.start(5000); + eventLoop.exec(); changedSpy.clear(); // recreate the file, we should not get any notification -- cgit v1.2.3 From 35a11d6fce6820fa71db7c8b696d25b5de508277 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Fri, 28 Mar 2014 22:52:04 +0100 Subject: OS X QSettings auto test/writing check update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch aims to provide an updated test that follows changes started in 10.7: new rule is that only root can access SystemScope settings. It also disables the sync() workaround code path which is at least not executed during the tst_QSettings execution and returns wrong value to the test. From Apple's documentation: "Note that modification of some preferences domains (those not belonging to the “Current User”) requires root privileges (or Admin privileges prior to OS X v10.6)—see Authorization Services Programming Guide for information on how to gain suitable privileges" https://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFPreferencesUtils/Reference/reference.html [ChangeLog][QtCore][QSettings] QSettings now returns the correct value for isWritable() when using SystemScope settings. Task-number: QTBUG-9824 Task-number: QTBUG-21062 Task-number: QTBUG-22745 Change-Id: Ib6a1490ec596b99d189ec4de9a0f28ecfd684172 Reviewed-by: Liang Qi --- tests/auto/corelib/io/qsettings/tst_qsettings.cpp | 27 ++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 12c89b1cf4..501ad6f415 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -2797,10 +2798,30 @@ void tst_QSettings::isWritable() QSettings s1(format, QSettings::SystemScope, "software.org", "KillerAPP"); QSettings s2(format, QSettings::SystemScope, "software.org", "Something Different"); QSettings s3(format, QSettings::SystemScope, "foo.org", "Something Different"); + if (s1.contains("foo")) { - QVERIFY(s1.isWritable()); - QVERIFY(s2.isWritable()); - QVERIFY(s3.isWritable()); +#if defined(Q_OS_MACX) + if (QSysInfo::macVersion() >= QSysInfo::MV_10_9) { + QVERIFY(s1.isWritable()); + if (format == QSettings::NativeFormat) { + QVERIFY(!s2.isWritable()); + QVERIFY(!s3.isWritable()); + } else { + QVERIFY(s2.isWritable()); + QVERIFY(s3.isWritable()); + } + } else if (QSysInfo::macVersion() >= QSysInfo::MV_10_7 && + format == QSettings::NativeFormat) { + QVERIFY(!s1.isWritable()); + QVERIFY(!s2.isWritable()); + QVERIFY(!s3.isWritable()); + } else +#endif + { + QVERIFY(s1.isWritable()); + QVERIFY(s2.isWritable()); + QVERIFY(s3.isWritable()); + } } else { QVERIFY(!s1.isWritable()); QVERIFY(!s2.isWritable()); -- cgit v1.2.3