From 7864003652ce34fdc6bc5bc6643d54bd7cc676c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Ko=C5=88a=C5=99=C3=ADk?= Date: Thu, 26 Sep 2024 11:08:43 +0200 Subject: [PATCH] Initialize terrain generator correctly in tests --- tests/src/3d/testqgs3drendering.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/src/3d/testqgs3drendering.cpp b/tests/src/3d/testqgs3drendering.cpp index b7e3916623c8..9d2d2529c8fa 100644 --- a/tests/src/3d/testqgs3drendering.cpp +++ b/tests/src/3d/testqgs3drendering.cpp @@ -325,9 +325,11 @@ void TestQgs3DRendering::testDemTerrain() map->setLayers( QList() << mLayerRgb ); QgsDemTerrainGenerator *demTerrain = new QgsDemTerrainGenerator; + demTerrain->setCrs( mProject->crs(), mProject->transformContext() ); demTerrain->setLayer( mLayerDtm ); map->setTerrainGenerator( demTerrain ); map->setTerrainVerticalScale( 3 ); + QVERIFY( demTerrain->isValid() ); QgsOffscreen3DEngine engine; Qgs3DMapScene *scene = new Qgs3DMapScene( *map, &engine ); @@ -358,9 +360,11 @@ void TestQgs3DRendering::testTerrainShading() // no terrain layers set! QgsDemTerrainGenerator *demTerrain = new QgsDemTerrainGenerator; + demTerrain->setCrs( mProject->crs(), mProject->transformContext() ); demTerrain->setLayer( mLayerDtm ); map->setTerrainGenerator( demTerrain ); map->setTerrainVerticalScale( 3 ); + QVERIFY( demTerrain->isValid() ); QgsPhongMaterialSettings terrainMaterial; terrainMaterial.setAmbient( QColor( 0, 0, 0 ) ); @@ -1452,9 +1456,11 @@ void TestQgs3DRendering::testFilteredDemTerrain() map->setLayers( QList() << mLayerRgb ); QgsDemTerrainGenerator *demTerrain = new QgsDemTerrainGenerator; + demTerrain->setCrs( mProject->crs(), mProject->transformContext() ); demTerrain->setLayer( mLayerDtm ); map->setTerrainGenerator( demTerrain ); map->setTerrainVerticalScale( 3 ); + QVERIFY( demTerrain->isValid() ); QgsOffscreen3DEngine engine; Qgs3DMapScene *scene = new Qgs3DMapScene( *map, &engine ); @@ -1550,9 +1556,11 @@ void TestQgs3DRendering::testAmbientOcclusion() mapSettings.setMapThemeCollection( project.mapThemeCollection() ); QgsDemTerrainGenerator *demTerrain = new QgsDemTerrainGenerator; + demTerrain->setCrs( mProject->crs(), mProject->transformContext() ); demTerrain->setLayer( layerDtm ); mapSettings.setTerrainGenerator( demTerrain ); mapSettings.setTerrainVerticalScale( 3 ); + QVERIFY( demTerrain->isValid() ); QgsPointLightSettings defaultPointLight; defaultPointLight.setPosition( QgsVector3D( 0, 400, 0 ) ); @@ -1615,9 +1623,11 @@ void TestQgs3DRendering::testDepthBuffer() mapSettings.setMapThemeCollection( project.mapThemeCollection() ); QgsDemTerrainGenerator *demTerrain = new QgsDemTerrainGenerator; + demTerrain->setCrs( mProject->crs(), mProject->transformContext() ); demTerrain->setLayer( layerDtm ); mapSettings.setTerrainGenerator( demTerrain ); mapSettings.setTerrainVerticalScale( 3 ); + QVERIFY( demTerrain->isValid() ); QgsPointLightSettings defaultPointLight; defaultPointLight.setPosition( QgsVector3D( 0, 1000, 0 ) ); @@ -1943,10 +1953,12 @@ void TestQgs3DRendering::test3DSceneExporterBig() mapSettings.setPathResolver( project.pathResolver() ); mapSettings.setMapThemeCollection( project.mapThemeCollection() ); - QgsDemTerrainGenerator *demTerrain = new QgsDemTerrainGenerator(); + QgsDemTerrainGenerator *demTerrain = new QgsDemTerrainGenerator; + demTerrain->setCrs( mProject->crs(), mProject->transformContext() ); demTerrain->setLayer( layerDtm ); mapSettings.setTerrainGenerator( demTerrain ); mapSettings.setTerrainVerticalScale( 3 ); + QVERIFY( demTerrain->isValid() ); QgsPointLightSettings defaultPointLight; defaultPointLight.setPosition( QgsVector3D( 0, 400, 0 ) );