Created
May 31, 2011 08:58
-
-
Save Smith1123/1000201 to your computer and use it in GitHub Desktop.
testRepaint()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | |
index 001d55b..6d907c3 100644 | |
--- a/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | |
+++ b/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp | |
@@ -951,12 +951,52 @@ 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(); | |
- | |
+ QPainter painter(&image); | |
+// mainFrame->render(&painter); | |
+ | |
+// QRect q_rect(100,100,100,100), q_rect2(300,300,300,300); | |
+// QPainter painter2(&image); | |
+// painter2.drawRect(q_rect); | |
+// painter2.drawRect(q_rect2); | |
+// mainFrame->render(&painter2, q_rect); | |
+// mainFrame->render(&painter2); | |
+// mainFrame->render(&painter); | |
+// painter.end(); | |
+// painter2.end(); | |
+ if(m_controller->shouldTestRepaint()) { | |
+ int width = m_page->viewportSize().width(); | |
+ int height = m_page->viewportSize().height(); | |
+// QPainter painter2; | |
+ if (m_controller->shouldSweepHorizontally()) { | |
+ for (QRect column(QPoint(0,height), QSize(m_page->viewportSize())); column.x() < width; column.setX(column.x()+1)){ | |
+// pixmap = QPixmap(QSize(column.width(), height)); | |
+// QPainter painter(&image); | |
+// painter.fillRect(column, Qt::white); | |
+ painter.drawRect(column); | |
+ mainFrame->render(&painter); | |
+ | |
+// painter.end(); | |
+ | |
+ } | |
+ } else { | |
+ for (QRect line(QPoint(0,0), QSize(m_page->viewportSize())); line.y() < height; line.setY(line.y()+1)){ | |
+// pixmap = QPixmap(QSize(width, line.height())); | |
+// QPainter painter(&image); | |
+ painter.fillRect(line, Qt::yellow); | |
+ painter.drawRect(line); | |
+ mainFrame->render(&painter, line); | |
+// painter.end(); | |
+ } | |
+ } | |
+ | |
+ //mainFrame->render(&painter, column); | |
+// 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); | |
@@ -998,8 +1038,8 @@ void DumpRenderTree::dump() | |
ptr += bytesWritten; | |
} | |
} | |
- | |
- fflush(stdout); | |
+ } | |
+ fflush(stdout); | |
} | |
puts("#EOF"); // terminate the (possibly empty) pixels block | |
@@ -1007,7 +1047,7 @@ void DumpRenderTree::dump() | |
fflush(stdout); | |
fflush(stderr); | |
- emit ready(); | |
+ emit ready();} | |
} | |
void DumpRenderTree::titleChanged(const QString &s) | |
diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | |
index ff3ed33..5dd22b5 100644 | |
--- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | |
+++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp | |
@@ -224,6 +224,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 99d04f3..d9631e4 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() { return m_testRepaint; } | |
+ bool shouldSweepHorizontally() { 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); | |
@@ -301,6 +305,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