From 17f8f1cc49dd1e5a71799767d849ac2e8a3b2b33 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 15 May 2024 18:27:07 +0100 Subject: [PATCH] JAL-4397 IdWidth tests slightly less restrictive for platform/scaling variations --- test/jalview/gui/AnnotationLabelsTest2.java | 2 +- test/jalview/project/Jalview2xmlTests.java | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/test/jalview/gui/AnnotationLabelsTest2.java b/test/jalview/gui/AnnotationLabelsTest2.java index ddbaf94..21a0217 100644 --- a/test/jalview/gui/AnnotationLabelsTest2.java +++ b/test/jalview/gui/AnnotationLabelsTest2.java @@ -237,7 +237,7 @@ public class AnnotationLabelsTest2 int idWidth2max, */ int idWidth2min = scaling == 1.0 ? 114 : 108; - int idWidth2max = scaling == 1.0 ? 114 : 114; // was 130 + int idWidth2max = scaling == 1.0 ? 117 : 114; // was 130 if (Platform.isMac()) { idWidth2max = 122; diff --git a/test/jalview/project/Jalview2xmlTests.java b/test/jalview/project/Jalview2xmlTests.java index 302efdc..8fd8b31 100644 --- a/test/jalview/project/Jalview2xmlTests.java +++ b/test/jalview/project/Jalview2xmlTests.java @@ -101,7 +101,6 @@ import jalview.schemes.StrandColourScheme; import jalview.schemes.TCoffeeColourScheme; import jalview.structure.StructureImportSettings; import jalview.util.MapList; -import jalview.util.Platform; import jalview.util.matcher.Condition; import jalview.viewmodel.AlignmentViewport; import jalview.viewmodel.seqfeatures.FeatureRendererModel; @@ -1480,9 +1479,14 @@ public class Jalview2xmlTests extends Jalview2xmlBase assertEquals(ov1.getTitle(), "Overview examples/uniref50.fa Original"); double scaling = jalview.gui.JvSwingUtilsTest.getScaling(ov1); - int width = scaling == 1.0 ? 225 : 200; + // int width = scaling == 1.0 ? 225 : 200; + // int width = scaling == 1.0 ? 225 : 200; Rectangle ov1Rectangle = ov1.getFrameBounds(); - assertEquals(ov1Rectangle, new Rectangle(20, 30, width, 400)); + assertEquals(ov1Rectangle, + new Rectangle(20, 30, ov1Rectangle.width, 400)); + int width = ov1Rectangle.width; + assertTrue(width >= 200 && width < 225, + "Rectangle width was not in the range expected (200<=width<=225)"); assertTrue(ov1.isShowHiddenRegions()); } @@ -1767,10 +1771,13 @@ public class Jalview2xmlTests extends Jalview2xmlBase // shouldn't be platform dependent int idWidth = af.alignPanel.getAlignViewport().getIdWidth(); double scaling = jalview.gui.JvSwingUtilsTest.getScaling(af.alignPanel); - int expectedWidth = Platform.isMac() ? 144 - : Platform.isLinux() ? scaling == 1.0 ? 131 : 128 : 138; - assertEquals(idWidth, expectedWidth, - "Legacy project import should have fixed ID width"); + // int expectedWidth = Platform.isMac() ? 144 : Platform.isLinux() ? scaling + // == 1.0 ? 131 : 128 : 138; + int minExpectedWidth = 128; + int maxExpectedWidth = 144; + assertTrue(minExpectedWidth <= idWidth && maxExpectedWidth >= idWidth, + "Legacy project import should have fixed ID width. Not within the expected range (" + + minExpectedWidth + "-" + maxExpectedWidth + ")"); assertTrue( af.alignPanel.getIdPanel().getIdCanvas().isManuallyAdjusted()); -- 1.7.10.2