Skip to content
Permalink
Browse files

Fix some possible leaks in tests

  • Loading branch information
nyalldawson committed Aug 31, 2017
1 parent 6bddc38 commit e68835f12e618826f0341ec0454d16c53e5a97eb
Showing with 4 additions and 6 deletions.
  1. +4 −6 tests/src/core/testqgsgeometry.cpp
@@ -4592,8 +4592,8 @@ void TestQgsGeometry::multiPolygon()
polygon1.setExteriorRing( ring1.clone() );
multiPolygon1.addGeometry( polygon1.clone() );

QgsAbstractGeometry *boundary = multiPolygon1.boundary();
QgsMultiLineString *lineBoundary = dynamic_cast< QgsMultiLineString * >( boundary );
std::unique_ptr< QgsAbstractGeometry > boundary( multiPolygon1.boundary() );
QgsMultiLineString *lineBoundary = dynamic_cast< QgsMultiLineString * >( boundary.get() );
QVERIFY( lineBoundary );
QCOMPARE( lineBoundary->numGeometries(), 1 );
QCOMPARE( dynamic_cast< QgsLineString * >( lineBoundary->geometryN( 0 ) )->numPoints(), 4 );
@@ -4605,7 +4605,6 @@ void TestQgsGeometry::multiPolygon()
QCOMPARE( dynamic_cast< QgsLineString * >( lineBoundary->geometryN( 0 ) )->yAt( 1 ), 0.0 );
QCOMPARE( dynamic_cast< QgsLineString * >( lineBoundary->geometryN( 0 ) )->yAt( 2 ), 1.0 );
QCOMPARE( dynamic_cast< QgsLineString * >( lineBoundary->geometryN( 0 ) )->yAt( 3 ), 0.0 );
delete boundary;

// add polygon with interior rings
QgsLineString ring2;
@@ -4619,8 +4618,8 @@ void TestQgsGeometry::multiPolygon()
polygon2.setInteriorRings( QList< QgsCurve * >() << boundaryRing1.clone() << boundaryRing2.clone() );
multiPolygon1.addGeometry( polygon2.clone() );

boundary = multiPolygon1.boundary();
QgsMultiLineString *multiLineBoundary = dynamic_cast< QgsMultiLineString * >( boundary );
boundary.reset( multiPolygon1.boundary() );
QgsMultiLineString *multiLineBoundary( static_cast< QgsMultiLineString * >( boundary.get() ) );
QVERIFY( multiLineBoundary );
QCOMPARE( multiLineBoundary->numGeometries(), 4 );
QCOMPARE( dynamic_cast< QgsLineString * >( multiLineBoundary->geometryN( 0 ) )->numPoints(), 4 );
@@ -4659,7 +4658,6 @@ void TestQgsGeometry::multiPolygon()
QCOMPARE( dynamic_cast< QgsLineString * >( multiLineBoundary->geometryN( 3 ) )->yAt( 1 ), 10.8 );
QCOMPARE( dynamic_cast< QgsLineString * >( multiLineBoundary->geometryN( 3 ) )->yAt( 2 ), 10.9 );
QCOMPARE( dynamic_cast< QgsLineString * >( multiLineBoundary->geometryN( 3 ) )->yAt( 3 ), 10.8 );
delete boundary;
}

void TestQgsGeometry::geometryCollection()

0 comments on commit e68835f

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