diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-01 08:40:49 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-03-01 08:22:52 +0000 |
commit | 9fdbdea176007ed7b470e317e9002aa77ddd4ead (patch) | |
tree | d8fbd4fd68ea360e341825fb3252d95f48815f93 /tests | |
parent | 694438066eb88e53e4070630e6b99d0f552d254d (diff) |
Fix tst_cursor::controls(containers) test failing after change in the Windows QPA
The test failed in case the mouse cursor was within the view to be created.
Move the cursor away to prevent that.
Fixes: QTBUG-74130
Change-Id: I8d77fc9b4cc5380ddb06ba128bca7c1666357b50
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/cursor/tst_cursor.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/cursor/tst_cursor.cpp b/tests/auto/cursor/tst_cursor.cpp index 0f24a29e..d59e7091 100644 --- a/tests/auto/cursor/tst_cursor.cpp +++ b/tests/auto/cursor/tst_cursor.cpp @@ -44,6 +44,11 @@ #include <QtQuickTemplates2/private/qquickscrollbar_p.h> #include <QtQuickTemplates2/private/qquicktextarea_p.h> +#if QT_CONFIG(cursor) +# include <QtGui/qscreen.h> +# include <QtGui/qcursor.h> +#endif + using namespace QQuickVisualTestUtil; class tst_cursor : public QQmlDataTest @@ -51,6 +56,7 @@ class tst_cursor : public QQmlDataTest Q_OBJECT private slots: + void init(); void controls_data(); void controls(); void editable(); @@ -58,6 +64,17 @@ private slots: void scrollBar(); }; +void tst_cursor::init() +{ +#if QT_CONFIG(cursor) + // Ensure mouse cursor was not left by previous tests where widgets + // will appear, as it could cause events and interfere with the tests. + const QScreen *screen = QGuiApplication::primaryScreen(); + const QRect availableGeometry = screen->availableGeometry(); + QCursor::setPos(availableGeometry.topLeft()); +#endif +} + void tst_cursor::controls_data() { QTest::addColumn<QString>("testFile"); |