Skip to content

Some test cases fail because comparison of an object to itself returns false #5

@GoogleCodeExporter

Description

@GoogleCodeExporter
test/test_osg.py tests 4 and 5 fail.

Test 4:
{{{
n = osg.Node()
g = osg.Group()
g.addChild(n)
self.failUnless(n.getParent(0) == g) # fails
self.failUnless(g.getChild(0) == n)  # fails

parents = n.getParents()
self.failUnless(parents[0] == g)     # fails
}}}

Test 5:
{{{
sd = osg.ShapeDrawable(osg.Sphere(), None)
geode = osg.Geode()
geode.addDrawable(sd)
self.failUnless(sd.getParent(0) == geode)   # fails
self.failUnless(geode.getDrawable(0) == sd) # fails

drawables = geode.getDrawableList()
self.failUnless(drawables[0] == sd)         # fails
}}}

So it seems there is some copying going on, or for some other reason the
comparison fails. Perhaps it compares the addresses of the ref_ptrs instead
of using ref_ptr::operator== or comparing the pointers directly? Or perhaps
it stores the object in a ref_ptr, and getParent()/getChild()/getDrawable()
returns a pointer, and since the objects are not the same type the
comparison returns false by default?

I have at least verified that sd == sd returns true. This fails though:

{{{
n1 = g.getChild(0)
self.failUness(n1 == n)
}}}

So it would seem it's a copying issue.

Original issue reported on code.google.com by jean.sebastien.guay13@gmail.com on 11 Sep 2009 at 4:23

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions