diff options
Diffstat (limited to 'tests/auto/qmainwindow')
-rw-r--r-- | tests/auto/qmainwindow/tst_qmainwindow.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp index b1c44be..1273e85 100644 --- a/tests/auto/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp @@ -108,6 +108,7 @@ private slots: void addToolbarAfterShow(); void centralWidgetSize(); void dockWidgetSize(); + void QTBUG2774_stylechange(); }; // Testing get/set functions @@ -1709,6 +1710,45 @@ void tst_QMainWindow::dockWidgetSize() } } +void tst_QMainWindow::QTBUG2774_stylechange() +{ + + QMainWindow mw; + QDockWidget *dockw = new QDockWidget(); + mw.addDockWidget(Qt::LeftDockWidgetArea, dockw); + mw.addDockWidget(Qt::LeftDockWidgetArea, new QDockWidget()); + QTextEdit *central = new QTextEdit(&mw); + mw.setCentralWidget(central); + dockw->resize(10,10); + mw.show(); + QTest::qWaitForWindowShown(&mw); + int centralOriginalWidth = central->width(); + + QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() - 3))); + QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); + QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 30))); + + + { + QTest::qWait(1000); + mw.setStyleSheet("QMainWindow::separator { width: 50px; height:50px; }"); + QTest::qWait(5000); + QApplication::processEvents(); + QVERIFY(central->width() < centralOriginalWidth); + QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); + QVERIFY( mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 49))); + } + + { + mw.setStyleSheet("QMainWindow::separator { width: 0px; height: 0px; }"); + QApplication::processEvents(); + QVERIFY(central->width() > centralOriginalWidth); + QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height()))); + QVERIFY(!mw.isSeparator(QPoint(4, dockw->pos().y() + dockw->size().height() + 1))); + } +} + + QTEST_MAIN(tst_QMainWindow) #include "tst_qmainwindow.moc" |