Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQuickVisualTestUtils Namespace Reference

Classes

class  MnemonicKeySimulator
 
class  PointLerper
 
class  QQuickApplicationHelper
 
struct  SignalMultiSpy
 

Enumerations

enum class  FindViewDelegateItemFlag { None = 0x0 , PositionViewAtIndex = 0x01 }
 

Functions

QQuickItemfindVisibleChild (QQuickItem *parent, const QString &objectName)
 
void dumpTree (QQuickItem *parent, int depth=0)
 
void moveMouseAway (QQuickWindow *window)
 
void centerOnScreen (QQuickWindow *window)
 
template<typename F >
void forEachStep (int steps, F &&func)
 
QPoint lerpPoints (const QPoint &point1, const QPoint &point2, qreal t)
 
bool isDelegateVisible (QQuickItem *item)
 
template<typename T >
T * findItem (QQuickItem *parent, const QString &objectName, int index=-1)
 
template<typename T >
QList< T * > findItems (QQuickItem *parent, const QString &objectName, bool visibleOnly=true)
 
template<typename T >
QList< T * > findItems (QQuickItem *parent, const QString &objectName, const QList< int > &indexes)
 
bool compareImages (const QImage &ia, const QImage &ib, QString *errorMessage)
 
template<typename T >
bool findViewDelegateItem (QQuickItemView *itemView, int index, T &delegateItem, FindViewDelegateItemFlags flags=FindViewDelegateItemFlag::PositionViewAtIndex)
 
QPoint mapCenterToWindow (const QQuickItem *item)
 
QPoint mapToWindow (const QQuickItem *item, qreal relativeX, qreal relativeY)
 
QPoint mapToWindow (const QQuickItem *item, const QPointF &relativePos)
 

Enumeration Type Documentation

◆ FindViewDelegateItemFlag

Enumerator
None 
PositionViewAtIndex 

Definition at line 156 of file visualtestutils_p.h.

Function Documentation

◆ centerOnScreen()

void QQuickVisualTestUtils::centerOnScreen ( QQuickWindow * window)

Definition at line 58 of file visualtestutils.cpp.

References QRect::center(), and window().

+ Here is the call graph for this function:

◆ compareImages()

bool QQuickVisualTestUtils::compareImages ( const QImage & ia,
const QImage & ib,
QString * errorMessage )

Compares ia with ib, returning true if the images are equal. If they are not equal, false is returned and errorMessage is set.

A custom compare function to avoid issues such as: When running on native Nvidia graphics cards on linux, the distance field glyph pixels have a measurable, but not visible pixel error. This was GT-216 with the ubuntu "nvidia-319" driver package. llvmpipe does not show the same issue.

Definition at line 137 of file visualtestutils.cpp.

References QImage::constScanLine(), QImage::devicePixelRatio(), errorMessage(), QImage::format(), QImage::height(), Qt::hex(), qAbs(), qRed(), Qt::showbase(), QImage::size(), and QImage::width().

+ Here is the call graph for this function:

◆ dumpTree()

void QQuickVisualTestUtils::dumpTree ( QQuickItem * parent,
int depth = 0 )

Definition at line 31 of file visualtestutils.cpp.

References QList< T >::at(), QQuickItem::childItems(), dumpTree(), i, item, QString::left(), qDebug, qobject_cast< QQuickItem * >(), and QStringLiteral.

Referenced by dumpTree().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findItem()

template<typename T >
T * QQuickVisualTestUtils::findItem ( QQuickItem * parent,
const QString & objectName,
int index = -1 )

Definition at line 72 of file visualtestutils_p.h.

References QList< T >::at(), QQuickItem::childItems(), context, QQmlExpression::evaluate(), i, QString::isEmpty(), item, mo, qmlContext(), qobject_cast< QQuickItem * >(), and QVariant::toInt().

+ Here is the call graph for this function:

◆ findItems() [1/2]

