Add test to make sure the curve point is part of the segmented result

This commit is contained in:
Marco Hugentobler 2016-05-10 11:52:47 +02:00
parent 0493cbfc21
commit daabda8ca7

View File

@ -35,6 +35,7 @@
#include "qgspolygonv2.h"
#include "qgscircularstringv2.h"
#include "qgsgeometrycollectionv2.h"
#include "qgsgeometryfactory.h"
//qgs unit test utility class
#include "qgsrenderchecker.h"
@ -94,6 +95,8 @@ class TestQgsGeometry : public QObject
void wkbInOut();
void segmentizeCircularString();
private:
/** A helper method to do a render check to see if the geometry op is as expected */
bool renderCheck( const QString& theTestName, const QString& theComment = "", int mismatchCount = 0 );
@ -3419,5 +3422,22 @@ void TestQgsGeometry::wkbInOut()
QCOMPARE( badHeader.wkbType(), QGis::WKBUnknown );
}
void TestQgsGeometry::segmentizeCircularString()
{
QString wkt( "CIRCULARSTRING( 0 0, 0.5 0.5, 2 0 )" );
QgsCircularStringV2* circularString = dynamic_cast<QgsCircularStringV2*>( QgsGeometryFactory::geomFromWkt( wkt ) );
QVERIFY( circularString );
QgsLineStringV2* lineString = circularString->curveToLine();
QVERIFY( lineString );
QgsPointSequenceV2 points;
lineString->points( points );
delete circularString;
delete lineString;
//make sure the curve point is part of the segmentized result
QVERIFY( points.contains( QgsPointV2( 0.5, 0.5 ) ) );
}
QTEST_MAIN( TestQgsGeometry )
#include "testqgsgeometry.moc"