summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2010-01-12 11:28:22 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2010-01-12 11:28:22 (GMT)
commit04bdf9f6a77e9ebf96431f89b8240a037b3d2b09 (patch)
treeb79f63e113a1b025421dcafb821e026376011a64 /src/3rdparty/webkit/WebKit/qt/tests
parentd1f73b7be62b0f6e9294b5d78ccd0680cb9fe118 (diff)
downloadQt-04bdf9f6a77e9ebf96431f89b8240a037b3d2b09.zip
Qt-04bdf9f6a77e9ebf96431f89b8240a037b3d2b09.tar.gz
Qt-04bdf9f6a77e9ebf96431f89b8240a037b3d2b09.tar.bz2
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( bd6591b4acaf2172ab05702153ef539c0ac89cbb )
Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2009-12-18 Joe Ligman <joseph.ligman@nokia.com> Reviewed by Kenneth Rohde Christiansen. [Qt] Add new API to QWebFrame to scrollRecursively starting with any css overflow then checking current frame and then ancestors https://bugs.webkit.org/show_bug.cgi?id=32668 * Api/qwebframe.cpp: (QWebFramePrivate::scrollOverflow): (QWebFrame::scrollRecursively): * Api/qwebframe.h: * Api/qwebframe_p.h: * tests/qwebframe/qwebframe.qrc: * tests/qwebframe/testiframe.html: Added. * tests/qwebframe/testiframe2.html: Added. * tests/qwebframe/tst_qwebframe.cpp:
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/tests')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html54
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html21
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp67
4 files changed, 144 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc
index 9615e27..8afa0c1 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/qwebframe.qrc
@@ -4,5 +4,7 @@
<file>style.css</file>
<file>test1.html</file>
<file>test2.html</file>
+<file>testiframe.html</file>
+<file>testiframe2.html</file>
</qresource>
</RCC>
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html
new file mode 100644
index 0000000..9f3ae85
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe.html
@@ -0,0 +1,54 @@
+</html>
+<html>
+<head>
+<title></title>
+<style type="text/css">
+<!--
+#header {
+ background: #0f0;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 800px;
+ height: 100px;
+}
+#content1 {
+ background: #ff0;
+ position: absolute;
+ top: 101px;
+ left: 0px;
+ width: 400px;
+ height: 400px;
+ overflow: scroll;
+}
+#content2 {
+ background: #ff7;
+ position: absolute;
+ top: 101px;
+ left: 401px;
+ width: 400px;
+ height: 400px;
+}
+#footer {
+ background: #0f0;
+ position: absolute;
+ top: 502px;
+ left: 0px;
+ width: 800px;
+ height: 200px;
+}
+-->
+</style>
+</head>
+<body>
+<div id="header"></div>
+<div id="content1">You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.
+You can use the overflow property when you want to have better control of the layout. Try to change the overflow property to: visible, hidden, auto, or inherit and see what happens. The default value is visible.</div>
+<iframe id="content2" name="control" src="testiframe2.html"> </iframe>
+<div id="footer"></div>
+</body>
+</html> \ No newline at end of file
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html
new file mode 100644
index 0000000..1913a89
--- /dev/null
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/testiframe2.html
@@ -0,0 +1,21 @@
+</html>
+<html>
+<head>
+<title></title>
+<style type="text/css">
+<!--
+#content {
+ background: #fff;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+ width: 800px;
+ height: 800px;
+}
+-->
+</style>
+</head>
+<body>
+<div id="content"> </div>
+</body>
+</html> \ No newline at end of file
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
index 8cc7953..609f8b4 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
@@ -606,6 +606,7 @@ private slots:
void scrollPosition();
void evaluateWillCauseRepaint();
void qObjectWrapperWithSameIdentity();
+ void scrollRecursively();
private:
QString evalJS(const QString&s) {
@@ -2824,5 +2825,71 @@ void tst_QWebFrame::qObjectWrapperWithSameIdentity()
QCOMPARE(mainFrame->toPlainText(), QString("test2"));
}
+bool QWEBKIT_EXPORT qtwebkit_webframe_scrollRecursively(QWebFrame* qFrame, int dx, int dy);
+
+void tst_QWebFrame::scrollRecursively()
+{
+ // The test content is
+ // a nested frame set
+ // The main frame scrolls
+ // and has two children
+ // an iframe and a div overflow
+ // both scroll
+ QWebView webView;
+ QWebPage* webPage = webView.page();
+ QSignalSpy loadSpy(webPage, SIGNAL(loadFinished(bool)));
+ QUrl url = QUrl("qrc:///testiframe.html");
+ webPage->mainFrame()->load(url);
+ QTRY_COMPARE(loadSpy.count(), 1);
+
+ QList<QWebFrame*> children = webPage->mainFrame()->childFrames();
+ QVERIFY(children.count() == 1);
+
+ // 1st test
+ // call scrollRecursively over mainframe
+ // verify scrolled
+ // verify scroll postion changed
+ QPoint scrollPosition(webPage->mainFrame()->scrollPosition());
+ QVERIFY(qtwebkit_webframe_scrollRecursively(webPage->mainFrame(), 10, 10));
+ QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition());
+
+ // 2nd test
+ // call scrollRecursively over child iframe
+ // verify scrolled
+ // verify child scroll position changed
+ // verify parent's scroll position did not change
+ scrollPosition = webPage->mainFrame()->scrollPosition();
+ QPoint childScrollPosition = children.at(0)->scrollPosition();
+ QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), 10, 10));
+ QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition());
+ QVERIFY(childScrollPosition != children.at(0)->scrollPosition());
+
+ // 3rd test
+ // call scrollRecursively over div overflow
+ // verify scrolled == true
+ // verify parent and child frame's scroll postion did not change
+ QWebElement div = webPage->mainFrame()->documentElement().findFirst("#content1");
+ QMouseEvent evpres(QEvent::MouseMove, div.geometry().center(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
+ webPage->event(&evpres);
+ scrollPosition = webPage->mainFrame()->scrollPosition();
+ childScrollPosition = children.at(0)->scrollPosition();
+ QVERIFY(qtwebkit_webframe_scrollRecursively(webPage->mainFrame(), 5, 5));
+ QVERIFY(childScrollPosition == children.at(0)->scrollPosition());
+ QVERIFY(scrollPosition == webPage->mainFrame()->scrollPosition());
+
+ // 4th test
+ // call scrollRecursively twice over childs iframe
+ // verify scrolled == true first time
+ // verify parent's scroll == true second time
+ // verify parent and childs scroll position changed
+ childScrollPosition = children.at(0)->scrollPosition();
+ QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), -10, -10));
+ QVERIFY(childScrollPosition != children.at(0)->scrollPosition());
+ scrollPosition = webPage->mainFrame()->scrollPosition();
+ QVERIFY(qtwebkit_webframe_scrollRecursively(children.at(0), -10, -10));
+ QVERIFY(scrollPosition != webPage->mainFrame()->scrollPosition());
+
+}
+
QTEST_MAIN(tst_QWebFrame)
#include "tst_qwebframe.moc"