summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-10-01 01:11:45 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-10-01 06:03:42 (GMT)
commit6f74eef81cfbebce797f4a3464ea0cefbd268d7b (patch)
treea2aba15e1f9135a926603d18c2cfe4e442232703 /tests
parent5a6f2b7ed7d1d37379324898161a6d03457c591e (diff)
downloadQt-6f74eef81cfbebce797f4a3464ea0cefbd268d7b.zip
Qt-6f74eef81cfbebce797f4a3464ea0cefbd268d7b.tar.gz
Qt-6f74eef81cfbebce797f4a3464ea0cefbd268d7b.tar.bz2
Qt.openUrlExternally should resolve relative URLs.
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml3
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.js9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.qml9
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp30
4 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml
index c9fb25e..dc4049c 100644
--- a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml
+++ b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally.qml
@@ -2,4 +2,7 @@ import QtQuick 1.0
QtObject {
Component.onCompleted: Qt.openUrlExternally("test:url")
+
+ property bool testFile
+ onTestFileChanged: Qt.openUrlExternally("test.html")
}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.js b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.js
new file mode 100644
index 0000000..702357a
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.js
@@ -0,0 +1,9 @@
+.pragma library
+
+function loadTest() {
+ Qt.openUrlExternally("test:url")
+}
+
+function loadFile() {
+ Qt.openUrlExternally("test.html")
+}
diff --git a/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.qml
new file mode 100644
index 0000000..456653b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/openUrlExternally_lib.qml
@@ -0,0 +1,9 @@
+import QtQuick 1.0
+import "openUrlExternally_lib.js" as Test
+
+Item {
+ Component.onCompleted: Test.loadTest();
+
+ property bool testFile
+ onTestFileChanged: Test.loadFile();
+}
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()