From 3a6d075cbbc1d81209209b3caa73471fe5b6b21e Mon Sep 17 00:00:00 2001 From: evgeny Date: Sat, 10 Oct 2026 01:42:42 +0200 Subject: [PATCH] Add an opt-in native file manager drag integration test --- .../chatgui/tests/test_member_files_browser.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/chatgui/tests/test_member_files_browser.cpp b/tools/chatgui/tests/test_member_files_browser.cpp index 3d173ebe..f90c013d 100644 --- a/tools/chatgui/tests/test_member_files_browser.cpp +++ b/tools/chatgui/tests/test_member_files_browser.cpp @@ -170,6 +170,22 @@ private slots: QFile deep(folder + "/nested/deep.txt"); QVERIFY(deep.open(QIODevice::ReadOnly)); QCOMPARE(deep.readAll(), QByteArray("folder/nested/deep.txt")); QVERIFY(QFileInfo(urls[1].toLocalFile()).isFile()); + // Опциональная интеграция с настоящим системным менеджером: координаты читает внешний XTest-драйвер. + QString nativeDestination = qEnvironmentVariable("UTUN_MEMBER_FILES_NATIVE_DEST"); + if (!nativeDestination.isEmpty()) { + for (int i = 0; i < 120; ++i) directories["folder"].append(QString("many-%1.txt").arg(i)); + browser.setWindowTitle("uTun native file copy test"); browser.raise(); browser.activateWindow(); + QTRY_VERIFY(browser.isActiveWindow()); + 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()); + QCOMPARE(transfers.size(), 126); // По три исходных файла и ещё 120 в native drag. + } requestStarted = {}; transferStarted = {}; } db.setDb(nullptr); QCOMPARE(sqlite3_close(sql), SQLITE_OK);