summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io/qlockfile
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-05-08 13:22:49 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-05-08 13:26:44 +0200
commit1fce111809f216383e60f56b57a9f68ccd2b766f (patch)
tree521d560ae28354ec495ee49e2abf4cfd28303c3f /tests/auto/corelib/io/qlockfile
parente6ffb36b5517d1d4025718b56423db9bdf0a63f8 (diff)
parent3545ef41217e3ce4d1bea2b07793fa7a8c1058a6 (diff)
Merge remote-tracking branch 'origin/5.4' into merge5.5
Conflicts: src/corelib/global/qglobal.h src/corelib/io/qnoncontiguousbytedevice_p.h src/gui/image/qjpeghandler.cpp src/network/access/qhttpthreaddelegate_p.h tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp tests/auto/widgets/widgets/qmenubar/BLACKLIST Change-Id: I01de8c1c28efcedfd7953d05025f54802dc08ab3
Diffstat (limited to 'tests/auto/corelib/io/qlockfile')
-rw-r--r--tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
index bef3d3a012..8d890e81fa 100644
--- a/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
+++ b/tests/auto/corelib/io/qlockfile/tst_qlockfile.cpp
@@ -62,6 +62,7 @@ private slots:
void staleLockRace();
void noPermissions();
void noPermissionsWindows();
+ void corruptedLockFile();
public:
QString m_helperApp;
@@ -480,5 +481,21 @@ void tst_QLockFile::noPermissionsWindows()
QCOMPARE(int(lockFile.error()), int(QLockFile::PermissionError));
}
+void tst_QLockFile::corruptedLockFile()
+{
+ const QString fileName = dir.path() + "/corruptedLockFile";
+
+ {
+ // Create a empty file. Typically the result of a computer crash or hard disk full.
+ QFile file(fileName);
+ QVERIFY(file.open(QFile::WriteOnly));
+ }
+
+ QLockFile secondLock(fileName);
+ secondLock.setStaleLockTime(100);
+ QVERIFY(secondLock.tryLock(10000));
+ QCOMPARE(int(secondLock.error()), int(QLockFile::NoError));
+}
+
QTEST_MAIN(tst_QLockFile)
#include "tst_qlockfile.moc"