Skip to content
Permalink
Browse files
Test tolerance
  • Loading branch information
nyalldawson committed Nov 2, 2021
1 parent d787754 commit 0fc9a39d0a6978e0ced6b85ec5f0cee849ede8dd
Showing with 17 additions and 17 deletions.
  1. +15 −15 tests/src/analysis/testqgszonalstatistics.cpp
  2. +2 −2 tests/src/geometry_checker/testqgsgeometrychecks.cpp
@@ -321,27 +321,27 @@ void TestQgsZonalStatistics::testSmallPolygons()
QgsFeatureIterator it = vectorLayer->getFeatures( request );
bool fetched = it.nextFeature( f );
QVERIFY( fetched );
QGSCOMPARENEAR( f.attribute( "ncount" ).toDouble(), 0.698248, 0.001 );
QGSCOMPARENEAR( f.attribute( "nsum" ).toDouble(), 588.711, 0.001 );
QCOMPARE( f.attribute( "nmin" ).toDouble(), 826.0 );
QCOMPARE( f.attribute( "nmax" ).toDouble(), 851.0 );
QGSCOMPARENEAR( f.attribute( "nmean" ).toDouble(), 843.125292, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "ncount" ) ).toDouble(), 0.698248, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nsum" ) ).toDouble(), 588.711, 0.01 );
QCOMPARE( f.attribute( QStringLiteral( "nmin" ) ).toDouble(), 826.0 );
QCOMPARE( f.attribute( QStringLiteral( "nmax" ) ).toDouble(), 851.0 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nmean" ) ).toDouble(), 843.125292, 0.01 );

fetched = it.nextFeature( f );
QVERIFY( fetched );
QGSCOMPARENEAR( f.attribute( "ncount" ).toDouble(), 0.240808, 0.001 );
QGSCOMPARENEAR( f.attribute( "nsum" ).toDouble(), 208.030921, 0.001 );
QCOMPARE( f.attribute( "nmin" ).toDouble(), 859.0 );
QCOMPARE( f.attribute( "nmax" ).toDouble(), 868.0 );
QGSCOMPARENEAR( f.attribute( "nmean" ).toDouble(), 863.887500, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "ncount" ) ).toDouble(), 0.240808, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nsum" ) ).toDouble(), 208.030921, 0.01 );
QCOMPARE( f.attribute( QStringLiteral( "nmin" ) ).toDouble(), 859.0 );
QCOMPARE( f.attribute( QStringLiteral( "nmax" ) ).toDouble(), 868.0 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nmean" ) ).toDouble(), 863.887500, 0.01 );

fetched = it.nextFeature( f );
QVERIFY( fetched );
QGSCOMPARENEAR( f.attribute( "ncount" ).toDouble(), 0.259522, 0.001 );
QGSCOMPARENEAR( f.attribute( "nsum" ).toDouble(), 224.300747, 0.001 );
QCOMPARE( f.attribute( "nmin" ).toDouble(), 851.0 );
QCOMPARE( f.attribute( "nmax" ).toDouble(), 872.0 );
QGSCOMPARENEAR( f.attribute( "nmean" ).toDouble(), 864.285638, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "ncount" ) ).toDouble(), 0.259522, 0.001 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nsum" ) ).toDouble(), 224.300747, 0.01 );
QCOMPARE( f.attribute( QStringLiteral( "nmin" ) ).toDouble(), 851.0 );
QCOMPARE( f.attribute( QStringLiteral( "nmax" ) ).toDouble(), 872.0 );
QGSCOMPARENEAR( f.attribute( QStringLiteral( "nmean" ) ).toDouble(), 864.285638, 0.01 );
}

void TestQgsZonalStatistics::testShortName()
@@ -1202,7 +1202,7 @@ void TestQgsGeometryChecks::testGapCheckPointInPoly()
QgsFeature f;
testContext.second[layers["gap_layer_point_in_poly.shp"]]->getFeature( 1, f );
const double areaOld = f.geometry().area();
QCOMPARE( areaOld, 19913.135772452362 );
QGSCOMPARENEAR( areaOld, 19913.135772452362, 0.0001 );

QgsGeometryCheck::Changes changes;
const QMap<QString, int> mergeAttrs;
@@ -1257,7 +1257,7 @@ void TestQgsGeometryChecks::testOverlapCheckToleranceBug()
const QgsPoint pointOld_2 = f.geometry().vertexAt( 2 );

// Just making sure we've got the right feature/point
QCOMPARE( areaOld, 10442.710061549426 );
QGSCOMPARENEAR( areaOld, 10442.710061549426, 0.0002 );
QGSCOMPARENEARPOINT( pointOld_1, QgsPoint( 2537221.53079314017668366, 1152360.02460834058001637 ), 0.00001 );
QGSCOMPARENEARPOINT( pointOld_2, QgsPoint( 2537366.84566075634211302, 1152360.28978145681321621 ), 0.00001 );

0 comments on commit 0fc9a39

Please sign in to comment.