X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FAlignViewportTest.java;fp=test%2Fjalview%2Fgui%2FAlignViewportTest.java;h=00267b31d4ee5b3cda04325dde87c5493f4cf633;hb=65740880573a48adc758bec3939ece9d9ae104dd;hp=4e15dba3675e0c82a0eac5aed656a900af9c6312;hpb=71aa78b8a7d54e5aeb6b278310dfd735efb77477;p=jalview.git diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index 4e15dba..00267b3 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -297,6 +297,26 @@ public class AlignViewportTest * wait for Conservation thread to complete */ AlignViewport viewport = af.getViewport(); + waitForCalculations(viewport); + AlignmentAnnotation[] anns = viewport.getAlignment() + .getAlignmentAnnotation(); + assertNotNull("No annotations found", anns); + assertEquals("More than one annotation found", 1, anns.length); + assertTrue("Annotation is not Quality", + anns[0].description.startsWith("Alignment Quality")); + Annotation[] annotations = anns[0].annotations; + assertNotNull("Quality annotations are null", annotations); + assertNotNull("Quality in column 1 is null", annotations[0]); + assertTrue("No quality value in column 1", annotations[0].value > 10f); + } + + /** + * Wait for consensus etc calculation threads to complete + * + * @param viewport + */ + protected void waitForCalculations(AlignViewport viewport) + { synchronized (this) { while (viewport.getCalcManager().isWorking()) @@ -309,16 +329,6 @@ public class AlignViewportTest } } } - AlignmentAnnotation[] anns = viewport.getAlignment() - .getAlignmentAnnotation(); - assertNotNull("No annotations found", anns); - assertEquals("More than one annotation found", 1, anns.length); - assertTrue("Annotation is not Quality", - anns[0].description.startsWith("Alignment Quality")); - Annotation[] annotations = anns[0].annotations; - assertNotNull("Quality annotations are null", annotations); - assertNotNull("Quality in column 1 is null", annotations[0]); - assertTrue("No quality value in column 1", annotations[0].value > 10f); } @Test(groups = { "Functional" }) @@ -466,6 +476,7 @@ public class AlignViewportTest AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(fasta, DataSourceType.PASTE); AlignViewport testme = af.getViewport(); + waitForCalculations(testme); SequenceI cons = testme.getConsensusSeq(); assertEquals("A-C", cons.getSequenceAsString()); }