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
@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);
@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);
@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);
"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());
+ }
}