diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-03-31 02:30:33 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-03-31 02:30:33 (GMT) |
commit | 75e9dc39dda515847961a04d402754d93d0b3326 (patch) | |
tree | 599c5704511cb5aa26889976983ba826abcd5e90 /tests/auto/declarative/qdeclarativeqt | |
parent | 67667a5fee2f3c693e29e7c57b73fc8a6a508d01 (diff) | |
download | Qt-75e9dc39dda515847961a04d402754d93d0b3326.zip Qt-75e9dc39dda515847961a04d402754d93d0b3326.tar.gz Qt-75e9dc39dda515847961a04d402754d93d0b3326.tar.bz2 |
Test openUrlExternally
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt')
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp | 26 |
2 files changed, 29 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml new file mode 100644 index 0000000..70bd74d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +QtObject { + Component.onCompleted: Qt.openUrlExternally("test:url") +} diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 4987557..48d5235 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -44,6 +44,7 @@ #include <QDeclarativeEngine> #include <QFileInfo> #include <QDeclarativeComponent> +#include <QDesktopServices> #include <QDir> #include <QVector3D> #include <QCryptographicHash> @@ -261,10 +262,31 @@ void tst_qdeclarativeqt::tint() delete object; } +class MyUrlHandler : public QObject +{ + Q_OBJECT +public: + MyUrlHandler() : called(0) { } + int called; + QUrl last; + +public slots: + void noteCall(const QUrl &url) { called++; last = url; } +}; + void tst_qdeclarativeqt::openUrlExternally() { - QEXPECT_FAIL("", "How do we test this?", Abort); - QVERIFY(false); + MyUrlHandler handler; + + QDesktopServices::setUrlHandler("test", &handler, "noteCall"); + + QDeclarativeComponent component(&engine, TEST_FILE("openUrlExternally.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(handler.called,1); + QCOMPARE(handler.last, QUrl("test:url")); + + QDesktopServices::unsetUrlHandler("test"); } void tst_qdeclarativeqt::md5() |