Attempt to stabilize tst_qgl::graphicsViewClipping().

Make sure the graphics view is exposed and has been painted before
trying to grab the framebuffer.

Task-number: QTBUG-29943
Change-Id: I2945cb78b58265864744a0d5fc99fb430306b578
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
Samuel Rødal 2013-03-05 16:08:40 +01:00 committed by The Qt Project
parent a8c6708260
commit 7128bcbbd5

View File

@ -832,10 +832,19 @@ static void fuzzyCompareImages(const QImage &testImage, const QImage &referenceI
class UnclippedWidget : public QWidget
{
public:
bool painted;
UnclippedWidget()
: painted(false)
{
}
void paintEvent(QPaintEvent *)
{
QPainter p(this);
p.fillRect(rect().adjusted(-1000, -1000, 1000, 1000), Qt::black);
painted = true;
}
};
@ -865,7 +874,9 @@ void tst_QGL::graphicsViewClipping()
scene.setSceneRect(view.viewport()->rect());
QVERIFY(QTest::qWaitForWindowActive(&view));
QTest::qWaitForWindowExposed(&view);
QTRY_VERIFY(widget->painted);
QImage image = viewport->grabFrameBuffer();
QImage expected = image;