Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Mar 14, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 11 Sep 2009 at 4:23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant