From: gmungoc Date: Tue, 21 Apr 2020 13:03:35 +0000 (+0100) Subject: JAL-3210 try adding setup method to unit test failing on server... X-Git-Tag: Develop-2_11_2_0-d20201215~24^2~68^2~1 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=421a5c8265f5d65c7dca1827e8f5af0b66ab3fe9 JAL-3210 try adding setup method to unit test failing on server... --- diff --git a/test/jalview/gui/SeqCanvasTest.java b/test/jalview/gui/SeqCanvasTest.java index 73aeb79..22035f1 100644 --- a/test/jalview/gui/SeqCanvasTest.java +++ b/test/jalview/gui/SeqCanvasTest.java @@ -22,19 +22,22 @@ package jalview.gui; import static org.testng.Assert.assertEquals; -import jalview.datamodel.AlignmentI; -import jalview.io.DataSourceType; -import jalview.io.FileLoader; - import java.awt.Font; import java.awt.FontMetrics; +import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; +import jalview.bin.Cache; +import jalview.datamodel.AlignmentI; +import jalview.io.DataSourceType; +import jalview.io.FileLoader; import junit.extensions.PA; public class SeqCanvasTest { + private AlignFrame af; + /** * Test the method that computes wrapped width in residues, height of wrapped * widths in pixels, and the number of widths visible @@ -42,8 +45,6 @@ public class SeqCanvasTest @Test(groups = "Functional") public void testCalculateWrappedGeometry_noAnnotations() { - AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( - "examples/uniref50.fa", DataSourceType.FILE); AlignViewport av = af.getViewport(); AlignmentI al = av.getAlignment(); assertEquals(al.getWidth(), 157); @@ -212,8 +213,6 @@ public class SeqCanvasTest @Test(groups = "Functional") public void testCalculateWrappedGeometry_withAnnotations() { - AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( - "examples/uniref50.fa", DataSourceType.FILE); AlignViewport av = af.getViewport(); AlignmentI al = av.getAlignment(); assertEquals(al.getWidth(), 157); @@ -310,20 +309,18 @@ public class SeqCanvasTest @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); av.getRanges().setStartEndSeq(0, 3); + av.setFont(new Font("SansSerif", Font.PLAIN, 14), true); + av.setWrapAlignment(true); av.setShowAnnotation(false); av.setScaleAboveWrapped(true); SeqCanvas testee = af.alignPanel.getSeqPanel().seqCanvas; - av.setWrapAlignment(true); - av.setFont(new Font("SansSerif", Font.PLAIN, 14), true); int charHeight = av.getCharHeight(); int charWidth = av.getCharWidth(); assertEquals(charHeight, 17); @@ -338,4 +335,27 @@ public class SeqCanvasTest "wrappedRepeatHeightPx"); assertEquals(repeatingHeight, charHeight * (2 + al.getHeight())); } + + @BeforeMethod(alwaysRun = true) + public void setUp() + { + Cache.loadProperties("test/jalview/io/testProps.jvprops"); + Cache.applicationProperties.setProperty("SHOW_IDENTITY", + Boolean.TRUE.toString()); + af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa", + DataSourceType.FILE); + + /* + * wait for Consensus thread to complete + */ + do + { + try + { + Thread.sleep(50); + } catch (InterruptedException x) + { + } + } while (af.getViewport().getCalcManager().isWorking()); + } }