import jalview.datamodel.SequenceI;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
+import jalview.util.Platform;
import jalview.viewmodel.ViewportRanges;
public class AlignmentPanelTest
@Test(groups = { "Functional", "Not-bamboo" })
public void testGetVisibleWidth()
{
+ double scaling = jalview.gui.JvSwingUtilsTest.getScaling(af.alignPanel);
/*
* width for onscreen rendering is IDPanel width
*/
int w = af.alignPanel.getVisibleIdWidth(true);
assertEquals(w, af.alignPanel.getIdPanel().getWidth());
- assertEquals(w, 115);
+
+ // different scaling (1.0, 2.0) gives different results
+ int expectedWidth = scaling == 1.0 ? 112 : Platform.isMac() ? 115 : 107;
+ assertEquals(w, expectedWidth);
/*
* width for offscreen rendering is the same
* preference for auto id width overrides fixed width
*/
Cache.setProperty("FIGURE_AUTOIDWIDTH", Boolean.TRUE.toString());
- assertEquals(115, af.alignPanel.getVisibleIdWidth(false));
+ w = af.alignPanel.getVisibleIdWidth(false);
+ // allow some leeway for different OS renderings
+ assertTrue(w > 105 && w < 120);
+ // different scaling (1.0, 2.0) gives different results
+ assertEquals(w, expectedWidth);
}
@Test(groups = { "Functional", "Not-bamboo" })
public void testresetIdWidth()
{
+ double scaling = jalview.gui.JvSwingUtilsTest.getScaling(af.alignPanel);
/*
* width for onscreen rendering is IDPanel width
*/
assertEquals(w, actual);
// allow some leeway for different OS renderings
assertTrue(w > 105 && w < 120);
+ // different scaling (1.0, 2.0) gives different results
+ int expectedWidth = scaling == 1.0 ? 112 : Platform.isMac() ? 115 : 107;
+ assertEquals(w, expectedWidth);
// manually adjust
af.viewport.setIdWidth(200);
// to optimal id width
// allow some leeway for different OS renderings
assertTrue(w > 105 && w < 120);
+ // different scaling (1.0, 2.0) gives different results
+ assertEquals(w, expectedWidth);
}
@Test(groups = "Functional")