From 57a15d5858abedcd0ae22114d3e11d176d079a2e Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 15 Jun 2017 14:22:11 +0100 Subject: [PATCH] JAL-2563 test updated for fix --- test/jalview/gui/SeqPanelTest.java | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/test/jalview/gui/SeqPanelTest.java b/test/jalview/gui/SeqPanelTest.java index 53dff0e..a5d244d 100644 --- a/test/jalview/gui/SeqPanelTest.java +++ b/test/jalview/gui/SeqPanelTest.java @@ -21,7 +21,6 @@ package jalview.gui; import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; @@ -42,7 +41,7 @@ public class SeqPanelTest JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); } @Test(groups = "Functional") - public void testSetStatusReturnsPosOrMinusOne() + public void testSetStatusReturnsNearestResiduePosition() { SequenceI seq1 = new Sequence("Seq1", "AACDE"); SequenceI seq2 = new Sequence("Seq2", "AA--E"); @@ -50,21 +49,27 @@ public class SeqPanelTest AlignFrame alignFrame = new AlignFrame(al, al.getWidth(), al.getHeight()); AlignmentI visAl = alignFrame.getViewport().getAlignment(); + // Test either side of gap - // This first assert fails due to JAL-2563 assertEquals( alignFrame.alignPanel.getSeqPanel().setStatusMessage( visAl.getSequenceAt(1), 1, 1), 2); + assertEquals(alignFrame.statusBar.getText(), + "Sequence 2 ID: Seq2 Residue: ALA (2)"); assertEquals( alignFrame.alignPanel.getSeqPanel().setStatusMessage( visAl.getSequenceAt(1), 4, 1), 3); - // Test gaps are -1 + assertEquals(alignFrame.statusBar.getText(), + "Sequence 2 ID: Seq2 Residue: GLU (3)"); + // no status message at a gap, returns next residue position to the right assertEquals( alignFrame.alignPanel.getSeqPanel().setStatusMessage( - visAl.getSequenceAt(1), 2, 1), -1); + visAl.getSequenceAt(1), 2, 1), 3); + assertEquals(alignFrame.statusBar.getText(), "Sequence 2 ID: Seq2"); assertEquals( alignFrame.alignPanel.getSeqPanel().setStatusMessage( - visAl.getSequenceAt(1), 3, 1), -1); + visAl.getSequenceAt(1), 3, 1), 3); + assertEquals(alignFrame.statusBar.getText(), "Sequence 2 ID: Seq2"); } @Test(groups = "Functional") @@ -76,11 +81,11 @@ public class SeqPanelTest AlignFrame alignFrame = new AlignFrame(al, al.getWidth(), al.getHeight()); AlignmentI visAl = alignFrame.getViewport().getAlignment(); - // Test either side of gap - // This first assert fails due to JAL-2563 + assertEquals( alignFrame.alignPanel.getSeqPanel().setStatusMessage( visAl.getSequenceAt(1), 1, 1), 2); - assertTrue(alignFrame.statusBar.getText().contains("(2)")); + assertEquals(alignFrame.statusBar.getText(), + "Sequence 2 ID: Seq2 Residue: B (2)"); } } -- 1.7.10.2