From: gmungoc Date: Thu, 1 Jun 2017 12:33:26 +0000 (+0100) Subject: JAL-2563 JAL-2547 amended unit tests for amended setStatusMessage X-Git-Tag: Release_2_10_3b1~219 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=173080a606f4e91665be2d9f67ed1271390a4c82;p=jalview.git JAL-2563 JAL-2547 amended unit tests for amended setStatusMessage --- 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)"); } }