summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-10-20 22:39:18 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2020-10-21 08:22:36 +0200
commit9aba868571e7448ea79229a31d18bfd3e69813f8 (patch)
tree54af30c7e0a01b88f74326370bee57697a790d9b /tests
parent21d39168170c6833512c4a5f53985272741bd7e7 (diff)
QEvent copy constructor: copy the type flags too
Failure to copy m_inputEvent and m_pointerEvent actually left them uninitialized, and resulted in random behavior in Qt Quick when Flickable clones a pointer event for later replay. Remove the comment about copying events being a "bad idea" in Qt 4, while we're at it. Copying became more common in Qt 5, and we probably won't be able to stop doing it now. Change-Id: I40b6ba5ad696e7aaafbeefbca86eca00cab40616 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
index c5bc7a9460..42a5f4d593 100644
--- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
@@ -179,6 +179,15 @@ void tst_QMouseEvent::mouseEventBasic()
me = QMouseEvent(QEvent::MouseButtonRelease, local, scene, screen, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
QVERIFY(!me.isBeginEvent());
QVERIFY(me.isEndEvent());
+ // Try out the copy constructor
+ QMouseEvent copy(me);
+ QVERIFY(copy.isInputEvent());
+ QVERIFY(copy.isPointerEvent());
+ QVERIFY(!copy.isBeginEvent());
+ QVERIFY(copy.isEndEvent());
+ QCOMPARE(copy.position(), local);
+ QCOMPARE(copy.scenePosition(), scene);
+ QCOMPARE(copy.globalPosition(), screen);
}
void tst_QMouseEvent::checkMousePressEvent_data()