|
|
|
|
@ -195,6 +195,31 @@ private slots:
|
|
|
|
|
QApplication::sendEvent(view.viewport(), &move); |
|
|
|
|
QCOMPARE(triggers.count(), 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void inviteClickDoesNotActivateOnDrag() { |
|
|
|
|
QStandardItemModel model; |
|
|
|
|
auto* message = new QStandardItem; |
|
|
|
|
message->setSizeHint(QSize(200, 60)); |
|
|
|
|
message->setData(QStringLiteral("utun://abc+/=="), MsgTextRole); |
|
|
|
|
model.appendRow(message); |
|
|
|
|
ChatView view; |
|
|
|
|
view.setModel(&model); view.resize(240, 140); |
|
|
|
|
view.setInviteHitTest([](const QModelIndex& index, const QPoint&) { return index.data(MsgTextRole).toString(); }); |
|
|
|
|
view.show(); |
|
|
|
|
QTest::qWait(30); |
|
|
|
|
const QPoint point = view.visualRect(model.index(0, 0)).center(); |
|
|
|
|
QSignalSpy links(&view, &ChatView::inviteLinkActivated); |
|
|
|
|
QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, point); |
|
|
|
|
QCOMPARE(links.count(), 1); |
|
|
|
|
QCOMPARE(links.first().first().toString(), QStringLiteral("utun://abc+/==")); |
|
|
|
|
QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, point); |
|
|
|
|
const QPointF dragged = point + QPoint(15, 0); |
|
|
|
|
QMouseEvent move(QEvent::MouseMove, dragged, dragged, Qt::NoButton, Qt::LeftButton, Qt::NoModifier); |
|
|
|
|
QApplication::sendEvent(view.viewport(), &move); |
|
|
|
|
QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::NoModifier, dragged.toPoint()); |
|
|
|
|
QCOMPARE(links.count(), 1); |
|
|
|
|
QVERIFY(view.hasSelection()); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
QTEST_MAIN(EmojiPlaybackTest) |
|
|
|
|
|