summaryrefslogtreecommitdiff
path: root/tests/auto/qmainwindow/tst_qmainwindow.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2010-02-08 15:27:12 +0100
committerOlivier Goffart <ogoffart@trolltech.com>2010-02-08 16:28:15 +0100
commit692e9103ebb85b90e79377206d5d03b704d43d42 (patch)
tree7949c69a8b61479f7bdf237f991d2247701c7f08 /tests/auto/qmainwindow/tst_qmainwindow.cpp
parentdd1a2ad2eb40afd29d418cdf54544d110d39dc25 (diff)
downloadqt4-tools-692e9103ebb85b90e79377206d5d03b704d43d42.tar.gz
QMainWindow: update the separator size when the style change
Task-number: QTBUG-2774 Reviewed-ny: Thierry
Diffstat (limited to 'tests/auto/qmainwindow/tst_qmainwindow.cpp')
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index b1c44beaad..1273e85603 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"