Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333611 - Selection event generated by Tree and Table clicks has a zero statemask value
Summary: Selection event generated by Tree and Table clicks has a zero statemask value
Status: RESOLVED FIXED
Alias: None
Product: SWTBot
Classification: Technology
Component: SWTBot (show other bugs)
Version: 2.0.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 2.0.3   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-05 19:03 EST by John Cortell CLA
Modified: 2011-01-31 14:06 EST (History)
0 users

See Also:


Attachments
Fix (1.92 KB, patch)
2011-01-05 19:05 EST, John Cortell CLA
john.cortell: iplog+
Details | Diff
Projects which reveal the problem (551.19 KB, application/x-zip-compressed)
2011-01-05 19:22 EST, John Cortell CLA
no flags Details
Updated patch that address double-click as well (2.51 KB, patch)
2011-01-06 10:27 EST, John Cortell CLA
john.cortell: iplog+
Details | Diff
Updated reproducibility projects for double-click (1.17 MB, application/x-zip-compressed)
2011-01-06 10:28 EST, John Cortell CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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!