@@ -44,6 +44,7 @@ class TestQgsDxfExport : public QObject
44
44
void testPoints ();
45
45
void testLines ();
46
46
void testPolygons ();
47
+ void testMultiSurface ();
47
48
void testMtext ();
48
49
void testMTextNoSymbology (); // tests if label export works if layer has vector renderer type 'no symbols'
49
50
void testMTextEscapeSpaces ();
@@ -216,6 +217,42 @@ void TestQgsDxfExport::testPolygons()
216
217
QCOMPARE ( result->wkbType (), QgsWkbTypes::LineString );
217
218
}
218
219
220
+ void TestQgsDxfExport::testMultiSurface ()
221
+ {
222
+ QgsDxfExport d;
223
+ std::unique_ptr< QgsVectorLayer > vl = qgis::make_unique< QgsVectorLayer >( QStringLiteral ( " MultiSurface" ), QString (), QStringLiteral ( " memory" ) );
224
+ QgsGeometry g = QgsGeometry::fromWkt ( " MultiSurface (Polygon ((0 0, 0 1, 1 1, 0 0)))" );
225
+ QgsFeature f;
226
+ f.setGeometry ( g );
227
+ vl->dataProvider ()->addFeatures ( QgsFeatureList () << f );
228
+ d.addLayers ( QList< QgsDxfExport::DxfLayer >() << QgsDxfExport::DxfLayer ( vl.get () ) );
229
+
230
+ QgsMapSettings mapSettings;
231
+ QSize size ( 640 , 480 );
232
+ mapSettings.setOutputSize ( size );
233
+ mapSettings.setExtent ( vl->extent () );
234
+ mapSettings.setLayers ( QList<QgsMapLayer *>() << vl.get () );
235
+ mapSettings.setOutputDpi ( 96 );
236
+ mapSettings.setDestinationCrs ( vl->crs () );
237
+
238
+ d.setMapSettings ( mapSettings );
239
+ d.setSymbologyScale ( 1000 );
240
+
241
+ QString file = getTempFileName ( " multisurface_dxf" );
242
+ QFile dxfFile ( file );
243
+ QCOMPARE ( d.writeToFile ( &dxfFile, QStringLiteral ( " CP1252" ) ), 0 );
244
+ dxfFile.close ();
245
+
246
+ // reload and compare
247
+ std::unique_ptr< QgsVectorLayer > result = qgis::make_unique< QgsVectorLayer >( file, " dxf" );
248
+ QVERIFY ( result->isValid () );
249
+ QCOMPARE ( result->featureCount (), 1L );
250
+ QCOMPARE ( result->wkbType (), QgsWkbTypes::LineString );
251
+ QgsFeature f2;
252
+ result->getFeatures ().nextFeature ( f2 );
253
+ QCOMPARE ( f2.geometry ().asWkt (), QStringLiteral ( " LineString (0 0, 0 1, 1 1, 0 0)" ) );
254
+ }
255
+
219
256
void TestQgsDxfExport::testMtext ()
220
257
{
221
258
QVERIFY ( testMtext ( mPointLayer , QStringLiteral ( " mtext_dxf" ) ) );
0 commit comments