Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-02-19 16:14:26 +0300
committerHannah von Reth <hannah.vonreth@owncloud.com>2021-02-19 16:14:26 +0300
commit574efb990cbfda210fdd72dd0808397a0f6b0a54 (patch)
tree9455ebd9f6a73c77d83f72ce5b22a4a52a695c72 /test
parent6008dec91d9decad026053841a213c6b8a367050 (diff)
parent4c729554f1f3b53b25b54980d4a1e3a89fac2af3 (diff)
Merge remote-tracking branch 'origin/2.7' into master
Diffstat (limited to 'test')
-rw-r--r--test/testlockedfiles.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/test/testlockedfiles.cpp b/test/testlockedfiles.cpp
index df1e8f8d0..cae7fb11c 100644
--- a/test/testlockedfiles.cpp
+++ b/test/testlockedfiles.cpp
@@ -17,7 +17,8 @@ using namespace OCC;
// pass combination of FILE_SHARE_READ, FILE_SHARE_WRITE, FILE_SHARE_DELETE
HANDLE makeHandle(const QString &file, int shareMode)
{
- const wchar_t *wuri = reinterpret_cast<const wchar_t *>(file.utf16());
+ const auto fName = FileSystem::longWinPath(file);
+ const wchar_t *wuri = reinterpret_cast<const wchar_t *>(fName.utf16());
auto handle = CreateFileW(
wuri,
GENERIC_READ | GENERIC_WRITE,
@@ -39,6 +40,7 @@ class TestLockedFiles : public QObject
private slots:
void testBasicLockFileWatcher()
{
+ QTemporaryDir tmp;
int count = 0;
QString file;
@@ -46,12 +48,16 @@ private slots:
watcher.setCheckInterval(std::chrono::milliseconds(50));
connect(&watcher, &LockWatcher::fileUnlocked, &watcher, [&](const QString &f) { ++count; file = f; });
- QString tmpFile;
+ const QString tmpFile = tmp.path() + QString::fromUtf8("/alonglonglonglong/blonglonglonglong/clonglonglonglong/dlonglonglonglong/"
+ "elonglonglonglong/flonglonglonglong/glonglonglonglong/hlonglonglonglong/ilonglonglonglong/"
+ "jlonglonglonglong/klonglonglonglong/llonglonglonglong/mlonglonglonglong/nlonglonglonglong/"
+ "olonglonglonglong/file🐷.txt");
{
- QTemporaryFile tmp;
- tmp.setAutoRemove(false);
- tmp.open();
- tmpFile = tmp.fileName();
+ // use a long file path to ensure we handle that correctly
+ QVERIFY(QFileInfo(tmpFile).dir().mkpath("."));
+ QFile tmp(tmpFile);
+ QVERIFY(tmp.open(QFile::WriteOnly));
+ QVERIFY(tmp.write("ownCLoud"));
}
QVERIFY(QFile::exists(tmpFile));
@@ -91,7 +97,7 @@ private slots:
QCOMPARE(file, tmpFile);
QVERIFY(!watcher.contains(tmpFile));
#endif
- QFile::remove(tmpFile);
+ QVERIFY(tmp.remove());
}
#ifdef Q_OS_WIN