Stabilize tst_SceneGraph::createTextureFromImage

The test would crash half the time on my laptop due to the scene graph
not being initialized and then returning a nullptr for the texture.
At that point texture->hasAlphaChannel() crashes.

Change-Id: I9220d9bd6abe6381752c26335f2b60fa8d2adccf
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
Frederik Gladhorn 2016-07-03 12:46:57 +02:00 committed by Frederik Gladhorn
parent 123481f94e
commit a669a2cd49
1 changed files with 1 additions and 0 deletions

View File

@ -549,6 +549,7 @@ void tst_SceneGraph::createTextureFromImage()
QQuickView view;
view.show();
QTest::qWaitForWindowExposed(&view);
QTRY_VERIFY(view.isSceneGraphInitialized());
QScopedPointer<QSGTexture> texture(view.createTextureFromImage(image, (QQuickWindow::CreateTextureOptions) flags));
QCOMPARE(texture->hasAlphaChannel(), expectedAlpha);