Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions src/actions/SoCallbackAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1300,41 +1300,3 @@ SbBool SoCallbackAction::isCallbackAll(void) const
}

#undef PRIVATE

#ifdef COIN_TEST_SUITE

#include <Inventor/nodes/SoSwitch.h>
#include <Inventor/nodes/SoCube.h>

static SoCallbackAction::Response
preCB(void * userdata, SoCallbackAction *, const SoNode * node)
{
SbString *str = (SbString *)userdata;
(*str) += node->getName();
return SoCallbackAction::CONTINUE;
}

BOOST_AUTO_TEST_CASE(callbackall)
{
SbString str;
SoSwitch * sw = new SoSwitch;
sw->setName("switch");
SoCube * cube = new SoCube;
cube->setName("cube");
sw->addChild(cube);
sw->ref();

SoCallbackAction cba;
cba.addPreCallback(SoNode::getClassTypeId(), preCB, &str);
cba.apply(sw);
BOOST_CHECK_MESSAGE(str == "switch", "Should not traverse under switch node");

str = "";
cba.setCallbackAll(true);
cba.apply(sw);
BOOST_CHECK_MESSAGE(str == "switchcube", "Should traverse under switch node");

sw->unref();
}

#endif // COIN_TEST_SUITE
79 changes: 0 additions & 79 deletions src/actions/SoWriteAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,82 +281,3 @@ SoWriteAction::shouldCompactPathLists(void) const
{
return FALSE;
}

#ifdef COIN_TEST_SUITE

// check that the realTime GlobalField is written if it has any
// forward connections.

#include <Inventor/SoDB.h>
#include <Inventor/SoInput.h>
#include <Inventor/SoOutput.h>
#include <Inventor/fields/SoSFTime.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoText2.h>
#include <Inventor/C/tidbits.h>

BOOST_AUTO_TEST_CASE(GlobalField)
{
SoDB::init();

//Store away the state before we mess with the global realTime field
SoSFTime * realtime = static_cast<SoSFTime *>(SoDB::getGlobalField("realTime"));
assert(realtime);
SbTime realTimeStorage = realtime->getValue();

static const char inlinescenegraph[] =
"#Inventor V2.1 ascii\n"
"\n"
"\n"
"Separator {\n"
"\n"
" Text2 { \n"
" string \"\" = GlobalField { \n"
" type \"SFTime\" realTime 0 \n"
"\n"
" } . realTime \n"
" }\n"
"}\n";

// read scene
SoInput in;
in.setBuffer(inlinescenegraph, strlen(inlinescenegraph));
SoSeparator * top = SoDB::readAll(&in);
BOOST_REQUIRE(top);
top->ref();

// write scene
SoOutput out;
const int buffer_size = 1024;
char * buffer = (char *)malloc(buffer_size);
out.setBuffer(buffer, buffer_size, NULL);

SoWriteAction wa(&out);
wa.apply((SoNode *)top);

top->unref();
top = NULL;

// read scene again to check if realTime field was written
in.setBuffer(buffer, strlen(buffer));
top = SoDB::readAll(&in);
BOOST_REQUIRE(top);
top->ref();

SoText2 * text = (SoText2 *)top->getChild(0);
BOOST_REQUIRE(text);

SoField * string = text->getField("string");
BOOST_REQUIRE(string);
BOOST_CHECK_MESSAGE(string->isConnected(), "String field not connected to realTime field in written scene graph");

free(buffer);

top->unref();

//Restore state
realtime->setValue(realTimeStorage);

}

