GT-0 fixing junit tests

This commit is contained in:
ghidravore 2019-12-23 16:15:32 -05:00
parent 6a68e1f2dd
commit bca65330a8

View file

@ -1255,8 +1255,7 @@ public class FieldPanel extends JPanel
final FieldLocation loc = new FieldLocation(cursorPosition); final FieldLocation loc = new FieldLocation(cursorPosition);
final Field field = cursorHandler.getCurrentField(); final Field field = cursorHandler.getCurrentField();
SystemUtilities.runSwingLater(() -> { SystemUtilities.runSwingLater(() -> {
for (int i = 0; i < fieldMouseListeners.size(); i++) { for (FieldMouseListener l : fieldMouseListeners) {
FieldMouseListener l = fieldMouseListeners.get(i);
l.buttonPressed(loc, field, ev); l.buttonPressed(loc, field, ev);
} }
}); });
@ -1278,8 +1277,7 @@ public class FieldPanel extends JPanel
*/ */
private void notifySelectionChanged(EventTrigger trigger) { private void notifySelectionChanged(EventTrigger trigger) {
FieldSelection currentSelection = new FieldSelection(selection); FieldSelection currentSelection = new FieldSelection(selection);
for (int i = 0; i < selectionListeners.size(); i++) { for (FieldSelectionListener l : selectionListeners) {
FieldSelectionListener l = selectionListeners.get(i);
l.selectionChanged(currentSelection, trigger); l.selectionChanged(currentSelection, trigger);
} }
} }
@ -1290,8 +1288,7 @@ public class FieldPanel extends JPanel
private void notifyHighlightChanged() { private void notifyHighlightChanged() {
FieldSelection currentSelection = new FieldSelection(highlight); FieldSelection currentSelection = new FieldSelection(highlight);
for (int i = 0; i < highlightListeners.size(); i++) { for (FieldSelectionListener l : highlightListeners) {
FieldSelectionListener l = highlightListeners.get(i);
l.selectionChanged(currentSelection, EventTrigger.API_CALL); l.selectionChanged(currentSelection, EventTrigger.API_CALL);
} }
} }
@ -1646,7 +1643,13 @@ public class FieldPanel extends JPanel
} }
cursorHandler.setCursorPos(e.getX(), e.getY(), EventTrigger.GUI_ACTION); cursorHandler.setCursorPos(e.getX(), e.getY(), EventTrigger.GUI_ACTION);
if (!selectionHandler.isInProgress() && !didDrag) { if (didDrag) {
// Send an event after the drag is finished. Event are suppressed while dragging,
// meaning that the above call to setCursorPos() will not have fired an event
// because the internal cursor position did not change during the mouse release.
cursorHandler.notifyCursorChanged(EventTrigger.GUI_ACTION);
}
else if (!selectionHandler.isInProgress()) {
selectionHandler.clearSelection(); selectionHandler.clearSelection();
} }
selectionHandler.endSelectionSequence(); selectionHandler.endSelectionSequence();
@ -2111,8 +2114,7 @@ public class FieldPanel extends JPanel
} }
FieldLocation currentLocation = new FieldLocation(cursorPosition); FieldLocation currentLocation = new FieldLocation(cursorPosition);
for (int i = 0; i < cursorListeners.size(); i++) { for (FieldLocationListener l : cursorListeners) {
FieldLocationListener l = cursorListeners.get(i);
l.fieldLocationChanged(currentLocation, currentField, trigger); l.fieldLocationChanged(currentLocation, currentField, trigger);
} }
@ -2150,8 +2152,7 @@ public class FieldPanel extends JPanel
private void notifyInputListeners(KeyEvent ev) { private void notifyInputListeners(KeyEvent ev) {
if (cursorOn) { if (cursorOn) {
for (int i = 0; i < inputListeners.size(); i++) { for (FieldInputListener l : inputListeners) {
FieldInputListener l = inputListeners.get(i);
l.keyPressed(ev, cursorPosition.getIndex(), cursorPosition.fieldNum, l.keyPressed(ev, cursorPosition.getIndex(), cursorPosition.fieldNum,
cursorPosition.row, cursorPosition.col, currentField); cursorPosition.row, cursorPosition.col, currentField);
} }