diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-04-18 10:18:48 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-05-02 15:46:26 +0000 |
commit | d258c904a6027007d00526ab38b8cc5ba2aed3bf (patch) | |
tree | 5adcfee69c31dc6ab1c8bbe5950415b7d7370e23 /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | |
parent | 02fec0dbd7b9774d17690e378b814ff075ac6299 (diff) |
Throw type errors when attempting to mutate read-only sequence properties
Calling for example Qt.application.arguments.push("...") should throw an
exception.
Task-number: QTBUG-67774
Change-Id: Ifd5cd3357dde510cca77b9b32c9f55f8f72837ff
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 5a7ef01eea..b6f753b313 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -5784,6 +5784,16 @@ void tst_qqmlecmascript::assignSequenceTypes() QCOMPARE(msco5->urlListProperty(), (QList<QUrl>() << QUrl(testFileUrl("example.html")) << QUrl(testFileUrl("example2.html")))); delete object; } + + { + QQmlComponent component(&engine, testFileUrl("assignSequenceTypes.8.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY(object != nullptr); + QVariant result; + QMetaObject::invokeMethod(object.data(), "tryWritingReadOnlySequence", Q_RETURN_ARG(QVariant, result)); + QVERIFY(result.type() == QVariant::Bool); + QVERIFY(result.toBool()); + } } // Test that assigning a null object works |