diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-26 10:49:56 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-09-27 15:37:57 +0200 |
commit | a8b637e9b70bb420690523cd3f77f139813deec8 (patch) | |
tree | 4eba1ed7253baaddf76581312bf0318f5293e055 /tests/auto/declarative/qdeclarativewebview/resources | |
parent | 3ef5a2374862c82076427ca42e334aaaeb21ca45 (diff) |
Add QtQuick1 WebKit integration (from QtWebKit module)
This adds the QML1 QDeclarativeWebView integration to the default build (it was
added a while ago) as well as the unit tests.
Change-Id: I7324f5a3b00716d4b300e8c11d9ea3b8b9577da3
Reviewed-by: Pierre Rossi <pierre.rossi@gmail.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativewebview/resources')
18 files changed, 255 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativewebview/resources/basic.html b/tests/auto/declarative/qdeclarativewebview/resources/basic.html new file mode 100644 index 00000000..22e3e243 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/basic.html @@ -0,0 +1,17 @@ +<html> +<head><title>Basic</title> +<link rel="icon" sizes="48x48" href="basic.png"> +<script type="text/javascript"> +<!-- +window.onload = function(){ window.status = "status here"; } +// --> +</script> +</head> +<body leftmargin="0" marginwidth="0"> +<table width="123"> +<tbody> +<tr><td>This is a basic test.</td></tr> +</tbody> +</table> +</body> +</html> diff --git a/tests/auto/declarative/qdeclarativewebview/resources/basic.png b/tests/auto/declarative/qdeclarativewebview/resources/basic.png Binary files differnew file mode 100644 index 00000000..35717cca --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/basic.png diff --git a/tests/auto/declarative/qdeclarativewebview/resources/basic.qml b/tests/auto/declarative/qdeclarativewebview/resources/basic.qml new file mode 100644 index 00000000..b5208d03 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/basic.qml @@ -0,0 +1,5 @@ +import QtWebKit 1.0 + +WebView { + url: "basic.html" +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/elements.html b/tests/auto/declarative/qdeclarativewebview/resources/elements.html new file mode 100644 index 00000000..92368679 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/elements.html @@ -0,0 +1,14 @@ +<body leftmargin=0 topmargin=0> +<table width="300px" border=1 cellpadding=0 cellspacing=0> +<tr> +<td align=center width=25%%><p>A</p></td> +<td width=75% height=50px> + <table width=100% border=1 cellpadding=0 cellspacing=0> + <tr> + <td align=center width=50% height=50px><p>B</p></td> + <td align=center width=50% height=50px><p>C</p></td> + </tr> + </table> +</td> +</tr> +</table> diff --git a/tests/auto/declarative/qdeclarativewebview/resources/elements.qml b/tests/auto/declarative/qdeclarativewebview/resources/elements.qml new file mode 100644 index 00000000..8fef8c92 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/elements.qml @@ -0,0 +1,7 @@ +import QtWebKit 1.0 + +WebView { + url: "elements.html" + width: 310 + height: 100 +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/forward.html b/tests/auto/declarative/qdeclarativewebview/resources/forward.html new file mode 100644 index 00000000..62ab62da --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/forward.html @@ -0,0 +1,12 @@ +<html> +<head><title>Forward</title> +<link rel="icon" sizes="32x32" href="forward.png"> +</head> +<body leftmargin="0" marginwidth="0"> +<table width="123"> +<tbody> +<tr><td>This is more.</td></tr> +</tbody> +</table> +</body> +</html> diff --git a/tests/auto/declarative/qdeclarativewebview/resources/forward.png b/tests/auto/declarative/qdeclarativewebview/resources/forward.png Binary files differnew file mode 100644 index 00000000..a82533e3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/forward.png diff --git a/tests/auto/declarative/qdeclarativewebview/resources/javaScript.html b/tests/auto/declarative/qdeclarativewebview/resources/javaScript.html new file mode 100644 index 00000000..35270bc4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/javaScript.html @@ -0,0 +1,11 @@ +<html> +<head><title>JavaScript</title> +<link rel="icon" sizes="48x48" href="basic.png"> +<script type="text/javascript"> +<!-- +window.onload = function(){ window.status = "status here"; } +// --> +</script> +</head> +<body> +This is a JS test. diff --git a/tests/auto/declarative/qdeclarativewebview/resources/javaScript.qml b/tests/auto/declarative/qdeclarativewebview/resources/javaScript.qml new file mode 100644 index 00000000..527e3b98 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/javaScript.qml @@ -0,0 +1,12 @@ +import QtQuick 1.0 +import QtWebKit 1.0 + +WebView { + url: "javaScript.html" + javaScriptWindowObjects: [ + QtObject { + property string qmlprop: "qmlvalue" + WebView.windowObjectName: "myjsname" + } + ] +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/loadError.qml b/tests/auto/declarative/qdeclarativewebview/resources/loadError.qml new file mode 100644 index 00000000..26cec8f9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/loadError.qml @@ -0,0 +1,5 @@ +import QtWebKit 1.0 + +WebView { + url: "does-not-exist.html" +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/newwindows.html b/tests/auto/declarative/qdeclarativewebview/resources/newwindows.html new file mode 100644 index 00000000..4252d9a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/newwindows.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<script type="text/javascript"> +<!-- +function clickTheLink() +{ + var ev = document.createEvent('MouseEvents'); + ev.initEvent( "click", true, false ); + document.getElementById('thelink').dispatchEvent(ev); +} +// --> +</script> +</head> +<body> +<h1>Multiple windows...</h1> + +<a id=thelink target="_blank" href="newwindows.html">Popup!</a> +</body> +</html> diff --git a/tests/auto/declarative/qdeclarativewebview/resources/newwindows.qml b/tests/auto/declarative/qdeclarativewebview/resources/newwindows.qml new file mode 100644 index 00000000..166722d5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/newwindows.qml @@ -0,0 +1,51 @@ +// Demonstrates opening new WebViews from HTML + +import QtQuick 1.0 +import QtWebKit 1.0 + +Grid { + columns: 3 + id: pages + height: 300; width: 600 + property int pagesOpened: 0 + property Item firstPageOpened: null + + Component { + id: webViewPage + Rectangle { + id: thisPage + width: 150 + height: 150 + property WebView webView: wv + + WebView { + id: wv + anchors.fill: parent + newWindowComponent: webViewPage + newWindowParent: pages + url: "newwindows.html" + Component.onCompleted: { + if (pagesOpened == 1) { + pages.firstPageOpened = thisPage; + } + } + } + } + } + + Loader { + id: originalPage + sourceComponent: webViewPage + property bool ready: status == Loader.Ready && item.webView.status == WebView.Ready + } + + Timer { + interval: 10 + running: originalPage.ready && pagesOpened < 4 + repeat: true + onTriggered: { + pagesOpened++; + originalPage.item.webView.evaluateJavaScript("clickTheLink()"); + } + } +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/propertychanges.qml b/tests/auto/declarative/qdeclarativewebview/resources/propertychanges.qml new file mode 100644 index 00000000..8210e85a --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/propertychanges.qml @@ -0,0 +1,34 @@ +import QtQuick 1.0 +import QtWebKit 1.0 + +Item { + width: 240 + height: 160 + Grid { + anchors.fill: parent + objectName: "newWindowParent" + id: newWindowParent + } + + Row { + anchors.fill: parent + id: oldWindowParent + objectName: "oldWindowParent" + } + + Loader { + sourceComponent: webViewComponent + } + Component { + id: webViewComponent + WebView { + id: webView + objectName: "webView" + newWindowComponent: webViewComponent + newWindowParent: oldWindowParent + url: "basic.html" + renderingEnabled: true + pressGrabTime: 200 + } + } +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/sample.html b/tests/auto/declarative/qdeclarativewebview/resources/sample.html new file mode 100644 index 00000000..cc9bffaf --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/sample.html @@ -0,0 +1,6 @@ +<html> +<head></head> +<body width=400 height=400> +Here is a sample text +</body> +</html> diff --git a/tests/auto/declarative/qdeclarativewebview/resources/sethtml.qml b/tests/auto/declarative/qdeclarativewebview/resources/sethtml.qml new file mode 100644 index 00000000..5bff442b --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/sethtml.qml @@ -0,0 +1,5 @@ +import QtWebKit 1.0 + +WebView { + html: "<p>This is a <b>string</b> set on the WebView" +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/webviewbackgroundcolor.qml b/tests/auto/declarative/qdeclarativewebview/resources/webviewbackgroundcolor.qml new file mode 100644 index 00000000..fb46d38b --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/webviewbackgroundcolor.qml @@ -0,0 +1,10 @@ +import QtQuick 1.0 +import QtWebKit 1.1 + +WebView { + id: myweb + height: 300 + width: 300 + focus: true + backgroundColor : "red" +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/webviewtest.qml b/tests/auto/declarative/qdeclarativewebview/resources/webviewtest.qml new file mode 100644 index 00000000..609d9c99 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/webviewtest.qml @@ -0,0 +1,24 @@ +import QtQuick 1.0 +import QtWebKit 1.0 + +Flickable { + id: flick + width: 640 + height: 400 + clip: true + contentWidth: myweb.width; contentHeight: myweb.height + property alias myurl: myweb.url + property alias prefHeight: myweb.preferredHeight + property alias prefWidth: myweb.preferredWidth + property url testUrl; + WebView { + id: myweb + url: testUrl + smooth: false + scale: 1.0 + preferredHeight: 500 + preferredWidth: 600 + pressGrabTime: 1000 + focus: true + } +} diff --git a/tests/auto/declarative/qdeclarativewebview/resources/webviewtestdefault.qml b/tests/auto/declarative/qdeclarativewebview/resources/webviewtestdefault.qml new file mode 100644 index 00000000..b26eea61 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/resources/webviewtestdefault.qml @@ -0,0 +1,22 @@ +import QtQuick 1.0 +import QtWebKit 1.0 + +Flickable { + id: flick + width: 640 + height: 400 + clip: true + contentWidth: myweb.width; contentHeight: myweb.height + property alias myurl: myweb.url + property alias prefHeight: myweb.preferredHeight + property alias prefWidth: myweb.preferredWidth + property url testUrl; + WebView { + id: myweb + url: testUrl; + smooth: false + scale: 1.0 + pressGrabTime: 1000 + focus: true + } +} |