Hi SWTBot gurus,
I am using SWTBotMenuItem to post some doubleClick events to a Tree.
The events got posted correctly but without the mouse coordinates which make impossible to determine which TreeItem the double click was made to.
I took a look at the doubleClick() method in SWTBotMenuItem and it posts event without the mouse coordinates.
public SWTBotTreeItem doubleClick() {
assertEnabled();
asyncExec(new VoidResult() {
public void run() {
tree.setSelection(widget);
}
});
notifyTree(SWT.Selection);
notifyTree(SWT.MouseDown);
notifyTree(SWT.MouseUp);
notifyTree(SWT.MouseDown);
notifyTree(SWT.MouseDoubleClick);
notifyTree(SWT.DefaultSelection);
notifyTree(SWT.MouseUp);
return this;
}
should it not be something like
int x = cellBounds.x + (cellBounds.width / 2);
int y = cellBounds.y + (cellBounds.height / 2);
notifyTree(SWT.Selection);
notifyTree(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
notifyTree(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
notifyTree(SWT.MouseDown, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
notifyTree(SWT.MouseDoubleClick, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
notifyTree(SWT.DefaultSelection);
notifyTree(SWT.MouseUp, createMouseEvent(x, y, 1, SWT.BUTTON1, 1));
Or is there any other method to get the TreeItem when SWTBot is posting doubleclick events?
Thanks,
Luchesar