Carsten Neumann wrote:

>       Hi,
>
>I think I got Allen's OSGNodeTest working (one test still fails, but due
>to a potential bug). I'll just attach it. The OSGInitFixture should go
>into the UnitTestUtil dir and all tests that require a call to osgInit
>need to use a fixture that derives from OSGInitFixture.
>  
>
I was thinking we could just put the init call in the main test runner.  
That way we can ensure that init has been called before any tests are 
run and we don't have to deal with fixtures every time.  In my opinion 
this would make the tests simpler and avoid bugs.

The only issue I see with that approach (or yours) is what happens when 
we get to a test where we want to test multiple aspects.  As I 
understand it, the number of aspects is fixed at init time in OpenSG 
1.x.  Is there any way with OpenSG 2.0 to adjust the number of aspects 
at run time?

-Allen

>Comments ?
>
>       Carsten
>  
>
>------------------------------------------------------------------------
>
>
>#include <UnitTest++.h>
>
>// Unit tests for vec classes
>
>#include <OpenSG/OSGNode.h>
>#include <OpenSG/OSGNameAttachment.h>
>
>namespace {
>
>struct OSGInitFixture
>{
>    OSGInitFixture(void)
>    {
>        if(initRun == false)
>        {
>            initRun = true;
>            OSG::osgInit(0, 0);
>        }
>    }
>    
>    ~OSGInitFixture(void)
>    {
>    }
>    
>    static bool initRun;
>};
>
>bool OSGInitFixture::initRun = false;
>
>TEST_FIXTURE(OSGInitFixture, CreateNode)
>{
>   OSG::NodePtr n = OSG::Node::create();
>   CHECK(n != OSG::NullFC);
>}
>
>TEST_FIXTURE(OSGInitFixture, AddChild)
>{
>    OSG::NodePtr n = OSG::Node::create();
>    OSG::NodePtr c = OSG::Node::create();
>    
>    n->addChild(c);
>    CHECK_EQUAL(n->getNChildren(), 1);
>    CHECK_EQUAL(c->getParent(), n);
>}
>
>// --- Cloning --- //
>TEST_FIXTURE(OSGInitFixture, TreeCloningName)
>{
>   OSG::NodePtr root = OSG::Node::create();
>   OSG::NodePtr child_node = OSG::Node::create();
>   root->addChild(child_node);
>   OSG::setName(root, "root");
>   OSG::setName(child_node, "child_node");
>   
>   OSG::NodePtr new_root = OSG::cloneTree(root);
>   
>   CHECK(new_root->getNChildren() == 1);
>   CHECK(new_root != root);
>   CHECK(new_root->getChild(0) != child_node);
>   
>   // the next two tests fail - looks like something goes wrong in clone wrt
>   // attachments...
>   CHECK(OSG::getName(new_root) != 0);
>   
>   std::string new_name = OSG::getName(new_root);
>   CHECK(new_name == "root");   
>}
>
>}
>  
>
>------------------------------------------------------------------------
>
>-------------------------------------------------------------------------
>Take Surveys. Earn Cash. Influence the Future of IT
>Join SourceForge.net's Techsay panel and you'll get the chance to share your
>opinions on IT & business topics through brief surveys -- and earn cash
>http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Opensg-core mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/opensg-core
>  
>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core

Reply via email to