diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2017-01-16 16:28:31 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-01-18 05:51:05 +0000 |
commit | 89c6bee139422b17534f79129eea2820d2ce952e (patch) | |
tree | 6c13b355e51e1aaf0b4163db7b20209db88f10af /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | |
parent | 563b640de4312d4a06f33c4db24bd2444586889f (diff) |
Fix support for QJSValue as C++ signal parameter type, part 2
After commit 0e3380f9c6ab6e3ea7398caccf5aa84f1575f1cd we wouldn't crash
anymore, if QJSValue::UndefinedValue was provided as value for a
QJSValue C++ signal parameter. However that was not a complete fix for
the regression of commit aa869cbb06bcf005e238059a2cb0205947ff0b5f, as
other primitive values stored in QJSValue as QVariant were not
converted, so for example QJSValue(42). So let's fix this once and for
all by using QJSValuePrivate::valueForData, that handles all types of
QJSValuePrivate encodings.
Task-number: QTBUG-58133
Change-Id: Ib7c0461b18df6260ccd4bce729ae2348281eb7f3
Reviewed-by: Arnaud Vrac <avrac@freebox.fr>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index b8f12e772d..20f7940e9d 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -1410,7 +1410,6 @@ void tst_qqmlecmascript::signalParameterTypes() QVERIFY(object != 0); emit object->basicSignal(); - emit object->qjsValueEmittingSignal(QJSValue()); QCOMPARE(object->property("intProperty").toInt(), 10); QCOMPARE(object->property("realProperty").toReal(), 19.2); @@ -1419,6 +1418,12 @@ void tst_qqmlecmascript::signalParameterTypes() QVERIFY(object->property("enumProperty") == MyQmlObject::EnumValue3); QVERIFY(object->property("qtEnumProperty") == Qt::LeftButton); + emit object->qjsValueEmittingSignal(QJSValue()); + QVERIFY(object->property("emittedQjsValueWasUndefined").toBool()); + emit object->qjsValueEmittingSignal(QJSValue(42)); + QVERIFY(!object->property("emittedQjsValueWasUndefined").toBool()); + QCOMPARE(object->property("emittedQjsValueAsInt").value<int>(), 42); + delete object; } |