Skip to content

Commit bc7f311

Browse files
mhugentnyalldawson
authored andcommitted
Adapt numbers in test for QgsLineStringV2::sumUpArea
(forward port from df0f97)
1 parent b0e9125 commit bc7f311

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

tests/src/core/testqgsgeometry.cpp

+24-24
Original file line numberDiff line numberDiff line change
@@ -2079,13 +2079,13 @@ void TestQgsGeometry::lineStringV2()
20792079
QCOMPARE( area, 1.0 );
20802080
l36.setPoints( QgsPointSequenceV2() << QgsPointV2( 5, 10 ) << QgsPointV2( 10, 10 ) );
20812081
l36.sumUpArea( area );
2082-
QCOMPARE( area, 1.0 );
2082+
QVERIFY( qgsDoubleNear( area, -24 ) );
20832083
l36.setPoints( QgsPointSequenceV2() << QgsPointV2( 0, 0 ) << QgsPointV2( 2, 0 ) << QgsPointV2( 2, 2 ) );
20842084
l36.sumUpArea( area );
2085-
QVERIFY( qgsDoubleNear( area, 3.0 ) );
2085+
QVERIFY( qgsDoubleNear( area, -22 ) );
20862086
l36.setPoints( QgsPointSequenceV2() << QgsPointV2( 0, 0 ) << QgsPointV2( 2, 0 ) << QgsPointV2( 2, 2 ) << QgsPointV2( 0, 2 ) );
20872087
l36.sumUpArea( area );
2088-
QVERIFY( qgsDoubleNear( area, 7.0 ) );
2088+
QVERIFY( qgsDoubleNear( area, -18 ) );
20892089

20902090
//boundingBox - test that bounding box is updated after every modification to the line string
20912091
QgsLineStringV2 l37;
@@ -2204,27 +2204,27 @@ void TestQgsGeometry::lineStringV2()
22042204

22052205
void TestQgsGeometry::compoundCurveV2()
22062206
{
2207-
//test that area of a compound curve ring is equal to a closed linestring with the same vertices
2208-
QgsCompoundCurveV2 cc;
2209-
QgsLineStringV2* l1 = new QgsLineStringV2();
2210-
l1->setPoints( QgsPointSequenceV2() << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 2 ) );
2211-
cc.addCurve( l1 );
2212-
QgsLineStringV2* l2 = new QgsLineStringV2();
2213-
l2->setPoints( QgsPointSequenceV2() << QgsPointV2( 0, 2 ) << QgsPointV2( -1, 0 ) << QgsPointV2( 0, -1 ) );
2214-
cc.addCurve( l2 );
2215-
QgsLineStringV2* l3 = new QgsLineStringV2();
2216-
l3->setPoints( QgsPointSequenceV2() << QgsPointV2( 0, -1 ) << QgsPointV2( 1, 1 ) );
2217-
cc.addCurve( l3 );
2218-
2219-
double ccArea = 0.0;
2220-
cc.sumUpArea( ccArea );
2221-
2222-
QgsLineStringV2 ls;
2223-
ls.setPoints( QgsPointSequenceV2() << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 2 ) << QgsPointV2( -1, 0 ) << QgsPointV2( 0, -1 )
2224-
<< QgsPointV2( 1, 1 ) );
2225-
double lsArea = 0.0;
2226-
ls.sumUpArea( lsArea );
2227-
QVERIFY( qgsDoubleNear( ccArea, lsArea ) );
2207+
//test that area of a compound curve ring is equal to a closed linestring with the same vertices
2208+
QgsCompoundCurveV2 cc;
2209+
QgsLineStringV2* l1 = new QgsLineStringV2();
2210+
l1->setPoints( QgsPointSequenceV2() << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 2 ) );
2211+
cc.addCurve( l1 );
2212+
QgsLineStringV2* l2 = new QgsLineStringV2();
2213+
l2->setPoints( QgsPointSequenceV2() << QgsPointV2( 0, 2 ) << QgsPointV2( -1, 0 ) << QgsPointV2( 0, -1 ) );
2214+
cc.addCurve( l2 );
2215+
QgsLineStringV2* l3 = new QgsLineStringV2();
2216+
l3->setPoints( QgsPointSequenceV2() << QgsPointV2( 0, -1 ) << QgsPointV2( 1, 1 ) );
2217+
cc.addCurve( l3 );
2218+
2219+
double ccArea = 0.0;
2220+
cc.sumUpArea( ccArea );
2221+
2222+
QgsLineStringV2 ls;
2223+
ls.setPoints( QgsPointSequenceV2() << QgsPointV2( 1, 1 ) << QgsPointV2( 0, 2 ) << QgsPointV2( -1, 0 ) << QgsPointV2( 0, -1 )
2224+
<< QgsPointV2( 1, 1 ) );
2225+
double lsArea = 0.0;
2226+
ls.sumUpArea( lsArea );
2227+
QVERIFY( qgsDoubleNear( ccArea, lsArea ) );
22282228
}
22292229

22302230
void TestQgsGeometry::polygonV2()

0 commit comments

Comments
 (0)