diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-10 07:58:06 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2014-12-10 07:58:06 +0100 |
commit | 015002fec9abff6a4c1bb3fa4b9de87279a079c3 (patch) | |
tree | ad93af535a503d0a49d6c6367e990a8fbca163d3 /tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | |
parent | f1e00262321cc8daa3c7506153653453e2779886 (diff) | |
parent | b9547af45ea2bbbc634722c1ef41afdb54216ce2 (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
doc/global/template/style/online.css
mkspecs/android-g++/qmake.conf
Change-Id: Ib39ea7bd42f5ae12e82a3bc59a66787a16bdfc61
Diffstat (limited to 'tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp')
-rw-r--r-- | tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp | 36 |
1 files changed, 36 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..15f2f88a8d 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,41 @@ 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.menuBar()->geometry().left(), contentsMargin); + QCOMPARE(mw.menuBar()->geometry().top(), contentsMargin); + + QCOMPARE(mw.statusBar()->geometry().left(), contentsMargin); + QCOMPARE(mw.statusBar()->geometry().bottom() + 1, mw.height() - contentsMargin); +} + void tst_QMainWindow::centralWidget() { { |