Skip to content

Commit ae6592d

Browse files
committedJun 30, 2016
Add QgsDistanceArea test for empty polygon
(cherry-picked from ebdccf3)
1 parent a8ecdb5 commit ae6592d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
 

‎tests/src/core/testqgsdistancearea.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class TestQgsDistanceArea: public QObject
4242
void collections();
4343
void measureUnits();
4444
void measureAreaAndUnits();
45+
void emptyPolygon();
4546

4647
};
4748

@@ -344,6 +345,17 @@ void TestQgsDistanceArea::measureAreaAndUnits()
344345
QVERIFY( qgsDoubleNear( area, 220240.8172549, 0.00001 ) );
345346
}
346347

348+
void TestQgsDistanceArea::emptyPolygon()
349+
{
350+
QgsDistanceArea da;
351+
da.setSourceCrs( 3452 );
352+
da.setEllipsoidalMode( true );
353+
da.setEllipsoid( "WGS84" );
354+
355+
//test that measuring an empty polygon doesn't crash
356+
da.measurePolygon( QList< QgsPoint >() );
357+
}
358+
347359
QTEST_MAIN( TestQgsDistanceArea )
348360
#include "testqgsdistancearea.moc"
349361

0 commit comments

Comments
 (0)