@@ -127,9 +127,13 @@ void TestQgs3DRendering::testFlatTerrain()
127
127
128
128
// look from the top
129
129
scene->cameraController ()->setLookingAtPoint ( QgsVector3D ( 0 , 0 , 0 ), 2500 , 0 , 0 );
130
+
131
+ // When running the test on Travis, it would initially return empty rendered image.
132
+ // Capturing the initial image and throwing it away fixes that. Hopefully we will
133
+ // find a better fix in the future.
134
+ Qgs3DUtils::captureSceneImage ( engine, scene );
135
+
130
136
QImage img = Qgs3DUtils::captureSceneImage ( engine, scene );
131
- // QTest::qSleep( 100 ); // a hack to avoid blank render on Travis
132
- img = Qgs3DUtils::captureSceneImage ( engine, scene );
133
137
QVERIFY ( renderCheck ( " flat_terrain_1" , img, 40 ) );
134
138
135
139
// tilted view (pitch = 60 degrees)
@@ -162,9 +166,13 @@ void TestQgs3DRendering::testDemTerrain()
162
166
engine.setRootEntity ( scene );
163
167
164
168
scene->cameraController ()->setLookingAtPoint ( QgsVector3D ( 0 , 0 , 0 ), 2000 , 60 , 0 );
169
+
170
+ // When running the test on Travis, it would initially return empty rendered image.
171
+ // Capturing the initial image and throwing it away fixes that. Hopefully we will
172
+ // find a better fix in the future.
173
+ Qgs3DUtils::captureSceneImage ( engine, scene );
174
+
165
175
QImage img3 = Qgs3DUtils::captureSceneImage ( engine, scene );
166
- QTest::qSleep ( 100 ); // a hack to avoid blank render on Travis
167
- img3 = Qgs3DUtils::captureSceneImage ( engine, scene );
168
176
169
177
QVERIFY ( renderCheck ( " dem_terrain_1" , img3, 40 ) );
170
178
}
0 commit comments