diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-14 01:00:08 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-02-14 01:00:09 +0100 |
commit | e6199a8357cb9a97a3de0e86af387ddbe15a18ea (patch) | |
tree | c33fdae61742736ad47a33ddc2458aed07d53b1b /tests/auto/quick/shared | |
parent | 57604562db870f7b05d4349761d73e054dbe04c6 (diff) | |
parent | 68d0377736a541fa29d1aaba6b7aa4a4cf8781ef (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I2842f4a8096c4555e29f08e65b88b77b841441cb
Diffstat (limited to 'tests/auto/quick/shared')
-rw-r--r-- | tests/auto/quick/shared/viewtestutil.cpp | 27 | ||||
-rw-r--r-- | tests/auto/quick/shared/viewtestutil.h | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/quick/shared/viewtestutil.cpp b/tests/auto/quick/shared/viewtestutil.cpp index 3bfa23173e..12d54c4bbe 100644 --- a/tests/auto/quick/shared/viewtestutil.cpp +++ b/tests/auto/quick/shared/viewtestutil.cpp @@ -451,3 +451,30 @@ namespace QQuickTouchUtils { } } + +namespace QQuickTest { + // Initialize view, set Url, center in available geometry, move mouse away if desired + bool initView(QQuickView &v, const QUrl &url, bool moveMouseOut, QByteArray *errorMessage) + { + v.setBaseSize(QSize(240,320)); + v.setSource(url); + while (v.status() == QQuickView::Loading) + QTest::qWait(10); + if (v.status() != QQuickView::Ready) { + foreach (const QQmlError &e, v.errors()) + errorMessage->append(e.toString().toLocal8Bit() + '\n'); + return false; + } + const QRect screenGeometry = v.screen()->availableGeometry(); + const QSize size = v.size(); + const QPoint offset = QPoint(size.width() / 2, size.height() / 2); + v.setFramePosition(screenGeometry.center() - offset); + #if QT_CONFIG(cursor) // Get the cursor out of the way. + if (moveMouseOut) + QCursor::setPos(v.geometry().topRight() + QPoint(100, 100)); + #else + Q_UNUSED(moveMouseOut) + #endif + return true; + } +} diff --git a/tests/auto/quick/shared/viewtestutil.h b/tests/auto/quick/shared/viewtestutil.h index 04e1771ef8..3b57a29777 100644 --- a/tests/auto/quick/shared/viewtestutil.h +++ b/tests/auto/quick/shared/viewtestutil.h @@ -185,6 +185,10 @@ namespace QQuickTouchUtils { void flush(QQuickWindow *window); } +namespace QQuickTest { + bool initView(QQuickView &v, const QUrl &url, bool moveMouseOut, QByteArray *errorMessage); +} + Q_DECLARE_METATYPE(QQuickViewTestUtil::QaimModel*) Q_DECLARE_METATYPE(QQuickViewTestUtil::ListChange) Q_DECLARE_METATYPE(QList<QQuickViewTestUtil::ListChange>) |