Skip to content

Commit

Permalink
add curveN tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Koyaani committed Oct 25, 2021
1 parent 84f04f0 commit 15e2143
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/src/core/geometry/testqgsmulticurve.cpp
Expand Up @@ -38,6 +38,7 @@ class TestQgsMultiCurve: public QObject
void addGeometryDimensionPreservationM();
void addGeometryDimensionPreservationZM();
void insertGeometry();
void curveN();
void clear();
void clone();
void copy();
Expand Down Expand Up @@ -438,6 +439,35 @@ void TestQgsMultiCurve::insertGeometry()
QCOMPARE( mc.numGeometries(), 1 );
}

void TestQgsMultiCurve::curveN()
{
QgsMultiCurve mc;

QVERIFY( !mc.curveN( 0 ) );
QVERIFY( !std::as_const( mc ).curveN( 0 ) );

QgsCircularString part;
part.setPoints( QgsPointSequence() << QgsPoint( 7, 17 )
<< QgsPoint( 3, 13 ) << QgsPoint( 7, 11 ) );
mc.addGeometry( part.clone() );

QCOMPARE( *mc.curveN( 0 ), part );
QCOMPARE( *std::as_const( mc ).curveN( 0 ), part );

part.setPoints( QgsPointSequence() << QgsPoint( 2, 20 )
<< QgsPoint( 3, 31 ) << QgsPoint( 2, 41 ) );
mc.addGeometry( part.clone() );

QCOMPARE( *mc.curveN( 1 ), part );
QCOMPARE( *std::as_const( mc ).curveN( 1 ), part );

QVERIFY( !mc.curveN( 3 ) );
QVERIFY( !std::as_const( mc ).curveN( 3 ) );

QVERIFY( !mc.curveN( -1 ) );
QVERIFY( !std::as_const( mc ).curveN( -1 ) );
}

void TestQgsMultiCurve::clear()
{
QgsMultiCurve mc;
Expand Down

0 comments on commit 15e2143

Please sign in to comment.