Community
Participate
Working Groups
I have a program I've been testing with SWTBot that has a jFace TreeViewer. The program has a selection listener registered with the Tree that reacts in a particular way when it detects that the selection happened via a mouse click (as opposed to a key arrow press). The way it does that is by looking at the statemask value in the event. It turns out that simulating a mouse click with SWTBot causes the listener to receive an event with statemask set to zero instead of SWT.BUTTON1 for left mouse button or SWT.BUTTON3 for right mouse button. So, my program doesn't react as expected--as it does when a real user clicks on the Tree element. The same problem is present for a Table viewer. I've attached a program that reproduces what my program does and an SWTBot test class which fails because of the bug in SWTBot. With my fix to SWTBot (also included), the test passes as expected.
Created attachment 186136 [details] Fix
Created attachment 186138 [details] Projects which reveal the problem Follow the instructions in the readme.txt included in the zip.
Created attachment 186173 [details] Updated patch that address double-click as well
Created attachment 186175 [details] Updated reproducibility projects for double-click
I've marked this as fixed in revision 1357ba (https://github.com/ketan/SWTBot/commit/1357babfcc236b2956eb8677a062924d67c167f5) I could not close this bug because my bugzilla account was locked out. Please verify the patch to see if you're OK with it, and reopen bug if you think there's more to what I've done.
Tested fix with my (attached) test case. Confirmed fixed. Thanks!