summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
be7bf23)
- \r\n, slightly differerent font metrics
public void testPrintAlignment()
{
AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s3, AlignSeq.PEP);
public void testPrintAlignment()
{
AlignSeq as = AlignSeq.doGlobalNWAlignment(s1, s3, AlignSeq.PEP);
+
+ // s1 = new Sequence("Seq1", "ASDFAQQQRRRSSS");
+ // s1.setStart(3);
+ // s1.setEnd(18);
+ // s3 = new Sequence("Seq3", "SDFAQQQSSS");
+ //
final StringBuilder baos = new StringBuilder();
PrintStream ps = new PrintStream(System.out)
{
@Override
public void print(String x)
{
final StringBuilder baos = new StringBuilder();
PrintStream ps = new PrintStream(System.out)
{
@Override
public void print(String x)
{
+ baos.append(x.replaceAll("\r", ""));
};
as.printAlignment(ps);
};
as.printAlignment(ps);
- String expected = "Score = 320.0\nLength of alignment = 10\nSequence Seq1/4-13 (Sequence length = 14)\nSequence Seq3/1-10 (Sequence length = 10)\n\n"
+ String expected = "Score = 320.0\n" + "Length of alignment = 10\n"
+ + "Sequence Seq1/4-13 (Sequence length = 14)\n"
+ + "Sequence Seq3/1-10 (Sequence length = 10)\n" + "\n"
+ "Seq1/4-13 SDFAQQQRRR\n"
+ " ||||||| \n"
+ "Seq1/4-13 SDFAQQQRRR\n"
+ " ||||||| \n"
- + "Seq3/1-10 SDFAQQQSSS\n\n" + "Percentage ID = 70.00\n\n";
- assertEquals(expected, baos.toString());
+ + "Seq3/1-10 SDFAQQQSSS\n" + "\n" + "Percentage ID = 70.00\n"
+ + "\n";
+
+ String s = baos.toString();
+ System.out.println(s);
+
+ assertEquals(expected, s);
import jalview.datamodel.AlignmentI;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
import jalview.datamodel.AlignmentI;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
+import jalview.util.Platform;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Font;
import java.awt.FontMetrics;
av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
- assertEquals(charHeight, 17);
- assertEquals(charWidth, 12);
+ assertEquals(charHeight, Platform.isMac() ? 17 : 19);
+ assertEquals(charWidth, Platform.isMac() ? 12 : 11);
/*
* first with scales above, left, right
/*
* first with scales above, left, right
av.setScaleRightWrapped(true);
FontMetrics fm = testee.getFontMetrics(av.getFont());
int labelWidth = fm.stringWidth("000") + charWidth;
av.setScaleRightWrapped(true);
FontMetrics fm = testee.getFontMetrics(av.getFont());
int labelWidth = fm.stringWidth("000") + charWidth;
- assertEquals(labelWidth, 39); // 3 x 9 + charWidth
+ assertEquals(labelWidth,
+ Platform.isMac() ? 3 * 9 + charWidth : 3 * 8 + charWidth);
/*
* width 400 pixels leaves (400 - 2*labelWidth) for residue columns
/*
* width 400 pixels leaves (400 - 2*labelWidth) for residue columns
canvasWidth += 2;
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
canvasHeight);
canvasWidth += 2;
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
canvasHeight);
- assertEquals(wrappedWidth, 24); // 2px not enough
+ assertEquals(wrappedWidth, Platform.isMac() ? 24 : 25); // 2px not enough
canvasWidth += 1;
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
canvasHeight);
canvasWidth += 1;
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
canvasHeight);
av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
- assertEquals(charHeight, 17);
- assertEquals(charWidth, 12);
-
+
+ assertEquals(charHeight, Platform.isMac() ? 17 : 19);
+ assertEquals(charWidth, Platform.isMac() ? 12 : 11);
+
SeqCanvas testee = af.alignPanel.getSeqPanel().seqCanvas;
/*
SeqCanvas testee = af.alignPanel.getSeqPanel().seqCanvas;
/*
av.setScaleAboveWrapped(true);
av.setScaleLeftWrapped(true);
av.setScaleRightWrapped(true);
av.setScaleAboveWrapped(true);
av.setScaleLeftWrapped(true);
av.setScaleRightWrapped(true);
FontMetrics fm = testee.getFontMetrics(av.getFont());
int labelWidth = fm.stringWidth("000") + charWidth;
FontMetrics fm = testee.getFontMetrics(av.getFont());
int labelWidth = fm.stringWidth("000") + charWidth;
- assertEquals(labelWidth, 39); // 3 x 9 + charWidth
+ assertEquals(labelWidth,
+ Platform.isMac() ? 3 * 9 + charWidth : 3 * 8 + charWidth);
+
int annotationHeight = testee.getAnnotationHeight();
/*
int annotationHeight = testee.getAnnotationHeight();
/*
av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
- assertEquals(charHeight, 17);
- assertEquals(charWidth, 12);
+ // Windows h=19, w=11.
+ assertEquals(charHeight, Platform.isMac() ? 17 : 19);
+ assertEquals(charWidth, Platform.isMac() ? 12 : 11);
int canvasWidth = 400;
int canvasHeight = 300;
int canvasWidth = 400;
int canvasHeight = 300;
PrintStream ps = new PrintStream(os, true);
rm.print(ps);
String result = new String(os.toByteArray());
PrintStream ps = new PrintStream(os, true);
rm.print(ps);
String result = new String(os.toByteArray());
- assertEquals(result, expected);
+ assertEquals(result.replaceAll("\r", ""), expected);
}
@Test(groups = "Functional")
}
@Test(groups = "Functional")