From: gmungoc Date: Tue, 21 May 2019 16:45:40 +0000 (+0100) Subject: JAL-3273 small correction to expected result calculation X-Git-Tag: Release_2_11_1_0~53^2~22 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=0435cd1ec60c5f90521835a79fb6702220a12a55;p=jalview.git JAL-3273 small correction to expected result calculation --- diff --git a/test/jalview/gui/SeqPanelTest.java b/test/jalview/gui/SeqPanelTest.java index 571c75b..cd0b594 100644 --- a/test/jalview/gui/SeqPanelTest.java +++ b/test/jalview/gui/SeqPanelTest.java @@ -39,8 +39,9 @@ import jalview.gui.SeqPanel.MousePos; import jalview.io.DataSourceType; import jalview.io.FileLoader; import jalview.util.MessageManager; +import jalview.viewmodel.ViewportRanges; -import java.awt.event.InputEvent;import java.awt.EventQueue; +import java.awt.EventQueue; import java.awt.event.MouseEvent; import java.lang.reflect.InvocationTargetException; @@ -722,7 +723,8 @@ public class SeqPanelTest int x = 0; final int charWidth = alignFrame.getViewport().getCharWidth(); assertTrue(charWidth > 0); // sanity check - assertEquals(alignFrame.getViewport().getRanges().getStartRes(), 0); + ViewportRanges ranges = alignFrame.getViewport().getRanges(); + assertEquals(ranges.getStartRes(), 0); /* * mouse at top left of unwrapped panel @@ -763,8 +765,10 @@ public class SeqPanelTest false, 0); SeqCanvas seqCanvas = alignFrame.alignPanel.getSeqPanel().seqCanvas; int w = seqCanvas.getWidth(); - // limited to number of whole columns, base 0 - int expected = w / charWidth - 1; + // limited to number of whole columns, base 0, + // and to end of visible range + int expected = w / charWidth; + expected = Math.min(expected, ranges.getEndRes()); assertEquals(testee.findColumn(evt), expected); /*