summaryrefslogtreecommitdiff
path: root/Tools/WebKitTestRunner/qt/TestInvocationQt.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-18 14:10:51 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-18 14:10:51 +0200
commitd9cf437c840c6eb7417bdd97e6c40979255d3158 (patch)
treea231782c949300763457407149cfd84c20e0222e /Tools/WebKitTestRunner/qt/TestInvocationQt.cpp
parentee4c86d1990a9e26277a6948e7027ad8d525ebfa (diff)
downloadqtwebkit-d9cf437c840c6eb7417bdd97e6c40979255d3158.tar.gz
Imported WebKit commit a1c73566da3265b6c5dc815a24b0e5ab02d2c885 (http://svn.webkit.org/repository/webkit/trunk@131728)
New snapshot with a better fix for the out-of-memory at link time situation.
Diffstat (limited to 'Tools/WebKitTestRunner/qt/TestInvocationQt.cpp')
-rw-r--r--Tools/WebKitTestRunner/qt/TestInvocationQt.cpp26
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());