isAncestorInvisible return value.

25 views
Skip to first unread message

Barnaby Robson

unread,
Oct 29, 2012, 4:48:12 PM10/29/12
to alemb...@googlegroups.com
Hey Guys,

Not sure if you've had a chance to look at Visibility.cpp yet but it
does seem like it isAncestorInvisible is backwards.

There are three (really only two) possible ways that isAncestorInvisible
can return. The second and third are just at the end of the function
where it checks the visibilityValue against kVisibilityHidden. If the
visibility value is "hidden" then that should mean that it is invisible
so it should return true (not false as it currently does).

The first way of returning could also be an issue.

IObject currentObject = iObject;
while ( (visibilityValue == kVisibilityDeferred) )
{
// go up a level
currentObject = currentObject.getParent();
if (! currentObject )
{
return true;
}
...

It's saying that if your initial value is deferred and there is no
parent above you to say otherwise then yes you are deemed to be
invisible. That seems wrong to me .. but then either could be the
"correct" way but you guys would know for sure.

Thanks !

barnaby.



Lucas Miller

unread,
Oct 29, 2012, 4:57:22 PM10/29/12
to alemb...@googlegroups.com
I looked at it briefly last week and noticed this as well, but haven't had a chance to fix it and add the appropriate unit tests.

If you have no parent above you, and YOUR visibility is deferred you are supposed to be visible.

Lucas 

Barnaby Robson

unread,
Oct 29, 2012, 5:00:10 PM10/29/12
to alemb...@googlegroups.com
Ok cool so then at least every return value is consistently wrong :)

barnaby.

Lucas Miller

unread,
Oct 29, 2012, 5:03:12 PM10/29/12
to alemb...@googlegroups.com
Unfortunately no.

If the object you are testing (or a parent object) is invisible (or marked specifically visible) then I think it will return the correct value.

I *think* it's only wrong for the deferred at root case.
This is why more unit tests are necessary here.

Lucas
Reply all
Reply to author
Forward
0 new messages