diff options
| author | Warwick Allison <warwick.allison@nokia.com> | 2009-11-09 03:08:26 (GMT) |
|---|---|---|
| committer | Warwick Allison <warwick.allison@nokia.com> | 2009-11-09 03:08:26 (GMT) |
| commit | 65ebb736e7d1f134b6d3dc5c620de43b9880d544 (patch) | |
| tree | e1731953e59a2ae3f8e90cf8c8656a7b631685ce /tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp | |
| parent | 58e1842aa9703f81c2f55758ba186315524027d8 (diff) | |
| download | Qt-65ebb736e7d1f134b6d3dc5c620de43b9880d544.zip Qt-65ebb736e7d1f134b6d3dc5c620de43b9880d544.tar.gz Qt-65ebb736e7d1f134b6d3dc5c620de43b9880d544.tar.bz2 | |
webview JS test
Diffstat (limited to 'tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp')
| -rw-r--r-- | tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp index 6cf6741..c05f8a6 100644 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp @@ -59,9 +59,9 @@ private slots: void historyNav(); void loadError(); void setHtml(); + void javaScript(); void cleanupTestCase(); - private: void checkNoErrors(const QmlComponent& component); QmlEngine engine; @@ -248,6 +248,18 @@ void tst_qmlgraphicswebview::setHtml() QCOMPARE(wv->html(),QString("<html><head></head><body><p>This is a <b>string</b> set on the WebView</p></body></html>")); } +void tst_qmlgraphicswebview::javaScript() +{ + QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/javaScript.qml")); + checkNoErrors(component); + QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(component.create()); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + QCOMPARE(wv->evaluateJavaScript("123").toInt(), 123); + QCOMPARE(wv->evaluateJavaScript("window.status").toString(), QString("status here")); + QCOMPARE(wv->evaluateJavaScript("window.myjsname.qmlprop").toString(), QString("qmlvalue")); +} + QTEST_MAIN(tst_qmlgraphicswebview) #include "tst_qmlgraphicswebview.moc" |
