summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qmainwindow
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2014-11-18 17:02:49 +0100
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2014-12-02 08:36:54 +0100
commit4958cadeda4baf20f74f6b46689ca05d3f2b7875 (patch)
treec060fef14b5b049113a2bba967de178c758b6b4e /tests/auto/widgets/widgets/qmainwindow
parent2409ed7d48e8c0e34e79d8b750fe3e5432a0d3f9 (diff)
QMainWindow: Observe left contents margin when positioning status bar.
Task-number: QTBUG-38152 Change-Id: I4c762a113dbfe47472d1087aa34c0e327083ee16 Reviewed-by: Jan Arve Sæther <jan-arve.saether@theqtcompany.com>
Diffstat (limited to 'tests/auto/widgets/widgets/qmainwindow')
-rw-r--r--tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
index 751a16c59d..f2ce2d1d96 100644
--- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
+++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp
@@ -46,6 +46,7 @@
#include <qlabel.h>
#include <qtextedit.h>
#include <qstylehints.h>
+#include <qdesktopwidget.h>
#include <private/qmainwindowlayout_p.h>
#include <private/qdockarealayout_p.h>
@@ -132,6 +133,8 @@ private slots:
void saveRestore_data();
void statusBar();
#endif
+ void contentsMargins_data();
+ void contentsMargins();
void isSeparator();
#ifndef QTEST_NO_CURSOR
void setCursor();
@@ -749,8 +752,38 @@ void tst_QMainWindow::statusBar()
QVERIFY(indexOfSb == -1);
}
}
+
#endif
+void tst_QMainWindow::contentsMargins_data()
+{
+ QTest::addColumn<int>("contentsMargin");
+ QTest::newRow("0") << 0;
+ QTest::newRow("10") << 10;
+}
+
+void tst_QMainWindow::contentsMargins()
+{
+ QFETCH(int, contentsMargin);
+
+ QMainWindow mw;
+ const QRect availGeometry = QApplication::desktop()->availableGeometry();
+ mw.menuBar()->addMenu("File");
+ mw.setWindowTitle(QLatin1String(QTest::currentTestFunction())
+ + QLatin1Char(' ') + QLatin1String(QTest::currentDataTag()));
+ mw.resize(availGeometry.size() / 4);
+ mw.move((availGeometry.width() - mw.width()) / 2,
+ (availGeometry.height() - mw.height()) / 2);
+ mw.setContentsMargins(contentsMargin, contentsMargin, contentsMargin, contentsMargin);
+ mw.statusBar()->showMessage("Hello");
+
+ mw.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&mw));
+
+ QCOMPARE(mw.statusBar()->geometry().left(), contentsMargin);
+ QCOMPARE(mw.statusBar()->geometry().bottom() + 1, mw.height() - contentsMargin);
+}
+
void tst_QMainWindow::centralWidget()
{
{