- Code: Select all
isShellUnderPointerActive
self adapterUnderPointer isNil
ifTrue: [^false].
^self adapterUnderPointer widgetShell == CwWMShell focusShell or:
[self adapterUnderPointer visualPolicy notNil and:
[self adapterUnderPointer visualPolicy popupWhenShellInactive == true]]
I got a "UndefinedObject does not understand visualPolicy". That's clearly a problem of "self adapterUnderPointer" toggling between the different calls. To my mind code like this must always use a local variable, where the result of the method call is stored, independently of whether the method call returns only a member variable or does some crazy calculation.
Code like the one above (with multiple method calls meaning to return the identical object) can probably be found in many more places throughout the system. Isn't that a very general problem? I guess that the chance of actually running into this problem is really small as typical user generated UI events just don't come fast enough into the message queue. But we see problems like this occur more often with automated UI testing (where the code is under much higher stress).
Does anyone else experience problems like this with automated UI testing? If so, what do you to get around these issues?