aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp6
-rw-r--r--tests/auto/declarative/qdeclarativeqt/data/resolvedUrl.qml13
-rw-r--r--tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp14
3 files changed, 30 insertions, 3 deletions
diff --git a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp
index 1ced8687ff..918fd527b0 100644
--- a/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp
+++ b/src/declarative/qml/v8/qdeclarativebuiltinfunctions.cpp
@@ -676,12 +676,12 @@ v8::Handle<v8::Value> resolvedUrl(const v8::Arguments &args)
if (p) {
QDeclarativeContextData *ctxt = V8ENGINE()->callingContext();
if (ctxt)
- return V8ENGINE()->fromVariant(ctxt->resolvedUrl(url));
+ return V8ENGINE()->toString(ctxt->resolvedUrl(url).toString());
else
- return V8ENGINE()->fromVariant(url);
+ return V8ENGINE()->toString(url.toString());
}
- return V8ENGINE()->fromVariant(e->baseUrl().resolved(url));
+ return V8ENGINE()->toString(e->baseUrl().resolved(url).toString());
}
/*!
diff --git a/tests/auto/declarative/qdeclarativeqt/data/resolvedUrl.qml b/tests/auto/declarative/qdeclarativeqt/data/resolvedUrl.qml
new file mode 100644
index 0000000000..06ef48b82b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeqt/data/resolvedUrl.qml
@@ -0,0 +1,13 @@
+import QtQuick 2.0
+
+QtObject {
+ property string result
+ property bool isString: false
+
+ Component.onCompleted: {
+ var a = Qt.resolvedUrl("resolvedUrl.qml");
+ result = a;
+ isString = (typeof a) == "string"
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
index b4ac2dfc66..b6cebf40ec 100644
--- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
+++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp
@@ -89,6 +89,7 @@ private slots:
void atob();
void fontFamilies();
void quit();
+ void resolvedUrl();
private:
QDeclarativeEngine engine;
@@ -727,6 +728,19 @@ void tst_qdeclarativeqt::quit()
delete object;
}
+void tst_qdeclarativeqt::resolvedUrl()
+{
+ QDeclarativeComponent component(&engine, TEST_FILE("resolvedUrl.qml"));
+
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("result").toString(), component.url().toString());
+ QCOMPARE(object->property("isString").toBool(), true);
+
+ delete object;
+}
+
QTEST_MAIN(tst_qdeclarativeqt)
#include "tst_qdeclarativeqt.moc"