summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicslinearlayout
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-10-19 07:39:30 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-10-19 07:39:30 (GMT)
commit856efef9bf87e0b7e5ed6ad2ccb225e294321888 (patch)
tree452563793f599fd457b2558e74561a864d5285af /tests/auto/qgraphicslinearlayout
parent6f20e48d946fa3c90215f6affe5aa490559a6971 (diff)
downloadQt-856efef9bf87e0b7e5ed6ad2ccb225e294321888.zip
Qt-856efef9bf87e0b7e5ed6ad2ccb225e294321888.tar.gz
Qt-856efef9bf87e0b7e5ed6ad2ccb225e294321888.tar.bz2
Do not loop forever if we are adding the layout itself to the layout.
Reviewed-by: alexis
Diffstat (limited to 'tests/auto/qgraphicslinearlayout')
-rw-r--r--tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 8e7bb45..546f92d 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -101,6 +101,7 @@ private slots:
void updateGeometry();
void layoutDirection();
void removeLayout();
+ void avoidRecursionInInsertItem();
// Task specific tests
void task218400_insertStretchCrash();
@@ -1432,6 +1433,16 @@ void tst_QGraphicsLinearLayout::removeLayout()
QCOMPARE(pushButton->geometry(), r2);
}
+void tst_QGraphicsLinearLayout::avoidRecursionInInsertItem()
+{
+ QGraphicsWidget window(0, Qt::Window);
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(&window);
+ QCOMPARE(layout->count(), 0);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsLinearLayout::insertItem: cannot insert itself");
+ layout->insertItem(0, layout);
+ QCOMPARE(layout->count(), 0);
+}
+
void tst_QGraphicsLinearLayout::task218400_insertStretchCrash()
{
QGraphicsScene *scene = new QGraphicsScene;