JAL-4290 Fix image comparison between gui and headless output. Images are now the...
authorBen Soares <b.soares@dundee.ac.uk>
Wed, 20 Dec 2023 13:14:26 +0000 (13:14 +0000)
committerJames Procter <j.procter@dundee.ac.uk>
Tue, 23 Jan 2024 16:54:50 +0000 (16:54 +0000)
src/jalview/gui/AlignmentPanel.java
test/jalview/bin/CommandsTest.java

index 358560b..0f5a9e8 100644 (file)
@@ -388,7 +388,10 @@ public class AlignmentPanel extends GAlignmentPanel implements
     // Also check annotation label widths
     if (includeAnnotations && al.getAlignmentAnnotation() != null)
     {
-      fm = c.getFontMetrics(getAlabels().getFont());
+      if (legacy)
+      {
+        fm = c.getFontMetrics(getAlabels().getFont());
+      }
 
       if (!legacy || Jalview.isHeadlessMode())
       {
@@ -1300,8 +1303,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
       return idwidth.intValue() + ID_WIDTH_PADDING;
     }
 
-    int w = getIdPanel().getWidth();
-    w = calculateIdWidth(-1, true, true).width;
+    // int w = getIdPanel().getWidth();
+    // w = calculateIdWidth(-1, true, true).width;
+    int w = calculateIdWidth(-1, true, true).width;
     return (w > 0 ? w : calculateIdWidth().width);
   }
 
index c34a7fa..7ca4e55 100644 (file)
@@ -198,7 +198,7 @@ public class CommandsTest
               x);
     } finally
     {
-      // cleanupFiles(filenames);
+      cleanupFiles(filenames);
       tearDown();
     }
   }
@@ -229,14 +229,12 @@ public class CommandsTest
           timeOut -= 25;
         }
       }
-      /*
-       *  larger margin between IDs and alignment/annotations when in --gui mode
-       *  
-      verifyOrderedFileSet(cmdLines[0] + " vs " + cmdLines[1], filenames, false);
-       */
+
+      verifyOrderedFileSet(cmdLines[0] + " vs " + cmdLines[1], filenames,
+              false);
 
       verifySimilarEnoughImages(cmdLines[0] + " vs " + cmdLines[1],
-              filenames, 0.6f, 0f);
+              filenames, 0f, 0f);
     } catch (Exception x)
     {
       Assert.fail("Unexpected exception during structureImageOutputTest",
@@ -361,19 +359,19 @@ public class CommandsTest
     Assert.assertTrue(max_h > 0,
             "Maximum height is not positive (" + max_h + ")");
     // tolerance
-    Assert.assertTrue(100 * (max_w - min_w) / min_w < w_tolerance_pc,
+    Assert.assertTrue(100 * (max_w - min_w) / min_w <= w_tolerance_pc,
             "Width variation (" + (max_w - min_w)
-                    + " not within tolerance of minimum width (" + min_w
-                    + ")");
+                    + " not within tolerance (" + w_tolerance_pc
+                    + "%) of minimum width (" + min_w + ")");
     if (max_w != min_w)
     {
       System.out.println("Widths within tolerance (" + w_tolerance_pc
               + "%), min_w=" + min_w + " < max_w=" + max_w);
     }
-    Assert.assertTrue(100 * (max_h - min_h) / min_h < w_tolerance_pc,
+    Assert.assertTrue(100 * (max_h - min_h) / min_h <= h_tolerance_pc,
             "Height variation (" + (max_h - min_h)
-                    + " not within tolerance of minimum height (" + min_h
-                    + ")");
+                    + " not within tolerance (" + h_tolerance_pc
+                    + "%) of minimum height (" + min_h + ")");
     if (max_h != min_h)
     {
       System.out.println("Heights within tolerance (" + h_tolerance_pc