av.setScaleLeftWrapped(true);
av.setScaleRightWrapped(true);
FontMetrics fm = SwingUtilities2.getFontMetrics(testee, av.getFont());
- int labelWidth = fm.stringWidth("00000"); // width of 3 digits and 2 spaces
- assertEquals(labelWidth, 45); // note this is not 5 * charWidth
+ int labelWidth = fm.stringWidth("000") + charWidth;
+ assertEquals(labelWidth, 39); // 3 x 9 + charWidth
/*
* width 400 pixels leaves (400 - 2*labelWidth) for residue columns
assertEquals(wrappedWidth, 19);
/*
- * turn off West scale - adds labelWidth (45) to available for residues
- * which with the 11 remainder makes 56 which is 4 more charWidths rem 8
+ * turn off West scale - adds labelWidth (39) to available for residues
+ * which with the 11 remainder makes 50 which is 4 more charWidths rem 2
*/
av.setScaleLeftWrapped(false);
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
assertEquals(wrappedWidth, 23);
/*
- * add 4 pixels to width to fit in another whole residue column
+ * add 10 pixels to width to fit in another whole residue column
*/
- canvasWidth += 3;
+ canvasWidth += 9;
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
canvasHeight);
assertEquals(wrappedWidth, 23);
assertEquals(wrappedWidth, 24);
/*
- * turn off East scale to gain 45 more pixels (3 columns remainder 9)
+ * turn off East scale to gain 39 more pixels (3 columns remainder 3)
*/
av.setScaleRightWrapped(false);
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
assertEquals(wrappedWidth, 27);
/*
- * add 3 pixels to width to gain a residue column
+ * add 9 pixels to width to gain a residue column
*/
- canvasWidth += 3;
+ canvasWidth += 8;
+ wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
+ canvasHeight);
+ assertEquals(wrappedWidth, 27);
+ canvasWidth += 1;
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
canvasHeight);
assertEquals(wrappedWidth, 28);
/*
- * now West but not East scale - lose 45 pixels or 4 columns
+ * now West but not East scale - lose 39 pixels or 4 columns
*/
av.setScaleLeftWrapped(true);
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
assertEquals(wrappedWidth, 24);
/*
- * adding 9 pixels to width regains one column
+ * adding 3 pixels to width regains one column
*/
- canvasWidth += 8;
+ canvasWidth += 2;
wrappedWidth = testee.calculateWrappedGeometry(canvasWidth,
canvasHeight);
assertEquals(wrappedWidth, 24);
av.setScaleLeftWrapped(true);
av.setScaleRightWrapped(true);
FontMetrics fm = SwingUtilities2.getFontMetrics(testee, av.getFont());
- int labelWidth = fm.stringWidth("00000"); // width of 3 digits and 2 spaces
- assertEquals(labelWidth, 45); // note this is not 5 * charWidth
+ int labelWidth = fm.stringWidth("000") + charWidth;
+ assertEquals(labelWidth, 39); // 3 x 9 + charWidth
int annotationHeight = testee.getAnnotationHeight();
/*