summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QTest: Make qExtractTestData() return the created QTemporaryDirv5.5.0-rc1Marc Mutz2015-06-141-7/+8
| | | | | | | | | | | | | | | | ... and enable auto-deletion on it. This allows users of the function to get rid of their own cleanup code. They just need to keep the shared pointer alive for as long as they need it. Drive-by changes: - replaced QStringLiterals that were only used as the rhs of op+ - replaced an instance of mid() used as the rhs of op+ with midRef() - enabled NRVO Change-Id: I161d39461e020c9e8d473c0810dea2109fe0d62d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Skip instead of entirely excluding tests with disabled featuresMarko Kangas2015-03-161-4/+6
| | | | | | | | | | | | Properly QSKIP tests that use disabled QProcess and symlink features instead of excluding them silently by #ifdef. Other reason is that moc doesn't respect QT_NO_* defines in class definition which causes build issues on some platforms. Change-Id: I041020f7452f7d36c7ec8a5866a4ba5eb23d1f94 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Jason McDonald <macadder1@gmail.com>
* Use qrc for test data in QFileInfo test on all platformsEskil Abrahamsen Blomfeldt2015-02-181-28/+11
| | | | | | | | | | | | To make the test compatible with cross-compilation, we need to bundle test data in qrc, and then extract files to the file system during initialization. We did this for Android before, but the change is required on many platforms and since it will also work on desktop platforms, we consistently just do it this way everywhere. Change-Id: I7f65bd9e1dd6f217e6adffda44a40da7599cfe72 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* Android: Fix tst_QFileInfo::isExecutable()Eskil Abrahamsen Blomfeldt2015-02-171-1/+5
| | | | | | | Use correct path for executable file. Change-Id: I50283fc43fe6561cb8eb687f739f21a3d5cbadbd Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* Android: Fix test failure for test QFileInfo::lastRead()Eskil Abrahamsen Blomfeldt2014-12-221-0/+4
| | | | | | | | | This test may not be possible on Android, since the file system can be mounted with noatime or relatime which means read access will not be registered. Change-Id: I40f587e1a1f131ee06f0e3700e908ccaa19c83ce Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Android: Fix QFileInfo testsEskil Abrahamsen Blomfeldt2014-12-221-1/+24
| | | | | | | | | Since there's no way to deploy files directly to the file file system on Android, we put them in a qrc file and extract them on startup. Change-Id: I6a42aa5e0372bfd9fb2f7ccfea964c9c3c2e45d8 Reviewed-by: BogDan Vatra <bogdan@kde.org>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QSettings: use QSaveFile and QLockFile to write the settingsOlivier Goffart2014-07-241-3/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | The old unix locking code is no longer working on unix since it locks on a file descriptor, but QSaveFile creates a new file, and as a result we get the lock on the wrong file. Also there is no need to keep the lock held only for reading as QSaveFile is atomic. It just needs to be held when doing a read before writing. As a result, since we don't hold the same lock, there could be a race with an application running an older version of Qt if they are writing on the same configuration file. [ChangeLog][QtCore][QSettings] Fixed data loss while writing the config to the disk fails. [ChangeLog][Important behavior changes] The locking mechanism inside QSettings has changed and is no longer compatible with the one of previous versions of Qt. There might be corruption if two applications running different versions of Qt are writing to the same config file at the same time. You must also now have write permissions in the directory containing the settings file in order to write settings Task-number: QTBUG-21739 Change-Id: I0844a5e96c8bc1e1222a3dac6cc48170ca77fe1b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QNX: Fix tst_qfileinfoBernd Weimer2014-05-141-6/+3
| | | | | Change-Id: Ia97a0c661d675e4f5ba800c32f8368583d58ee20 Reviewed-by: Sergio Ahumada <sahumada@blackberry.com>
* Disable UNC tests on WinRT.Janne Anttila2014-03-141-2/+2
| | | | | | | | Based on file system implementation for WinRT, the UNC paths are not supported on WinRT, so lets disable corresponding tests as well. Change-Id: Ib45ae618f39d5da39a822160096599b30204cf71 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
* Revert path() behavior to not expand a current path on a driveAndy Shaw2014-03-041-1/+1
| | | | | | | | | | | | | | | | | In the original change - cfb44c6528b2518274bf157388832d1d610ce0e4 - when querying for the path of a file that did not contain a slash after the drive indicator it would get the current path and return that as the path that the file resided on. However this meant that it would take the current path at that time which may not be the actual path that was expected. So it was decided that it should revert back to the original behavior which was to just return the drive letter followed by the colon which would thus indicate still that it represented whatever the current path was on that drive. Change-Id: Ic57ae9227882a66e9a4c4d6537d7f2cae829165a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* WinRT: Fix various test compilationsAndrew Knight2013-10-021-8/+8
| | | | | | | | | | | | | - Remove irrelevant test subdirs via .pro files - Follow WinCE codepaths where applicable - Replace unsupported Win32 APIs with WinRT equivalents This does not aim to fix any failures in the tests themselves; it only makes them compile. Change-Id: Ia82bc0cc402891f8f6238d4c261ee9152b51be80 Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Add a static QFileInfo::exists(fileName) functionhjk2013-09-131-0/+1
| | | | | | | | | This avoids dynamic construction of the private class. According to the benchmark we go from 4,550 to 3,900 instruction reads per iteration. (without change 32629676 the baseline is 5,600) Change-Id: I5df925e30dbd49bdde87173e481820574ce5abe1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve tst_QFileInfo::compare() test, but mark as QEXPECT_FAIL on MacTor Arne Vestbø2013-08-071-11/+6
| | | | | | | | | As Qt still thinks that all UNIX filesystems are case sensitive, which is not the case for eg Mac, where they might be both, as well as for mounts of other filesystems. Change-Id: I07b8550685bfa17ac407c20ac991dc54df040942 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
* tst_qfileinfo: Fix invalid preprocessor directive.Friedemann Kleint2013-02-261-1/+1
| | | | | | | Introduced by 5ec342fefdb00406d3bf6f3943d4b235b9094cc9 . Change-Id: I28f9e093567ef1abf3898146e7183a90888262ad Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix QFileInfo autotest for VxWorks.Pasi Petäjäjärvi2013-02-191-4/+10
| | | | | | | No users/groups/symlinks on VxWorks. Change-Id: I524a568202db2478b070b16a63ae425224c3aaa0 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Fix warning about redefinition of _WIN32_WINNT.Friedemann Kleint2013-01-281-1/+0
| | | | | | | This is redefined by qt_windows.h Change-Id: I6a8cb06c93c4055b166f1a214cba981d61680b9c Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-01-221-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qsavefile_p.h src/corelib/tools/qregularexpression.cpp src/gui/util/qvalidator.cpp src/gui/util/qvalidator.h Change-Id: I58fdf0358bd86e2fad5d9ad0556f3d3f1f535825
| * Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | | | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix cleanup of temporary files in test of QFileInfo.Friedemann Kleint2013-01-221-25/+24
| | | | | | | | | | Change-Id: I0d21fc05a7d816acab5f7284f905bf971a5c04da Reviewed-by: David Faure (KDE) <faure@kde.org>
* | Reduce invocations of QFINDTESTDATA in tst_qfileinfo.Friedemann Kleint2013-01-211-31/+47
| | | | | | | | | | | | | | | | Introduce variables for the paths used in the test and check in initTestCase(). Change-Id: Ie801266e30cd860e5bdf079c1182fe385f9598c7 Reviewed-by: David Faure (KDE) <faure@kde.org>
* | Fix temporary file leak in tst_qfileinfo.Friedemann Kleint2013-01-211-4/+3
|/ | | | | Change-Id: I0d679638d5a9564f612ae5e70717f164b74aefb0 Reviewed-by: David Faure (KDE) <faure@kde.org>
* Do not detect directories ending in ".lnk" as link files.Friedemann Kleint2012-11-231-0/+7
| | | | | | | Task-number: QTBUG-21863 Change-Id: I70b661fa5fcaba1293a80c971c506798826f5b23 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Blackberry: fix tst_QFileInfo::fileTimes()Rafael Roquetto2012-09-141-1/+5
| | | | | | | | | | | The Blackberry OS uses a filesystem with the noatime option, which returns a "wrong" access time. Change-Id: I04cdb899699e819a36e0917e30d750067b33388d Reviewed-by: Tobias Koenig Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Peter Hartmann <phartmann@rim.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Fixed: QFileInfo::lastModified() returning wrong value.Markku Heikkila2012-09-131-0/+10
| | | | | | | | | | | | | | | Fixed so that empty QDateTime is returned for non existing file. Fixed also created() and lastRead() to return empty QDateTime for non existing file. QFileSystemEngine::fillMetaData() returned true for non existing files. This was also corrected. Task-number: QTBUG-25811 Change-Id: I523eb99e4405b4b813b2950f85cc646239181d07 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Christian Stromme <christian.stromme@nokia.com>
* Blackberry: fix tst_QFileInfo::isWritable()Rafael Roquetto2012-09-131-1/+4
| | | | | | | | | This test checks the access permissions for '/etc/passwd', however the filesystem on Blackberry is always read-only Change-Id: I9299531397d4467287541b04184540ad6e2eae72 Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Use true and false in preference to TRUE and FALSESergio Ahumada2012-09-051-1/+1
| | | | | | | | The TRUE and FALSE macros are obsolete and should be replaced with true and false (all lower case) respectively. Change-Id: Iee352e8173500683e6319be0abbf5bacf29016e0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make tests/auto/corelib compile on Windows CEKevin Funk2012-08-301-0/+2
| | | | | Change-Id: I71987d40ae69d95f645c4c7d26d50add4c799327 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Fix cases where functions are called with a drive and no slashAndy Shaw2012-05-161-1/+25
| | | | | | | | | | | | | | | When a file is specified on a path that includes a drive letter followed by a colon but no slash then it didn't always account for the fact that this refers to the current path on that drive. This fixes the problems in completeBaseName(), baseName() and path(). Tests are also added for these three cases and some others too. Task-number: QTBUG-25353 Change-Id: I47a197c6af066f532442ad269be57597ec61303a Reviewed-by: Irfan Omair <irfan.omair@gmail.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Add QFileInfo::isNativePathJoão Abecasis2012-02-141-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | This function returns true if the file path can be used directly with native APIs, modulo encoding and path separator conversions. This is important for applications that interface with other libraries or simply need to use native APIs together with Qt. Traditionally, this information was available in QAbstractFileEngine and forced users to explicitly create an engine or use internal API such as QFile::fileEngine to access the underlying engine and this piece of information. Given its usefulness, exposing the information in a more visible place is more appropriate. This reduces the need for people to know or care about implementation details, like file engines... The existing isLocalFs test was updated and repurposed to use the new API, instead of relying on file engines and internal implementation details of QFileInfo. Change-Id: I65f497bb25741f6f7ea4d2c3b3562c8c4aab8bea Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com> Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fixed tst_qfileinfo::group crash if getgrgid failsRohan McGovern2012-02-091-0/+6
| | | | | | | | QVERIFY2 and gracefully fail with an error message, rather than crashing, if getgrgid() fails. Change-Id: I82a7290f83208486577988cc831d5d3cba20f98e Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Windows: Fix autotests with -qtnamespaceKai Koehne2012-01-311-1/+6
| | | | | Change-Id: If367429dafc283b3b2d57dab593060055f65659d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* QFileInfo autotest - don't fail on default configured windows systemsShane Kearns2012-01-201-0/+13
| | | | | | | | | NTFS file access times are disabled by default since windows 6 for performance reasons. The test now checks the registry setting and reports XFAIL if access times are disabled. Change-Id: Ia84ed0c8736e6c7d5817425006f6115d9f3e70a4 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* remove NTFS junction and mount point detectionJoerg Bornemann2012-01-191-5/+7
| | | | | | | | Qt now treats neither NTFS junctions nor mount points as symlinks. Task-number: QTBUG-20431 Change-Id: I93f67d7438d441ceb53308d4a1f29335beedd547 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Revert "fix NTFS mount points"Joerg Bornemann2012-01-191-1/+1
| | | | | | | | | | We agreed on treating neither junctions nor mount points as symlinks. This will be handled in another commit. This reverts commit 1656c4780cc6c1d96f47522046f3f53b1eebb95a. Change-Id: I41a87b6df9f7fba333df4c967ee9f0c1f3940952 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* fix NTFS mount pointsJoerg Bornemann2012-01-171-1/+1
| | | | | | | | | | | | NTFS mount points are not treated as symlinks, because they might not have a link target. This is the case when a volume is mounted as a single mount point without a drive letter. This patch fixes building Qt in an NTFS mount point. Task-number: QTBUG-20431 Change-Id: Ie2e15212e1a7ca7fa0067b7ca8857e243e42c21a Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Prevent QFileInfo test from leaving temporary files behind.Jason McDonald2012-01-051-20/+33
| | | | | | | | | | Use a small helper class to ensure that the files created during the test are removed afterwards, even if the test fails. Also, verify creation of the files in the body of the test function, not in the helper, as verifying in the helper won't terminate the test on failure. Change-Id: I76eff20e54ef6a1ed71d9bbb31e00f41f3d14c38 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove TESTED_CLASS/TESTED_FILES comments from tests.Jason McDonald2011-12-061-3/+0
| | | | | | | | | These comments were mostly empty or inaccurate. Appropriate naming of tests and appropriate placement of tests within the directory tree provide more reliable indicators of what is being tested. Change-Id: Ib6bf373d9e79917e4ab1417ee5c1264a2c2d7027 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fixed installation of corelib testsRohan McGovern2011-12-011-27/+27
| | | | | | | | | | | | | | | | | In .pro files, removed wince/symbian-specific DEPLOYMENT cases and replaced them with TESTDATA where appropriate. In .cpp files, removed SRCDIR and relative paths to testdata and replaced them with the QFINDTESTDATA macro where appropriate. Modified test helper apps/libs to install themselves under the test they relate to. This change allows corelib tests to be correctly installed, along with their testdata, via `make install'. Change-Id: I5e202e2f3b577af7e39072d5c9fe13e0ca125304 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Cleanup corelib autotestsJason McDonald2011-11-301-6/+5
| | | | | | | | Remove references to the old bug tracker. The data from the old bug tracker is no longer accessible, so these markers are meaningless. Change-Id: Ib9d029d52b70fd0a512b9532d65f03763eabfe57 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Correct usage of network-settings.h.Jason McDonald2011-11-281-0/+2
| | | | | | | | | Four of the modified files only use functions from network-settings.h on Windows, and the other three files don't use anything from that header. Change-Id: Ifa4b0319d14367735b859e538921fa0eeeccce1a Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove obsolete test data from QFileInfo test.Jason McDonald2011-11-181-1/+0
| | | | | | | | | | | The removed data relied on the test's own source file having no write permissions, but that is not a valid assumption -- in a source package the file wouldn't have had write permissions, in Perforce it would have depended on whether the file had been checked-out for editing and in git the file would always have write permission. Change-Id: I000596f122f2765f97a09a08074938c90e2e9f95 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Don't depend on moc to disable test functions.Jason McDonald2011-11-181-10/+14
| | | | | | | | | | | | | | | | | | | | | The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Add Q_DECLARE_PRIVATE equivalent for QDir, to be able to subclass itDavid Faure2011-11-081-3/+0
| | | | | | | | Apply the same solution to QFileInfo (no public detach(), but a non-inline d_func instead). Change-Id: I31c4c759f44a0649b97f7884b078b174c9c00f22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Cleanup corelib autotestsJason McDonald2011-11-071-10/+3
| | | | | | | Remove redundant empty constructors, destructors and test functions. Change-Id: Idb51368895e67ec3fc0345a9a5d33d77730c051b Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>