summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2013-05-14 13:45:46 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-05-14 15:17:18 +0200
commit8be5103d29f9c91dc54e3f4b16605c8a49928a20 (patch)
tree0ff41e011f0092ae3b4d649f65d471b9f4860011
parent27cbb58a92aaa629869f5b4dd05f2cefb4fc9f3a (diff)
tst_qmdiarea: Prevent scrollbars from messing up expected viewport calculation
With scrollbars enabled we would get two resize events when tiling the windows. First one with the expected viewport size, and then a second one with a bigger viewport when the QMdiArea calculated that the space it set off for scrollbars was not needed after all. Depending on whether or not the geometry propagation of the platform plugin was synchronous or not, we would get one or both of the events before evaluating the viewport size against the expected size, resulting in flakeyness, and an expected fail on OS X. We now explicitly disable the scrollbars during the test, and restore them for the latter test that verifies that scrollbars show up when the area is resized below the minimum size of the combined child widgets. This allows us to unskip the expected failure on OS X, and should make the test less flakey. Change-Id: Ief767456cfd79f5cd0bb0e220c40e5995674ff71 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
index 6364a736cd..f5d92be95d 100644
--- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
+++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp
@@ -1705,6 +1705,11 @@ void tst_QMdiArea::tileSubWindows()
subWindow->setMinimumSize(minSize);
QCOMPARE(workspace.size(), QSize(350, 150));
+
+ // Prevent scrollbars from messing up the expected viewport calculation below
+ workspace.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ workspace.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+
workspace.tileSubWindows();
// The sub-windows are now tiled like this:
// | win 1 || win 2 || win 3 |
@@ -1723,11 +1728,12 @@ void tst_QMdiArea::tileSubWindows()
#ifdef Q_OS_WINCE
QSKIP("Not fixed yet! See task 197453");
#endif
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-25298", Abort);
-#endif
QTRY_COMPARE(workspace.viewport()->rect().size(), expectedViewportSize);
+ // Restore original scrollbar behavior for test below
+ workspace.setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+ workspace.setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+
// Not enough space for all sub-windows to be visible -> provide scroll bars.
workspace.resize(160, 150);
qApp->processEvents();