summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QSaveFile: don't reset fileEngine after commit()David Faure99 min.1-0/+24
| | | | | | | | | | | [ChangeLog][QtCore][QSaveFile] Member functions such as fileTime() and size() now continue to work after commit(). Fixes: QTBUG-66605 Fixes: QTBUG-77039 Change-Id: I0b17eae9493911d1a0828b589d762bd8eb344bce Reviewed-by: Ahmad Samir <a.samirh78@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSaveFile: unittests: use strlen() instead of hardcoded numbersAhmad Samir7 days1-9/+14
| | | | | | | | DRY with respect to string literals. Change-Id: I606a4cbd502efb0f0f7d12176f4253fb2cd5eaa4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Tests: check the output of QFile::openGiuseppe D'Angelo2024-03-271-1/+1
| | | | | | | | | | Wrap the call in QVERIFY. tst_QTextStream::read0d0d0a was also faulty as it *never* opened the file because of a broken path. Fix it with QFINDTESTDATA. Change-Id: I61a8f83beddf098d37fda13cb3bfb4aaa4913fc5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change license for tests filesLucie Gérard2024-02-041-1/+1
| | | | | | | | | | | | According to QUIP-18 [1], all tests file should be LicenseRef-Qt-Commercial OR GPL-3.0-only [1]: https://contribute.qt-project.org/quips/18 Pick-to: 6.7 Task-number: QTBUG-121787 Change-Id: I9657df5d660820e56c96d511ea49d321c54682e8 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
* Fix undeclared identifier 'geteuid' for VxWorksMarcin Zdunek2023-09-121-2/+2
| | | | | | Task-number: QTBUG-115777 Change-Id: Ic95d5f92af185ac64b14ae6fafd4ffe507911f5b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* 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>
* QtBase: replace windows.h with qt_windows.hYuhang Zhao2021-11-231-1/+1
| | | | | | | | | | We have some special handling in qt_windows.h, use it instead of the original windows.h Change-Id: I12fa45b09d3f2aad355573dce45861d7d28e1d77 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@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>
* Replace QtTest headers with QTestDavid Skoland2020-12-221-1/+2
| | | | | | | | | | | 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>
* tst_QSaveFile: skip test that fails when run as rootThiago Macieira2020-04-081-0/+4
| | | | | | | | | | | FAIL! : tst_QSaveFile::retryTransactionalWrite() '!file.open(QIODevice::WriteOnly)' returned FALSE. () Loc: [/home/tjmaciei/src/qt/qt5/qtbase/tests/auto/corelib/io/qsavefile/tst_qsavefile.cpp(156)] strace reveals: access("/TEMPDIR/outfile.ro", W_OK) = 0 Change-Id: Ibdc95e9af7bd456a94ecfffd1603eb371aadb02b Reviewed-by: David Faure <david.faure@kdab.com>
* Avoid initializing QFlags with 0 or nullptr in testsFriedemann Kleint2019-11-261-1/+1
| | | | | | | Amends qtbase/af2daafde72db02454d24b7d691aa6861525ab99. Change-Id: Ib5d17611e43e7ab2c63c7f0587f549377f262e32 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* QSaveFile: Fix changing the file name after hitting on readonly fileFriedemann Kleint2019-07-111-0/+34
| | | | | | | | | The call to QFileDevice::unsetError() in QSaveFile::open() does not clear QSaveFilePrivate::writeError. Clear it in addition. Fixes: QTBUG-77007 Change-Id: I5e5009750f1726d1c74c1b4eb1c33f3a5393fe4f Reviewed-by: David Faure <david.faure@kdab.com>
* Support Alternate Data Streams in QSaveFileThiago Macieira2017-08-041-0/+60
| | | | | | | | | | | | | | | | We can't use MoveFile to do atomic commits on an ADS, so QSaveFile needs to detect when the target name is ADS and then use the direct fallback mode. [ChangeLog][QtCore][QSaveFile] Saving to Alternate Data Streams on NTFS on Windows is now possible, but requires setDirectWriteFallback(true). Task-number: QTBUG-47379 Change-Id: I81480fdb578d4d43b3fcfffd14d4bc062ae1750d Reviewed-by: Kai Koehne <kai.koehne@qt.io> Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
* Updated license headersJani Heikkinen2016-01-211-16/+11
| | | | | | | | | | | | | From Qt 5.7 -> tools & applications are lisenced under GPL v3 with some exceptions, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new GPL-EXCEPT header instead of LGPL21 one (in those files which will be under GPL 3 with exceptions) Change-Id: I42a473ddc97101492a60b9287d90979d9eb35ae1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Tests: Always verify whether QTemporaryDir/File creation succeeded.Friedemann Kleint2015-09-281-11/+11
| | | | | | | | | | | Use QVERIFY2() with QTemporaryDir/File::errorString() consistently. Attempt to catch issues like the below warning and follow-up issues. QSYSTEM: tst_QFiledialog::clearLineEdit() QFileSystemWatcher: FindNextChangeNotification failed for "C:\Users\qt\_____aaaaaaaaaaaaaaaaaaaaaa" (Access is denied.) Task-number: QTBUG-47370 Change-Id: I58a6e87c502627e976efa62ad73c912f3b2d49fa Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* QSaveFile: Fix permissions on creationKai Koehne2015-04-081-0/+8
| | | | | | | | | | | | | | | | | | | | QSaveFile is intended to be a replacement for QFile, and should use the same permissions for newly created files. QTemporaryFile however creates new files with 0600 mask by default. Fix this by making the mode_t argument QTemporaryFileEngine uses configurable, and using 0666 for QSaveFile (like we do in QFile). [ChangeLog][Important behavior changes] Files created by QSaveFile do now have the same rights as files created by QFile. This also fixes a regression in QSettings: In the Qt 5.4 series, new files created by QSettings were only readable by the current user. Task-number: QTBUG-44086 Change-Id: Ie1cc20e9f25c6e72e1bc9176490c419c27c5fc82 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@theqtcompany.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Update copyright headersJani Heikkinen2015-02-111-6/+6
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QSaveFile: error out in open when the file is a directoryOlivier Goffart2014-06-041-0/+25
| | | | | Change-Id: Ifb1697fedf6dd28fe317282c8b4824f34ec61981 Reviewed-by: David Faure <david.faure@kdab.com>
* QSaveFile: follow symbolic linksOlivier Goffart2014-05-301-0/+114
| | | | | | | | | [ChangeLog][QtCore][QSaveFile] Now follows symbolic links while writing to a link instead of replacing the link with the contents. Change-Id: I5afd519cb9f96ae68fa4c23c33a18de75671a301 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: David Faure <david.faure@kdab.com>
* Skip some qsavefile auto testsBernd Weimer2014-05-191-3/+14
| | | | | | | Some of the QSaveFile tests are not applicable with root privileges. Change-Id: I1a22906c0b14acf144f1849719152dfe9d79f426 Reviewed-by: David Faure <david.faure@kdab.com>
* Fix temporary directory leak in tst_qsavefile.Friedemann Kleint2013-10-011-45/+24
| | | | | | | Task-number: QTBUG-33769 Change-Id: I5177f09df22fd2b9b0d9eca4301c383c600d5ab8 Reviewed-by: David Faure <david.faure@kdab.com>
* tst_qsavefile: Check temporary dir and output open errors.Friedemann Kleint2013-09-301-12/+27
| | | | | Change-Id: Id28306ad414050a37b7779525f36edc3e15281b5 Reviewed-by: David Faure <david.faure@kdab.com>
* QSaveFile: allow saving to a writable file in a non-writable directoryDavid Faure2013-04-051-9/+76
| | | | | | | | | | The only way to make this possible is to disable the atomic-rename-from-temp-file behavior. This is not done by default, but only if the application allows this to happen. https://bugs.kde.org/show_bug.cgi?id=312415 Change-Id: I71ce54ae1f7f50ab5e8379f04c0ede74ebe3136d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSaveFile autotest: restore permissions using RAIIDavid Faure2013-01-171-8/+25
| | | | | | | So that the QTemporaryDir can happen even on error. Change-Id: I728d49eac8bd65e1919fd314a95387949e134de0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QSaveFile: test the case of an existing, but readonly, target file.David Faure2013-01-171-2/+23
| | | | | Change-Id: I296d9c2598b8c72e2fd3e6ec80a615364b7eddeb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add class QSaveFile.David Faure2013-01-171-0/+234
This QIODevice uses a temporary file for writing, so that in case of write errors, the writing operation is canceled, without losing any existing file. It also avoids having a partially-written file visible by other processes, at the final destination. Change-Id: I9482df45751cb890b1b6f1382ec2eea3eb980627 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>