diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 739b10a..9f45d74 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -75,6 +75,7 @@ private slots: void darker(); void tint(); void openUrlExternally(); + void openUrlExternally_pragmaLibrary(); void md5(); void createComponent(); void createComponent_pragmaLibrary(); @@ -321,6 +322,7 @@ void tst_qdeclarativeqt::openUrlExternally() MyUrlHandler handler; QDesktopServices::setUrlHandler("test", &handler, "noteCall"); + QDesktopServices::setUrlHandler("file", &handler, "noteCall"); QDeclarativeComponent component(&engine, TEST_FILE("openUrlExternally.qml")); QObject *object = component.create(); @@ -328,7 +330,35 @@ void tst_qdeclarativeqt::openUrlExternally() QCOMPARE(handler.called,1); QCOMPARE(handler.last, QUrl("test:url")); + object->setProperty("testFile", true); + + QCOMPARE(handler.called,2); + QCOMPARE(handler.last, TEST_FILE("test.html")); + + QDesktopServices::unsetUrlHandler("test"); + QDesktopServices::unsetUrlHandler("file"); +} + +void tst_qdeclarativeqt::openUrlExternally_pragmaLibrary() +{ + MyUrlHandler handler; + + QDesktopServices::setUrlHandler("test", &handler, "noteCall"); + QDesktopServices::setUrlHandler("file", &handler, "noteCall"); + + QDeclarativeComponent component(&engine, TEST_FILE("openUrlExternally_lib.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(handler.called,1); + QCOMPARE(handler.last, QUrl("test:url")); + + object->setProperty("testFile", true); + + QCOMPARE(handler.called,2); + QCOMPARE(handler.last, TEST_FILE("test.html")); + QDesktopServices::unsetUrlHandler("test"); + QDesktopServices::unsetUrlHandler("file"); } void tst_qdeclarativeqt::md5() |