diff options
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qboxlayout/tst_qboxlayout.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qboxlayout/tst_qboxlayout.cpp b/tests/auto/qboxlayout/tst_qboxlayout.cpp index 0f9bbce..466be31 100644 --- a/tests/auto/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/qboxlayout/tst_qboxlayout.cpp @@ -62,6 +62,7 @@ public slots: private slots: void insertSpacerItem(); + void insertLayout(); void sizeHint(); void sizeConstraints(); void setGeometry(); @@ -160,6 +161,26 @@ void tst_QBoxLayout::insertSpacerItem() window->show(); } +void tst_QBoxLayout::insertLayout() +{ + QWidget *window = new QWidget; + QVBoxLayout *vbox = new QVBoxLayout(window); + QVBoxLayout *dummyParentLayout = new QVBoxLayout; + QHBoxLayout *subLayout = new QHBoxLayout; + dummyParentLayout->addLayout(subLayout); + QCOMPARE(subLayout->parent(), dummyParentLayout); + QCOMPARE(dummyParentLayout->count(), 1); + + // add subLayout to another layout + QTest::ignoreMessage(QtWarningMsg, "QLayout::addChildLayout: layout \"\" already has a parent"); + vbox->addLayout(subLayout); + QCOMPARE((subLayout->parent() == vbox), (vbox->count() == 1)); + + delete dummyParentLayout; + delete window; +} + + void tst_QBoxLayout::sizeHint() { QWidget *window = new QWidget; |