diff options
Diffstat (limited to 'Source/WebKit/qt/tests/qgraphicswebview')
3 files changed, 45 insertions, 1 deletions
diff --git a/Source/WebKit/qt/tests/qgraphicswebview/resources/56929.html b/Source/WebKit/qt/tests/qgraphicswebview/resources/56929.html new file mode 100644 index 0000000..2f7fa97 --- /dev/null +++ b/Source/WebKit/qt/tests/qgraphicswebview/resources/56929.html @@ -0,0 +1,8 @@ +<body style="background-color: white"> + <div id="1" style="width: 50%; height: 50%; background-color: green"/> + <script> + function resizeDiv() { + document.getElementById("1").setAttribute("style", "width: 150%; height: 150%; background-color: green"); + } + </script> +</body> diff --git a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index 7cc88db..ed162c4 100644 --- a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -21,6 +21,7 @@ #include <QtTest/QtTest> #include <QGraphicsSceneMouseEvent> #include <QGraphicsView> +#include <QStyleOptionGraphicsItem> #include <qgraphicswebview.h> #include <qwebpage.h> #include <qwebframe.h> @@ -43,7 +44,9 @@ private slots: void setPalette_data(); void setPalette(); void renderHints(); - +#if defined(ENABLE_TILED_BACKING_STORE) && ENABLE_TILED_BACKING_STORE + void bug56929(); +#endif #if defined(ENABLE_WEBGL) && ENABLE_WEBGL void webglSoftwareFallbackVerticalOrientation(); void webglSoftwareFallbackHorizontalOrientation(); @@ -191,6 +194,38 @@ void tst_QGraphicsWebView::widgetsRenderingThroughCache() QCOMPARE(referencePixmap.toImage(), viewWithTiling.toImage()); } +#if defined(ENABLE_TILED_BACKING_STORE) && ENABLE_TILED_BACKING_STORE +void tst_QGraphicsWebView::bug56929() +{ + // When rendering from tiles sychronous layout should not be triggered + // and scrollbars should be in sync with the size of the document in the displayed state. + + QGraphicsWebView* webView = new QGraphicsWebView(); + webView->setGeometry(QRectF(0.0, 0.0, 100.0, 100.0)); + QGraphicsView view(new QGraphicsScene()); + view.scene()->setParent(&view); + view.scene()->addItem(webView); + webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true); + QUrl url("qrc:///resources/56929.html"); + webView->load(url); + QVERIFY(waitForSignal(webView, SIGNAL(loadFinished(bool)))); + QStyleOptionGraphicsItem option; + option.exposedRect = webView->geometry(); + QImage img(option.exposedRect.width(), option.exposedRect.height(), QImage::Format_ARGB32_Premultiplied); + QPainter painter(&img); + // This will not paint anything as the tiles are not ready, yet. + webView->paint(&painter, &option); + QApplication::processEvents(); + webView->paint(&painter, &option); + QCOMPARE(img.pixel(option.exposedRect.width() - 2, option.exposedRect.height() / 2), qRgba(255, 255, 255, 255)); + painter.fillRect(option.exposedRect, Qt::black); + QCOMPARE(img.pixel(option.exposedRect.width() - 2, option.exposedRect.height() / 2), qRgba(0, 0, 0, 255)); + webView->page()->mainFrame()->evaluateJavaScript(QString("resizeDiv();")); + webView->paint(&painter, &option); + QCOMPARE(img.pixel(option.exposedRect.width() - 2, option.exposedRect.height() / 2), qRgba(255, 255, 255, 255)); +} +#endif + void tst_QGraphicsWebView::microFocusCoordinates() { QWebPage* page = new QWebPage; diff --git a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc index 1488fcf..f929fe7 100644 --- a/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc +++ b/Source/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.qrc @@ -3,5 +3,6 @@ <file>resources/input_types.html</file> <file>resources/pointing_right.html</file> <file>resources/pointing_up.html</file> + <file>resources/56929.html</file> </qresource> </RCC> |