summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp')
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp25
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 6cc19051d2..67b79e3faf 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -1689,14 +1689,16 @@ void tst_QMdiArea::tileSubWindows()
workspace.setActiveSubWindow(0);
QVERIFY(workspace.viewport()->childrenRect() != workspace.viewport()->rect());
- // Make sure the active window is placed in top left corner regardless
+ // Make sure the active window does not move position after a tile regardless
// of whether we have any windows with staysOnTopHint or not.
+ workspace.tileSubWindows();
windows.at(3)->setWindowFlags(windows.at(3)->windowFlags() | Qt::WindowStaysOnTopHint);
QMdiSubWindow *activeSubWindow = windows.at(6);
workspace.setActiveSubWindow(activeSubWindow);
QCOMPARE(workspace.activeSubWindow(), activeSubWindow);
+ QPoint pos = activeSubWindow->geometry().topLeft();
workspace.tileSubWindows();
- QCOMPARE(activeSubWindow->geometry().topLeft(), QPoint(0, 0));
+ QCOMPARE(activeSubWindow->geometry().topLeft(), pos);
// Verify that we try to resize the area such that all sub-windows are visible.
// It's important that tiled windows are NOT overlapping.
@@ -1713,6 +1715,8 @@ void tst_QMdiArea::tileSubWindows()
// Prevent scrollbars from messing up the expected viewport calculation below
workspace.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
workspace.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ QCOMPARE(workspace.horizontalScrollBarPolicy(), Qt::ScrollBarAlwaysOff);
+ QCOMPARE(workspace.verticalScrollBarPolicy(), Qt::ScrollBarAlwaysOff);
workspace.tileSubWindows();
// The sub-windows are now tiled like this:
@@ -1731,9 +1735,11 @@ void tst_QMdiArea::tileSubWindows()
const QSize expectedViewportSize(3 * minSize.width() + spacing, 3 * minSize.height() + spacing);
QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize);
- // Restore original scrollbar behavior for test below
+ // Enable scroll bar for test below (default property for QMdiArea is Qt::ScrollBarAlwaysOff)
workspace.setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
workspace.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ QCOMPARE(workspace.horizontalScrollBarPolicy(), Qt::ScrollBarAsNeeded);
+ QCOMPARE(workspace.verticalScrollBarPolicy(), Qt::ScrollBarAsNeeded);
// Not enough space for all sub-windows to be visible -> provide scroll bars.
workspace.resize(160, 150);
@@ -1754,13 +1760,16 @@ void tst_QMdiArea::tileSubWindows()
QCOMPARE(vBar->value(), 0);
QCOMPARE(vBar->minimum(), 0);
+ // Tile windows with scroll bars enabled.
workspace.tileSubWindows();
QVERIFY(QTest::qWaitForWindowExposed(&workspace));
qApp->processEvents();
- QTRY_VERIFY(workspace.size() != QSize(150, 150));
- QTRY_VERIFY(!vBar->isVisible());
- QTRY_VERIFY(!hBar->isVisible());
+ // Workspace should not have changed size after tile.
+ QTRY_VERIFY(workspace.size() == QSize(160, 150));
+ // Scroll bars should be visible.
+ QTRY_VERIFY(vBar->isVisible());
+ QTRY_VERIFY(hBar->isVisible());
}
void tst_QMdiArea::cascadeAndTileSubWindows()
@@ -2180,7 +2189,7 @@ void tst_QMdiArea::setActivationOrder_data()
list << 2 << 1 << 0 << 1 << 2 << 3 << 4;
list2 << 0 << 1 << 2 << 3 << 4;
- list3 << 1 << 4 << 3 << 1 << 2 << 0;
+ list3 << 4 << 3 << 2 << 4 << 1 << 0; // Most recently created window is in top-left position
QTest::newRow("CreationOrder") << QMdiArea::CreationOrder << 5 << 3 << 1 << list << list2 << list3;
list = QList<int>();
@@ -2188,7 +2197,7 @@ void tst_QMdiArea::setActivationOrder_data()
list2 = QList<int>();
list2 << 0 << 2 << 4 << 1 << 3;
list3 = QList<int>();
- list3 << 1 << 3 << 4 << 1 << 2 << 0;
+ list3 << 3 << 1 << 4 << 3 << 2 << 0; // Window with "stays-on-top" flag set will be in the top-left position
QTest::newRow("StackingOrder") << QMdiArea::StackingOrder << 5 << 3 << 1 << list << list2 << list3;
list = QList<int>();