Skip to content

Commit

Permalink
add QgsBox3DDistanceTo test
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Jan 13, 2021
1 parent 2c9c6f9 commit bfa835d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/src/3d/testqgs3dutils.cpp
Expand Up @@ -17,6 +17,8 @@

#include "qgs3dutils.h"

#include "qgsbox3d.h"

#include <QSize>

/**
Expand All @@ -35,6 +37,7 @@ class TestQgs3DUtils : public QObject

void testTransforms();
void testRayFromScreenPoint();
void testQgsBox3DDistanceTo();
private:
};

Expand Down Expand Up @@ -138,7 +141,20 @@ void TestQgs3DUtils::testRayFromScreenPoint()
QVERIFY( ray1 == ray2 );
}
}
}

void TestQgs3DUtils::testQgsBox3DDistanceTo()
{
{
QgsBox3d box( -1, -1, -1, 1, 1, 1 );
QVERIFY( box.distanceTo( QVector3D( 0, 0, 0 ) ) == 0.0 );
QVERIFY( box.distanceTo( QVector3D( 2, 2, 2 ) ) == qSqrt( 3.0 ) );
}
{
QgsBox3d box( 1, 2, 1, 4, 3, 3 );
QVERIFY( box.distanceTo( QVector3D( 1, 2, 1 ) ) == 0.0 );
QVERIFY( box.distanceTo( QVector3D( 0, 0, 0 ) ) == qSqrt( 6.0 ) );
}
}

QGSTEST_MAIN( TestQgs3DUtils )
Expand Down

0 comments on commit bfa835d

Please sign in to comment.