Fix use of QTest::mouseMove() in widgets tests
Fixing some issues that could cause intermittent or environment-dependent failures. One kind regards the use of multiple QTest::mouseMove() calls in sequence internally using the QCursor API, causing timing dependent failures. Switching to the override that does not require the QCursor API, where possible. Other test could fail depending on the size of the screen. Change-Id: I4a368955ddbb48f729dcdf74c20eb163329936b2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
d6fb64267f
commit
dffbf4a7f6
@ -1275,10 +1275,10 @@ void tst_QGraphicsScene::removeItem()
|
|||||||
view.show();
|
view.show();
|
||||||
QApplication::setActiveWindow(&view);
|
QApplication::setActiveWindow(&view);
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&view));
|
QVERIFY(QTest::qWaitForWindowActive(&view));
|
||||||
QTest::mouseMove(view.viewport(), view.mapFromScene(hoverItem->scenePos() + QPointF(20, 20)), Qt::NoButton);
|
QTest::mouseMove(view.windowHandle(), view.mapFromScene(hoverItem->scenePos() + QPointF(20, 20)));
|
||||||
QTRY_VERIFY(!hoverItem->isHovered);
|
QTRY_VERIFY(!hoverItem->isHovered);
|
||||||
|
|
||||||
QTest::mouseMove(view.viewport(), view.mapFromScene(hoverItem->scenePos()), Qt::NoButton);
|
QTest::mouseMove(view.windowHandle(), view.mapFromScene(hoverItem->scenePos()));
|
||||||
QTRY_VERIFY(hoverItem->isHovered);
|
QTRY_VERIFY(hoverItem->isHovered);
|
||||||
|
|
||||||
scene.removeItem(hoverItem);
|
scene.removeItem(hoverItem);
|
||||||
|
@ -261,11 +261,11 @@ private slots:
|
|||||||
void QTBUG_4151_clipAndIgnore_data();
|
void QTBUG_4151_clipAndIgnore_data();
|
||||||
void QTBUG_4151_clipAndIgnore();
|
void QTBUG_4151_clipAndIgnore();
|
||||||
void QTBUG_5859_exposedRect();
|
void QTBUG_5859_exposedRect();
|
||||||
|
void hoverLeave();
|
||||||
|
void QTBUG_16063_microFocusRect();
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
void QTBUG_7438_cursor();
|
void QTBUG_7438_cursor();
|
||||||
#endif
|
#endif
|
||||||
void hoverLeave();
|
|
||||||
void QTBUG_16063_microFocusRect();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void dummySlot() {}
|
void dummySlot() {}
|
||||||
|
@ -3412,7 +3412,7 @@ void tst_QHeaderView::statusTips()
|
|||||||
// Ensure it is moved away first and then moved to the relevant section
|
// Ensure it is moved away first and then moved to the relevant section
|
||||||
QTest::mouseMove(QApplication::desktop(),
|
QTest::mouseMove(QApplication::desktop(),
|
||||||
headerView.rect().bottomLeft() + QPoint(20, 20));
|
headerView.rect().bottomLeft() + QPoint(20, 20));
|
||||||
QPoint centerPoint = QRect(headerView.sectionPosition(0), headerView.y(),
|
QPoint centerPoint = QRect(headerView.sectionPosition(0), 0,
|
||||||
headerView.sectionSize(0), headerView.height()).center();
|
headerView.sectionSize(0), headerView.height()).center();
|
||||||
QTest::mouseMove(headerView.windowHandle(), centerPoint);
|
QTest::mouseMove(headerView.windowHandle(), centerPoint);
|
||||||
QTRY_VERIFY(headerView.gotStatusTipEvent);
|
QTRY_VERIFY(headerView.gotStatusTipEvent);
|
||||||
@ -3420,7 +3420,7 @@ void tst_QHeaderView::statusTips()
|
|||||||
|
|
||||||
headerView.gotStatusTipEvent = false;
|
headerView.gotStatusTipEvent = false;
|
||||||
headerView.statusTipText.clear();
|
headerView.statusTipText.clear();
|
||||||
centerPoint = QRect(headerView.sectionPosition(1), headerView.y(),
|
centerPoint = QRect(headerView.sectionPosition(1), 0,
|
||||||
headerView.sectionSize(1), headerView.height()).center();
|
headerView.sectionSize(1), headerView.height()).center();
|
||||||
QTest::mouseMove(headerView.windowHandle(), centerPoint);
|
QTest::mouseMove(headerView.windowHandle(), centerPoint);
|
||||||
QTRY_VERIFY(headerView.gotStatusTipEvent);
|
QTRY_VERIFY(headerView.gotStatusTipEvent);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user