Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QQuickVisualTestUtils::PointLerper Class Reference

#include <visualtestutils_p.h>

+ Collaboration diagram for QQuickVisualTestUtils::PointLerper:

Public Member Functions

 PointLerper (QQuickWindow *window, const QPointingDevice *pointingDevice=QPointingDevice::primaryPointingDevice())
 
void move (const QPoint &pos, int steps=10, int delayInMilliseconds=1)
 
void move (int x, int y, int steps=10, int delayInMilliseconds=1)
 

Detailed Description

Definition at line 48 of file visualtestutils_p.h.

Constructor & Destructor Documentation

◆ PointLerper()

QQuickVisualTestUtils::PointLerper::PointLerper ( QQuickWindow window,
const QPointingDevice pointingDevice = QPointingDevice::primaryPointingDevice() 
)

Convenience class to linearly interpolate between two pointer move points.

PointLerper pointLerper(window);
// Lerps from {0, 0} to {15, 15}.
pointLerper.move(15, 15);
QVERIFY(parentButton->isHovered());
// Lerps from {15, 15} to {25, 25}.
pointLerper.move(25, 25);
QVERIFY(childButton->isHovered());
#define QVERIFY(statement)
Definition qtestcase.h:29
aWidget window() -> setWindowTitle("New Window Title")
[2]

Definition at line 86 of file visualtestutils.cpp.

Member Function Documentation

◆ move() [1/2]

void QQuickVisualTestUtils::PointLerper::move ( const QPoint pos,
int  steps = 10,
int  delayInMilliseconds = 1 
)

Moves from the last pos (or {0, 0} if there have been no calls to this function yet) to pos using linear interpolation over 10 (default value) steps with 1 ms (default value) delays between each step.

Definition at line 100 of file visualtestutils.cpp.

References QQuickVisualTestUtils::forEachStep(), QQuickVisualTestUtils::lerpPoints(), QQuickTest::pointerMove(), pos, and QTest::qWait().

+ Here is the call graph for this function:

◆ move() [2/2]

void QQuickVisualTestUtils::PointLerper::move ( int  x,
int  y,
int  steps = 10,
int  delayInMilliseconds = 1 
)

Definition at line 109 of file visualtestutils.cpp.


The documentation for this class was generated from the following files: