6#include <QtCore/QCoreApplication>
7#include <QtCore/private/qvariantanimation_p.h>
8#include <QtCore/QDebug>
9#include <QtQuick/QQuickItem>
10#if QT_CONFIG(quick_itemview)
11#include <QtQuick/private/qquickitemview_p.h>
13#include <QtQuickTest/QtQuickTest>
14#include <QtQuickTestUtils/private/viewtestutils_p.h>
60 const QRect screenGeometry =
window->screen()->availableGeometry();
88 , mPointingDevice(pointingDevice)
111 move(
QPoint(
x,
y), steps, delayInMilliseconds);
139 if (ia.
size() != ib.size()) {
144 if (ia.
format() != ib.format()) {
151 const int tolerance = 5;
152 for (
int y=0;
y<
h; ++
y) {
154 const uint *bs= (
const uint *) ib.constScanLine(
y);
155 for (
int x=0;
x<
w; ++
x) {
160 if ((
a & 0xff000000) != (
b & 0xff000000)
173#if QT_CONFIG(quick_itemview)
186 qWarning() <<
"failed to polish" << itemView;
192 if (index <= -1 || index >= itemView->
count()) {
193 qWarning() <<
"index" <<
index <<
"is out of bounds for" << itemView;
200 return itemView->itemAtIndex(
index);
207 for (
const auto &
path : qmlImportPaths)
212 component.loadUrl(testCase->testFileUrl(testFilePath));
214 QObject *rootObject =
component.createWithInitialProperties(initialProperties);
215 cleanup.reset(rootObject);
216 if (
component.isError() || !rootObject) {
221 window = qobject_cast<QQuickWindow*>(rootObject);
227 if (
window->isVisible()) {
236 : m_window(
window), m_modifiers(
Qt::NoModifier)
252 m_modifiers &=
~Qt::AltModifier;
279#include "moc_visualtestutils_p.cpp"
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static void setPos(int x, int y)
Moves the cursor (hot spot) of the primary screen to the global screen position (x,...
qreal x() const
This convenience function is equivalent to calling pos().x().
QPointF mapToScene(const QPointF &point) const
Maps the point point, which is in this item's coordinate system, to the scene's coordinate system,...
bool isVisible() const
Returns true if the item is visible; otherwise, false is returned.
QSize size() const
Returns the size of the image, i.e.
int width() const
Returns the width of the image.
int height() const
Returns the height of the image.
Format format() const
Returns the format of the image.
const uchar * constScanLine(int) const
Returns a pointer to the pixel data at the scanline with index i.
qreal devicePixelRatio() const
Returns the device pixel ratio for the image.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
QList< T > findChildren(QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns all children of this object with the given name that can be cast to type T,...
\inmodule QtCore\reentrant
constexpr QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
The QPointingDevice class describes a device from which mouse, touch or tablet events originate.
The QQmlComponent class encapsulates a QML component definition.
static QQuickItemPrivate * get(QQuickItem *item)
Q_INVOKABLE void positionViewAtIndex(int index, int mode)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
QList< QQuickItem * > childItems() const
Returns the children of this item.
void release(Qt::Key key)
MnemonicKeySimulator(QWindow *window)
void move(const QPoint &pos, int steps=10, int delayInMilliseconds=1)
PointLerper(QQuickWindow *window, const QPointingDevice *pointingDevice=QPointingDevice::primaryPointingDevice())
QQuickApplicationHelper(QQmlDataTest *testCase, const QString &testFilePath, const QVariantMap &initialProperties={}, const QStringList &qmlImportPaths={})
\qmltype Window \instantiates QQuickWindow \inqmlmodule QtQuick
\inmodule QtCore\reentrant
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Q_QMLTEST_EXPORT bool qWaitForPolish(const QQuickItem *item, int timeout=defaultTimeout)
Q_QMLTEST_EXPORT bool qIsPolishScheduled(const QQuickItem *item)
void pointerMove(const QPointingDevice *dev, QQuickWindow *window, int pointId, const QPoint &p)
void centerOnScreen(QQuickWindow *window)
void dumpTree(QQuickItem *parent, int depth=0)
bool isDelegateVisible(QQuickItem *item)
QPoint mapToWindow(const QQuickItem *item, qreal relativeX, qreal relativeY)
QPoint mapCenterToWindow(const QQuickItem *item)
bool findViewDelegateItem(QQuickItemView *itemView, int index, T &delegateItem, FindViewDelegateItemFlags flags=FindViewDelegateItemFlag::PositionViewAtIndex)
QQuickItem * findVisibleChild(QQuickItem *parent, const QString &objectName)
void moveMouseAway(QQuickWindow *window)
bool compareImages(const QImage &ia, const QImage &ib, QString *errorMessage)
QPoint lerpPoints(const QPoint &point1, const QPoint &point2, qreal t)
void forEachStep(int steps, F &&func)
Combined button and popup list for selecting options.
Q_CORE_EXPORT void qWait(int ms)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static void simulateEvent(QWindow *window, bool press, int code, Qt::KeyboardModifiers modifier, QString text, bool repeat, int delay=-1)
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
QTextStream & showbase(QTextStream &stream)
Calls QTextStream::setNumberFlags(QTextStream::numberFlags() | QTextStream::ShowBase) on stream and r...
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLintptr offset
GLfloat GLfloat GLfloat GLfloat h
GLsizei const GLchar *const * path
static qreal component(const QPointF &point, unsigned int i)
QQuickItem * qobject_cast< QQuickItem * >(QObject *o)
constexpr int qRed(QRgb rgb)
#define qPrintable(string)
#define QStringLiteral(str)
#define QVERIFY2(statement, description)
static QString errorMessage(QUrlPrivate::ErrorCode errorCode, const QString &errorSource, qsizetype errorPosition)
Q_INLINE_TEMPLATE QRect _q_interpolate(const QRect &f, const QRect &t, qreal progress)