Verify corrected emoji insertion through the real composer connection
This commit is contained in:
1 parent
214af09510
commit
cdaad39cf2
1 file changed
+18
@@ -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<QUrl>& urls, bool process = tr
|
||||
class FileDropTest : public QObject {
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void emojiSelectionInsertsCorrectTextAtCursor() {
|
||||
EmojiPanel panel;
|
||||
InputBar input(&panel, nullptr);
|
||||
auto* editor = input.findChild<QTextEdit*>(); QVERIFY(editor);
|
||||
editor->setPlainText("beforeafter");
|
||||
auto cursor = editor->textCursor(); cursor.setPosition(6); editor->setTextCursor(cursor);
|
||||
QPushButton* button = nullptr;
|
||||
for (auto* candidate : panel.findChildren<QPushButton*>()) {
|
||||
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());
|
||||
|
||||
Reference in new issue
Block a user