package jalview.gui;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
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");
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")
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)");
}
}