Merge branch 'develop' into features/JAL-4219_extended_fasta_rna_ss
[jalview.git] / test / jalview / gui / AnnotationLabelsTest2.java
index ad97e8b..21a0217 100644 (file)
@@ -40,9 +40,12 @@ import jalview.gui.StructureViewer.ViewerType;
 import jalview.io.DataSourceType;
 import jalview.io.FileLoader;
 import jalview.structure.StructureImportSettings.TFType;
+import jalview.util.Platform;
 
 public class AnnotationLabelsTest2
 {
+  private static double scaling;
+
   @BeforeClass(alwaysRun = true)
   public static void setUpBeforeClass() throws Exception
   {
@@ -55,6 +58,8 @@ public class AnnotationLabelsTest2
      */
     Cache.loadProperties("test/jalview/io/testProps.jvprops");
     Jalview.main(new String[] { "--nonews", "--nosplash", });
+
+    scaling = JvSwingUtilsTest.getScaling(Desktop.instance);
   }
 
   @AfterMethod(alwaysRun = true)
@@ -95,6 +100,7 @@ public class AnnotationLabelsTest2
   {
     AlignFrame af = new FileLoader()
             .LoadFileWaitTillLoaded(alignmentFilename, DataSourceType.FILE);
+
     try
     {
       Thread.sleep(200); // to allow alignment annotations to open
@@ -110,8 +116,8 @@ public class AnnotationLabelsTest2
     idWidth = av.getIdWidth();
     assertTrue(idWidth > idWidth1min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth1min);
-    assertTrue(idWidth < idWidth1max,
-            "idWidth (" + idWidth + ") is not narrower than" + idWidth1max);
+    assertTrue(idWidth < idWidth1max, "idWidth (" + idWidth
+            + ") is not narrower than " + idWidth1max);
 
     // set wrap
     if (wrap)
@@ -147,10 +153,10 @@ public class AnnotationLabelsTest2
 
     // idWidth = ap.getIdPanel().getWidth();
     idWidth = av.getIdWidth();
-    assertTrue(idWidth > idWidth2min,
+    assertTrue(idWidth >= idWidth2min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth2min);
-    assertTrue(idWidth < idWidth2max,
-            "idWidth (" + idWidth + ") is not narrower than" + idWidth2max);
+    assertTrue(idWidth <= idWidth2max, "idWidth (" + idWidth
+            + ") is not narrower than " + idWidth2max);
   }
 
   @Test(
@@ -176,7 +182,6 @@ public class AnnotationLabelsTest2
     AlignViewport av = af.getCurrentView();
 
     int idWidth = 0;
-
     idWidth = av.getIdWidth();
     assertTrue(idWidth > idWidth1min,
             "idWidth (" + idWidth + ") is not greater than " + idWidth1min);
@@ -231,6 +236,13 @@ public class AnnotationLabelsTest2
       int idWidth2min,
       int idWidth2max,
      */
+    int idWidth2min = scaling == 1.0 ? 114 : 108;
+    int idWidth2max = scaling == 1.0 ? 117 : 114; // was 130
+    if (Platform.isMac())
+    {
+      idWidth2max = 122;
+    }
+
     return new Object[][] {
         //
         /*
@@ -239,12 +251,12 @@ public class AnnotationLabelsTest2
             100,
             "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb",
             "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3_scores.json",
-            true, TFType.PLDDT, null, 115, 130 },
+            true, TFType.PLDDT, null, idWidth2min, idWidth2max },
         { "./test/files/annotation_label_width/sample.a2m", true, 50, 70,
             100,
             "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb",
             "./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3_scores.json",
-            true, TFType.PLDDT, null, 115, 130 },
+            true, TFType.PLDDT, null, idWidth2min, idWidth2max },
         /*
          */
     };