Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix memory leak
  • Loading branch information
nyalldawson committed Apr 29, 2017
1 parent 8593f3a commit e861f33
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/src/core/testqgsgeometry.cpp
Expand Up @@ -4127,9 +4127,9 @@ void TestQgsGeometry::circle()

//test conversion
QgsPointSequence ptsPol;
QgsPolygonV2 *pol = new QgsPolygonV2();
std::unique_ptr< QgsPolygonV2 > pol( new QgsPolygonV2() );
// polygon
pol = QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );

Expand All @@ -4144,7 +4144,7 @@ void TestQgsGeometry::circle()
// oriented
//45
double val = 5 * sin( M_PI / 4 );
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 45 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
pol->exteriorRing()->points( ptsPol );
Expand All @@ -4155,7 +4155,7 @@ void TestQgsGeometry::circle()
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( -val, val ) );
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, val ) );
//135
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 135 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
pol->exteriorRing()->points( ptsPol );
Expand All @@ -4166,7 +4166,7 @@ void TestQgsGeometry::circle()
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, val ) );
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( val, -val ) );
//225
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 225 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
pol->exteriorRing()->points( ptsPol );
Expand All @@ -4177,7 +4177,7 @@ void TestQgsGeometry::circle()
QVERIFY( ptsPol.at( 3 ) == QgsPointV2( val, -val ) );
QVERIFY( ptsPol.at( 4 ) == QgsPointV2( -val, -val ) );
//315
pol = QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 );
pol.reset( QgsCircle( QgsPointV2( 0, 0 ), 5, 315 ).toPolygon( 4 ) );
QCOMPARE( pol->numInteriorRings(), 0 );
QCOMPARE( pol->exteriorRing()->numPoints(), 5 );
pol->exteriorRing()->points( ptsPol );
Expand Down

0 comments on commit e861f33

Please sign in to comment.