summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-10-05 05:39:34 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-10-05 05:39:34 (GMT)
commita14337a9e9812bb485ba5774a8bccc977e1e9519 (patch)
tree73e7e778e83fc990729468b6238522a2c3fbf8cf
parentbe4ed0f02bf6c46e5d9c915b1d0d2b38c40bdfda (diff)
downloadQt-a14337a9e9812bb485ba5774a8bccc977e1e9519.zip
Qt-a14337a9e9812bb485ba5774a8bccc977e1e9519.tar.gz
Qt-a14337a9e9812bb485ba5774a8bccc977e1e9519.tar.bz2
Trivial WebView autotest
-rw-r--r--tests/auto/declarative/qfxwebview/data/creation.qml3
-rw-r--r--tests/auto/declarative/qfxwebview/qfxwebview.pro6
-rw-r--r--tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp59
3 files changed, 68 insertions, 0 deletions
diff --git a/tests/auto/declarative/qfxwebview/data/creation.qml b/tests/auto/declarative/qfxwebview/data/creation.qml
new file mode 100644
index 0000000..bb49143
--- /dev/null
+++ b/tests/auto/declarative/qfxwebview/data/creation.qml
@@ -0,0 +1,3 @@
+import Qt 4.6
+
+WebView { }
diff --git a/tests/auto/declarative/qfxwebview/qfxwebview.pro b/tests/auto/declarative/qfxwebview/qfxwebview.pro
new file mode 100644
index 0000000..ee78950
--- /dev/null
+++ b/tests/auto/declarative/qfxwebview/qfxwebview.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qfxwebview.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp
new file mode 100644
index 0000000..974a4b7
--- /dev/null
+++ b/tests/auto/declarative/qfxwebview/tst_qfxwebview.cpp
@@ -0,0 +1,59 @@
+#include <qtest.h>
+#include "../../../shared/util.h"
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxwebview.h>
+#include <QtWebKit/qwebpage.h>
+#include <QtWebKit/qwebframe.h>
+
+class tst_qfxwebview : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qfxwebview() {}
+
+private slots:
+ void testQmlFiles_data();
+ void testQmlFiles();
+
+private:
+ void checkNoErrors(const QmlComponent& component);
+ QmlEngine engine;
+};
+
+
+void tst_qfxwebview::checkNoErrors(const QmlComponent& component)
+{
+ if (component.isError()) {
+ QList<QmlError> errors = component.errors();
+ for (int ii = 0; ii < errors.count(); ++ii) {
+ const QmlError &error = errors.at(ii);
+ QByteArray errorStr = QByteArray::number(error.line()) + ":" +
+ QByteArray::number(error.column()) + ":" +
+ error.description().toUtf8();
+ qWarning() << errorStr;
+ }
+ }
+ QVERIFY(!component.isError());
+}
+
+void tst_qfxwebview::testQmlFiles_data()
+{
+ QTest::addColumn<QUrl>("qmlfile"); // The input file
+
+ QTest::newRow("creation") << QUrl::fromLocalFile(SRCDIR "/data/creation.qml");
+}
+
+void tst_qfxwebview::testQmlFiles()
+{
+ QFETCH(QUrl, qmlfile);
+
+ QmlComponent component(&engine, qmlfile);
+ checkNoErrors(component);
+ QFxWebView *wv = qobject_cast<QFxWebView*>(component.create());
+ QVERIFY(wv != 0);
+}
+
+QTEST_MAIN(tst_qfxwebview)
+
+#include "tst_qfxwebview.moc"