Skip to content

Commit

Permalink
Initialize terrain generator correctly in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdkon authored and wonder-sk committed Sep 29, 2024
1 parent c88750f commit 7864003
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/src/3d/testqgs3drendering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,11 @@ void TestQgs3DRendering::testDemTerrain()
map->setLayers( QList<QgsMapLayer *>() << 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 );
Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -1452,9 +1456,11 @@ void TestQgs3DRendering::testFilteredDemTerrain()
map->setLayers( QList<QgsMapLayer *>() << 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 );
Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) );
Expand Down Expand Up @@ -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 ) );
Expand Down

0 comments on commit 7864003

Please sign in to comment.