aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-07-14 11:58:14 +0200
committerLars Knoll <lars.knoll@qt.io>2016-07-14 11:29:34 +0000
commit91ed06b767aa4993d28c8b2db4900c319098b035 (patch)
tree28423682d32793ec867f28f03371a5d00c62f05b /tests/auto/qml/qqmlecmascript
parente4f7ab42c6c4f19eed76d9d0de5accda5835a3a8 (diff)
Fix logic bug when deleting properties of JS objects
The code used the size of the internal class in an inconsistent way. It should simply compute and work with the old internal class size, as that reflects the old object layout. [ChangeLog][QtQml] Fix assertion when deleting properties of JS objects Task-number: QTBUG-54589 Change-Id: Ie3db70437e780215d08a1a96491db75f8b859754 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/qtbug_54589.qml16
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp11
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/qtbug_54589.qml b/tests/auto/qml/qqmlecmascript/data/qtbug_54589.qml
new file mode 100644
index 0000000000..8f7d5f2a70
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/qtbug_54589.qml
@@ -0,0 +1,16 @@
+import QtQuick 2.0
+
+QtObject {
+ function checkPropertyDeletion() {
+ var o = {
+ x: 1,
+ y: 2
+ };
+ o.z = 3
+ delete o.y;
+
+ return (o.x === 1 && o.y === undefined && o.z === 3)
+ }
+
+ property bool result: checkPropertyDeletion()
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 08ebfbbbcf..2ec296ae66 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -328,6 +328,7 @@ private slots:
void switchExpression();
void qtbug_46022();
void qtbug_52340();
+ void qtbug_54589();
private:
// static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter);
@@ -7922,6 +7923,16 @@ void tst_qqmlecmascript::qtbug_52340()
QVERIFY(returnValue.toBool());
}
+void tst_qqmlecmascript::qtbug_54589()
+{
+ QQmlComponent component(&engine, testFileUrl("qtbug_54589.qml"));
+
+ QScopedPointer<QObject> obj(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->property("result").toBool(), true);
+}
+
+
QTEST_MAIN(tst_qqmlecmascript)
#include "tst_qqmlecmascript.moc"