Skip to content

Commit

Permalink
Add test to make sure the curve point is part of the segmented result
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed May 10, 2016
1 parent 0493cbf commit daabda8
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/src/core/testqgsgeometry.cpp
Expand Up @@ -35,6 +35,7 @@
#include "qgspolygonv2.h"
#include "qgscircularstringv2.h"
#include "qgsgeometrycollectionv2.h"
#include "qgsgeometryfactory.h"

//qgs unit test utility class
#include "qgsrenderchecker.h"
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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"

0 comments on commit daabda8

Please sign in to comment.