mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 12:59:07 -06:00
More restructuring work on SceneGraph
This commit is contained in:
@@ -24,359 +24,358 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <openspace/scene/scenegraphloader.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
class SceneGraphLoaderTest : public testing::Test {};
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, NonExistingFileTest) {
|
||||
const std::string file = "NonExistingFile";
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, IllformedFileTest) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformed.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, IllformedFileTestWrongCommonFolderType) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformedWrongType.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, IllformedFileTestInvalidSceneFolder) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformedInvalidScene.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, IllformedFileTestWrongCommonFolder) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformedWrongCommon.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, IllformedFileTestNonExistingCommonFolder) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformedNonExistingCommon.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test00) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test00.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "No scenegraph nodes loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test00Location) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test00-location.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "No scenegraph nodes loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, AbsoluteScenePath) {
|
||||
const std::string scenePath = absPath("${TEMPORARY}/tmp.scene");
|
||||
std::ofstream scene(scenePath.c_str());
|
||||
|
||||
scene << "return {" << std::endl <<
|
||||
" ScenePath = \"" << absPath("${TESTDIR}/SceneGraphLoaderTest/scene-folder") <<
|
||||
"\"," << std::endl <<
|
||||
" CommonFolder = \"\"," << std::endl <<
|
||||
" Modules = {}}" << std::endl;
|
||||
scene.close();
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(scenePath, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
EXPECT_TRUE(nodes.empty()) << "No scenegraph nodes loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test01) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test01.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 1) << "Correct number of nodes";
|
||||
EXPECT_TRUE(nodes[0]->name() == "Common") << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test01Location) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test01-location.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 1) << "Correct number of nodes";
|
||||
EXPECT_TRUE(nodes[0]->name() == "Common") << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test02) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test02.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 2) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "NoDependency")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test02Location) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test02-location.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 2) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "NoDependency")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test03) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test03.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 2) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "CommonDependency")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test03Location) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test03-location.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 2) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "CommonDependency")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test04) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test04.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 3) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "DirectDependency")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test04Location) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test04-location.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 3) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "DirectDependency")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test05) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test05.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 4) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "MultipleDependencies")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test05Location) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test05-location.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 4) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "MultipleDependencies")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "Correct node loaded";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test06) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test06.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_FALSE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.empty()) << "Correct number of nodes";
|
||||
}
|
||||
|
||||
TEST_F(SceneGraphLoaderTest, Test06Location) {
|
||||
const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test06-location.scene");
|
||||
|
||||
std::vector<openspace::SceneGraphNode*> nodes;
|
||||
bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
|
||||
ASSERT_TRUE(success) << "Successful loading";
|
||||
ASSERT_TRUE(nodes.size() == 4) << "Correct number of nodes";
|
||||
bool found = false;
|
||||
for (openspace::SceneGraphNode* n : nodes)
|
||||
if (n->name() == "MultipleDependencies")
|
||||
found = true;
|
||||
|
||||
EXPECT_TRUE(found) << "No scenegraph nodes loaded";
|
||||
}
|
||||
|
||||
//TEST_F(SceneGraphLoaderTest, NonExistingFileTest) {
|
||||
// const std::string file = "NonExistingFile";
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
//
|
||||
//TEST_F(SceneGraphTest, SceneGraphNode) {
|
||||
//
|
||||
// openspace::SceneGraphNode *node =
|
||||
// openspace::SceneGraphNode::createFromDictionary(ghoul::Dictionary());
|
||||
//
|
||||
// // Should not have a renderable and position should be 0,0,0,0 (undefined).
|
||||
// EXPECT_EQ(nullptr, node->renderable());
|
||||
// EXPECT_EQ(openspace::psc(), node->position());
|
||||
//
|
||||
// delete node;
|
||||
// ghoul::Dictionary nodeDictionary;
|
||||
//
|
||||
// ghoul::Dictionary positionDictionary;
|
||||
// ghoul::Dictionary positionPositionArrayDictionary;
|
||||
//
|
||||
// ghoul::Dictionary renderableDictionary;
|
||||
//
|
||||
// renderableDictionary.setValue("Type", std::string("RenderablePlanet"));
|
||||
//
|
||||
// positionPositionArrayDictionary.setValue("1", 1.0);
|
||||
// positionPositionArrayDictionary.setValue("2", 1.0);
|
||||
// positionPositionArrayDictionary.setValue("3", 1.0);
|
||||
// positionPositionArrayDictionary.setValue("4", 1.0);
|
||||
//
|
||||
// positionDictionary.setValue("Type", std::string("Static"));
|
||||
// positionDictionary.setValue("Position", positionPositionArrayDictionary);
|
||||
//
|
||||
// nodeDictionary.setValue("Position", positionDictionary);
|
||||
// nodeDictionary.setValue("Renderable", renderableDictionary);
|
||||
//
|
||||
// node =
|
||||
// openspace::SceneGraphNode::createFromDictionary(nodeDictionary);
|
||||
//
|
||||
// // This node should have a renderable (probably no good values but an existing one)
|
||||
// EXPECT_TRUE(node->renderable());
|
||||
//
|
||||
// // position should be initialized
|
||||
// EXPECT_EQ(openspace::psc(1.0,1.0,1.0,1.0), node->position());
|
||||
//
|
||||
// delete node;
|
||||
// EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphTest, Loading) {
|
||||
//
|
||||
//
|
||||
// // Should not successfully load a non existing scenegraph
|
||||
// EXPECT_FALSE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTestNonExisting"), absPath("${TESTDIR}")));
|
||||
//
|
||||
// // Existing scenegraph should load
|
||||
// EXPECT_TRUE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTest"), absPath("${TESTDIR}")));
|
||||
// // TODO need to check for correctness
|
||||
//
|
||||
// // This loading should fail regardless of existing or not since the
|
||||
// // scenegraph is already loaded
|
||||
// EXPECT_FALSE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTest"), absPath("${TESTDIR}")));
|
||||
//TEST_F(SceneGraphLoaderTest, IllformedFileTest) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformed.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphTest, Reinitializing) {
|
||||
//
|
||||
// // Existing scenegraph should load
|
||||
// EXPECT_TRUE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTest"), absPath("${TESTDIR}")));
|
||||
//
|
||||
// _scenegraph->deinitialize();
|
||||
//
|
||||
// // Existing scenegraph should load
|
||||
// EXPECT_TRUE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTest"), absPath("${TESTDIR}")));
|
||||
// // TODO need to check for correctness
|
||||
//TEST_F(SceneGraphLoaderTest, IllformedFileTestWrongCommonFolderType) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformedWrongType.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
//}
|
||||
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, IllformedFileTestInvalidSceneFolder) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformedInvalidScene.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, IllformedFileTestWrongCommonFolder) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformedWrongCommon.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, IllformedFileTestNonExistingCommonFolder) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/illformedNonExistingCommon.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// EXPECT_FALSE(success) << "Unsuccessful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "Empty scenegraph nodes list";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test00) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test00.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "No scenegraph nodes loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test00Location) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test00-location.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "No scenegraph nodes loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, AbsoluteScenePath) {
|
||||
// const std::string scenePath = absPath("${TEMPORARY}/tmp.scene");
|
||||
// std::ofstream scene(scenePath.c_str());
|
||||
//
|
||||
// scene << "return {" << std::endl <<
|
||||
// " ScenePath = \"" << absPath("${TESTDIR}/SceneGraphLoaderTest/scene-folder") <<
|
||||
// "\"," << std::endl <<
|
||||
// " CommonFolder = \"\"," << std::endl <<
|
||||
// " Modules = {}}" << std::endl;
|
||||
// scene.close();
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(scenePath, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// EXPECT_TRUE(nodes.empty()) << "No scenegraph nodes loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test01) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test01.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 1) << "Correct number of nodes";
|
||||
// EXPECT_TRUE(nodes[0]->name() == "Common") << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test01Location) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test01-location.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 1) << "Correct number of nodes";
|
||||
// EXPECT_TRUE(nodes[0]->name() == "Common") << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test02) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test02.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 2) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "NoDependency")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test02Location) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test02-location.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 2) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "NoDependency")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test03) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test03.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 2) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "CommonDependency")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test03Location) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test03-location.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 2) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "CommonDependency")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test04) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test04.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 3) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "DirectDependency")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test04Location) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test04-location.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 3) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "DirectDependency")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test05) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test05.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 4) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "MultipleDependencies")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test05Location) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test05-location.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 4) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "MultipleDependencies")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "Correct node loaded";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test06) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test06.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_FALSE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.empty()) << "Correct number of nodes";
|
||||
//}
|
||||
//
|
||||
//TEST_F(SceneGraphLoaderTest, Test06Location) {
|
||||
// const std::string file = absPath("${TESTDIR}/SceneGraphLoaderTest/test06-location.scene");
|
||||
//
|
||||
// std::vector<openspace::SceneGraphNode*> nodes;
|
||||
// bool success = openspace::SceneGraphLoader::load(file, nodes);
|
||||
//
|
||||
// ASSERT_TRUE(success) << "Successful loading";
|
||||
// ASSERT_TRUE(nodes.size() == 4) << "Correct number of nodes";
|
||||
// bool found = false;
|
||||
// for (openspace::SceneGraphNode* n : nodes)
|
||||
// if (n->name() == "MultipleDependencies")
|
||||
// found = true;
|
||||
//
|
||||
// EXPECT_TRUE(found) << "No scenegraph nodes loaded";
|
||||
//}
|
||||
//
|
||||
////
|
||||
////
|
||||
////
|
||||
////TEST_F(SceneGraphTest, SceneGraphNode) {
|
||||
////
|
||||
//// openspace::SceneGraphNode *node =
|
||||
//// openspace::SceneGraphNode::createFromDictionary(ghoul::Dictionary());
|
||||
////
|
||||
//// // Should not have a renderable and position should be 0,0,0,0 (undefined).
|
||||
//// EXPECT_EQ(nullptr, node->renderable());
|
||||
//// EXPECT_EQ(openspace::psc(), node->position());
|
||||
////
|
||||
//// delete node;
|
||||
//// ghoul::Dictionary nodeDictionary;
|
||||
////
|
||||
//// ghoul::Dictionary positionDictionary;
|
||||
//// ghoul::Dictionary positionPositionArrayDictionary;
|
||||
////
|
||||
//// ghoul::Dictionary renderableDictionary;
|
||||
////
|
||||
//// renderableDictionary.setValue("Type", std::string("RenderablePlanet"));
|
||||
////
|
||||
//// positionPositionArrayDictionary.setValue("1", 1.0);
|
||||
//// positionPositionArrayDictionary.setValue("2", 1.0);
|
||||
//// positionPositionArrayDictionary.setValue("3", 1.0);
|
||||
//// positionPositionArrayDictionary.setValue("4", 1.0);
|
||||
////
|
||||
//// positionDictionary.setValue("Type", std::string("Static"));
|
||||
//// positionDictionary.setValue("Position", positionPositionArrayDictionary);
|
||||
////
|
||||
//// nodeDictionary.setValue("Position", positionDictionary);
|
||||
//// nodeDictionary.setValue("Renderable", renderableDictionary);
|
||||
////
|
||||
//// node =
|
||||
//// openspace::SceneGraphNode::createFromDictionary(nodeDictionary);
|
||||
////
|
||||
//// // This node should have a renderable (probably no good values but an existing one)
|
||||
//// EXPECT_TRUE(node->renderable());
|
||||
////
|
||||
//// // position should be initialized
|
||||
//// EXPECT_EQ(openspace::psc(1.0,1.0,1.0,1.0), node->position());
|
||||
////
|
||||
//// delete node;
|
||||
////}
|
||||
////
|
||||
////TEST_F(SceneGraphTest, Loading) {
|
||||
////
|
||||
////
|
||||
//// // Should not successfully load a non existing scenegraph
|
||||
//// EXPECT_FALSE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTestNonExisting"), absPath("${TESTDIR}")));
|
||||
////
|
||||
//// // Existing scenegraph should load
|
||||
//// EXPECT_TRUE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTest"), absPath("${TESTDIR}")));
|
||||
//// // TODO need to check for correctness
|
||||
////
|
||||
//// // This loading should fail regardless of existing or not since the
|
||||
//// // scenegraph is already loaded
|
||||
//// EXPECT_FALSE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTest"), absPath("${TESTDIR}")));
|
||||
////}
|
||||
////
|
||||
////TEST_F(SceneGraphTest, Reinitializing) {
|
||||
////
|
||||
//// // Existing scenegraph should load
|
||||
//// EXPECT_TRUE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTest"), absPath("${TESTDIR}")));
|
||||
////
|
||||
//// _scenegraph->deinitialize();
|
||||
////
|
||||
//// // Existing scenegraph should load
|
||||
//// EXPECT_TRUE(_scenegraph->loadScene(absPath("${TESTDIR}/ScenegraphTest"), absPath("${TESTDIR}")));
|
||||
//// // TODO need to check for correctness
|
||||
////}
|
||||
//
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user