@Test
public void testClickWithPositionToPython() throws Exception {
MouseEvent e = new MouseEvent(new JLabel("DummyLabelComponent"), MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(),
InputEvent.BUTTON1_DOWN_MASK, 5, 5, 1, false);
ClickAction normalClick = new ClickAction(new ComponentId("button.name"), e, ClickAction.RECORD_EX,
ScriptModelServerPart.getModelServerPart(), WindowMonitor.getInstance());
String expected = "click('button.name', 5, 5)\n";
assertEquals(expected, normalClick.toScriptCode());
e = new MouseEvent(new JLabel("DummyLabelComponent"), MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(),
InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON1_DOWN_MASK, 5, 5, 1, false);
ClickAction ctrlClick = new ClickAction(new ComponentId("button.name"), e, ClickAction.RECORD_EX,
ScriptModelServerPart.getModelServerPart(), WindowMonitor.getInstance());
expected = "click('button.name', 5, 5, 'Ctrl')\n";
assertEquals(expected, ctrlClick.toScriptCode());
e = new MouseEvent(new JLabel("DummyLabelComponent"), MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(),
InputEvent.CTRL_DOWN_MASK | InputEvent.BUTTON3_DOWN_MASK, 5, 5, 1, false);
ClickAction ctrlRightClick = new ClickAction(new ComponentId("button.name"), e, ClickAction.RECORD_EX,
ScriptModelServerPart.getModelServerPart(), WindowMonitor.getInstance());
expected = "rightclick('button.name', 5, 5, 'Ctrl')\n";
assertEquals(expected, ctrlRightClick.toScriptCode());
e = new MouseEvent(new JLabel("DummyLabelComponent"), MouseEvent.MOUSE_CLICKED, System.currentTimeMillis(),
InputEvent.CTRL_DOWN_MASK | InputEvent.ALT_DOWN_MASK | InputEvent.BUTTON3_DOWN_MASK, 5, 5, 1, false);
ClickAction ctrlAltRightClick = new ClickAction(new ComponentId("button.name"), e, ClickAction.RECORD_EX,
ScriptModelServerPart.getModelServerPart(), WindowMonitor.getInstance());
expected = "rightclick('button.name', 5, 5, 'Ctrl+Alt')\n";
assertEquals(expected, ctrlAltRightClick.toScriptCode());
}