+
+ /**
+ * Test simulates loading an unwrapped alignment, shrinking it vertically so
+ * not all sequences are visible, then changing to wrapped mode. The ranges
+ * endSeq should be unchanged, but the vertical repeat height should include
+ * all sequences.
+ */
+ @Test(groups = "Functional")
+ public void testCalculateWrappedGeometry_fromScrolled()
+ {
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+ "examples/uniref50.fa", DataSourceType.FILE);
+ AlignViewport av = af.getViewport();
+ AlignmentI al = av.getAlignment();
+ assertEquals(al.getWidth(), 157);
+ assertEquals(al.getHeight(), 15);
+ String ss = "";
+ av.getRanges().setStartEndSeq(0, 3);
+
+ String s = "";
+ s += " SC1 " + av.getRanges();
+ av.setShowAnnotation(false);
+ s += " SC2 " + av.getRanges();
+ av.setScaleAboveWrapped(true);
+ s += " SC3 " + av.getRanges();
+ SeqCanvas testee = af.alignPanel.getSeqPanel().seqCanvas;
+ av.setWrapAlignment(true);
+ s += " SC4 " + av.getRanges();
+ av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
+ int charHeight = av.getCharHeight();
+ int charWidth = av.getCharWidth();
+ // Windows h=19, w=11; Mac (and Linux?) 17,11
+ Assert.assertTrue(charHeight == 17 && charWidth == 12
+ || charHeight == 19 && charWidth == 11,
+ "char height/width " + charHeight + "/" + charWidth);
+ int canvasWidth = 400;
+ int canvasHeight = 300;
+ testee.calculateWrappedGeometry(canvasWidth, canvasHeight);
+
+ s += " SC5 " + av.getRanges();
+ int repeatingHeight = (int) PA.getValue(testee,
+ "wrappedRepeatHeightPx");
+ assertEquals(av.getRanges().getEndSeq(), 0, "endSeq should be 3 " + s); // unchanged
+ assertEquals(repeatingHeight, charHeight * (2 + al.getHeight()));
+ }