![]() |
Qt 6.x
The Qt SDK
|
Functions | |
| Q_QUICK_TEST_EXPORT bool | qIsPolishScheduled (const QQuickItem *item) |
| Q_QUICK_TEST_EXPORT bool | qIsPolishScheduled (const QQuickWindow *window) |
| Q_QUICK_TEST_EXPORT bool | qWaitForPolish (const QQuickItem *item, int timeout=defaultTimeout) |
| Q_QUICK_TEST_EXPORT bool | qWaitForPolish (const QQuickWindow *window, int timeout=defaultTimeout) |
| bool | initView (QQuickView &view, const QUrl &url, bool moveMouseOut, QByteArray *errorMessage) |
| bool | showView (QQuickView &view, const QUrl &url) |
| void | pointerPress (const QPointingDevice *dev, QQuickWindow *window, int pointId, const QPoint &p, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) |
| void | pointerMove (const QPointingDevice *dev, QQuickWindow *window, int pointId, const QPoint &p) |
| void | pointerRelease (const QPointingDevice *dev, QQuickWindow *window, int pointId, const QPoint &p, Qt::MouseButton button, Qt::KeyboardModifiers modifiers) |
Variables | |
| static const int | defaultTimeout = 5000 |
| static Qt::MouseButton | pressedTabletButton = Qt::NoButton |
| static Qt::KeyboardModifiers | pressedTabletModifiers = Qt::NoModifier |
| bool QQuickTest::initView | ( | QQuickView & | view, |
| const QUrl & | url, | ||
| bool | moveMouseOut, | ||
| QByteArray * | errorMessage | ||
| ) |
Initialize view, set url, center in available geometry, move mouse away if desired. If errorMessage is given, QQuickView::errors() will be concatenated into it; otherwise, the QWARN messages are generally enough to debug the test.
Returns false if the view fails to load the QML. That should be fatal in most tests, so normally the return value should be checked with QVERIFY.
Definition at line 469 of file viewtestutils.cpp.
References QString::append(), QRect::center(), e, errorMessage(), QQuickView::errors(), QWindow::height, initView(), QQuickView::Loading, Q_UNUSED, QTest::qWait(), QQuickView::Ready, QWindow::setHeight(), QCursor::setPos(), QQuickView::setSource(), QWindow::setWidth(), QQuickView::status, url, view, and QWindow::width.
Referenced by initView(), and showView().
Here is the call graph for this function:
Here is the caller graph for this function:| void QQuickTest::pointerMove | ( | const QPointingDevice * | dev, |
| QQuickWindow * | window, | ||
| int | pointId, | ||
| const QPoint & | p | ||
| ) |
Definition at line 553 of file viewtestutils.cpp.
References QInputDevice::Airbrush, QTest::defaultMouseDelay(), QQuickTouchUtils::flush(), QWindowSystemInterface::handleTabletEvent(), QTest::lastMouseTimestamp, QInputDevice::Mouse, QTest::mouseMove(), QTest::QTouchEventSequence::move(), pointerMove(), pressedTabletButton, pressedTabletModifiers, QInputDevice::Puck, qWarning, QInputDevice::Stylus, QTest::touchEvent(), QInputDevice::TouchPad, QInputDevice::TouchScreen, QInputDevice::type, and window().
Referenced by QQuickVisualTestUtils::PointLerper::move(), and pointerMove().
Here is the call graph for this function:
Here is the caller graph for this function:| void QQuickTest::pointerPress | ( | const QPointingDevice * | dev, |
| QQuickWindow * | window, | ||
| int | pointId, | ||
| const QPoint & | p, | ||
| Qt::MouseButton | button, | ||
| Qt::KeyboardModifiers | modifiers | ||
| ) |
Definition at line 526 of file viewtestutils.cpp.
References QInputDevice::Airbrush, button, QTest::defaultMouseDelay(), QQuickTouchUtils::flush(), QWindowSystemInterface::handleTabletEvent(), QTest::lastMouseTimestamp, QInputDevice::Mouse, QTest::mousePress(), pointerPress(), QTest::QTouchEventSequence::press(), pressedTabletButton, pressedTabletModifiers, QInputDevice::Puck, qWarning, QInputDevice::Stylus, QTest::touchEvent(), QInputDevice::TouchPad, QInputDevice::TouchScreen, QInputDevice::type, and window().
Referenced by pointerPress().
Here is the call graph for this function:
Here is the caller graph for this function:| void QQuickTest::pointerRelease | ( | const QPointingDevice * | dev, |
| QQuickWindow * | window, | ||
| int | pointId, | ||
| const QPoint & | p, | ||
| Qt::MouseButton | button, | ||
| Qt::KeyboardModifiers | modifiers | ||
| ) |
Definition at line 577 of file viewtestutils.cpp.
References QInputDevice::Airbrush, button, QTest::defaultMouseDelay(), QQuickTouchUtils::flush(), QWindowSystemInterface::handleTabletEvent(), QTest::lastMouseTimestamp, QInputDevice::Mouse, QTest::mouseRelease(), Qt::NoButton, pointerRelease(), QInputDevice::Puck, qWarning, QTest::QTouchEventSequence::release(), QInputDevice::Stylus, QTest::touchEvent(), QInputDevice::TouchPad, QInputDevice::TouchScreen, QInputDevice::type, and window().
Referenced by pointerRelease().
Here is the call graph for this function:
Here is the caller graph for this function:| QT_BEGIN_NAMESPACE bool QQuickTest::qIsPolishScheduled | ( | const QQuickItem * | item | ) |
Returns true if \l {QQuickItem::}{updatePolish()} has not been called on item since the last call to \l {QQuickItem::}{polish()}, otherwise returns false.
When assigning values to properties in QML, any layouting the item must do as a result of the assignment might not take effect immediately, but can instead be postponed until the item is polished. For these cases, you can use this function to ensure that the item has been polished before the execution of the test continues. For example:
Without the call to qIsPolishScheduled() above, the call to qWaitForItemPolished() might see that no polish was scheduled and therefore pass instantly, assuming that the item had already been polished. This function makes it obvious why an item wasn't polished and allows tests to fail early under such circumstances.
The QML equivalent of this function is \l {TestCase::}{isPolishScheduled()}.
Definition at line 73 of file quicktest.cpp.
References QQuickItemPrivate::get(), item, and QQuickItemPrivate::polishScheduled.
Here is the call graph for this function:| bool QQuickTest::qIsPolishScheduled | ( | const QQuickWindow * | window | ) |
Definition at line 101 of file quicktest.cpp.
References QQuickWindowPrivate::get(), QQuickWindowPrivate::itemsToPolish, and window().
Here is the call graph for this function:| bool QQuickTest::qWaitForPolish | ( | const QQuickItem * | item, |
| int | timeout = defaultTimeout |
||
| ) |
Waits for timeout milliseconds or until \l {QQuickItem::}{updatePolish()} has been called on item.
Returns true if updatePolish() was called on item within timeout milliseconds, otherwise returns false.
Definition at line 143 of file quicktest.cpp.
References QQuickItemPrivate::get(), item, QQuickItemPrivate::polishScheduled, and QTest::qWaitFor().
Here is the call graph for this function:| bool QQuickTest::qWaitForPolish | ( | const QQuickWindow * | window, |
| int | timeout = defaultTimeout |
||
| ) |
Waits for timeout milliseconds or until qIsPolishScheduled(item) returns false for all items managed by window.
Returns true if qIsPolishScheduled(item) returns false for all items within timeout milliseconds, otherwise returns false.
The QML equivalent of this function is \l [QML]{TestCase::}{waitForPolish()}.
Definition at line 163 of file quicktest.cpp.
References QQuickWindowPrivate::get(), QQuickWindowPrivate::itemsToPolish, QTest::qWaitFor(), and window().
Here is the call graph for this function:| bool QQuickTest::showView | ( | QQuickView & | view, |
| const QUrl & | url | ||
| ) |
Initialize view, set url, center in available geometry, move mouse away, show the view, wait for it to be exposed, and verify that its rootObject is not null.
Returns false if anything fails, which should be fatal in most tests. The usual way to call this function is
Definition at line 509 of file viewtestutils.cpp.
References initView(), QTest::qWaitForWindowExposed(), QQuickView::rootObject(), QWindow::show(), showView(), url, and view.
Referenced by showView().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 69 of file quicktest.h.
|
static |
Definition at line 523 of file viewtestutils.cpp.
Referenced by pointerMove(), and pointerPress().
|
static |
Definition at line 524 of file viewtestutils.cpp.
Referenced by pointerMove(), and pointerPress().