template<typename T >
QList< T * > QQuickVisualTestUtils::findItems ( QQuickItem * parent,
const QString & objectName,
bool visibleOnly = true )

Definition at line 102 of file visualtestutils_p.h.

References QList< T >::append(), QList< T >::at(), QQuickItem::childItems(), QQuickItemPrivate::get(), i, QString::isEmpty(), QGraphicsItem::isVisible(), item, items, mo, and qobject_cast< QQuickItem * >().

+ Here is the call graph for this function:

◆ findItems() [2/2]

template<typename T >
QList< T * > QQuickVisualTestUtils::findItems ( QQuickItem * parent,
const QString & objectName,
const QList< int > & indexes )

Definition at line 119 of file visualtestutils_p.h.

References i, and items.

◆ findViewDelegateItem()

template<typename T >
bool QQuickVisualTestUtils::findViewDelegateItem ( QQuickItemView * itemView,
int index,
T & delegateItem,
FindViewDelegateItemFlags flags = FindViewDelegateItemFlag::PositionViewAtIndex )

Same as above except allows use in QTRY_* functions without having to call it again afterwards to assign the delegate.

Definition at line 174 of file visualtestutils_p.h.

References findViewDelegateItem().

Referenced by findViewDelegateItem().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ findVisibleChild()

QT_BEGIN_NAMESPACE QQuickItem * QQuickVisualTestUtils::findVisibleChild ( QQuickItem * parent,
const QString & objectName )

Definition at line 18 of file visualtestutils.cpp.

References QList< T >::at(), QObject::findChildren(), QQuickItemPrivate::get(), i, item, items, and QList< T >::size().

+ Here is the call graph for this function:

◆ forEachStep()

template<typename F >
void QQuickVisualTestUtils::forEachStep ( int steps,
F && func )

Definition at line 40 of file visualtestutils_p.h.

References i.

Referenced by QQuickVisualTestUtils::PointLerper::move().

+ Here is the caller graph for this function:

◆ isDelegateVisible()

bool QQuickVisualTestUtils::isDelegateVisible ( QQuickItem * item)

Returns true if {item->isVisible()} returns true, and the item is not culled.

Definition at line 120 of file visualtestutils.cpp.

References QQuickItemPrivate::get(), QGraphicsItem::isVisible(), and item.

+ Here is the call graph for this function:

◆ lerpPoints()

QPoint QQuickVisualTestUtils::lerpPoints ( const QPoint & point1,
const QPoint & point2,
qreal t )

Definition at line 65 of file visualtestutils.cpp.

References _q_interpolate(), QPoint::x(), and QPoint::y().

Referenced by QQuickVisualTestUtils::PointLerper::move().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mapCenterToWindow()

QPoint QQuickVisualTestUtils::mapCenterToWindow ( const QQuickItem * item)

Definition at line 262 of file visualtestutils.cpp.

References item, QGraphicsItem::mapToScene(), and QPointF::toPoint().

+ Here is the call graph for this function:

◆ mapToWindow() [1/2]

QPoint QQuickVisualTestUtils::mapToWindow ( const QQuickItem * item,
const QPointF & relativePos )

Definition at line 272 of file visualtestutils.cpp.

References item, mapToWindow(), and QGraphicsItem::x().

+ Here is the call graph for this function:

◆ mapToWindow() [2/2]

QPoint QQuickVisualTestUtils::mapToWindow ( const QQuickItem * item,
qreal relativeX,
qreal relativeY )

Definition at line 267 of file visualtestutils.cpp.

References item, QGraphicsItem::mapToScene(), and QPointF::toPoint().

Referenced by mapToWindow().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moveMouseAway()

void QQuickVisualTestUtils::moveMouseAway ( QQuickWindow * window)

Definition at line 43 of file visualtestutils.cpp.

References leave, QEvent::Leave, QCoreApplication::sendEvent(), QCursor::setPos(), and window().

+ Here is the call graph for this function: