aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-10-04 10:41:55 +0200
committerLiang Qi <liang.qi@qt.io>2017-10-04 10:41:55 +0200
commit0d3592aa7fab8bf4d8f80bc3b35323efe6950b1b (patch)
tree169707c4318185c418c8705628f03dd4118223e0 /tests/auto
parentb9e3df1cceb337947c2c701975163b53dbe131d8 (diff)
parent265b3bea18c1ac13da413931024f64f49a2da7fc (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10v5.10.0-beta1
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp10
-rw-r--r--tests/auto/quick/qquickbehaviors/data/ItemWithInnerBehavior.qml10
-rw-r--r--tests/auto/quick/qquickbehaviors/data/overwrittenbehavior.qml14
-rw-r--r--tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp9
4 files changed, 38 insertions, 5 deletions
diff --git a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp
index 6ac0412ae5..fb63d811a8 100644
--- a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp
+++ b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp
@@ -47,18 +47,18 @@ static bool compareItems(QQmlObjectModel *model, const QObjectList &items)
return true;
}
-static bool verifyChangeSet(const QQmlChangeSet &changeSet, int expectedInserts, int expectedRemoves, bool isMove)
+static bool verifyChangeSet(const QQmlChangeSet &changeSet, int expectedInserts, int expectedRemoves, bool isMove, int moveId = -1)
{
int actualRemoves = 0;
for (const QQmlChangeSet::Change &r : changeSet.removes()) {
- if (r.isMove() != isMove)
+ if (r.isMove() != isMove && (!isMove || moveId == r.moveId))
return false;
actualRemoves += r.count;
}
int actualInserts = 0;
for (const QQmlChangeSet::Change &i : changeSet.inserts()) {
- if (i.isMove() != isMove)
+ if (i.isMove() != isMove && (!isMove || moveId == i.moveId))
return false;
actualInserts += i.count;
}
@@ -129,7 +129,7 @@ void tst_QQmlObjectModel::changes()
QCOMPARE(countSpy.count(), countSignals);
QCOMPARE(childrenSpy.count(), ++childrenSignals);
QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals);
- QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true));
+ QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true, 1));
// move(3, 2) -> [item0, item1, item2, item3]
model.move(3, 2); items.move(3, 2);
@@ -138,7 +138,7 @@ void tst_QQmlObjectModel::changes()
QCOMPARE(countSpy.count(), countSignals);
QCOMPARE(childrenSpy.count(), ++childrenSignals);
QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals);
- QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true));
+ QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true, 2));
// remove(0) -> [item1, item2, item3]
model.remove(0); items.removeAt(0);
diff --git a/tests/auto/quick/qquickbehaviors/data/ItemWithInnerBehavior.qml b/tests/auto/quick/qquickbehaviors/data/ItemWithInnerBehavior.qml
new file mode 100644
index 0000000000..09983645ef
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/ItemWithInnerBehavior.qml
@@ -0,0 +1,10 @@
+import QtQuick 2.4
+
+Item {
+ id: root
+
+ property bool someValue
+ Behavior on someValue {
+ ScriptAction { script: { parent.behaviorTriggered = true }}
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/data/overwrittenbehavior.qml b/tests/auto/quick/qquickbehaviors/data/overwrittenbehavior.qml
new file mode 100644
index 0000000000..e627c45782
--- /dev/null
+++ b/tests/auto/quick/qquickbehaviors/data/overwrittenbehavior.qml
@@ -0,0 +1,14 @@
+import QtQuick 2.4
+
+Item {
+ property bool behaviorTriggered
+ property bool someProperty
+
+ ItemWithInnerBehavior {
+ //the existence of this property triggers the bug
+ property bool iDoAbsolutelyNothing
+
+ Component.onCompleted: parent.someProperty = true
+ someValue: parent.someProperty
+ }
+}
diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
index 80c76a377b..bdd53702e5 100644
--- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
+++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp
@@ -72,6 +72,7 @@ private slots:
void currentValue();
void disabledWriteWhileRunning();
void aliasedProperty();
+ void innerBehaviorOverwritten();
};
void tst_qquickbehaviors::simpleBehavior()
@@ -589,6 +590,14 @@ void tst_qquickbehaviors::aliasedProperty()
//i.e. the behavior has been triggered
}
+void tst_qquickbehaviors::innerBehaviorOverwritten()
+{
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("overwrittenbehavior.qml"));
+ QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem*>(c.create()));
+ QVERIFY(item->property("behaviorTriggered").toBool());
+}
+
QTEST_MAIN(tst_qquickbehaviors)
#include "tst_qquickbehaviors.moc"