Show
Ignore:
Timestamp:
12/03/07 17:54:44 (1 year ago)
Author:
cneumann
Message:

fixed: added missing _fieldType instantiations

VRML loader compiles (not sure if it works though)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Carsten_PtrWork2/Source/System/FieldContainer/Base/OSGReferenceCountTest.cpp

    r1030 r1031  
    4949{ 
    5050 
    51 TEST(ChildLinkingCleanup1
     51TEST(BasicStructure
    5252{ 
    5353    // Basic case, two nodes, each with it's own core. 
     
    136136} 
    137137 
    138 TEST(ChildLinkingCleanup2) 
     138TEST(RefPtrReuse) 
     139
     140    // Still basic case, but use fewer ref ptrs 
     141    // 
     142    //  np0[gp0] 
     143    //   +-----------+ 
     144    //  np1[gp0]    np2[gp0] 
     145     
     146    OSG::NodeRefPtr     nrp0(OSG::Node ::create()); 
     147    OSG::NodeRefPtr     nrp1(OSG::Node ::create()); 
     148    OSG::NodeCoreRefPtr grp (OSG::Group::create()); 
     149     
     150    OSG::NodePtr     np0(nrp0.get()); 
     151    OSG::NodePtr     np1(nrp1.get()); 
     152    OSG::NodeCorePtr gp0(grp .get()); 
     153     
     154    OSG::UInt32 ni0 = OSG::getContainerId(nrp0); 
     155    OSG::UInt32 ni1 = OSG::getContainerId(nrp1); 
     156    OSG::UInt32 gi0 = OSG::getContainerId(grp); 
     157     
     158    nrp0->setCore (grp ); 
     159    nrp0->addChild(nrp1); 
     160     
     161    nrp1->setCore(grp); 
     162     
     163    nrp1 = OSG::Node::create(); 
     164     
     165    OSG::NodePtr np2(nrp1.get()); 
     166    OSG::UInt32  ni2 = OSG::getContainerId(nrp1); 
     167     
     168    nrp0->addChild(nrp1); 
     169    nrp1->setCore (grp ); 
     170     
     171    CHECK_EQUAL(np0->getRefCount(),         0); 
     172    CHECK_EQUAL(np0->getExternalRefCount(), 1); 
     173    CHECK_EQUAL(np0->getWeakRefCount(),     3); 
     174     
     175    CHECK_EQUAL(np1->getRefCount(),         1); 
     176    CHECK_EQUAL(np1->getExternalRefCount(), 0); 
     177    CHECK_EQUAL(np1->getWeakRefCount(),     1); 
     178     
     179    CHECK_EQUAL(np2->getRefCount(),         1); 
     180    CHECK_EQUAL(np2->getExternalRefCount(), 1); 
     181    CHECK_EQUAL(np2->getWeakRefCount(),     1); 
     182     
     183    CHECK_EQUAL(gp0->getRefCount(),         3); 
     184    CHECK_EQUAL(gp0->getExternalRefCount(), 1); 
     185    CHECK_EQUAL(gp0->getWeakRefCount(),     0); 
     186     
     187    // remove all ref pointers (i.e. all external refs) 
     188     
     189    nrp1 = NullFC; 
     190    grp  = NullFC; 
     191     
     192    // all containers must still exist 
     193    CHECK_EQUAL(OSG::FieldContainerFactory::the()->getContainer(gi0), gp0); 
     194    CHECK_EQUAL(OSG::FieldContainerFactory::the()->getContainer(ni0), np0); 
     195    CHECK_EQUAL(OSG::FieldContainerFactory::the()->getContainer(ni1), np1); 
     196    CHECK_EQUAL(OSG::FieldContainerFactory::the()->getContainer(ni2), np2); 
     197     
     198    nrp0 = NullFC; 
     199     
     200    // all containers must be gone 
     201    CHECK_EQUAL(OSG::FieldContainerFactory::the()->getContainer(gi0), OSG::FieldContainerPtr(NullFC)); 
     202    CHECK_EQUAL(OSG::FieldContainerFactory::the()->getContainer(ni0), OSG::FieldContainerPtr(NullFC)); 
     203    CHECK_EQUAL(OSG::FieldContainerFactory::the()->getContainer(ni1), OSG::FieldContainerPtr(NullFC)); 
     204    CHECK_EQUAL(OSG::FieldContainerFactory::the()->getContainer(ni2), OSG::FieldContainerPtr(NullFC)); 
     205
     206 
     207TEST(SharedCore) 
    139208{ 
    140209    // A bit more complex, two nodes with a shared core 
     
    256325} 
    257326 
    258 TEST(ChildLinkingCleanup3
     327TEST(MultipleChildrenSharedCores
    259328{ 
    260329    // Test a bit more complex hierarchy, with two shared cores