import static org.testng.AssertJUnit.assertSame;
import static org.testng.AssertJUnit.assertTrue;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import jalview.bin.Cache;
import jalview.bin.Jalview;
import jalview.datamodel.AlignedCodonFrame;
import jalview.util.MapList;
import jalview.viewmodel.ViewportRanges;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.testng.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
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.getAlignmentConservationAnnotation() != null)
+ while (viewport.getCalcManager().isWorking())
{
try
{
}
}
}
- 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" })
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(fasta,
DataSourceType.PASTE);
AlignViewport testme = af.getViewport();
+ waitForCalculations(testme);
SequenceI cons = testme.getConsensusSeq();
assertEquals("A-C", cons.getSequenceAsString());
}