#endif // COIN_TEST_SUITE
45 changes: 0 additions & 45 deletions src/base/SbBSPTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,48 +675,3 @@ SbBSPTree::findPoints(const SbSphere &sphere,
{
this->topnode->findPoints(sphere, array);
}

#ifdef COIN_TEST_SUITE

BOOST_AUTO_TEST_CASE(initialized)
{
SbBSPTree bsp;
SbVec3f p0(0.0f, 0.0f, 0.0f);
SbVec3f p1(1.0f, 0.0f, 0.0f);
SbVec3f p2(2.0f, 0.0f, 0.0f);
void * userdata0 = reinterpret_cast<void*> (&p0);
void * userdata1 = reinterpret_cast<void*> (&p1);
void * userdata2 = reinterpret_cast<void*> (&p2);

BOOST_CHECK_MESSAGE(bsp.addPoint(p0, userdata0) == 0, "unexpected index");
BOOST_CHECK_MESSAGE(bsp.addPoint(p1, userdata1) == 1, "unexpected index");
BOOST_CHECK_MESSAGE(bsp.addPoint(p2, userdata2) == 2, "unexpected index");
BOOST_CHECK_MESSAGE(bsp.addPoint(p2, userdata2) == 2, "unexpected index");
BOOST_CHECK_MESSAGE(bsp.numPoints() == 3, "wrong number of points in the tree");

BOOST_CHECK_MESSAGE(bsp.findPoint(p0) == 0, "wrong index");
BOOST_CHECK_MESSAGE(bsp.getUserData(0) == userdata0, "wrong userdata");
BOOST_CHECK_MESSAGE(bsp.findPoint(p1) == 1, "wrong index");
BOOST_CHECK_MESSAGE(bsp.getUserData(1) == userdata1, "wrong userdata");
BOOST_CHECK_MESSAGE(bsp.findPoint(p2) == 2, "wrong index");
BOOST_CHECK_MESSAGE(bsp.getUserData(2) == userdata2, "wrong userdata");

BOOST_CHECK_MESSAGE(bsp.numPoints() == 3, "wrong number of points in the tree");
BOOST_CHECK_MESSAGE(bsp.getPointsArrayPtr()[0] == p0, "wrong point at index 0");
BOOST_CHECK_MESSAGE(bsp.getPointsArrayPtr()[1] == p1, "wrong point at index 1");
BOOST_CHECK_MESSAGE(bsp.getPointsArrayPtr()[2] == p2, "wrong point at index 2");

BOOST_CHECK_MESSAGE(bsp.removePoint(p1) == 1, "unable to remove point");
BOOST_CHECK_MESSAGE(bsp.numPoints() == 2, "wrong number of points after removePoint().");
BOOST_CHECK_MESSAGE(bsp.getPointsArrayPtr()[0] == p0, "wrong point at index 0");
BOOST_CHECK_MESSAGE(bsp.getUserData(0) == userdata0, "wrong userdata");
BOOST_CHECK_MESSAGE(bsp.getPointsArrayPtr()[1] == p2, "wrong point at index 1");
BOOST_CHECK_MESSAGE(bsp.getUserData(1) == userdata2, "wrong userdata");

BOOST_CHECK_MESSAGE(bsp.removePoint(p0) >= 0, "unable to remove point");
BOOST_CHECK_MESSAGE(bsp.removePoint(p2) >= 0, "unable to remove point");
BOOST_CHECK_MESSAGE(bsp.numPoints() == 0, "wrong number of points after removing all points.");

}

#endif // COIN_TEST_SUITE
31 changes: 0 additions & 31 deletions src/base/SbBox2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,34 +560,3 @@ SbBox2d::getClosestPoint(const SbVec2d & point) const

Check \a b1 and \a b2 for inequality.
*/

#ifdef COIN_TEST_SUITE
BOOST_AUTO_TEST_CASE(checkSize) {
SbVec2d min(1,2);
SbVec2d max(3,4);

SbVec2d diff = max - min;

SbBox2d box(min, max);

BOOST_CHECK_MESSAGE(box.getSize() == diff,
"Box has incorrect size");
}
BOOST_AUTO_TEST_CASE(checkGetClosestPoint) {
SbVec2d point(1524, 13794);
SbVec2d min(1557, 3308);
SbVec2d max(3113, 30157);

SbBox2d box(min, max);
SbVec2d expected(1557, 13794);

BOOST_CHECK_MESSAGE(box.getClosestPoint(point) == expected,
"Closest point does not fit");

SbVec2d sizes = box.getSize();
SbVec2d expectedCenterQuery(max[0], sizes[1] / 2.0);

BOOST_CHECK_MESSAGE(box.getClosestPoint(box.getCenter()) == expectedCenterQuery,
"Closest point for center query does not fit");
}
#endif //COIN_TEST_SUITE
31 changes: 0 additions & 31 deletions src/base/SbBox2f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,34 +412,3 @@ SbBox2f::getClosestPoint(const SbVec2f & point) const

Check \a b1 and \a b2 for inequality.
*/

#ifdef COIN_TEST_SUITE
BOOST_AUTO_TEST_CASE(checkSize) {
SbVec2f min(1,2);
SbVec2f max(3,4);

SbVec2f diff = max - min;

SbBox2f box(min, max);

BOOST_CHECK_MESSAGE(box.getSize() == diff,
"Box has incorrect size");
}
BOOST_AUTO_TEST_CASE(checkGetClosestPoint) {
SbVec2f point(1524, 13794);
SbVec2f min(1557, 3308);
SbVec2f max(3113, 30157);

SbBox2f box(min, max);
SbVec2f expected(1557, 13794);

BOOST_CHECK_MESSAGE(box.getClosestPoint(point) == expected,
"Closest point does not fit");

SbVec2f sizes = box.getSize();
SbVec2f expectedCenterQuery(max[0], sizes[1] / 2.0f);

BOOST_CHECK_MESSAGE(box.getClosestPoint(box.getCenter()) == expectedCenterQuery,
"Closest point for center query does not fit");
}
#endif //COIN_TEST_SUITE
16 changes: 0 additions & 16 deletions src/base/SbBox2i32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,19 +367,3 @@ SbBox2i32::intersect(const SbBox2i32 & box) const

Check \a b1 and \a b2 for inequality.
*/

#ifdef COIN_TEST_SUITE
BOOST_AUTO_TEST_CASE(checkSize) {
SbVec2i32 min(1,2);
SbVec2i32 max(3,4);

SbVec2i32 diff = max - min;


SbBox2i32 box(min, max);

BOOST_CHECK_MESSAGE(box.getSize() == diff,
"Box has incorrect size");

}
#endif //COIN_TEST_SUITE
16 changes: 0 additions & 16 deletions src/base/SbBox2s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,19 +383,3 @@ SbBox2s::intersect(const SbBox2s & box) const
(the maximum point) are greater than the corresponding coordinates
of its lower left corner (the minimum point).
*/

#ifdef COIN_TEST_SUITE
BOOST_AUTO_TEST_CASE(checkSize) {
SbVec2s min(1,2);
SbVec2s max(3,4);

SbVec2s diff = max - min;


SbBox2s box(min, max);

BOOST_CHECK_MESSAGE(box.getSize() == diff,
"Box has incorrect size");

}
#endif //COIN_TEST_SUITE
20 changes: 0 additions & 20 deletions src/base/SbBox3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,23 +589,3 @@ SbBox3d::getClosestPoint(const SbVec3d & point) const

return closest;
}

