diff options
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r-- | tests/auto/widgets/kernel/qboxlayout/tst_qboxlayout.cpp | 32 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qformlayout/tst_qformlayout.cpp | 24 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qgridlayout/tst_qgridlayout.cpp | 32 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp | 35 |
5 files changed, 123 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; diff --git a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro index d61681d5cb..d61681d5cb 100644..100755 --- a/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro +++ b/tests/auto/widgets/kernel/qwidget_window/qwidget_window.pro diff --git a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp index f9d705de26..0240bde3e9 100644..100755 --- a/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp +++ b/tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp @@ -52,6 +52,7 @@ #include <qlistwidget.h> #include <qpushbutton.h> #include <qboxlayout.h> +#include <qtabwidget.h> #include <qlabel.h> #include <private/qwindow_p.h> @@ -100,6 +101,8 @@ private slots: void tst_qtbug35600(); void tst_updateWinId_QTBUG40681(); + void tst_recreateWindow_QTBUG40817(); + }; void tst_QWidget_window::initTestCase() @@ -634,5 +637,37 @@ void tst_QWidget_window::tst_updateWinId_QTBUG40681() QCOMPARE(lbl->winId(), lbl->windowHandle()->winId()); } +void tst_QWidget_window::tst_recreateWindow_QTBUG40817() +{ + QTabWidget tab; + + QWidget *w = new QWidget; + tab.addTab(w, "Tab1"); + QVBoxLayout *vl = new QVBoxLayout(w); + QLabel *lbl = new QLabel("HELLO1"); + lbl->setObjectName("label1"); + vl->addWidget(lbl); + w = new QWidget; + tab.addTab(w, "Tab2"); + vl = new QVBoxLayout(w); + lbl = new QLabel("HELLO2"); + lbl->setAttribute(Qt::WA_NativeWindow); + lbl->setObjectName("label2"); + vl->addWidget(lbl); + + tab.show(); + + QVERIFY(QTest::qWaitForWindowExposed(&tab)); + + QWindow *win = tab.windowHandle(); + win->destroy(); + QWindowPrivate *p = qt_window_private(win); + p->create(true); + win->show(); + + tab.setCurrentIndex(1); +} + + QTEST_MAIN(tst_QWidget_window) #include "tst_qwidget_window.moc" |