From: Mungo Carstairs Date: Tue, 22 Oct 2019 13:21:10 +0000 (+0100) Subject: JAL-32423 tidying X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=fcb944cdd9de849c89f0a8744ae6e56e22de9c1e;hp=cc75fb7e201de35734cd3f1f5f8020b971ebdd92;p=jalview.git JAL-32423 tidying --- diff --git a/src/jalview/io/cache/JvCacheableInputBox.java b/src/jalview/io/cache/JvCacheableInputBox.java index e02a396..3f17172 100644 --- a/src/jalview/io/cache/JvCacheableInputBox.java +++ b/src/jalview/io/cache/JvCacheableInputBox.java @@ -243,13 +243,14 @@ public class JvCacheableInputBox } /** - * For TestNG - * - * @author Bob Hanson 2019.08.28 + * Updates the cached values to include the last user input as the most + * recently added (without duplication), and rebuilds the dropdown list with + * this as the first entry. If the maximum configured cache size would be + * exceeded, the oldest entry is removed. */ - public void updateCacheNow() + void updateCacheNow() { - int cacheLimit = Integer.parseInt(appCache.getCacheLimit(cacheKey)); + int cacheLimit = Integer.valueOf(appCache.getCacheLimit(cacheKey)); String userInput = getUserInput(); if (userInput != null && !userInput.isEmpty()) { diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java index e205e76..97babfd 100644 --- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java +++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java @@ -355,7 +355,6 @@ public class ASequenceFetcher { try { - System.err.println("ASeqFetch " + className); return (DbSourceProxy) Class.forName(className).newInstance(); } catch (Exception e) { diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index 3ba93bc..891a203 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -274,7 +274,7 @@ public class AlignViewportTest * Test for JAL-1306 - conservation thread should run even when only Quality * (and not Conservation) is enabled in Preferences */ - @Test(groups = { "Functional" }, timeOut = 2000) // BH removed timeOut=2000 + @Test(groups = { "Functional" }, timeOut = 2000) public void testUpdateConservation_qualityOnly() { Cache.setPropertyNoSave("SHOW_ANNOTATIONS", @@ -296,8 +296,8 @@ public class AlignViewportTest AlignViewport viewport = af.getViewport(); synchronized (this) { - System.out.println("AVT consv: " - + viewport.getAlignmentConservationAnnotation()); + // System.out.println("AVT consv: " + // + viewport.getAlignmentConservationAnnotation()); try { wait(250); // BH increased from 50 -- was getting Quality in column 1 @@ -305,8 +305,8 @@ public class AlignViewportTest } catch (InterruptedException e) { } - System.out.println("AVT consv: " - + viewport.getAlignmentConservationAnnotation()); + // System.out.println("AVT consv: " + // + viewport.getAlignmentConservationAnnotation()); while (viewport.getAlignmentConservationAnnotation() != null) { try @@ -488,7 +488,7 @@ public class AlignViewportTest // af.paintImmediately(af.getBounds()); AlignViewport testme = af.getViewport(); SequenceI cons = testme.getConsensusSeq(); - System.out.println("AVT " + cons.getSequenceAsString()); + // System.out.println("AVT " + cons.getSequenceAsString()); assertEquals("A-C", cons.getSequenceAsString()); } diff --git a/test/jalview/gui/AlignmentPanelTest.java b/test/jalview/gui/AlignmentPanelTest.java index 4d1a730..80dc939 100644 --- a/test/jalview/gui/AlignmentPanelTest.java +++ b/test/jalview/gui/AlignmentPanelTest.java @@ -168,7 +168,7 @@ public class AlignmentPanelTest * or without hidden columns */ @Test(groups = "Functional") - public void TestSetScrollValues() + public void testSetScrollValues() { ViewportRanges ranges = af.getViewport().getRanges(); af.alignPanel.setScrollValues(0, 0); @@ -233,19 +233,19 @@ public class AlignmentPanelTest * when switching from wrapped back to unwrapped mode (JAL-2739) */ @Test(groups = "Functional") - public void TestUpdateLayout_endRes() + public void testUpdateLayout_endRes() { // get details of original alignment dimensions ViewportRanges ranges = af.getViewport().getRanges(); int endres = ranges.getEndRes(); - System.out.println("APT range end0 " + ranges.getEndRes()); + // System.out.println("APT range end0 " + ranges.getEndRes()); // wrap af.alignPanel.getAlignViewport().setWrapAlignment(true); af.alignPanel.updateLayout(); af.paintImmediately(af.getBounds()); waitSome(); - System.out.println("APT range end1 " + ranges.getEndRes()); + // System.out.println("APT range end1 " + ranges.getEndRes()); // endRes has changed assertNotEquals(ranges.getEndRes(), endres); @@ -255,7 +255,7 @@ public class AlignmentPanelTest waitSome(); af.paintImmediately(af.getBounds()); - System.out.println("APT range end3 " + ranges.getEndRes()); + // System.out.println("APT range end3 " + ranges.getEndRes()); // endRes back to original value assertEquals(ranges.getEndRes(), endres); diff --git a/test/jalview/gui/SeqCanvasTest.java b/test/jalview/gui/SeqCanvasTest.java index 25c4862..801c778 100644 --- a/test/jalview/gui/SeqCanvasTest.java +++ b/test/jalview/gui/SeqCanvasTest.java @@ -48,7 +48,7 @@ public class SeqCanvasTest * Test the method that computes wrapped width in residues, height of wrapped * widths in pixels, and the number of widths visible */ - @Test(groups = "BHTEST") + @Test(groups = "Functional") public void testCalculateWrappedGeometry_noAnnotations() { AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( @@ -219,7 +219,7 @@ public class SeqCanvasTest * Test the method that computes wrapped width in residues, height of wrapped * widths in pixels, and the number of widths visible */ - @Test(groups = "BHTEST") + @Test(groups = "Functional") public void testCalculateWrappedGeometry_withAnnotations() { AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( @@ -321,7 +321,7 @@ public class SeqCanvasTest * endSeq should be unchanged, but the vertical repeat height should include * all sequences. */ - @Test(groups = "BHTEST") + @Test(groups = "Functional") public void testCalculateWrappedGeometry_fromScrolled() { AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( @@ -331,24 +331,12 @@ public class SeqCanvasTest assertEquals(al.getWidth(), 157); assertEquals(al.getHeight(), 15); av.getRanges().setStartEndSeq(0, 3); - System.out.println("SCT1 " + av.getRanges().getEndSeq()); av.setShowAnnotation(false); av.setScaleAboveWrapped(true); - System.out.println("SCT2 " + av.getRanges().getEndSeq()); - SeqCanvas testee = af.alignPanel.getSeqPanel().seqCanvas; - - System.out.println("SCT3 " + av.getRanges().getEndSeq()); - av.setWrapAlignment(true); - - System.out.println("SCT4 " + av.getRanges().getEndSeq()); - av.setFont(new Font("SansSerif", Font.PLAIN, 14), true); - - System.out.println("SCT5 " + av.getRanges().getEndSeq()); - int charHeight = av.getCharHeight(); int charWidth = av.getCharWidth(); // Windows h=19, w=11. @@ -359,8 +347,6 @@ public class SeqCanvasTest int canvasHeight = 300; testee.calculateWrappedGeometry(canvasWidth, canvasHeight); - System.out.println("SCT6 " + av.getRanges().getEndSeq()); - assertEquals(av.getRanges().getEndSeq(), 3); // unchanged int repeatingHeight = (int) PA.getValue(testee, "wrappedRepeatHeightPx"); diff --git a/test/jalview/gui/SeqPanelTest.java b/test/jalview/gui/SeqPanelTest.java index c148039..fd611fc 100644 --- a/test/jalview/gui/SeqPanelTest.java +++ b/test/jalview/gui/SeqPanelTest.java @@ -724,9 +724,6 @@ public class SeqPanelTest final int charWidth = alignFrame.getViewport().getCharWidth(); assertTrue(charWidth > 0); // sanity check assertEquals(alignFrame.getViewport().getRanges().getStartRes(), 0); - - System.out.println("SPT endres " - + alignFrame.getViewport().getRanges().getEndRes()); /* * mouse at top left of unwrapped panel */ @@ -767,16 +764,6 @@ public class SeqPanelTest SeqCanvas seqCanvas = alignFrame.alignPanel.getSeqPanel().seqCanvas; int w = seqCanvas.getWidth(); // limited to number of whole columns, base 0 - // BH there are only 61 residues, but this calculation gives 65 - // from SeqPanel return for findColumn: - - // /* - // * make sure we calculate relative to visible alignment, - // * rather than right-hand gutter - // */ - // x = Math.min(x, seqCanvas.getX() + seqCanvas.getWidth()); - // res = (x / charWidth) + startRes; - // res = Math.min(res, av.getRanges().getEndRes()); int expected = w / charWidth; expected = Math.min( diff --git a/test/jalview/io/cache/JvCacheableInputBoxTest.java b/test/jalview/io/cache/JvCacheableInputBoxTest.java index 73aae61..7a2f8b4 100644 --- a/test/jalview/io/cache/JvCacheableInputBoxTest.java +++ b/test/jalview/io/cache/JvCacheableInputBoxTest.java @@ -31,18 +31,7 @@ public class JvCacheableInputBoxTest String testInput = "TestInput"; cacheBox.addItem(testInput); cacheBox.setSelectedItem(testInput); - cacheBox.updateCacheNow(); - - // try - // { - // // This delay is essential to prevent the - // // assertion below from executing before - // // swing thread finishes updating the combo-box - // Thread.sleep(100); - // } catch (InterruptedException e) - // { - // e.printStackTrace(); - // } + cacheBox.updateCacheNow(); // synchronous update userInput = cacheBox.getUserInput(); Assert.assertEquals(testInput, userInput); } @@ -54,19 +43,6 @@ public class JvCacheableInputBoxTest cacheBox.addItem(testInput); cacheBox.setSelectedItem(testInput); cacheBox.updateCacheNow(); - // synchronized (this) - // { - // try - // { - // wait(100); - // // This delay is to let - // // cacheBox.updateCache() finish updating the cache - // Thread.sleep(200); - // } catch (InterruptedException e) - // { - // e.printStackTrace(); - // } - // } LinkedHashSet foundCache = appCache .getAllCachedItemsFor(TEST_CACHE_KEY); Assert.assertTrue(foundCache.contains(testInput)); diff --git a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java index 43382f8..eab8805 100644 --- a/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java +++ b/test/jalview/renderer/seqfeatures/FeatureColourFinderTest.java @@ -75,8 +75,13 @@ public class FeatureColourFinderTest @BeforeMethod(alwaysRun = true) public void setUpBeforeTest() { - //required for Windows, only when in batch mode? - setUp(); + /* + * fudge for failure in test suite on Windows; + * without this call added, av.getAlignment() is null; + * root cause not known - AlignViewport.dispose() called?? + */ + setUp(); + List sfs = seq.getSequenceFeatures(); for (SequenceFeature sf : sfs) {