Skip to content
Permalink
Browse files
add tests
  • Loading branch information
Koyaani committed Nov 25, 2021
1 parent c45c5ab commit d4cd1cc4429cbb33370bd6c6f8dcf993a4c468c3
Showing with 9 additions and 1 deletion.
  1. +9 −1 tests/src/core/geometry/testqgsmultipolygon.cpp
@@ -53,7 +53,7 @@ class TestQgsMultiPolygon: public QObject
void exportImport();
};

//

void TestQgsMultiPolygon::constructor()
{
QgsMultiPolygon mp;
@@ -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 ) );
@@ -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() );

0 comments on commit d4cd1cc

Please sign in to comment.