Skip to content

Commit

Permalink
Merge pull request #171 from SeeSharpSoft/master
Browse files Browse the repository at this point in the history
Release 2.8.2
  • Loading branch information
SeeSharpSoft committed Jan 21, 2020
2 parents d13fd2c + 9bc0096 commit 3017b97
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG
@@ -1,7 +1,12 @@
2.8.2
Jan 22, 2020

FIX: horizontal scrolling within table editor #169

2.8.1
Nov 22, 2019

FIX: scrolling within table editor #164
FIX: vertical scrolling within table editor #164

2.8.0
Oct 12, 2019
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -24,7 +24,7 @@ jacocoTestReport {
}

group 'net.seesharpsoft.intellij.plugins'
version '2.8.1'
version '2.8.2'

apply plugin: 'java'
sourceCompatibility = javaVersion
Expand Down
Expand Up @@ -23,6 +23,10 @@ public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent) {
return;
}
csvTableEditor.changeFontSize(amount);
} else if (mouseWheelEvent.isShiftDown()) {
JScrollPane scrollPane = csvTableEditor.getTableScrollPane();
JScrollBar hScrollbar = scrollPane.getHorizontalScrollBar();
hScrollbar.setValue(hScrollbar.getValue() + (int)(SCROLL_FACTOR * mouseWheelEvent.getPreciseWheelRotation()));
} else {
JScrollPane scrollPane = csvTableEditor.getTableScrollPane();
JScrollBar vScrollbar = scrollPane.getVerticalScrollBar();
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/META-INF/plugin.xml
Expand Up @@ -44,7 +44,8 @@

<change-notes><![CDATA[
<pre style="font-family: sans-serif">
FIX: scrolling within table editor #164
FIX: vertical scrolling within table editor #164
FIX: horizontal scrolling within table editor #169
NOTE: IDE versions prior to 2017.3.* are no longer supported!
</pre>
Expand Down
Expand Up @@ -27,7 +27,7 @@ public void testZoomOnCsvTable() {
assertEquals(size + 1, new_size);
}

public void testScrollOnCsvTable() {
public void testVerticalScrollingOnCsvTable() {
CsvTableEditorSwing fileEditor = Mockito.spy(this.fileEditor);

MouseWheelEvent wheelEvent = new MouseWheelEvent(fileEditor.getTable(),
Expand All @@ -37,12 +37,39 @@ public void testScrollOnCsvTable() {

CsvTableEditorMouseWheelListener spiedMouseWheelListener = fileEditor.tableEditorMouseWheelListener;

int scrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
assertEquals(0, scrollValue);
int hScrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
int vScrollValue = fileEditor.getTableScrollPane().getHorizontalScrollBar().getValue();
assertEquals(0, hScrollValue);
assertEquals(0, vScrollValue);
spiedMouseWheelListener.mouseWheelMoved(wheelEvent);
scrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
hScrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
vScrollValue = fileEditor.getTableScrollPane().getHorizontalScrollBar().getValue();

// 90 is max in this case
assertEquals(90, scrollValue);
assertEquals(90, hScrollValue);
assertEquals(0, vScrollValue);
}

public void testHorizontalScrollingOnCsvTable() {
CsvTableEditorSwing fileEditor = Mockito.spy(this.fileEditor);

MouseWheelEvent wheelEvent = new MouseWheelEvent(fileEditor.getTable(),
MouseWheelEvent.MOUSE_WHEEL,JComponent.WHEN_FOCUSED,
MouseWheelEvent.SHIFT_MASK,0,0,0,false, MouseWheelEvent.WHEEL_UNIT_SCROLL,
1,1);

CsvTableEditorMouseWheelListener spiedMouseWheelListener = fileEditor.tableEditorMouseWheelListener;

int hScrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
int vScrollValue = fileEditor.getTableScrollPane().getHorizontalScrollBar().getValue();
assertEquals(0, hScrollValue);
assertEquals(0, vScrollValue);
spiedMouseWheelListener.mouseWheelMoved(wheelEvent);
hScrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
vScrollValue = fileEditor.getTableScrollPane().getHorizontalScrollBar().getValue();

// 90 is max in this case
assertEquals(0, hScrollValue);
assertEquals(90, vScrollValue);
}
}

0 comments on commit 3017b97

Please sign in to comment.