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 org.testng.annotations.Test;
import junit.extensions.PA;
public class SeqCanvasTest
{
import org.testng.annotations.Test;
import junit.extensions.PA;
public class SeqCanvasTest
{
/**
* Test the method that computes wrapped width in residues, height of wrapped
* widths in pixels, and the number of widths visible
/**
* Test the method that computes wrapped width in residues, height of wrapped
* widths in pixels, and the number of widths visible
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);
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;
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);
+
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;
2 * charHeight);
int repeatingHeight = (int) PA.getValue(testee, "wrappedRepeatHeightPx");
assertEquals(repeatingHeight, charHeight * (2 + al.getHeight())
2 * charHeight);
int repeatingHeight = (int) PA.getValue(testee, "wrappedRepeatHeightPx");
assertEquals(repeatingHeight, charHeight * (2 + al.getHeight())
- * repeat height is 17 * (2 + 15) = 289 + annotationHeight = 507
- * make canvas height 2 * 289 + 3 * charHeight so just enough to
- * draw 2 widths and the first sequence of a third
+ * repeat height is 17 * (2 + 15) = 289 + 3 + annotationHeight = 510
+ * make canvas height 2 of these plus 3 charHeights
+ * so just enough to draw 2 widths, gap + scale + the first sequence of a third
testee.calculateWrappedGeometry(canvasWidth, canvasHeight);
assertEquals(PA.getValue(testee, "wrappedVisibleWidths"), 3);
testee.calculateWrappedGeometry(canvasWidth, canvasHeight);
assertEquals(PA.getValue(testee, "wrappedVisibleWidths"), 3);
* reduce height to enough for 2 widths and not quite a third
* i.e. two repeating heights + spacer + sequence - 1 pixel
*/
* reduce height to enough for 2 widths and not quite a third
* i.e. two repeating heights + spacer + sequence - 1 pixel
*/
testee.calculateWrappedGeometry(canvasWidth, canvasHeight);
assertEquals(PA.getValue(testee, "wrappedVisibleWidths"), 2);
testee.calculateWrappedGeometry(canvasWidth, canvasHeight);
assertEquals(PA.getValue(testee, "wrappedVisibleWidths"), 2);
av.setWrapAlignment(true);
av.setFont(new Font("SansSerif", Font.PLAIN, 14), true);
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
av.setWrapAlignment(true);
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);