Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333611

Summary: Selection event generated by Tree and Table clicks has a zero statemask value
Product: [Technology] SWTBot Reporter: John Cortell <john.cortell>
Component: SWTBotAssignee: Project Inbox <swtbot-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0.2   
Target Milestone: 2.0.3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix
john.cortell: iplog+
Projects which reveal the problem
none
Updated patch that address double-click as well
john.cortell: iplog+
Updated reproducibility projects for double-click none

Description John Cortell CLA 2011-01-05 19:03:31 EST
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.
Comment 1 John Cortell CLA 2011-01-05 19:05:56 EST
Created attachment 186136 [details]
Fix
Comment 2 John Cortell CLA 2011-01-05 19:22:22 EST
Created attachment 186138 [details]
Projects which reveal the problem

Follow the instructions in the readme.txt included in the zip.
Comment 3 John Cortell CLA 2011-01-06 10:27:25 EST
Created attachment 186173 [details]
Updated patch that address double-click as well
Comment 4 John Cortell CLA 2011-01-06 10:28:45 EST
Created attachment 186175 [details]
Updated reproducibility projects for double-click
Comment 5 Ketan Padegaonkar CLA 2011-01-28 22:11:15 EST
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.
Comment 6 John Cortell CLA 2011-01-31 14:06:07 EST
Tested fix with my (attached) test case. Confirmed fixed. Thanks!