mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-14 04:26:35 +02:00
Disabled Model (entity) Tests, as they are waaay out of date and will not run with the current codebase. These should get reimplemented at some point.
This commit is contained in:
parent
c61b38f5e6
commit
dfe58a5ed4
7 changed files with 107 additions and 102 deletions
|
@ -229,7 +229,7 @@ EntityItemPointer EntityTree::addEntity(const EntityItemID& entityID, const Enti
|
|||
if (getIsClient()) {
|
||||
// if our Node isn't allowed to create entities in this domain, don't try.
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
if (!nodeList->getThisNodeCanRez()) {
|
||||
if (nodeList && !nodeList->getThisNodeCanRez()) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,92 +9,65 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QDebug>
|
||||
//#include <QDebug>
|
||||
|
||||
#include <AABox.h>
|
||||
#include <AACube.h>
|
||||
|
||||
#include "AABoxCubeTests.h"
|
||||
|
||||
void AABoxCubeTests::AABoxCubeTests(bool verbose) {
|
||||
qDebug() << "******************************************************************************************";
|
||||
qDebug() << "AABoxCubeTests::AABoxCubeTests()";
|
||||
QTEST_MAIN(AABoxCubeTests)
|
||||
|
||||
{
|
||||
qDebug() << "Test 1: AABox.findRayIntersection() inside out MIN_X_FACE";
|
||||
void AABoxCubeTests::raycastOutHitsXMinFace() {
|
||||
// Raycast inside out
|
||||
glm::vec3 corner(0.0f, 0.0f, 0.0f);
|
||||
float size = 1.0f;
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.5f, 0.5f, 0.5f);
|
||||
glm::vec3 direction(-1.0f, 0.0f, 0.0f);
|
||||
float distance;
|
||||
BoxFace face;
|
||||
|
||||
glm::vec3 corner(0.0f, 0.0f, 0.0f);
|
||||
float size = 1.0f;
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.5f, 0.5f, 0.5f);
|
||||
glm::vec3 direction(-1.0f, 0.0f, 0.0f);
|
||||
float distance;
|
||||
BoxFace face;
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face);
|
||||
|
||||
if (intersects && distance == 0.5f && face == MIN_X_FACE) {
|
||||
qDebug() << "Test 1: PASSED";
|
||||
} else {
|
||||
qDebug() << "intersects=" << intersects << "expected=" << true;
|
||||
qDebug() << "distance=" << distance << "expected=" << 0.5f;
|
||||
qDebug() << "face=" << face << "expected=" << MIN_X_FACE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
qDebug() << "Test 2: AABox.findRayIntersection() inside out MAX_X_FACE";
|
||||
|
||||
glm::vec3 corner(0.0f, 0.0f, 0.0f);
|
||||
float size = 1.0f;
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.5f, 0.5f, 0.5f);
|
||||
glm::vec3 direction(1.0f, 0.0f, 0.0f);
|
||||
float distance;
|
||||
BoxFace face;
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face);
|
||||
|
||||
if (intersects && distance == 0.5f && face == MAX_X_FACE) {
|
||||
qDebug() << "Test 2: PASSED";
|
||||
} else {
|
||||
qDebug() << "intersects=" << intersects << "expected=" << true;
|
||||
qDebug() << "distance=" << distance << "expected=" << 0.5f;
|
||||
qDebug() << "face=" << face << "expected=" << MAX_X_FACE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
qDebug() << "Test 3: AABox.findRayIntersection() outside in";
|
||||
|
||||
glm::vec3 corner(0.5f, 0.0f, 0.0f);
|
||||
float size = 0.5f;
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.25f, 0.25f, 0.25f);
|
||||
glm::vec3 direction(1.0f, 0.0f, 0.0f);
|
||||
float distance;
|
||||
BoxFace face;
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face);
|
||||
|
||||
if (intersects && distance == 0.25f && face == MIN_X_FACE) {
|
||||
qDebug() << "Test 3: PASSED";
|
||||
} else {
|
||||
qDebug() << "intersects=" << intersects << "expected=" << true;
|
||||
qDebug() << "distance=" << distance << "expected=" << 0.5f;
|
||||
qDebug() << "face=" << face << "expected=" << MIN_X_FACE;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "******************************************************************************************";
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face);
|
||||
|
||||
QCOMPARE(intersects, true);
|
||||
QCOMPARE(distance, 0.5f);
|
||||
QCOMPARE(face, MIN_X_FACE);
|
||||
}
|
||||
|
||||
void AABoxCubeTests::runAllTests(bool verbose) {
|
||||
AABoxCubeTests(verbose);
|
||||
void AABoxCubeTests::raycastOutHitsXMaxFace () {
|
||||
// Raycast inside out
|
||||
glm::vec3 corner(0.0f, 0.0f, 0.0f);
|
||||
float size = 1.0f;
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.5f, 0.5f, 0.5f);
|
||||
glm::vec3 direction(1.0f, 0.0f, 0.0f);
|
||||
float distance;
|
||||
BoxFace face;
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face);
|
||||
|
||||
QCOMPARE(intersects, true);
|
||||
QCOMPARE(distance, 0.5f);
|
||||
QCOMPARE(face, MAX_X_FACE);
|
||||
}
|
||||
void AABoxCubeTests::raycastInHitsXMinFace () {
|
||||
// Raycast outside in
|
||||
glm::vec3 corner(0.5f, 0.0f, 0.0f);
|
||||
float size = 0.5f;
|
||||
|
||||
AABox box(corner, size);
|
||||
glm::vec3 origin(0.25f, 0.25f, 0.25f);
|
||||
glm::vec3 direction(1.0f, 0.0f, 0.0f);
|
||||
float distance;
|
||||
BoxFace face;
|
||||
|
||||
bool intersects = box.findRayIntersection(origin, direction, distance, face);
|
||||
|
||||
QCOMPARE(intersects, true);
|
||||
QCOMPARE(distance, 0.5f);
|
||||
QCOMPARE(face, MIN_X_FACE);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,19 @@
|
|||
#ifndef hifi_AABoxCubeTests_h
|
||||
#define hifi_AABoxCubeTests_h
|
||||
|
||||
namespace AABoxCubeTests {
|
||||
void AABoxCubeTests(bool verbose);
|
||||
void runAllTests(bool verbose);
|
||||
}
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
|
||||
class AABoxCubeTests : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void raycastOutHitsXMinFace ();
|
||||
void raycastOutHitsXMaxFace ();
|
||||
void raycastInHitsXMinFace ();
|
||||
|
||||
// TODO: Add more unit tests!
|
||||
// (eg. no test for failed intersection or non-orthogonal ray)
|
||||
};
|
||||
|
||||
#endif // hifi_AABoxCubeTests_h
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
//#include "EntityTests.h"
|
||||
#include "ModelTests.h" // needs to be EntityTests.h soon
|
||||
|
||||
QTEST_MAIN(EntityTests)
|
||||
|
||||
/*
|
||||
void EntityTests::entityTreeTests(bool verbose) {
|
||||
|
||||
bool extraVerbose = false;
|
||||
|
@ -508,4 +511,4 @@ void EntityTests::entityTreeTests(bool verbose) {
|
|||
void EntityTests::runAllTests(bool verbose) {
|
||||
entityTreeTests(verbose);
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
|
@ -12,9 +12,18 @@
|
|||
#ifndef hifi_EntityTests_h
|
||||
#define hifi_EntityTests_h
|
||||
|
||||
namespace EntityTests {
|
||||
void entityTreeTests(bool verbose = false);
|
||||
void runAllTests(bool verbose = false);
|
||||
}
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
//
|
||||
// TODO: These are waaay out of date with the current codebase, and should be reimplemented at some point.
|
||||
//
|
||||
|
||||
class EntityTests : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
// void entityTreeTests(bool verbose = false);
|
||||
// void runAllTests(bool verbose = false);
|
||||
};
|
||||
|
||||
#endif // hifi_EntityTests_h
|
||||
|
|
|
@ -51,8 +51,11 @@ enum ExamplePropertyList {
|
|||
|
||||
typedef PropertyFlags<ExamplePropertyList> ExamplePropertyFlags;
|
||||
|
||||
QTEST_MAIN(OctreeTests)
|
||||
|
||||
void OctreeTests::propertyFlagsTests(bool verbose) {
|
||||
void OctreeTests::propertyFlagsTests() {
|
||||
bool verbose = true;
|
||||
|
||||
int testsTaken = 0;
|
||||
int testsPassed = 0;
|
||||
int testsFailed = 0;
|
||||
|
@ -891,7 +894,9 @@ typedef ByteCountCoded<quint64> ByteCountCodedQUINT64;
|
|||
|
||||
typedef ByteCountCoded<int> ByteCountCodedINT;
|
||||
|
||||
void OctreeTests::byteCountCodingTests(bool verbose) {
|
||||
void OctreeTests::byteCountCodingTests() {
|
||||
bool verbose = true;
|
||||
|
||||
int testsTaken = 0;
|
||||
int testsPassed = 0;
|
||||
int testsFailed = 0;
|
||||
|
@ -1268,7 +1273,8 @@ void OctreeTests::byteCountCodingTests(bool verbose) {
|
|||
}
|
||||
}
|
||||
|
||||
void OctreeTests::modelItemTests(bool verbose) {
|
||||
void OctreeTests::modelItemTests() {
|
||||
bool verbose = true;
|
||||
|
||||
#if 0 // TODO - repair/replace these
|
||||
|
||||
|
@ -1440,9 +1446,9 @@ void OctreeTests::modelItemTests(bool verbose) {
|
|||
}
|
||||
|
||||
|
||||
void OctreeTests::runAllTests(bool verbose) {
|
||||
propertyFlagsTests(verbose);
|
||||
byteCountCodingTests(verbose);
|
||||
modelItemTests(verbose);
|
||||
}
|
||||
//void OctreeTests::runAllTests(bool verbose) {
|
||||
// propertyFlagsTests(verbose);
|
||||
// byteCountCodingTests(verbose);
|
||||
// modelItemTests(verbose);
|
||||
//}
|
||||
|
||||
|
|
|
@ -12,13 +12,17 @@
|
|||
#ifndef hifi_OctreeTests_h
|
||||
#define hifi_OctreeTests_h
|
||||
|
||||
namespace OctreeTests {
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
void propertyFlagsTests(bool verbose);
|
||||
void byteCountCodingTests(bool verbose);
|
||||
void modelItemTests(bool verbose);
|
||||
class OctreeTests : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void propertyFlagsTests();
|
||||
void byteCountCodingTests();
|
||||
void modelItemTests();
|
||||
|
||||
void runAllTests(bool verbose);
|
||||
}
|
||||
// void runAllTests(bool verbose);
|
||||
};
|
||||
|
||||
#endif // hifi_OctreeTests_h
|
||||
|
|
Loading…
Reference in a new issue