aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@viroteck.net>2016-09-30 10:37:28 +0200
committerRobin Burchell <robin.burchell@viroteck.net>2016-09-30 09:24:05 +0000
commit0d8a2831779ccb15984e2fe80be04e9856668434 (patch)
tree579c6d3fd062a65bafa7471c1927ab9c10e2808f /tests
parentc9ffed92a0dee0ae00a9632177ea42f85ea8a48c (diff)
qv4jsonobject: Make use of QVariant::toString in stringification
This covers a whole host of missing cases, notably QUrl stored in a QV4::Value. Task-number: QTBUG-50592 Change-Id: I8afd772046c7bfbbcf916a7e90a57be5257b9df8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/stringify_qtbug_50592.qml12
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp10
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/stringify_qtbug_50592.qml b/tests/auto/qml/qqmlecmascript/data/stringify_qtbug_50592.qml
new file mode 100644
index 0000000000..e739b85ef8
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/stringify_qtbug_50592.qml
@@ -0,0 +1,12 @@
+import QtQuick 2.0
+
+Item {
+ Image {
+ id: img
+ source: "http://example.org/some_nonexistant_image.png"
+ visible: false
+ }
+
+ property string source: JSON.stringify(img.source)
+}
+
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index d65cec843c..1d335f1f6a 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -333,6 +333,7 @@ private slots:
void qtbug_52340();
void qtbug_54589();
void qtbug_54687();
+ void stringify_qtbug_50592();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -8045,6 +8046,15 @@ void tst_qqmlecmascript::qtbug_54687()
engine.evaluate("12\n----12");
}
+void tst_qqmlecmascript::stringify_qtbug_50592()
+{
+ QQmlComponent component(&engine, testFileUrl("stringify_qtbug_50592.qml"));
+
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->property("source").toString(), QString::fromLatin1("http://example.org/some_nonexistant_image.png"));
+}
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"