src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp
changeset 19 fcece45ef507
parent 0 1918ee327afb
--- a/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp	Fri Apr 16 15:50:13 2010 +0300
+++ b/src/3rdparty/webkit/WebKit/qt/tests/benchmarks/painting/tst_painting.cpp	Mon May 03 13:17:34 2010 +0300
@@ -19,6 +19,7 @@
 
 #include <QtTest/QtTest>
 
+#include <qwebelement.h>
 #include <qwebframe.h>
 #include <qwebview.h>
 #include <qpainter.h>
@@ -59,6 +60,7 @@
 private Q_SLOTS:
     void paint_data();
     void paint();
+    void textAreas();
 
 private:
     QWebView* m_view;
@@ -105,5 +107,30 @@
     }
 }
 
+void tst_Painting::textAreas()
+{
+    m_view->load(QUrl("data:text/html;<html><body></body></html>"));
+    ::waitForSignal(m_view, SIGNAL(loadFinished(bool)));
+
+    QWebElement bodyElement = m_page->mainFrame()->findFirstElement("body");
+
+    int count = 100;
+    while (count--) {
+        QString markup("<textarea cols='1' rows='1'></textarea>");
+        bodyElement.appendInside(markup);
+    }
+
+    /* force a layout */
+    QWebFrame* mainFrame = m_page->mainFrame();
+    mainFrame->toPlainText();
+
+    QPixmap pixmap(mainFrame->contentsSize());
+    QBENCHMARK {
+        QPainter painter(&pixmap);
+        mainFrame->render(&painter, QRect(QPoint(0, 0), mainFrame->contentsSize()));
+        painter.end();
+    }
+}
+
 QTEST_MAIN(tst_Painting)
 #include "tst_painting.moc"