From: kiramt Date: Fri, 17 Feb 2017 13:17:32 +0000 (+0000) Subject: JAL-2421 incomplete unit test X-Git-Tag: Release_2_10_3b1~339^2~1^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=c3ea4d2f3fd04a817a5f0c9bac5652c106928eee;p=jalview.git JAL-2421 incomplete unit test --- diff --git a/test/jalview/gui/AlignmentPanelTest.java b/test/jalview/gui/AlignmentPanelTest.java index 5c5890e..b77dd98 100644 --- a/test/jalview/gui/AlignmentPanelTest.java +++ b/test/jalview/gui/AlignmentPanelTest.java @@ -22,12 +22,12 @@ package jalview.gui; import static org.testng.Assert.assertEquals; -import jalview.bin.Jalview; import jalview.datamodel.Alignment; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; -import org.testng.annotations.AfterMethod; +import java.awt.Dimension; + import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; @@ -130,15 +130,6 @@ public class AlignmentPanelTest { JvOptionPane.setInteractiveMode(false); JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); - - Jalview.main(new String[] { "-nonews", "-props", - "test/jalview/testProps.jvprops" }); - } - - @AfterMethod(alwaysRun = true) - public void tearDown() - { - Desktop.instance.closeAll_actionPerformed(null); } /** @@ -153,25 +144,26 @@ public class AlignmentPanelTest seq16, seq17, seq18, seq19, seq20, seq21, seq22, seq23 }; Alignment al = new Alignment(seqs); al.setDataset(null); - AlignViewport av = new AlignViewport(al); - AlignFrame alignFrame = new AlignFrame(al, 700, 500); - AlignmentPanel ap = new AlignmentPanel(alignFrame, av); + AlignFrame alignFrame = new AlignFrame(al, 500, 700); + + alignFrame.alignPanel.getSeqPanel().seqCanvas + .setPreferredSize(new Dimension(300, 300)); - int oldres = av.getEndRes(); - ap.setScrollValues(-1, 5); + int oldres = alignFrame.getViewport().getEndRes(); + alignFrame.alignPanel.setScrollValues(-1, 5); // setting -ve x value does not change residue - assertEquals(av.getEndRes(), oldres); + assertEquals(alignFrame.getViewport().getEndRes(), oldres); - ap.setScrollValues(0, 5); + alignFrame.alignPanel.setScrollValues(0, 5); // setting 0 as x value does not change residue - assertEquals(av.getEndRes(), oldres); + assertEquals(alignFrame.getViewport().getEndRes(), oldres); - ap.setScrollValues(5, 5); + alignFrame.alignPanel.setScrollValues(5, 5); // setting x value to 20 extends endRes by 20px converted to residues - assertEquals(av.getEndRes(), oldres + 5); + assertEquals(alignFrame.getViewport().getEndRes(), oldres + 5); }