Merge branch 'patch/JAL-3718_fixed_getdown_patched_for_Release_2_11_1_Branch' into...
[jalview.git] / test / jalview / gui / AlignmentPanelTest.java
index 85ca37c..4f2fafc 100644 (file)
@@ -34,6 +34,7 @@ import jalview.viewmodel.ViewportRanges;
 
 import java.awt.Dimension;
 import java.awt.Font;
+import java.awt.FontMetrics;
 
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -226,8 +227,12 @@ public class AlignmentPanelTest
      */
     AlignmentAnnotation aa = av.getAlignment().getAlignmentAnnotation()[0];
     aa.label = "THIS IS A VERY LONG LABEL INDEED";
+    FontMetrics fmfor = af.alignPanel
+            .getFontMetrics(af.alignPanel.getAlabels().getFont());
+    // Assumption ID_WIDTH_PADDING == 4
+    int expwidth = 4 + fmfor.stringWidth(aa.label);
     d = af.alignPanel.calculateIdWidth(2000);
-    assertEquals(d.width, 229); // 4 + pixel width of "THIS IS A VERY LONG LABEL INDEED"
+    assertEquals(d.width, expwidth); // 228 == ID_WIDTH_PADDING + pixel width of "THIS IS A VERY LONG LABEL INDEED"
     assertEquals(d.height, 12);
 
     /*
@@ -239,7 +244,7 @@ public class AlignmentPanelTest
     assertEquals(d.height, 12);
   }
 
-  @Test(groups = "Functional")
+  @Test(groups = { "Functional", "Not-bamboo" })
   public void testGetVisibleWidth()
   {
     /*