Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Koyaani committed Nov 25, 2021
1 parent c45c5ab commit d4cd1cc
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/src/core/geometry/testqgsmultipolygon.cpp
Expand Up @@ -53,7 +53,7 @@ class TestQgsMultiPolygon: public QObject
void exportImport();
};

//

void TestQgsMultiPolygon::constructor()
{
QgsMultiPolygon mp;
Expand Down Expand Up @@ -276,13 +276,18 @@ void TestQgsMultiPolygon::addGeometry()

const QgsPolygon *ls = static_cast< const QgsPolygon * >( mp.geometryN( 0 ) );

// test polygonN by the same occasion
QCOMPARE( *ls, *static_cast< const QgsPolygon * >( mp.polygonN( 0 ) ) );

QCOMPARE( static_cast< const QgsLineString *>( ls->exteriorRing() )->pointN( 0 ), QgsPoint( 9, 12 ) );
QCOMPARE( static_cast< const QgsLineString *>( ls->exteriorRing() )->pointN( 1 ), QgsPoint( 3, 13 ) );
QCOMPARE( static_cast< const QgsLineString *>( ls->exteriorRing() )->pointN( 2 ), QgsPoint( 4, 17 ) );
QCOMPARE( static_cast< const QgsLineString *>( ls->exteriorRing() )->pointN( 3 ), QgsPoint( 9, 12 ) );

ls = static_cast< const QgsPolygon * >( mp.geometryN( 1 ) );

QCOMPARE( *ls, *static_cast< const QgsPolygon * >( mp.polygonN( 1 ) ) );

QCOMPARE( static_cast< const QgsLineString *>( ls->exteriorRing() )->pointN( 0 ), QgsPoint( 1, 10 ) );
QCOMPARE( static_cast< const QgsLineString *>( ls->exteriorRing() )->pointN( 1 ), QgsPoint( 2, 11 ) );
QCOMPARE( static_cast< const QgsLineString *>( ls->exteriorRing() )->pointN( 2 ), QgsPoint( 10, 13 ) );
Expand Down Expand Up @@ -653,6 +658,9 @@ void TestQgsMultiPolygon::boundary()
part.setExteriorRing( ring.clone() );
mp.addGeometry( part.clone() );

part.clear();
mp.addGeometry( part.clone() );

std::unique_ptr< QgsAbstractGeometry > boundary( mp.boundary() );
QgsMultiLineString *mls = dynamic_cast< QgsMultiLineString * >( boundary.get() );

Expand Down

0 comments on commit d4cd1cc

Please sign in to comment.