From: BobHanson Date: Wed, 10 Jun 2020 22:49:51 +0000 (-0500) Subject: Bamboo #36 checking component sizes X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d0520ee1359d7300dc5e69b6159ccd7488bd3a95;p=jalview.git Bamboo #36 checking component sizes --- diff --git a/test/jalview/gui/SeqCanvasTest.java b/test/jalview/gui/SeqCanvasTest.java index 0e14a6b..b426562 100644 --- a/test/jalview/gui/SeqCanvasTest.java +++ b/test/jalview/gui/SeqCanvasTest.java @@ -43,8 +43,9 @@ public class SeqCanvasTest @BeforeClass(alwaysRun = true) public void setUp() { - Jalview.setInteractive(false); + Cache.loadProperties(null); Cache.initLogger(); + Desktop.getInstance().setVisible(false); } /** @@ -56,6 +57,7 @@ public class SeqCanvasTest { AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( "examples/uniref50.fa", DataSourceType.FILE); + AlignViewport av = af.getViewport(); AlignmentI al = av.getAlignment(); assertEquals(al.getWidth(), 157); @@ -329,35 +331,39 @@ public class SeqCanvasTest { AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( "examples/uniref50.fa", DataSourceType.FILE); + // The thing is that + System.out.println("ap dim = " + af.alignPanel.getSize()); + System.out.println("seqpan dim = " + af.alignPanel.getSeqPanel().getSize()); + System.out.println("seqcan dim = " + af.alignPanel.getSeqPanel().seqCanvas.getSize()); + + AlignViewport av = af.getViewport(); AlignmentI al = av.getAlignment(); assertEquals(al.getWidth(), 157); assertEquals(al.getHeight(), 15); ViewportRanges ranges = av.getRanges(); + System.out.println(ranges + " before setting to 3"); ranges.setStartEndSeq(0, 3); - System.out.println(ranges); + int endSeq = ranges.getEndSeq(); + System.out.println(ranges + " after setting to 3"); av.setShowAnnotation(false); av.setScaleAboveWrapped(true); - System.out.println(ranges); SeqCanvas testee = af.alignPanel.getSeqPanel().seqCanvas; av.setWrapAlignment(true); - System.out.println(ranges); av.setFont(new Font("SansSerif", Font.PLAIN, 14), true); int charHeight = av.getCharHeight(); int charWidth = av.getCharWidth(); - System.out.println(ranges); // Windows h=19, w=11. assertEquals(charHeight, !Platform.isWin() ? 17 : 19); assertEquals(charWidth, !Platform.isWin() ? 12 : 11); - System.out.println(ranges); int canvasWidth = 400; int canvasHeight = 300; testee.calculateWrappedGeometry(canvasWidth, canvasHeight); System.out.println(ranges); - assertEquals(ranges.getEndSeq(), 3); // unchanged + assertEquals(ranges.getEndSeq(), endSeq); // unchanged int repeatingHeight = (int) PA.getValue(testee, "wrappedRepeatHeightPx"); int h = charHeight * (2 + al.getHeight());