Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lbartoletti authored and nyalldawson committed Nov 27, 2020
1 parent 25e14ee commit dfe4453
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/src/core/testqgsgeometryutils.cpp
Expand Up @@ -81,6 +81,7 @@ class TestQgsGeometryUtils: public QObject
void testWeightedPointInTriangle_data();
void testWeightedPointInTriangle();
void testPointContinuesArc();
void testBisector();
};


Expand Down Expand Up @@ -1497,5 +1498,19 @@ void TestQgsGeometryUtils::testPointContinuesArc()
QVERIFY( !QgsGeometryUtils::pointContinuesArc( QgsPoint( 0, 0 ), QgsPoint( 1, 1 ), QgsPoint( 2, 0 ), QgsPoint( 1.01, -1 ), 0.000000001, 0.05 ) );
}

void TestQgsGeometryUtils::testBisector()
{
double x, y;
QVERIFY( QgsGeometryUtils::bisector( 5, 5, 0, 0, -7, 11, x, y ) );
QGSCOMPARENEAR( x, -2.416, 10e-3 );
QGSCOMPARENEAR( y, 3.797, 10e-3 );

QVERIFY( QgsGeometryUtils::bisector( 2.5, 2, 0, 0, 5, 0, x, y ) );
QGSCOMPARENEAR( x, 2.5, 10e-3 );
QGSCOMPARENEAR( y, 0, 10e-3 );

// collinear
QVERIFY( !QgsGeometryUtils::bisector( 5, 5, 0, 0, 1, 1, x, y ) );
}
QGSTEST_MAIN( TestQgsGeometryUtils )
#include "testqgsgeometryutils.moc"

0 comments on commit dfe4453

Please sign in to comment.