diff --git a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp index 77613341dd..2775e2c683 100644 --- a/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp +++ b/tests/auto/widgets/widgets/qlabel/tst_qlabel.cpp @@ -608,32 +608,39 @@ void tst_QLabel::mouseEventPropagation_data() { QTest::addColumn("text"); QTest::addColumn("interaction"); + QTest::addColumn>("buttons"); QTest::addColumn("expectPropagation"); QTest::newRow("RichText") << QString("This is a rich text propagating mouse events") << Qt::LinksAccessibleByMouse + << QList{Qt::LeftButton, Qt::RightButton, Qt::MiddleButton} << true; QTest::newRow("PlainText") << QString("This is a plain text propagating mouse events") << Qt::LinksAccessibleByMouse + << QList{Qt::LeftButton, Qt::RightButton, Qt::MiddleButton} << true; QTest::newRow("PlainTextConsume") << QString("This is a plain text consuming mouse events") << Qt::TextSelectableByMouse + << QList{Qt::LeftButton} << false; QTest::newRow("RichTextConsume") << QString("This is a rich text consuming mouse events") << Qt::TextSelectableByMouse + << QList{Qt::LeftButton} << false; QTest::newRow("PlainTextNoInteraction") << QString("This is a text not interacting with mouse") << Qt::NoTextInteraction + << QList{Qt::LeftButton, Qt::RightButton, Qt::MiddleButton} << true; QTest::newRow("RichTextNoInteraction") << QString("This is a rich text not interacting with mouse") << Qt::NoTextInteraction + << QList{Qt::LeftButton, Qt::RightButton, Qt::MiddleButton} << true; } @@ -663,21 +670,23 @@ void tst_QLabel::mouseEventPropagation() QFETCH(const QString, text); QFETCH(const Qt::TextInteractionFlag, interaction); + QFETCH(const QList, buttons); QFETCH(const bool, expectPropagation); MouseEventWidget widget; auto *layout = new QVBoxLayout(&widget); auto *label = new QLabel(text); label->setTextInteractionFlags(interaction); - const uint count = expectPropagation ? 1 : 0; layout->addWidget(label); widget.show(); QVERIFY(QTest::qWaitForWindowExposed(&widget)); const QPoint labelCenter = label->rect().center(); - QTest::mouseClick(label, Qt::LeftButton, Qt::KeyboardModifiers(), labelCenter); + for (Qt::MouseButton mouseButton : buttons) + QTest::mouseClick(label, mouseButton, Qt::KeyboardModifiers(), labelCenter); + const uint count = expectPropagation ? buttons.count() : 0; QTRY_COMPARE(widget.pressed(), count); QTRY_COMPARE(widget.released(), count); }