summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmainwindow
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-08-26 13:38:45 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-08-26 13:38:45 (GMT)
commit478f18e37a04849f4577ded7ba60d8360b6c5c90 (patch)
treeb8b7a135ab54c76e0b87a0665632015cc1d2ef13 /tests/auto/qmainwindow
parent88ecc8c8250505129ccff2660c60412996e2fd85 (diff)
downloadQt-478f18e37a04849f4577ded7ba60d8360b6c5c90.zip
Qt-478f18e37a04849f4577ded7ba60d8360b6c5c90.tar.gz
Qt-478f18e37a04849f4577ded7ba60d8360b6c5c90.tar.bz2
QMainWindow: adding autotest for the size of the central widget
It just ensures that the central widget gets its correct size (ie. sizehint) when a menu bar is present.
Diffstat (limited to 'tests/auto/qmainwindow')
-rw-r--r--tests/auto/qmainwindow/tst_qmainwindow.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/auto/qmainwindow/tst_qmainwindow.cpp b/tests/auto/qmainwindow/tst_qmainwindow.cpp
index e118c65..9156e5e 100644
--- a/tests/auto/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/qmainwindow/tst_qmainwindow.cpp
@@ -106,6 +106,7 @@ private slots:
void isSeparator();
void setCursor();
void addToolbarAfterShow();
+ void centralWidgetSize();
};
// Testing get/set functions
@@ -1336,6 +1337,19 @@ public:
}
};
+class MyWidget : public QWidget
+{
+public:
+ MyWidget(QWidget *parent = 0) : QWidget(parent)
+ {
+ }
+
+ QSize sizeHint() const
+ {
+ return QSize(200, 200);
+ }
+};
+
void tst_QMainWindow::hideBeforeLayout()
{
QMainWindow win;
@@ -1650,6 +1664,18 @@ void tst_QMainWindow::addToolbarAfterShow()
QVERIFY(!toolBar.isHidden());
}
+void tst_QMainWindow::centralWidgetSize()
+{
+ QMainWindow mainWindow;
+ mainWindow.menuBar()->addMenu("menu");
+
+ MyWidget widget;
+ mainWindow.setCentralWidget(&widget);
+
+ mainWindow.show();
+ QTest::qWait(100);
+ QCOMPARE(widget.size(), widget.sizeHint());
+}
QTEST_MAIN(tst_QMainWindow)