Skip to content

Commit

Permalink
Fix tests on old geos
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Jan 4, 2022
1 parent 32e8ba3 commit aca1200
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/core/expression/qgsexpressionfunction.cpp
Expand Up @@ -6851,6 +6851,7 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress
}
}

#if GEOS_VERSION_MAJOR>3 || ( GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR>=9 )
// Check min inscribed circle radius for intersection (if set)
if ( minInscribedCircleRadius != -1 || requireMeasures )
{
Expand All @@ -6863,6 +6864,7 @@ static QVariant executeGeomOverlay( const QVariantList &values, const QgsExpress
testResult = radiusValue >= minInscribedCircleRadius;
radiusValues.append( radiusValues );
}
#endif
}

// Get the max values
Expand Down
7 changes: 4 additions & 3 deletions tests/src/core/testqgsoverlayexpression.cpp
Expand Up @@ -248,8 +248,6 @@ void TestQgsOverlayExpression::testOverlayMeasure()
QVERIFY2( exp.prepare( &context ), exp.parserErrorString().toUtf8().constData() );
const QVariant result = exp.evaluate( &context );

qDebug() << "RES:" << result;
qDebug() << "EXP:" << expectedResult;
QCOMPARE( result, expectedResult );

}
Expand All @@ -265,13 +263,16 @@ void TestQgsOverlayExpression::testOverlayMeasure_data()
expected3.insert( QStringLiteral( "id" ), 3LL );
expected3.insert( QStringLiteral( "result" ), 3LL );
expected3.insert( QStringLiteral( "overlap" ), 1.4033836999701634 );
#if GEOS_VERSION_MAJOR>3 || ( GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR>=9 )
expected3 .insert( QStringLiteral( "radius" ), 0.5344336346973622 );
#endif
QVariantMap expected1;
expected1.insert( QStringLiteral( "id" ), 1LL );
expected1.insert( QStringLiteral( "result" ), 1LL );
expected1.insert( QStringLiteral( "overlap" ), 1.2281139270096446 );
#if GEOS_VERSION_MAJOR>3 || ( GEOS_VERSION_MAJOR == 3 && GEOS_VERSION_MINOR>=9 )
expected1.insert( QStringLiteral( "radius" ), 0.46454276882989376 );

#endif
QTest::newRow( "intersects min_overlap multi match return measure" ) << "overlay_intersects('polys', expression:=$id, min_overlap:=1.34, return_measure:=true)" << "POLYGON((-107.37 33.75, -102.76 33.75, -102.76 36.97, -107.37 36.97, -107.37 33.75))" << ( QVariantList() << expected3 ) ;

QTest::newRow( "intersects multi match return measure" ) << "overlay_intersects('polys', expression:=$id, return_measure:=true)" << "POLYGON((-107.37 33.75, -102.76 33.75, -102.76 36.97, -107.37 36.97, -107.37 33.75))" << ( QVariantList() << expected1 << expected3 ) ;
Expand Down

0 comments on commit aca1200

Please sign in to comment.