qtest_results.wait(ms)
}
+ function waitForRendering(item, timeout) {
+ if (timeout === undefined)
+ timeout = 5000
+ return qtest_results.waitForRendering(item, timeout)
+ }
+
function sleep(ms) {
qtest_results.sleep(ms)
}
Waits for \a ms milliseconds while processing Qt events.
- \sa sleep()
+ \sa sleep(), waitForRendering()
+*/
+
+/*!
+ \qmlmethod TestCase::waitForRendering(item, timeout = 5000)
+
+ Waits for \a timeout milliseconds or until the \a item is rendered by the renderer.
+ Returns true if \c item is rendered in \a timeout milliseconds, otherwise returns false.
+ The default \a timeout value is 5000.
+
+ \sa sleep(), wait()
*/
/*!
Sleeps for \a ms milliseconds without processing Qt events.
- \sa wait()
+ \sa wait(), waitForRendering()
*/
/*!
results.stopLogging();
}
-static bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000)
+bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000)
{
QSignalSpy spy(obj, signal);
QElapsedTimer timer;
static bool loggingStarted = false;
static QBenchmarkGlobalData globalBenchmarkData;
+extern bool qWaitForSignal(QObject *obj, const char* signal, int timeout = 5000);
+
class Q_QUICK_TEST_EXPORT QuickTestImageObject : public QObject
{
Q_OBJECT
QTest::qSleep(ms);
}
+bool QuickTestResult::waitForRendering(QQuickItem *item, int timeout)
+{
+ Q_ASSERT(item);
+
+ return qWaitForSignal(item->canvas(), SIGNAL(frameSwapped()), timeout);
+}
+
void QuickTestResult::startMeasurement()
{
Q_D(QuickTestResult);
void wait(int ms);
void sleep(int ms);
+ bool waitForRendering(QQuickItem *item, int timeout = 5000);
void startMeasurement();
void beginDataRun();
fuzzyCompare(img.pixel(1,1), "#FF0201", 2);
rect.color = "blue";
- wait(200);
+ waitForRendering(rect);
img = grabImage(rect);
compare(img.pixel(20, 20), Qt.rgba(0, 0, 255, 255));
compare(img.red(1,1), 0);