From 4a6765c49a6d834394a01a1e3877f70530099a21 Mon Sep 17 00:00:00 2001 From: evgeny Date: Sat, 10 Oct 2026 09:37:44 +0200 Subject: [PATCH] Wait for the file manager to finish copying every entry --- tools/chatgui/tests/test_member_files_browser.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tools/chatgui/tests/test_member_files_browser.cpp b/tools/chatgui/tests/test_member_files_browser.cpp index bd6563c6..642ac2a0 100644 --- a/tools/chatgui/tests/test_member_files_browser.cpp +++ b/tools/chatgui/tests/test_member_files_browser.cpp @@ -180,11 +180,16 @@ private slots: QPoint source = tree->viewport()->mapToGlobal(tree->visualItemRect(tree->topLevelItem(0)).center()); QFile control(nativeDestination + "/source-position"); QVERIFY(control.open(QIODevice::WriteOnly)); control.write(QByteArray::number(source.x()) + ' ' + QByteArray::number(source.y())); control.close(); - QTRY_VERIFY_WITH_TIMEOUT(QFile::exists(nativeDestination + "/folder/many-119.txt"), 60000); - QFile received(nativeDestination + "/folder/nested/deep.txt"); QVERIFY(received.open(QIODevice::ReadOnly)); - QCOMPARE(received.readAll(), QByteArray("folder/nested/deep.txt")); - QVERIFY(QFileInfo(nativeDestination + "/folder/empty").isDir()); - QVERIFY(QFileInfo(nativeDestination + "/loose.txt").isFile()); + auto allCopied = [&] { + QStringList files{"loose.txt", "folder/inside.txt", "folder/nested/deep.txt"}; + for (int i = 0; i < 120; ++i) files.append(QString("folder/many-%1.txt").arg(i)); + for (const auto& path : files) { + QFile received(nativeDestination + '/' + path); + if (!received.open(QIODevice::ReadOnly) || received.readAll() != path.toUtf8()) return false; + } + return QFileInfo(nativeDestination + "/folder/empty").isDir(); + }; + QTRY_VERIFY_WITH_TIMEOUT(allCopied(), 60000); QCOMPARE(transfers.size(), 126); // По три исходных файла и ещё 120 в native drag. } requestStarted = {}; transferStarted = {};