diff options
author | J-P Nurmi <jpnurmi@digia.com> | 2013-03-18 17:08:17 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-18 22:32:15 +0100 |
commit | 0554341d9f684e6867b36a9ce6af7c846c64057d (patch) | |
tree | fe047db5664abc0ccc7d3603346932eb41a4af9f /tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | |
parent | 36e6632fa363152e1a0d42e53a0e5ada09092324 (diff) |
Tests: stabilize tst_qwidget::scroll on small screens
The test has been recently failing in CI. The problem was easy to
reproduce in a virtual machine by resizing the window of the virtual
machine small enough. This change makes sure that the requested size
hint is significantly smaller than the desktop size, to avoid the
window manager stepping in and limiting the window size.
Change-Id: Ie319892747bee60ea6f11e27b6c1bfb4731ef587
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Diffstat (limited to 'tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 78fce7661e..f9ee2e485a 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -4239,8 +4239,11 @@ void tst_QWidget::isOpaque() */ void tst_QWidget::scroll() { + const int w = qMin(500, qApp->desktop()->availableGeometry().width() / 2); + const int h = qMin(500, qApp->desktop()->availableGeometry().height() / 2); + UpdateWidget updateWidget; - updateWidget.resize(500, 500); + updateWidget.resize(w, h); updateWidget.reset(); updateWidget.show(); qApp->setActiveWindow(&updateWidget); @@ -4251,8 +4254,8 @@ void tst_QWidget::scroll() updateWidget.reset(); updateWidget.scroll(10, 10); qApp->processEvents(); - QRegion dirty(QRect(0, 0, 500, 10)); - dirty += QRegion(QRect(0, 10, 10, 490)); + QRegion dirty(QRect(0, 0, w, 10)); + dirty += QRegion(QRect(0, 10, 10, h - 10)); QCOMPARE(updateWidget.paintedRegion, dirty); } @@ -4261,11 +4264,14 @@ void tst_QWidget::scroll() updateWidget.update(0, 0, 10, 10); updateWidget.scroll(0, 10); qApp->processEvents(); - QRegion dirty(QRect(0, 0, 500, 10)); + QRegion dirty(QRect(0, 0, w, 10)); dirty += QRegion(QRect(0, 10, 10, 10)); QCOMPARE(updateWidget.paintedRegion, dirty); } + if (updateWidget.width() < 200 || updateWidget.height() < 200) + QSKIP("Skip this test due to too small screen geometry."); + { updateWidget.reset(); updateWidget.update(0, 0, 100, 100); |