From cdaad39cf21ee514e4034d965ffb5acb6094a82a Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 27 Oct 2026 18:19:42 +0100 Subject: [PATCH] Verify corrected emoji insertion through the real composer connection --- tools/chatgui/tests/test_file_drop.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/chatgui/tests/test_file_drop.cpp b/tools/chatgui/tests/test_file_drop.cpp index 2dcc56d4..76b1b6d9 100644 --- a/tools/chatgui/tests/test_file_drop.cpp +++ b/tools/chatgui/tests/test_file_drop.cpp @@ -1,6 +1,7 @@ /* Реальные Qt-события на viewport: drop только готовит вложение, отправку инициирует пользователь. */ #include "../src/inputbar.h" #include "../src/chatview.h" +#include "../src/emojipanel.h" #include "../../../lib/debug_config.h" extern "C" { #include "media_async/attachment_send.h" @@ -53,6 +54,23 @@ static bool dropUrls(QWidget* target, const QList& urls, bool process = tr class FileDropTest : public QObject { Q_OBJECT private slots: + void emojiSelectionInsertsCorrectTextAtCursor() { + EmojiPanel panel; + InputBar input(&panel, nullptr); + auto* editor = input.findChild(); QVERIFY(editor); + editor->setPlainText("beforeafter"); + auto cursor = editor->textCursor(); cursor.setPosition(6); editor->setTextCursor(cursor); + QPushButton* button = nullptr; + for (auto* candidate : panel.findChildren()) { + if (candidate->toolTip() == ":pinched_fingers:") { button = candidate; break; } + } + QVERIFY(button); QSignalSpy selected(&panel, &EmojiPanel::emojiSelected); button->click(); + const QString emoji = QString::fromUtf8("🤌"); + QCOMPARE(selected.count(), 1); QCOMPARE(selected.first().first().toString(), emoji); + QCOMPARE(editor->toPlainText(), "before" + emoji + "after"); + QCOMPARE(editor->textCursor().position(), 6 + emoji.size()); + } + void deletedPmDropsDraftAndLatePreparation() { QTemporaryDir source; QVERIFY(source.isValid()); const QString path = makeFile(source, "private.txt"); QVERIFY(!path.isEmpty());