summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-08-10 01:50:49 (GMT)
committerToby Tomkins <toby.tomkins@nokia.com>2010-08-11 05:08:46 (GMT)
commite0167ee787bd0d28a9de0278c3f70f30151e2be6 (patch)
tree7f6036cc44c50e113e898f3b12635f1a17849cfe /tests/auto
parente133941d76a2214708b5d7c6aa35eae44d6f5076 (diff)
downloadQt-e0167ee787bd0d28a9de0278c3f70f30151e2be6.zip
Qt-e0167ee787bd0d28a9de0278c3f70f30151e2be6.tar.gz
Qt-e0167ee787bd0d28a9de0278c3f70f30151e2be6.tar.bz2
Don't double-add item change listeners.
When a Repeater was used as the child of an Item binding to childrenRect, the item change listener was being added twice for the items created by the Repeater. Task-number: QTBUG-12722 (cherry picked from commit 6feb5b75ce96aeeefee189af003949db8c031519)
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml15
-rw-r--r--tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp12
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml
new file mode 100644
index 0000000..f19ab4f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug3.qml
@@ -0,0 +1,15 @@
+import Qt 4.7
+
+Rectangle {
+ width: 300
+ height: 300
+
+ Rectangle {
+ height: childrenRect.height
+
+ Repeater {
+ model: 1
+ Rectangle { }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
index d76d360..25ca157 100644
--- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
+++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp
@@ -75,6 +75,7 @@ private slots:
void childrenRect();
void childrenRectBug();
void childrenRectBug2();
+ void childrenRectBug3();
void childrenProperty();
void resourcesProperty();
@@ -780,6 +781,17 @@ void tst_QDeclarativeItem::childrenRectBug2()
delete canvas;
}
+// QTBUG-12722
+void tst_QDeclarativeItem::childrenRectBug3()
+{
+ QDeclarativeView *canvas = new QDeclarativeView(0);
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug3.qml"));
+ canvas->show();
+
+ //don't crash on delete
+ delete canvas;
+}
+
template<typename T>
T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName)
{