Tests: stabilize tst_QAbstractScrollArea::setScrollBars2()

Use QWidget::isVisibleTo(parent) instead of isVisible(), just like
QAbstractScrollArea::replaceScrollBar() does. This removes the need
of using QCoreApplication::processEvents() to deliver the actual
hide event just for testing if the scrollbar was requested to be
hidden as it should.

Change-Id: Ie9a816e7b871d280a4b3d9d76adb10601915bd56
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
This commit is contained in:
J-P Nurmi 2012-12-20 15:16:30 +01:00 committed by The Qt Project
parent 92243bc346
commit 71fdc0d8a6

View File

@ -238,17 +238,17 @@ void tst_QAbstractScrollArea::setScrollBars2()
// Hide the OLD scroll bar and ensure that the NEW one is hidden.
hbar->hide();
scrollArea.setHorizontalScrollBar(new QScrollBar);
qApp->processEvents();
QVERIFY(!scrollArea.horizontalScrollBar()->isVisible());
hbar = new QScrollBar(&scrollArea);
scrollArea.setHorizontalScrollBar(hbar);
QVERIFY(!hbar->isVisibleTo(hbar->parentWidget()));
vbar->hide();
scrollArea.setVerticalScrollBar(new QScrollBar);
qApp->processEvents();
QVERIFY(!scrollArea.verticalScrollBar()->isVisible());
vbar = new QScrollBar(&scrollArea);
scrollArea.setVerticalScrollBar(vbar);
QVERIFY(!vbar->isVisibleTo(vbar->parentWidget()));
scrollArea.verticalScrollBar()->show();
scrollArea.horizontalScrollBar()->show();
vbar->show();
hbar->show();
// Hide the NEW scroll bar and ensure that it's visible
// (because the OLD one is visible).