diff options
Diffstat (limited to 'Tools/WebKitTestRunner/qt/TestInvocationQt.cpp')
-rw-r--r-- | Tools/WebKitTestRunner/qt/TestInvocationQt.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp b/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp index 981c2032a..0c231508e 100644 --- a/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp +++ b/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp @@ -27,6 +27,8 @@ #include "TestInvocation.h" +#include "PlatformWebView.h" +#include "TestController.h" #include <QBuffer> #include <QCryptographicHash> #include <QtGui/QPainter> @@ -63,9 +65,31 @@ static void dumpImage(const QImage& image) fflush(stdout); } +void TestInvocation::forceRepaintDoneCallback(WKErrorRef, void *context) +{ + static_cast<TestInvocation*>(context)->m_gotRepaint = true; + TestController::shared().notifyDone(); +} + void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef imageRef, WKArrayRef repaintRects) { - QImage image = WKImageCreateQImage(imageRef); + QImage image; + if (PlatformWebView::windowShapshotEnabled()) { + WKPageRef page = TestController::shared().mainWebView()->page(); + WKPageForceRepaint(page, this, &forceRepaintDoneCallback); + + TestController::shared().runUntil(m_gotRepaint, TestController::ShortTimeout); + + if (m_gotRepaint) + image = WKImageCreateQImage(TestController::shared().mainWebView()->windowSnapshotImage().get()); + else { + // The test harness expects an image so we output an empty one. + WKRect windowRect = TestController::shared().mainWebView()->windowFrame(); + image = QImage(QSize(windowRect.size.width, windowRect.size.height), QImage::Format_ARGB32_Premultiplied); + image.fill(Qt::red); + } + } else + image = WKImageCreateQImage(imageRef); if (repaintRects) { QImage mask(image.size(), image.format()); |