From e9891c69d490f81a80b5355f49ec60f2c637f5ea Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Fri, 26 Apr 2024 18:41:40 +0100 Subject: [PATCH] JAL-4397 Adjustments for macOS HiDPI --- test/jalview/gui/AlignmentPanelTest.java | 11 +++++++---- test/jalview/gui/AnnotationLabelsTest2.java | 13 +++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/test/jalview/gui/AlignmentPanelTest.java b/test/jalview/gui/AlignmentPanelTest.java index eefe950..caa4e22 100644 --- a/test/jalview/gui/AlignmentPanelTest.java +++ b/test/jalview/gui/AlignmentPanelTest.java @@ -44,6 +44,7 @@ import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.SequenceI; import jalview.io.DataSourceType; import jalview.io.FileLoader; +import jalview.util.Platform; import jalview.viewmodel.ViewportRanges; public class AlignmentPanelTest @@ -282,7 +283,8 @@ public class AlignmentPanelTest assertEquals(w, af.alignPanel.getIdPanel().getWidth()); // different scaling (1.0, 2.0) gives different results - assertEquals(w, scaling == 1.0 ? 112 : 107); + int expectedWidth = scaling == 1.0 ? 112 : Platform.isMac() ? 115 : 107; + assertEquals(w, expectedWidth); /* * width for offscreen rendering is the same @@ -306,7 +308,7 @@ public class AlignmentPanelTest // allow some leeway for different OS renderings assertTrue(w > 105 && w < 120); // different scaling (1.0, 2.0) gives different results - assertEquals(w, scaling == 1.0 ? 112 : 107); + assertEquals(w, expectedWidth); } @Test(groups = { "Functional", "Not-bamboo" }) @@ -322,7 +324,8 @@ public class AlignmentPanelTest // allow some leeway for different OS renderings assertTrue(w > 105 && w < 120); // different scaling (1.0, 2.0) gives different results - assertEquals(w, scaling == 1.0 ? 112 : 107); + int expectedWidth = scaling == 1.0 ? 112 : Platform.isMac() ? 115 : 107; + assertEquals(w, expectedWidth); // manually adjust af.viewport.setIdWidth(200); @@ -352,7 +355,7 @@ public class AlignmentPanelTest // allow some leeway for different OS renderings assertTrue(w > 105 && w < 120); // different scaling (1.0, 2.0) gives different results - assertEquals(w, scaling == 1.0 ? 112 : 107); + assertEquals(w, expectedWidth); } @Test(groups = "Functional") diff --git a/test/jalview/gui/AnnotationLabelsTest2.java b/test/jalview/gui/AnnotationLabelsTest2.java index 54c6f34..ddbaf94 100644 --- a/test/jalview/gui/AnnotationLabelsTest2.java +++ b/test/jalview/gui/AnnotationLabelsTest2.java @@ -40,6 +40,7 @@ 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 { @@ -115,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) @@ -154,8 +155,8 @@ public class AnnotationLabelsTest2 idWidth = av.getIdWidth(); 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( @@ -237,6 +238,10 @@ public class AnnotationLabelsTest2 */ int idWidth2min = scaling == 1.0 ? 114 : 108; int idWidth2max = scaling == 1.0 ? 114 : 114; // was 130 + if (Platform.isMac()) + { + idWidth2max = 122; + } return new Object[][] { // -- 1.7.10.2