Community
Participate
Working Groups
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
Created attachment 209205 [details] Patch for SWTBotTreeItem.doubleClick
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.
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?