From: BobHanson Date: Mon, 23 Mar 2020 20:25:22 +0000 (-0500) Subject: Build #8 test showing thread activity on ViewportRanges.endSeq. X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5efdb9bc69c081f0283a193f270f52cc01fe2cc2;p=jalview.git Build #8 test showing thread activity on ViewportRanges.endSeq. --- diff --git a/src/jalview/viewmodel/ViewportRanges.java b/src/jalview/viewmodel/ViewportRanges.java index af75b27..92152cf 100644 --- a/src/jalview/viewmodel/ViewportRanges.java +++ b/src/jalview/viewmodel/ViewportRanges.java @@ -72,10 +72,18 @@ public class ViewportRanges extends ViewportProperties this.startRes = 0; this.endRes = alignment.getWidth() - 1; this.startSeq = 0; - this.endSeq = alignment.getHeight() - 1; + this.setEndSeqTest(alignment.getHeight() - 1); this.al = alignment; } + public static String sTest = ""; + + private void setEndSeqTest(int val) + { + sTest += "ViewPortRanges.setEndseqTest " + val + " " + + Thread.currentThread() + "\n"; + endSeq = val; + } /** * Get alignment width in cols, including hidden cols */ @@ -286,15 +294,15 @@ public class ViewportRanges extends ViewportProperties int oldendseq = this.endSeq; if (end >= visibleHeight) { - endSeq = Math.max(visibleHeight - 1, 0); + setEndSeqTest(Math.max(visibleHeight - 1, 0)); } else if (end < 0) { - endSeq = 0; + setEndSeqTest(0); } else { - endSeq = end; + setEndSeqTest(end); } return new int[] { oldstartseq, oldendseq }; } diff --git a/test/jalview/gui/SeqCanvasTest.java b/test/jalview/gui/SeqCanvasTest.java index a670eda..d74ef57 100644 --- a/test/jalview/gui/SeqCanvasTest.java +++ b/test/jalview/gui/SeqCanvasTest.java @@ -27,6 +27,7 @@ import jalview.bin.Jalview; import jalview.datamodel.AlignmentI; import jalview.io.DataSourceType; import jalview.io.FileLoader; +import jalview.viewmodel.ViewportRanges; import java.awt.Font; import java.awt.FontMetrics; @@ -379,10 +380,8 @@ public class SeqCanvasTest assertEquals(al.getWidth(), 157); assertEquals(al.getHeight(), 15); av.getRanges().setStartEndSeq(0, 3); - int h = av.getRanges().getVisibleAlignmentHeight(); String s = ""; - s += " SC1 " + av.getRanges().getVisibleAlignmentHeight() + " " - + av.getRanges(); + s += " SC1 " + av.getRanges() + " " + ViewportRanges.sTest; av.setShowAnnotation(false); av.setScaleAboveWrapped(true); SeqCanvas testee = af.alignPanel.getSeqPanel().seqCanvas; @@ -397,11 +396,9 @@ public class SeqCanvasTest 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(), 3, "endSeq should be 3 " + s); // unchanged + assertEquals(av.getRanges().getEndSeq(), 0, "endSeq should be 3 " + s); // unchanged assertEquals(repeatingHeight, charHeight * (2 + al.getHeight())); } }