Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368162 - Make SWTBotTreeItem/TableItem doubleClick methods more realistic
Summary: Make SWTBotTreeItem/TableItem doubleClick methods more realistic
Status: NEW
Alias: None
Product: SWTBot
Classification: Technology
Component: SWTBot (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-09 09:13 EST by Tim Moore CLA
Modified: 2012-01-09 09:48 EST (History)
0 users

See Also:


Attachments
Patch for SWTBotTreeItem.doubleClick (1.74 KB, text/plain)
2012-01-09 09:15 EST, Tim Moore CLA
no flags Details
Patch which syserrs events from a Tree node (2.44 KB, text/plain)
2012-01-09 09:19 EST, Tim Moore CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Moore CLA 2012-01-09 09:13:18 EST
Build Identifier: M20100909-0800

SWTBotTreeItem.doubleClick fires as follows (in addition to some async stuff beforehand):
---
notifyTree(SWT.Selection, createSelectionEvent(SWT.BUTTON1));
notifyTree(SWT.MouseDown, createMouseEvent(center.x, center.y, 1, SWT.BUTTON1, 1));
notifyTree(SWT.MouseUp, createMouseEvent(center.x, center.y, 1, SWT.BUTTON1, 1));
notifyTree(SWT.MouseDown, createMouseEvent(center.x, center.y, 1, SWT.BUTTON1, 1));
notifyTree(SWT.MouseDoubleClick, createMouseEvent(center.x, center.y, 1, SWT.BUTTON1, 1));
notifyTree(SWT.DefaultSelection);
notifyTree(SWT.MouseUp);
---

We've found this insufficient, and it doesn't match the pattern set by clickXY (e.g. consider MouseEnter et al.).

On Linux I got the following order of events (ignoring paints and similar):

MouseEnter
MouseMove
MouseHover
Activate
FocusIn
MouseDown
Selection
MouseUp
MouseDown
DefaultSelection
MouseDoubleClick
MouseUp
MouseExit
FocusOut
Deactivate

Taking this into consideration, and following the example of clickXY for consistency, I propose to fire the following events. In particular note that the first MouseHover disappears, but a later one is added together with a MouseMove. Also note that FocusOut/Deactivate are swapped - perhaps this order is OS-dependant. I've not investigated this further since it does not affect us.

MouseEnter
MouseMove
Activate
FocusIn
MouseDown
Selection
MouseUp
MouseDown
DefaultSelection
MouseDoubleClick
MouseUp
MouseHover
MouseMove
MouseExit
Deactivate
FocusOut


A further issue is that MouseDoubleClick is currently fired with the wrong number of clicks, i.e. 1 when it should be 2.

Reproducible: Always
Comment 1 Tim Moore CLA 2012-01-09 09:15:38 EST
Created attachment 209205 [details]
Patch for SWTBotTreeItem.doubleClick
Comment 2 Tim Moore CLA 2012-01-09 09:19:23 EST
Created attachment 209206 [details]
Patch which syserrs events from a Tree node

After applying the patch, double click on "Node 1" in the tree to syserr the events that are fired. This isn't a usable automated test, unfortunately.
Comment 3 Tim Moore CLA 2012-01-09 09:48:26 EST
In the case of SWTBotTableItem, there is no double click method, rather SWTBotTable.doubleClick(row, column) is available. This method invokes AbstractSWTBot.doubleClickXY(x, y). There are several issues with that method from the perspective of double clicking on a Table, and I would imagine other things too. In particular:

* Only one mouse down/up cycle.
* Firing of Selection before MouseDown.

But I can't say for certain whether these should hold true for all uses of it in SWTBot? In any case I got the following events when double clicking on a Table (note, interestingly, that for a Table two Selection events are fired whereas for a Tree there was only one):

MouseEnter
MouseMove
Activate
FocusIn
MouseDown
Selection
MouseUp
MouseHover
MouseDown
Selection
DefaultSelection
MouseDoubleClick
MouseUp
MouseMove
MouseMove
MouseExit
Deactivate
FocusOut

So, similarly to above I propose the following order for SWTBotTable.doubleClick(row, column):

MouseEnter
MouseMove
Activate
FocusIn
MouseDown
Selection
MouseUp
MouseDown
Selection
DefaultSelection
MouseDoubleClick
MouseUp
MouseHover
MouseMove
MouseExit
Deactivate
FocusOut

Possibly it would make sense to apply this ordering to AbstractSWTBot.doubleClickXY?