TestFX/TestFX — pull request #95 by lgringo (2014-06-18 19:59:46+00:00)
Title: Fix scroll direction as UP was going down (and DOWN up).

When FxRobot has been refactored, Up and Down scroll have been inverted.

Old code :

/**
* Scrolls the mouse-wheel a given number of notches in a direction.
*
* @param amount the number of notches to scroll
* @param direction
* @return
*/
public GuiTest scroll(int amount, VerticalDirection direction) {
for (int x = 0; x < Math.abs(amount); x++) {
screenRobot.scrollMouse(directionToInteger(direction));
}
return this;
}

private int directionToInteger(VerticalDirection direction) {
if (direction == VerticalDirection.UP)
return -1;
return 1;
}

Actual code is :
@Override
public void scroll(int amount) {
if (amount >= 0) {
scrollUp(amount);
}
else {
scrollDown(Math.abs(amount));
}
}
[...]
@Override
public void scrollUp(int positiveAmount) {
for (int scrollTick = 0; scrollTick < positiveAmount; scrollTick++) {
screenRobot.scrollMouse(1);
}
}

@Override
public void scrollDown(int positiveAmount) {
for (int scrollTick = 0; scrollTick < positiveAmount; scrollTick++) {
screenRobot.scrollMouse(-1);
}
}

Regression test added (I hope the Duke with a guitar image do not have a copyright).