aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanthosh Kumar <santhosh.kumar.selvaraj@qt.io>2024-11-05 15:01:54 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-11-08 20:22:23 +0000
commit3537f745090284836a5d657768b5c3f54c4acf9e (patch)
tree99221b648f5a91f9fb502dbbf13c8a36c9041db6
parente9affd88a9cdf8827eeee6e164ed7fc0db9b80eb (diff)
Skip verifying mouse propagation in the menu gap area for some styles
Amends patch 9fd43c27d19e675a0f5efdda4ea53fa97f61f852 The test case added to verify the mouse propagation in the gap area between the menu and its items doesn't work for styles (such as Universal) as there won't be any border. Make this case conditional, so the styles that don't support borders can skip it. Task-number: QTBUG-130536 Change-Id: I0f9657be3965e02c49578006fbe14b6eb0a7dd1f Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 4a55dde38238908fc8eef26fc005e8ca47eb31cf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/quickcontrols/qquickmenu/tst_qquickmenu.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/tests/auto/quickcontrols/qquickmenu/tst_qquickmenu.cpp b/tests/auto/quickcontrols/qquickmenu/tst_qquickmenu.cpp
index a1acaee841..e8d8349915 100644
--- a/tests/auto/quickcontrols/qquickmenu/tst_qquickmenu.cpp
+++ b/tests/auto/quickcontrols/qquickmenu/tst_qquickmenu.cpp
@@ -3359,12 +3359,20 @@ void tst_QQuickMenu::mousePropagationWithinPopup()
QCOMPARE(clickedSpy.size(), 0);
// Check on the gap area between menu and its item
- auto menuItem1 = qobject_cast<QQuickMenuItem *>(nestedMenu->itemAt(0));
+ // Note: Skip verifying this case for the styles (such as Imagine) that doesn't have gap
+ // between menu and its item
+ const auto menuItem1 = qobject_cast<QQuickMenuItem *>(nestedMenu->itemAt(0));
QVERIFY(menuItem1);
- auto menuItem1Pos = mapCenterToWindow(menuItem1);
- QPoint gapPoint(menuItem1Pos.x() - menuItem1->size().width() / 2 - 1, menuItem1Pos.y());
- QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, gapPoint);
- QCOMPARE(clickedSpy.size(), 0);
+ const QPointF point = menuItem1->mapToItem(nestedMenu->background(), QPointF(0, 0));
+ const bool xAxis = (point.x() + nestedMenu->leftInset()) > 0;
+ const bool yAxis = (point.y() + nestedMenu->topInset()) > 0;
+ if (xAxis || yAxis) {
+ const auto menuItem1Pos = mapCenterToWindow(menuItem1);
+ QPoint gapPoint(xAxis ? menuItem1Pos.x() - menuItem1->width() / 2 - 1 : menuItem1Pos.x(),
+ yAxis ? menuItem1Pos.y() : menuItem1Pos.y() - menuItem1->height() / 2 - 1);
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, gapPoint);
+ QCOMPARE(clickedSpy.size(), 0);
+ }
}
QTEST_QUICKCONTROLS_MAIN(tst_QQuickMenu)