summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp26
1 files changed, 24 insertions, 2 deletions
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()