summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r--tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp32
-rw-r--r--tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp24
-rw-r--r--tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp32
3 files changed, 88 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)
diff --git a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
index 9df7e1662d..962e472606 100644
--- a/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
+++ b/tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp
@@ -135,6 +135,8 @@ private slots:
*/
void taskQTBUG_27420_takeAtShouldUnparentLayout();
+ void taskQTBUG_40609_addingWidgetToItsOwnLayout();
+ void taskQTBUG_40609_addingLayoutToItself();
};
@@ -949,6 +951,28 @@ void tst_QFormLayout::taskQTBUG_27420_takeAtShouldUnparentLayout()
QVERIFY(!inner.isNull());
}
+void tst_QFormLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){
+ QWidget widget;
+ widget.setObjectName("6435cbada60548b4522cbb6");
+ QFormLayout layout(&widget);
+ layout.setObjectName("c03c0e22c0b6d019a93a248");
+
+ QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/6435cbada60548b4522cbb6 to its child layout QFormLayout/c03c0e22c0b6d019a93a248");
+ layout.addRow(QLatin1String("48c81f39b7320082f8"), &widget);
+ QCOMPARE(layout.count(), 0);
+}
+
+void tst_QFormLayout::taskQTBUG_40609_addingLayoutToItself(){
+ QWidget widget;
+ widget.setObjectName("2bc425637d084c07ce65956");
+ QFormLayout layout(&widget);
+ layout.setObjectName("60e31de0c8800eaba713a4f2");
+
+ QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QFormLayout/60e31de0c8800eaba713a4f2 to itself");
+ layout.addRow(QLatin1String("9a2cd4f40c06b489f889"), &layout);
+ QCOMPARE(layout.count(), 0);
+}
+
void tst_QFormLayout::replaceWidget()
{
QWidget w;
diff --git a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
index 3b7c2ac14d..0dcae2fbcc 100644
--- a/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
+++ b/tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp
@@ -101,6 +101,8 @@ private slots:
void distributeMultiCell();
void taskQTBUG_27420_takeAtShouldUnparentLayout();
+ void taskQTBUG_40609_addingWidgetToItsOwnLayout();
+ void taskQTBUG_40609_addingLayoutToItself();
void replaceWidget();
private:
@@ -1660,6 +1662,36 @@ void tst_QGridLayout::taskQTBUG_27420_takeAtShouldUnparentLayout()
QVERIFY(!inner.isNull());
}
+void tst_QGridLayout::taskQTBUG_40609_addingWidgetToItsOwnLayout(){
+ QWidget widget;
+ widget.setObjectName("9bb37ca762aeb7269b8");
+ QGridLayout layout(&widget);
+ layout.setObjectName("d631e91a35f2b66a6dff35");
+
+ QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null widget to QGridLayout/d631e91a35f2b66a6dff35");
+ layout.addWidget(Q_NULLPTR, 0, 0);
+ QCOMPARE(layout.count(), 0);
+
+ QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add parent widget QWidget/9bb37ca762aeb7269b8 to its child layout QGridLayout/d631e91a35f2b66a6dff35");
+ layout.addWidget(&widget, 0, 0);
+ QCOMPARE(layout.count(), 0);
+}
+
+void tst_QGridLayout::taskQTBUG_40609_addingLayoutToItself(){
+ QWidget widget;
+ widget.setObjectName("0373d417fffe2c59c6fe543");
+ QGridLayout layout(&widget);
+ layout.setObjectName("5d79e1b0aed83f100e3c2");
+
+ QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add a null layout to QGridLayout/5d79e1b0aed83f100e3c2");
+ layout.addLayout(Q_NULLPTR, 0, 0);
+ QCOMPARE(layout.count(), 0);
+
+ QTest::ignoreMessage(QtWarningMsg, "QLayout: Cannot add layout QGridLayout/5d79e1b0aed83f100e3c2 to itself");
+ layout.addLayout(&layout, 0, 0);
+ QCOMPARE(layout.count(), 0);
+}
+
void tst_QGridLayout::replaceWidget()
{
QWidget wdg;