#ifdef COIN_TEST_SUITE
BOOST_AUTO_TEST_CASE(checkGetClosestPoint) {
SbVec3d point(1524, 13794, 851);
SbVec3d min(1557, 3308, 850);
SbVec3d max(3113, 30157, 1886);

SbBox3d box(min, max);
SbVec3d expected(1557, 13794, 851);

BOOST_CHECK_MESSAGE(box.getClosestPoint(point) == expected,
"Closest point does not fit");

SbVec3d sizes = box.getSize();
SbVec3d expectedCenterQuery(sizes[0] / 2.0, sizes[1] / 2.0, max[2]);

BOOST_CHECK_MESSAGE(box.getClosestPoint(box.getCenter()) == expectedCenterQuery,
"Closest point for center query does not fit");
}
#endif //COIN_TEST_SUITE
20 changes: 0 additions & 20 deletions src/base/SbBox3f.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,23 +589,3 @@ SbBox3f::getClosestPoint(const SbVec3f & point) const

return closest;
}

#ifdef COIN_TEST_SUITE
BOOST_AUTO_TEST_CASE(checkGetClosestPoint) {
SbVec3f point(1524 , 13794 , 851);
SbVec3f min(1557, 3308, 850);
SbVec3f max(3113, 30157, 1886);

SbBox3f box(min, max);
SbVec3f expected(1557, 13794, 851);

BOOST_CHECK_MESSAGE(box.getClosestPoint(point) == expected,
"Closest point does not fit");

SbVec3f sizes = box.getSize();
SbVec3f expectedCenterQuery(sizes[0]/2.0f, sizes[1]/2.0f, max[2]);

BOOST_CHECK_MESSAGE(box.getClosestPoint(box.getCenter()) == expectedCenterQuery,
"Closest point for center query does not fit");
}
#endif //COIN_TEST_SUITE
32 changes: 0 additions & 32 deletions src/base/SbBox3i32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -587,35 +587,3 @@ SbBox3i32::getSpan(const SbVec3f & dir, float & dmin, float & dmax) const
dmin = mindist;
dmax = maxdist;
}


#ifdef COIN_TEST_SUITE
BOOST_AUTO_TEST_CASE(checkSize) {
SbVec3i32 min(1,2,3);
SbVec3i32 max(3,4,5);

SbVec3i32 diff = max - min;

SbBox3i32 box(min, max);

BOOST_CHECK_MESSAGE(box.getSize() == diff,
"Box has incorrect size");
}
BOOST_AUTO_TEST_CASE(checkGetClosestPoint) {
SbVec3f point(1524 , 13794 , 851);
SbVec3i32 min(1557, 3308, 850);
SbVec3i32 max(3113, 30157, 1886);

SbBox3i32 box(min, max);
SbVec3f expected(1557, 13794, 851);

BOOST_CHECK_MESSAGE(box.getClosestPoint(point) == expected,
"Closest point does not fit");

SbVec3i32 sizes = box.getSize();
SbVec3f expectedCenterQuery(sizes[0]/2.0f, sizes[1]/2.0f, (float)max[2]);

BOOST_CHECK_MESSAGE(box.getClosestPoint(box.getCenter()) == expectedCenterQuery,
"Closest point for center query does not fit");
}
#endif //COIN_TEST_SUITE
Loading
Loading