diff options
Diffstat (limited to 'tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp')
-rw-r--r-- | tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp index 850bedd9cc..4167d633b0 100644 --- a/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp +++ b/tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp @@ -79,6 +79,8 @@ private slots: void taskQTBUG_7103_minMaxWidthNotRespected(); void taskQTBUG_27420_takeAtShouldUnparentLayout(); + void taskQTBUG_40609_addingWidgetToItsOwnLayout(); + void taskQTBUG_40609_addingLayoutToItself(); void replaceWidget(); }; @@ -329,6 +331,36 @@ void tst_QBoxLayout::taskQTBUG_27420_takeAtShouldUnparentLayout() QVERIFY(!inner.isNull()); } +void tst_QBoxLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){ + QWidget widget; + widget.setObjectName("347b469225a24a0ef05150a"); + QVBoxLayout layout(&widget); + layout.setObjectName("ef9e2b42298e0e6420105bb"); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null widget to QVBoxLayout/ef9e2b42298e0e6420105bb"); + layout.addWidget(Q_NULLPTR); + QCOMPARE(layout.count(), 0); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/347b469225a24a0ef05150a to its child layout QVBoxLayout/ef9e2b42298e0e6420105bb"); + layout.addWidget(&widget); + QCOMPARE(layout.count(), 0); +} + +void tst_QBoxLayout::taskQTBUG_40609_addingLayoutToItself(){ + QWidget widget; + widget.setObjectName("fe44e5cb6c08006597126a"); + QVBoxLayout layout(&widget); + layout.setObjectName("cc751dd0f50f62b05a62da"); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null layout to QVBoxLayout/cc751dd0f50f62b05a62da"); + layout.addLayout(Q_NULLPTR); + QCOMPARE(layout.count(), 0); + + QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QVBoxLayout/cc751dd0f50f62b05a62da to itself"); + layout.addLayout(&layout); + QCOMPARE(layout.count(), 0); +} + struct Descr { Descr(int min, int sh, int max = -1, bool exp= false, int _stretch = 0, bool _empty = false) |