Skip to content

Instantly share code, notes, and snippets.

@Smith1123
Created May 27, 2011 07:40
Show Gist options
  • Save Smith1123/994811 to your computer and use it in GitHub Desktop.
Save Smith1123/994811 to your computer and use it in GitHub Desktop.
testRepaint()
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
index b8f7b41..b91096e 100644
--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
@@ -950,12 +950,36 @@ void DumpRenderTree::dump()
// FIXME: All other ports don't dump pixels, if generatePixelResults is false.
if (m_dumpPixels) {
- QImage image(m_page->viewportSize(), QImage::Format_ARGB32);
+ QImage image;
+ image = QImage(m_page->viewportSize(), QImage::Format_ARGB32);
image.fill(Qt::white);
- QPainter painter(&image);
- mainFrame->render(&painter);
- painter.end();
-
+
+// QPixmap pixmap;
+// pixmap = QPixmap();
+// pixmap = QPixmap(image.width(), image.height());
+ if(m_controller->shouldTestRepaint()) {
+ int width = m_page->viewportSize().width();
+ int height = m_page->viewportSize().height();
+ if (m_controller->shouldSweepHorizontally()) {
+ for (QRect column(0, 0, 1, height); column.x() < width; column.setX(column.x()+1)){
+// pixmap = QPixmap(QSize(column.width(), height));
+ QPainter painter(&image);
+ painter.drawRect(column);
+ //Ezt sztem nem itt kell hivni, mert igy kod ismétlés van
+ mainFrame->render(&painter);
+ painter.end();
+ }
+ } else {
+ for (QRect line(0, 0, width, 1); line.y() < height; line.setY(line.y()+1)){
+// pixmap = QPixmap(QSize(width, line.height()));
+ QPainter painter(&image);
+ painter.drawRect(line);
+
+ mainFrame->render(&painter);
+ painter.end();
+ }
+ }
+// m_page->setViewportSize(QSize(column.width(), height));
QCryptographicHash hash(QCryptographicHash::Md5);
for (int row = 0; row < image.height(); ++row)
hash.addData(reinterpret_cast<const char*>(image.scanLine(row)), image.width() * 4);
@@ -997,8 +1021,8 @@ void DumpRenderTree::dump()
ptr += bytesWritten;
}
}
-
- fflush(stdout);
+ }
+ fflush(stdout);
}
puts("#EOF"); // terminate the (possibly empty) pixels block
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index b751f94..22eee7c 100644
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -72,6 +72,8 @@ void LayoutTestController::reset()
m_isGeolocationPermissionSet = false;
m_isPrinting = false;
m_geolocationPermission = false;
+ m_testRepaint = false;
+ m_sweepHorizontally = false;
DumpRenderTreeSupportQt::dumpEditingCallbacks(false);
DumpRenderTreeSupportQt::dumpFrameLoader(false);
@@ -224,6 +226,16 @@ void LayoutTestController::display()
emit showPage();
}
+void LayoutTestController::testRepaint()
+{
+ m_testRepaint = true;
+}
+
+void LayoutTestController::repaintSweepHorizontally()
+{
+ m_sweepHorizontally = true;
+}
+
void LayoutTestController::displayInvalidatedRegion()
{
display();
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 550192e..2a3ca21 100644
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -73,6 +73,8 @@ public:
bool waitForPolicy() const { return m_waitForPolicy; }
bool ignoreReqestForPermission() const { return m_ignoreDesktopNotification; }
bool isPrinting() { return m_isPrinting; }
+ bool shouldTestRepaint() const { return m_testRepaint; }
+ bool shouldSweepHorizontally() const {return m_sweepHorizontally; }
void reset();
@@ -133,6 +135,8 @@ public slots:
bool checkDesktopNotificationPermission(const QString& origin);
void simulateDesktopNotificationClick(const QString& title);
void display();
+ void testRepaint();
+ void repaintSweepHorizontally();
void displayInvalidatedRegion();
void clearBackForwardList();
QString pathToLocalResource(const QString& url);
@@ -300,6 +304,8 @@ private:
bool m_isGeolocationPermissionSet;
bool m_isPrinting;
bool m_geolocationPermission;
+ bool m_testRepaint;
+ bool m_sweepHorizontally;
QUrl m_userStyleSheetLocation;
QBasicTimer m_timeoutTimer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment