summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmlgraphicswebview
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-11-13 05:20:33 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-11-13 05:20:33 (GMT)
commit4aa6a63f0f77a86f1af7c2e25b92b4d0ed92a267 (patch)
tree8e92c976b2cd03af50528caa57799b95b7c38b3c /tests/auto/declarative/qmlgraphicswebview
parentb143576a735b6ec67058d5c6b6cf369b1002756d (diff)
downloadQt-4aa6a63f0f77a86f1af7c2e25b92b4d0ed92a267.zip
Qt-4aa6a63f0f77a86f1af7c2e25b92b4d0ed92a267.tar.gz
Qt-4aa6a63f0f77a86f1af7c2e25b92b4d0ed92a267.tar.bz2
WebView tests and testability.
Diffstat (limited to 'tests/auto/declarative/qmlgraphicswebview')
-rw-r--r--tests/auto/declarative/qmlgraphicswebview/data/elements.html14
-rw-r--r--tests/auto/declarative/qmlgraphicswebview/data/elements.qml7
-rw-r--r--tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp67
3 files changed, 88 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlgraphicswebview/data/elements.html b/tests/auto/declarative/qmlgraphicswebview/data/elements.html
new file mode 100644
index 0000000..9236867
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicswebview/data/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/qmlgraphicswebview/data/elements.qml b/tests/auto/declarative/qmlgraphicswebview/data/elements.qml
new file mode 100644
index 0000000..7c030e6
--- /dev/null
+++ b/tests/auto/declarative/qmlgraphicswebview/data/elements.qml
@@ -0,0 +1,7 @@
+import Qt 4.6
+
+WebView {
+ url: "elements.html"
+ width: 310
+ height: 100
+}
diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp
index 308cdd6..da43e68 100644
--- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp
+++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp
@@ -43,6 +43,7 @@
#include <QtDeclarative/qmlengine.h>
#include <QtDeclarative/qmlcomponent.h>
#include <private/qmlgraphicswebview_p.h>
+#include <private/qmlgraphicswebview_p_p.h>
#include <private/qmlgraphicspositioners_p.h>
#include <QtWebKit/qwebpage.h>
#include <QtWebKit/qwebframe.h>
@@ -57,6 +58,7 @@ public:
private slots:
void basicProperties();
+ void settings();
void historyNav();
void multipleWindows();
void elementAreaAt();
@@ -156,6 +158,71 @@ void tst_qmlgraphicswebview::basicProperties()
QTRY_COMPARE(wv->progress(), 1.0);
}
+void tst_qmlgraphicswebview::settings()
+{
+ QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));
+ checkNoErrors(component);
+ QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(component.create());
+ QVERIFY(wv != 0);
+ QTRY_COMPARE(wv->progress(), 1.0);
+
+ QmlGraphicsWebSettings *s = wv->settingsObject();
+
+ // merely tests that setting gets stored (in QWebSettings)
+ // behavioural tests are in WebKit.
+ for (int b=0; b<=1; ++b) {
+ bool on = !!b;
+
+ s->setAutoLoadImages(on);
+ s->setDeveloperExtrasEnabled(on);
+ s->setJavaEnabled(on);
+ s->setJavascriptCanAccessClipboard(on);
+ s->setJavascriptCanOpenWindows(on);
+ s->setJavascriptEnabled(on);
+ s->setLinksIncludedInFocusChain(on);
+ s->setLocalContentCanAccessRemoteUrls(on);
+ s->setLocalStorageDatabaseEnabled(on);
+ s->setOfflineStorageDatabaseEnabled(on);
+ s->setOfflineWebApplicationCacheEnabled(on);
+ s->setPluginsEnabled(on);
+ s->setPrintElementBackgrounds(on);
+ s->setPrivateBrowsingEnabled(on);
+ s->setZoomTextOnly(on);
+
+ QVERIFY(s->autoLoadImages() == on);
+ QVERIFY(s->developerExtrasEnabled() == on);
+ QVERIFY(s->javaEnabled() == on);
+ QVERIFY(s->javascriptCanAccessClipboard() == on);
+ QVERIFY(s->javascriptCanOpenWindows() == on);
+ QVERIFY(s->javascriptEnabled() == on);
+ QVERIFY(s->linksIncludedInFocusChain() == on);
+ QVERIFY(s->localContentCanAccessRemoteUrls() == on);
+ QVERIFY(s->localStorageDatabaseEnabled() == on);
+ QVERIFY(s->offlineStorageDatabaseEnabled() == on);
+ QVERIFY(s->offlineWebApplicationCacheEnabled() == on);
+ QVERIFY(s->pluginsEnabled() == on);
+ QVERIFY(s->printElementBackgrounds() == on);
+ QVERIFY(s->privateBrowsingEnabled() == on);
+ QVERIFY(s->zoomTextOnly() == on);
+
+ QVERIFY(s->property("autoLoadImages") == on);
+ QVERIFY(s->property("developerExtrasEnabled") == on);
+ QVERIFY(s->property("javaEnabled") == on);
+ QVERIFY(s->property("javascriptCanAccessClipboard") == on);
+ QVERIFY(s->property("javascriptCanOpenWindows") == on);
+ QVERIFY(s->property("javascriptEnabled") == on);
+ QVERIFY(s->property("linksIncludedInFocusChain") == on);
+ QVERIFY(s->property("localContentCanAccessRemoteUrls") == on);
+ QVERIFY(s->property("localStorageDatabaseEnabled") == on);
+ QVERIFY(s->property("offlineStorageDatabaseEnabled") == on);
+ QVERIFY(s->property("offlineWebApplicationCacheEnabled") == on);
+ QVERIFY(s->property("pluginsEnabled") == on);
+ QVERIFY(s->property("printElementBackgrounds") == on);
+ QVERIFY(s->property("privateBrowsingEnabled") == on);
+ QVERIFY(s->property("zoomTextOnly") == on);
+ }
+}
+
void tst_qmlgraphicswebview::historyNav()
{
QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));