void tst_QLayout::warnIfWrongParent() { QWidget root; QHBoxLayout lay; lay.setParent(&root); QTest::ignoreMessage(QtWarningMsg, "QLayout::parentWidget: A layout can only have another layout as a parent."); QCOMPARE(lay.parentWidget(), static_cast<QWidget*>(0)); }