summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qsettings/tst_qsettings.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Clear tst_QSettings of deprecation warningsEdward Welbourne2022-04-261-5/+5
| | | | | | | | | | | Assorted QMetaType and QVariant methods deprecated in Qt 6 were still in use - the deprecation warnings were suppressed by setting QT_DISABLE_DEPRECATED_BEFORE=0 - fix them and clear that suppression. Change-Id: I1aa8f45dcb5a18449b060b346c80ad70536896ab Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_QSettings::testVariantTypes(): modernize list initializationsEdward Welbourne2022-04-261-10/+6
| | | | | Change-Id: Ia84cd7590f9bcc95a790efb1e1dab46ab368cd2d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Convert tst_QSettings::testVariantTypes()'s macro body into a lambdaEdward Welbourne2022-04-261-13/+18
| | | | | | | | | Retain the macro, so as to automate checking QTest::currentTestFailed() after return from the lambda. Change-Id: If5873a533224ea3b809cef02255642a7d071d642 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Clean up tst_QSettings::testVariantTypes()Edward Welbourne2022-04-261-27/+26
| | | | | | | | | | | | | | | | | | | | | Give the macro and its parameters clearer names, wrap the macro body in do {...} while (0), use QCOMPARE() rather than QVERIFY()ing comparisons, convert the result type to QMetaType::Type rather than QVariant's deprecated equivalent, save one macro parameter by using decltype() on another. Simplify one check by pulling out a common sub-expression as a local variable. In the process, give the settings keys meaningful names rather than just "key" with a numeric suffix. Ideally this test would be reworked to be data-driven, instead of using macros, but the use of qvariant_cast<> to convert a read-back value, along with the variable type of the input value compared to the result of that cast, precludes this (as far as I can see). Change-Id: I4e083cd0dea14d723910873829352e15740006bd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Rearrange tst_QSettings::testVariantTypes()Edward Welbourne2022-04-261-24/+24
| | | | | | | | | | | | Move the large block unrelated to the macro-driven parts to before the macro is defined. This makes it clearer that it has nothing to do with the macro-driven part of the test. This is, in any case, a more basic test of behavior, so may as well go first. Rename the tested key in the process. Change-Id: I783fcd812e36320e9bb9765bab3ec09b56d6e6e6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Inline a shared data-driven test table in tst_QSettingsEdward Welbourne2022-04-261-88/+23
| | | | | | | | | | | Move its static populateWithFormats to before the class is declared and make the _data() methods that call it (including one that did so via another) inline so that we can see which are this simple - and thus which aren't. Change-Id: I71863244ba0e4bd188424b6a3f8d86d5d9f635a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Clean up includes involving tst_qmetatype_common.hEdward Welbourne2022-04-261-9/+4
| | | | | | | | | | | The functions it defines depend on many many types in QtCore for which it did not have a #include; both files that included it thus had to pull in QtCore to compile. Put that #include where it belongs and clean out many specific QtCore includes that it makes redundant. Change-Id: Ie9d9ec325d4879d771cb14baecb06fecbdaf62c5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* QSettingsPrivate: fold from/to parameters into the view they boundEdward Welbourne2022-03-301-2/+2
| | | | | | | | | | Two methods of the private class used to take a QByteArray with from and to indices into it, for where to start and stop a scan. Now that they take a QByteArrayView, those parameters can be used by the caller to shorten the view to the desired portion. Change-Id: Id1586afb87a9e8a189b69e485278375ff504fb7b Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* QSettings: port key processing to QAnyStringViewMarc Mutz2022-03-191-15/+12
| | | | | | | | | | | | | | | | | | | | | | | ... in preparation for replacing the QString keys in the public API with QAnyStringView ones. This removes the "important optimization" that avoids a detach in the common case where the input is the same as the output of normalization. But that optimization is beside the point, because it trades a memory allocation avoided in the library for O(N) allocations inserted into user code for each call to QSettings::value(), the vast majority of which are calls with string literals. With the public interface ported to QAnyStringView in the follow-up patch, we can then internally optimize memory allocations _in a central place_ (e.g. by returning std::u16string or QVarLengthArray<QChar> from normalizeKey() instead of QString). But first we need to get rid of all the unwarranted allocations in user code. Change-Id: I45fc83d972c552a220c9c29508001d3f172e1162 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
* Do not assume implicit string-ish → QColor conversionMarc Mutz2022-03-111-1/+1
| | | | | | | | We want to mark the corresponding QColor ctor(s) explicit. Use Qt::GlobalColor or the new QColor::fromString() instead. Change-Id: I68bf75a094e6821b97682de5a0ffd975834d22d0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QSettings: support reading UTF-8 keys in INI filesIvan Solovev2022-03-021-0/+38
| | | | | | | | | | | | | | [ChangeLog][QtCore][QSettings] The INI file reader now supports keys encoded with UTF-8, as well as the %-encoded format. Writing the keys back to the INI file is still done using %-encoded format. This change does not touch the way the *values* are handled - they are both read and written in UTF-8. Drive-by: remove misleading comments from the reading algorithm. Task-number: QTBUG-99401 Change-Id: I6a83cbf24d919a499540403688615f93cb195e93 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Windows: Fix handling of childGroups() when fallbacks are disabledJeremie Graulle2021-12-271-0/+10
| | | | | | | | | | When fallbacks are disabled for QSettings then it should not be falling back to any child groups or keys that might exist in a fallback set of settings. Fixes: QTBUG-85295 Change-Id: I563999293a103702035c8d3b027b59b94ca43c0e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Compile autotests for IntegrityTatiana Borisova2021-09-201-0/+4
| | | | | | | | | - process environment/DNS are OFF for INTEGRITY Task-number: QTBUG-96176 Pick-to: 6.2 Change-Id: I189a97f88c96a428586c31a66b8d250e04482900 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* testlib: Deprecate QWARN() in favor of qWarning()Tor Arne Vestbø2021-08-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The QtTest best practices documentations recommends using output mechanisms such as qDebug() and qWarning() for diagnostic messages, and this is also what most of our own tests do. The QWARN() macro and corresponding internal QTest::qWarn() function was added when QtTest was first implemented, but was likely meant as an internal implementation detail, like its cousin QTestLog::info(), which does not have any corresponding macro. This theory is backed by our own QtTest self-test (tst_silent) describing the output from QWARN() as "an internal testlib warning". The only difference between QWARN() and qWarning(), besides the much richer feature set of the latter, is that qWarning() will not pass on file and line number information in release mode, but QWARN() will. This is an acceptable loss of functionality, considering that the user can override this behavior by defining QT_MESSAGELOGCONTEXT. [ChangeLog][QtTest] QWARN() has been deprecated in favor of qWarning() Pick-to: 6.2 Change-Id: I5a2431ce48c47392244560dd520953b9fc735c85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* macOS: Don't mangle QByteArray settings with @ prefix by decoding as UTF-8Tor Arne Vestbø2021-07-131-0/+4
| | | | | | | | | | | | | | | | | | QSettings encodes QVariants as @Type(data) strings. If that data contains a null-byte, we write the string as UTF-8 encoded CFData. When reading it back we look for a @ prefix, and then pass it as UTF-8 through stringToVariant. The problem arises then the user writes raw QByteArrays with a @ prefix. We can detect this situation by checking the result of stringToVariant, and if it's just a simple conversion of the string into a QVariant, we know that stringToVariant hit its fallback path due to not finding any embedded variants. If that's the case, we return the raw bytes as a QByteArray. Pick-to: 6.2 6.1 5.15 5.12 Change-Id: I4ac5c35d0a6890ebea983b9aca0a3a36b0143de2 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* tst_qsettings: reliably remove the empty.ini fileMarc Mutz2021-06-111-1/+2
| | | | | | | ... using QScopeGuard. Change-Id: I3693ca5e5ef32aa7ccabaa7e05a94bee69e0910b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix warnings from deprecated posix functionsVolker Hilsheimer2021-04-281-1/+3
| | | | | | | | | Windows wants ISO C++ _fileno and _unlink instead of posix fileno and unlink. For fileno we have the QT_FILENO macro in qplatformdefs.h, so use it. For unlink we don't have a macro in Qt, so declare one in the test. Change-Id: I56c5c3fb4e500769c744132c46107816f89bb2c3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Split up the QMetaType unit testVolker Hilsheimer2021-02-091-1/+1
| | | | | | | | | | | gcc 9 consumed enourmous amounts of memory building the test, regularly dying on a VM with 4GB RAM. Splitting it up helps. As a drive-by, use inline static variables, and rename the header used by other tests to tst_qmetatype_common.h. Change-Id: Ib716d8e3506aac6c87845e57b04cb1a4f6c68387 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* QSettings: Add support for QMetaType::FloatChristian Ehrlicher2021-01-151-0/+23
| | | | | | | | | | | When writing out a float value, the output string is encoded as QVariant for no reason. Looks like an oversight when QMetaType::Float was added a long time ago. Fixes: QTBUG-21156 Change-Id: I7f5d31e15892d700c1b1e5e731b7733ce3a15730 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace QtTest headers with QTestDavid Skoland2020-12-221-1/+1
| | | | | | | | | | | Complete search and replace of QtTest and QtTest/QtTest with QTest, as QtTest includes the whole module. Replace all such instances with correct header includes. See Jira task for more discussion. Fixes: QTBUG-88831 Change-Id: I981cfae18a1cabcabcabee376016b086d9d01f44 Pick-to: 6.0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Deprecate QVariant::TypeLars Knoll2020-10-231-5/+5
| | | | | | | | | It's been obsolete for a long time already. Make sure the compiler now warns about it and remove all remaining uses in qtbase. Change-Id: I0ff80311184dba52d2ba5f4e2fabe0d47fdc59d7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Fix compiler warnings about missing overridesLars Knoll2020-09-131-1/+1
| | | | | Change-Id: I52bf9fe45607f4a99cafa441bd78dfe5f7adb0e1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Implement QMetaType::canConvert() and use it in QVariantLars Knoll2020-08-241-1/+2
| | | | | | | | | | | | | | | | | | | | Use the fact that we return the conversion function as a lambda to find out reliably whether a conversion between two types can be done. This requires some minor adjustments to our tests: * Nothing can convert to an unknown type and vice versa * Adjust results to the fact that we don't convert from char to QString anymore (where the old method was incorrect) * QStringList->QString requires some adjustments, as we only convert if the string list has exactly one element. For now we return true in canConvert(), but the conversion behavior in this case is something we should rethink, as it is very surprising. Change-Id: I3f5f87ee9cb99d690f5a7d13b13d6a6313d8038e Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
* Tests: Use QVERIFY instead of QCOMPARE for empty listsFriedemann Kleint2020-07-101-1/+1
| | | | | | Pick-to: 5.15 Change-Id: I4da02fa11583eca3844bf42efcdf818b8bbd6a94 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* Replace use of deprecated Q_OS_MACX in favor of Q_OS_MACOSTor Arne Vestbø2020-07-081-1/+1
| | | | | Change-Id: I1059d56f67be28a4cc1a66b744e81df6d0b5d00d Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove QByteArray's methods taking QString and their usesSona Kurazyan2020-06-251-2/+0
| | | | | | | | | | [ChangeLog][QtCore][QByteArray] Remove method overloads taking QString as argument, all of which were equivalent to passing the toUtf8() of the string instead. Change-Id: I9251733a9b3711153b2faddbbc907672a7cba190 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Remove winrtOliver Wolff2020-06-061-31/+14
| | | | | | | | | Macros and the await helper function from qfunctions_winrt(_p).h are needed in other Qt modules which use UWP APIs on desktop windows. Task-number: QTBUG-84434 Change-Id: Ice09c11436ad151c17bdccd2c7defadd08c13925 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Get rid of QSettings::iniCodec()Lars Knoll2020-05-141-108/+5
| | | | | | | | | | | | | | | | | | Always encodee INI files as utf-8 in Qt6. This is mostly backwards compatible, as old ini files would encode all non ascii characters. [ChangeLog][Important behavioral changes] QSettings will now always encode INI files as utf-8 (and the iniCodec/setIniCode methods are removed). This is a change from Qt 5 and earlier, where QSettings would by default escape all non ascii characters. The behavior is equivalent to what you got in Qt5 by setting a utf-8 iniCodec on the settings object. Settings files written in Qt 5 will still be readable in Qt 6 (unless an iniCodec different from utf-8 was used), but to read Qt6 based ini files in Qt 5 applications, setting the iniCodec to utf-8 is required. Change-Id: Ic7dffcca17779bd5e3dae50d42ce633170289f6c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devLars Knoll2020-02-281-2/+3
|\ | | | | | | Change-Id: I469b0501cc65fc5ce4d797a69ae89405cc69c7f8
| * tst_QSettings: Fix leaking registry keyFriedemann Kleint2020-02-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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 <thiago.macieira@intel.com>
* | QShortcut: Properly port to the new configure systemFriedemann Kleint2019-10-251-1/+5
|/ | | | | | | | | | | | | | | Move the feature to corelib so that the QMetaType enumeration values can be properly excluded and there is no need for a dummy class. Use QT_REQUIRE_CONFIG in the headers of classes to be disabled. Add headers/source files in the .pro file depending on the configure feature in libraries and tests. Add the necessary exclusions and use QT_CONFIG. Task-number: QTBUG-76493 Change-Id: I02499ebee1a3d6d9a1e5afd02517beed5f4536b7 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Win32: Consolidate registry codeFriedemann Kleint2019-10-141-30/+13
| | | | | | | | Add a RAII class for registry keys and use it throughout the code base. Change-Id: I666b2fbb790f83436443101d6bc1e3c0525e78df Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove usages of deprecated APIs of qtbase/guiSona Kurazyan2019-07-131-1/+3
| | | | | | | | | | | | | | | - Replaced the usages of deprecated APIs by corresponding alternatives in the library code and documentation. - Modified the tests to make them build when deprecated APIs disabled: * Made the the parts of the tests testing the deprecated APIs to be compiled conditionally, only when the corresponding methods are enabled. * If the test-case tests only the deprecated API, but not the corresponding replacement, added tests for the replacement. Change-Id: Ic38245015377fc0c8127eb5458c184ffd4b450f1 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove usages of deprecated APIs of corelibSona Kurazyan2019-07-051-2/+5
| | | | | | | | | | | | | | | | | | - Replaced the usages of deprecated APIs of corelib by corresponding alternatives in the library code and documentation. - Modified the tests to make them build when deprecated APIs disabled: * Made the the parts of the tests testing the deprecated APIs to be compiled conditionally, only when the corresponding methods are enabled. * If the test-case tests only the deprecated API, but not the corresponding replacement, added tests for the replacement. Task-number: QTBUG-76491 Task-number: QTBUG-76539 Task-number: QTBUG-76541 Change-Id: I62ed4a5b530a965ec3f6502c6480808f938921aa Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Fix QSettings parsing of spaces after comment linesThiago Macieira2018-12-071-0/+29
| | | | | | | | | [ChangeLog][QtCore][QSettings] Fixed QSettings parsing of blank spaces after comment lines in INI-style configuration files. Fixes: QTBUG-72007 Change-Id: Idd0c85a4e7b64f9c9c7dfffd156c5b219f3b5c0a Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Metatype: make the Qt CBOR value-like types built-in meta typesThiago Macieira2018-07-041-0/+4
| | | | | | | | This change only adds them to the registry and reserves the IDs. The next commit will handle conversions. Change-Id: I56b444f9d6274221a3b7fffd150d2d49f40940c2 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* tst_qsettings: Check case sensitivity of actual settings fileTor Arne Vestbø2018-03-071-1/+1
| | | | | | | | Instead of the current working directory, which doesn't necessarily match the location of the settings file. Change-Id: Idffe2e87190cc9b6027fbba3b84e9dbf72ccf2f6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-1/+1
| | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Allow QSettings to synchronize non-atomicallyThiago Macieira2017-08-041-0/+76
| | | | | | | | | | | | | | | | | | | | This is required so that one can use QSettings in situations that temporary files or renaming may not work. [ChangeLog][QtCore][QSettings] Added setAtomicSyncRequired(), which allows one to use QSettings with config files in unwriteable directories or in Alternate Data Streams on NTFS on Windows. This used to work before Qt 5.4, but remains a non-default behavior due to the potential of data corruption. Task-number: QTBUG-47379 Change-Id: I81480fdb578d4d43b3fcfffd14d4f77112f0402f Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-02-081-5/+13
|\ | | | | | | | | | | | | | | Conflicts: configure.json mkspecs/win32-icc/qmake.conf Change-Id: Ibf40546b024d644c7d9ed490bee15b82597f4d3f
| * Fix data corruption when reading byte arrays from QSettingsThierry Bastian2017-02-031-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | On macOS, the code that read the plist is using QByteArray::fromRawCFData. When we return the data directly we need to detach the QByteArray so that it does not point CFData's data that will get deallocated just after the call. Task-number: QTBUG-58531 Change-Id: If829a304b986c99c8fc2aeeb992f2d539a4eef3a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
| * Read the .ini file back in text modeThiago Macieira2017-01-311-5/+2
| | | | | | | | | | | | | | | | | | | | Because on Windows, the .ini files are saved with CRLF, but the files in the Qt resource are just LF (.gitattributes makes them so). Task-number: QTBUG-25446 Change-Id: I5eab0d9620bd1ba675b0a87c554f62cef0f98fcc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.8' into devLiang Qi2016-10-131-18/+178
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/library/qmakeevaluator.cpp (cherry picked from commit 1af6dc2c8fb4d91400fddc5050166f972ae57c9a in qttools) src/corelib/kernel/qcore_mac_objc.mm src/gui/painting/qcolor.h src/plugins/platforms/cocoa/qcocoawindow.mm Change-Id: I5b3ec468a5a9a73911b528d3d24ff8e19f339f31
| * tst_QSettings: Don't assume the presence of a key means isWritableTor Arne Vestbø2016-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * tst_QSettings: Fix tests on sandboxed platforms such as iOSTor Arne Vestbø2016-10-101-13/+7
| | | | | | | | | | | | | | | | | | | | | | WinRT is not the only sandboxed platform. Since it doesn't hurt to keep the test data in a well known location, we enable the code for all platforms. We also make sure to mkpath the location, since writableLocation doesn't guarantee that the location exists. Change-Id: Ie8d90c5fbdf3b7fbf85ba6be25372b0ef7c4da55 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
| * Don't truncate QDateTime milliseconds when storing QSettings on Apple platformsTor Arne Vestbø2016-10-051-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The fix is trivial, but the patch adds a new QSettings tests that iterates most of the QMetaTypes and verifies that storing and retrieving them again gives the same value. This is a more complete test than the testVariantTypes tests, which is limited to a subset of the QVariant types. The new tests borrows logic from the QMetaType test machinery. QSettings has been Q_ENUM'ified in the process, for improved debug output. Note that on backends such as the INI backend, the metatype of the QVariant read from the settings will be a string, so it won't match the input QVariant type, but the result of converting that to the original value type should still work. Task-number: QTBUG-56124 Change-Id: Ib03a26abf77c9fb449b94160d28bc4baeb095f25 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
| * Apple OS: Handle QSetting strings with embedded zero-bytesTor Arne Vestbø2016-10-051-1/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Saving strings with embedded zero-bytes (\0) as CFStrings would sometimes fail, and only write the part of the string leading up to the first zero-byte, instead of all the way to the final zero-terminator. This bug was revealed by the code-path that falls back to storing e.g. QTime as strings, via the helper method QSettingsPrivate::variantToString(). We now use the same approach as on platforms such as Windows and WinRT, where the string produced by variantToString() is checked for null-bytes, and if so, stored using a binary representation instead of as a string. For our case that means we fall back to CFData when detecting the null-byte. To separate strings from regular byte arrays, new logic has been added to variantToString() that wraps the null-byte strings in @String(). That way we can implement a fast-path when converting back from CFData, that doesn't go via the slow and lossy conversion via UTF8, and the resulting QVariant will be of type QVariant::ByteArray. The reason for using UTF-8 as the binary representation of the string is that in the case of storing a QByteArray("@foo") we need to still be able to convert it back to the same byte array, which doesn't work if the on-disk format is UTF-16. Task-number: QTBUG-56124 Change-Id: Iab2f71cf96cf3225de48dc5e71870d74b6dde1e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * tst_QSettings: Detect if Apple platforms support writing to SystemScopeTor Arne Vestbø2016-10-041-1/+17
| | | | | | | | | | | | | | | | A fair amount of tests are skipped if we can't write to the system scope, eg on iOS. Without this detection they will fail. Change-Id: I8257f1f24e69dae88925c20d2bff851e81701405 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
| * Exclude tst_QSettings::rainersSyncBugOnMac() on all Apple OSesTor Arne Vestbø2016-10-031-2/+2
| | | | | | | | | | | | | | It fails on iOS as well, and likely also tvOS and watchOS. Change-Id: Idfce98a5aeccb5680f6b4c6e66b526dd7922156d Reviewed-by: Jake Petroules <jake.petroules@qt.io>