Fix failing test

This commit is contained in:
Nyall Dawson 2016-06-29 09:59:00 +10:00
parent ec49c407a4
commit 724d3e0832
2 changed files with 10 additions and 3 deletions

View File

@ -23,7 +23,14 @@
* @note added in QGIS 2.16
*/
#define QGSCOMPARENEAR(a,b,epsilon) { bool _xxxresult = qgsDoubleNear( a, b, epsilon ); if ( !_xxxresult ) { qDebug( "Expecting %f got %f (diff %f > %f)", static_cast< double >( a ), static_cast< double >( b ), qAbs( static_cast< double >( a ) - b ), static_cast< double >( epsilon ) ); } QVERIFY( _xxxresult ); }
#define QGSCOMPARENEAR(a,b,epsilon) { \
bool _xxxresult = qgsDoubleNear( a, b, epsilon ); \
if ( !_xxxresult ) \
{ \
qDebug( "Expecting %f got %f (diff %f > %f)", static_cast< double >( a ), static_cast< double >( b ), qAbs( static_cast< double >( a ) - b ), static_cast< double >( epsilon ) ); \
} \
QVERIFY( qgsDoubleNear( a, b, epsilon ) ); \
}
#endif // QGSTESTUTILS_H

View File

@ -19,6 +19,7 @@
#include "qgslinestringv2.h"
#include "qgspolygonv2.h"
#include "qgsmultipolygonv2.h"
#include "qgstestutils.h"
class TestQgsGeometryUtils: public QObject
{
@ -413,8 +414,7 @@ void TestQgsGeometryUtils::testSqrDistToLine()
p1.x(), p1.y(),
p2.x(), p2.y(),
rx, ry, epsilon );
sqrDist = qRound( sqrDist * 100 ) / 100;
QCOMPARE( sqrDist, 11.83 );
QGSCOMPARENEAR( sqrDist, 11.83, 0.01 );
}