Skip to content

Commit

Permalink
testqgs3drendering: fix debugmap to work with QT6 by forcing sync bet…
Browse files Browse the repository at this point in the history
…ween QT3D backend/frontend.

Also disable shadow debug map as broken with QT6 (see #58184).
  • Loading branch information
benoitdm-oslandia committed Aug 26, 2024
1 parent b1f6ea6 commit 654a7c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/src/3d/testqgs3drendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1780,14 +1780,30 @@ void TestQgs3DRendering::testDebugMap()
// =========== activate debug depth map
mapSettings.setDebugDepthMapSettings( true, Qt::Corner::BottomRightCorner, 0.5 );

// force QT3D backend/frontend synchronization
{
scene->cameraController()->setLookingAtPoint( QVector3D( 0, 0, 0 ), 2005, 40.0, -10.0 );
Qgs3DUtils::captureSceneImage( engine, scene );
scene->cameraController()->setLookingAtPoint( QVector3D( 0, 0, 0 ), 2000, 40.0, -10.0 );
}

QImage img = Qgs3DUtils::captureSceneImage( engine, scene );
QGSVERIFYIMAGECHECK( "debug_map_1", "debug_map_1", img, QString(), 100, QSize( 0, 0 ), 15 );

#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) // shadows do not work for QT6 see: https://github.com/qgis/QGIS/issues/58184
// =========== activate debug shadow map
mapSettings.setDebugShadowMapSettings( true, Qt::Corner::TopLeftCorner, 0.5 );

// force QT3D backend/frontend synchronization
{
scene->cameraController()->setLookingAtPoint( QVector3D( 0, 0, 0 ), 2005, 40.0, -10.0 );
Qgs3DUtils::captureSceneImage( engine, scene );
scene->cameraController()->setLookingAtPoint( QVector3D( 0, 0, 0 ), 2000, 40.0, -10.0 );
}

img = Qgs3DUtils::captureSceneImage( engine, scene );
QGSVERIFYIMAGECHECK( "debug_map_2", "debug_map_2", img, QString(), 100, QSize( 0, 0 ), 15 );
#endif

delete scene;
mapSettings.setLayers( {} );
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 654a7c4

Please sign in to comment.