From c1d3767ca5911b37b8211ddf6d4ec426f59692a7 Mon Sep 17 00:00:00 2001 From: David Stephan Date: Sun, 29 Jul 2018 14:13:17 -0700 Subject: [PATCH] removed tests --- examples/CMakeLists.txt | 1 - examples/osgmultiswitchtest/CMakeLists.txt | 5 - .../osgmultiswitchtest/osgmultiswitchtest.cpp | 112 ------------------ 3 files changed, 118 deletions(-) delete mode 100644 examples/osgmultiswitchtest/CMakeLists.txt delete mode 100644 examples/osgmultiswitchtest/osgmultiswitchtest.cpp diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 70d98af13..4edb8dc39 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -73,7 +73,6 @@ IF(DYNAMIC_OPENSCENEGRAPH) ADD_SUBDIRECTORY(osgmovie) ADD_SUBDIRECTORY(osgmultiplemovies) ADD_SUBDIRECTORY(osgmultiplerendertargets) - ADD_SUBDIRECTORY(osgmultiswitchtest) ADD_SUBDIRECTORY(osgmultitexture) ADD_SUBDIRECTORY(osgmultitexturecontrol) ADD_SUBDIRECTORY(osgmultitouch) diff --git a/examples/osgmultiswitchtest/CMakeLists.txt b/examples/osgmultiswitchtest/CMakeLists.txt deleted file mode 100644 index 504c037cb..000000000 --- a/examples/osgmultiswitchtest/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ - -SET(TARGET_SRC osgmultiswitchtest.cpp) -SET(TARGET_ADDED_LIBRARIES osgSim) -# also depends on osgsim plugin, osg plugins -SETUP_COMMANDLINE_EXAMPLE(osgmultiswitchtest) diff --git a/examples/osgmultiswitchtest/osgmultiswitchtest.cpp b/examples/osgmultiswitchtest/osgmultiswitchtest.cpp deleted file mode 100644 index a978b3c23..000000000 --- a/examples/osgmultiswitchtest/osgmultiswitchtest.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* OpenSceneGraph example, osgmultiswitchtest. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -* THE SOFTWARE. -*/ - -#include -#include -#include -#include - -#include - -void assert2(bool success) { - if (!success) throw std::runtime_error(""); -} - -void testSerializer(const osgSim::MultiSwitch::SwitchSetList &values, - const osgSim::MultiSwitch::SwitchSetNameList &names) { - - osg::ref_ptr ms(new osgSim::MultiSwitch); - if (values.size() > 0) { - size_t nchildren = values[0].size(); - for (size_t i = 0; i < nchildren; i++) { - ms->addChild(new osg::Node); - } - } - - ms->setSwitchSetList(values); - for (size_t i = 0; i < names.size(); i++) { - ms->setValueName(i, names[i]); - } - - osgDB::ReaderWriter *rw = osgDB::Registry::instance()->getReaderWriterForExtension("osgb"); - osg::ref_ptr options = new osgDB::Options; - std::stringstream ss; - - // write - osgDB::ReaderWriter::WriteResult wresult = rw->writeNode(*ms, ss, options); - - // read - osgDB::ReaderWriter::ReadResult rresult = rw->readNode(ss, options); - osg::ref_ptr node = rresult.takeNode(); - - osg::ref_ptr ms2(dynamic_cast(node.get())); - assert2(ms2 != NULL); - - assert2(ms2->getSwitchSetList() == values); - for (size_t i = 0; i < values.size(); i++) { - assert2(ms2->getValueName(i) == names[i]); - } - assert2(ms->getNumChildren() == ms2->getNumChildren()); -} - -int main() -{ - osgSim::MultiSwitch::SwitchSetList values; - osgSim::MultiSwitch::SwitchSetNameList names; - //testSerializer( - // { - // {false, false}, - // {true, true} - // }, - // { "offs", "ons" } - //); - std::vector offs(false, 2); - std::vector ons(true, 2); - values.push_back(offs); - values.push_back(ons); - names.push_back("offs"); - names.push_back("ons"); - testSerializer(values, names); - - //testSerializer({}, {}); - values.clear(); - names.clear(); - testSerializer(values, names); - - //testSerializer( - // { - // { true, true, false, true, false, true } - // }, - // {"stuff"} - //); - values.clear(); - std::vector stuff; - stuff.push_back(true); - stuff.push_back(true); - stuff.push_back(false); - stuff.push_back(true); - stuff.push_back(false); - stuff.push_back(true); - values.push_back(stuff); - - names.clear(); - names.push_back("stuff"); - testSerializer(values, names); - - return 0; -}