summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-08-10 01:50:49 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-08-10 01:50:49 (GMT)
commit6feb5b75ce96aeeefee189af003949db8c031519 (patch)
tree1d079b5ed48007f3dff4a4ffaced61eed83d9012 /tests/auto/declarative
parent27b5da4ff5a762df0ab3e98ecde9dac4aa589178 (diff)
downloadQt-6feb5b75ce96aeeefee189af003949db8c031519.zip
Qt-6feb5b75ce96aeeefee189af003949db8c031519.tar.gz
Qt-6feb5b75ce96aeeefee189af003949db8c031519.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
Diffstat (limited to 'tests/auto/declarative')
-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)
{