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>
This commit is contained in:
parent
36e6632fa3
commit
0554341d9f
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user