summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexander Volkov <avolkov@astralinux.ru>2020-04-30 15:15:12 +0300
committerAlexander Volkov <avolkov@astralinux.ru>2020-05-14 15:19:47 +0300
commitaf3caa2271f47ddf48da46a0cc5932aaa442eb39 (patch)
treee1e3010b22bc7bc50eabf7324063c254ba4d09f1 /tests
parent45ed28a9d3790707b18798454d976f3a818a7740 (diff)
QBasicDrag: Send QDragMoveEvent when modifiers change
... without moving the mouse. This allows to update drop action and cursor. Task-number: QTBUG-56218 Task-number: QTBUG-82934 Pick-to: 5.15 Change-Id: I8b0ac2a008a9dbcc4c2d6abce282e6f169c2f542 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp27
1 files changed, 24 insertions, 3 deletions
diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
index 12d60a33c2..72fa32a1b1 100644
--- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
+++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp
@@ -725,7 +725,7 @@ protected:
{
e->accept();
_dndEvents.append(QStringLiteral("DragMove "));
- emit releaseMouseButton();
+ emit dragMoveReceived();
}
void dragLeaveEvent(QDragLeaveEvent *e)
{
@@ -739,7 +739,7 @@ protected:
}
signals:
- void releaseMouseButton();
+ void dragMoveReceived();
};
void tst_QWidget_window::tst_dnd_events()
@@ -774,7 +774,7 @@ void tst_QWidget_window::tst_dnd_events()
// Some dnd implementation rely on running internal event loops, so we have to use
// the following queued signal hack to simulate mouse clicks in the widget.
- QObject::connect(&dndWidget, &DnDEventRecorder::releaseMouseButton, this, [=]() {
+ QObject::connect(&dndWidget, &DnDEventRecorder::dragMoveReceived, this, [=]() {
QTest::mouseRelease(window, Qt::LeftButton);
}, Qt::QueuedConnection);
@@ -783,6 +783,27 @@ void tst_QWidget_window::tst_dnd_events()
QTest::mousePress(window, Qt::LeftButton);
QCOMPARE(dndWidget._dndEvents, expectedDndEvents);
+
+ dndWidget._dndEvents.clear();
+ dndWidget.disconnect();
+ int step = 0;
+ QObject::connect(&dndWidget, &DnDEventRecorder::dragMoveReceived, this, [window, &step]() {
+ switch (step++) {
+ case 0:
+ QTest::keyPress(window, Qt::Key_Shift, Qt::ShiftModifier);
+ break;
+ case 1:
+ QTest::keyRelease(window, Qt::Key_Shift, Qt::NoModifier);
+ break;
+ default:
+ QTest::mouseRelease(window, Qt::LeftButton);
+ break;
+ }
+ }, Qt::QueuedConnection);
+
+ QTest::mousePress(window, Qt::LeftButton);
+ const QString expectedDndWithModsEvents = "DragEnter DragMove DragMove DragMove DropEvent ";
+ QCOMPARE(dndWidget._dndEvents, expectedDndWithModsEvents);
}
class DropTarget : public QWidget