Skip to content
Permalink
Browse files

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

  • Loading branch information
mhugent committed May 10, 2016
1 parent 0493cbf commit daabda8ca712a4c75573e821089c8a538c702a5e
Showing with 20 additions and 0 deletions.
  1. +20 −0 tests/src/core/testqgsgeometry.cpp
@@ -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"

0 comments on commit daabda8

Please sign in to comment.
You can’t perform that action at this time.