equal
deleted
inserted
replaced
17 * Boston, MA 02110-1301, USA. |
17 * Boston, MA 02110-1301, USA. |
18 */ |
18 */ |
19 |
19 |
20 #include <QtTest/QtTest> |
20 #include <QtTest/QtTest> |
21 |
21 |
|
22 #include <qwebelement.h> |
22 #include <qwebframe.h> |
23 #include <qwebframe.h> |
23 #include <qwebview.h> |
24 #include <qwebview.h> |
24 #include <qpainter.h> |
25 #include <qpainter.h> |
25 |
26 |
26 /** |
27 /** |
57 void cleanup(); |
58 void cleanup(); |
58 |
59 |
59 private Q_SLOTS: |
60 private Q_SLOTS: |
60 void paint_data(); |
61 void paint_data(); |
61 void paint(); |
62 void paint(); |
|
63 void textAreas(); |
62 |
64 |
63 private: |
65 private: |
64 QWebView* m_view; |
66 QWebView* m_view; |
65 QWebPage* m_page; |
67 QWebPage* m_page; |
66 }; |
68 }; |
103 mainFrame->render(&painter, QRect(QPoint(0, 0), m_page->viewportSize())); |
105 mainFrame->render(&painter, QRect(QPoint(0, 0), m_page->viewportSize())); |
104 painter.end(); |
106 painter.end(); |
105 } |
107 } |
106 } |
108 } |
107 |
109 |
|
110 void tst_Painting::textAreas() |
|
111 { |
|
112 m_view->load(QUrl("data:text/html;<html><body></body></html>")); |
|
113 ::waitForSignal(m_view, SIGNAL(loadFinished(bool))); |
|
114 |
|
115 QWebElement bodyElement = m_page->mainFrame()->findFirstElement("body"); |
|
116 |
|
117 int count = 100; |
|
118 while (count--) { |
|
119 QString markup("<textarea cols='1' rows='1'></textarea>"); |
|
120 bodyElement.appendInside(markup); |
|
121 } |
|
122 |
|
123 /* force a layout */ |
|
124 QWebFrame* mainFrame = m_page->mainFrame(); |
|
125 mainFrame->toPlainText(); |
|
126 |
|
127 QPixmap pixmap(mainFrame->contentsSize()); |
|
128 QBENCHMARK { |
|
129 QPainter painter(&pixmap); |
|
130 mainFrame->render(&painter, QRect(QPoint(0, 0), mainFrame->contentsSize())); |
|
131 painter.end(); |
|
132 } |
|
133 } |
|
134 |
108 QTEST_MAIN(tst_Painting) |
135 QTEST_MAIN(tst_Painting) |
109 #include "tst_painting.moc" |
136 #include "tst_painting.moc" |