From: James Procter Date: Thu, 16 Feb 2023 12:25:41 +0000 (+0000) Subject: JAL-1713 don’t close an automatically created overview window for projects from Jalvi... X-Git-Tag: Release_2_11_3_0~18^2~14 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d6eab72955158d1e070b45dfd93e55c64a47ff86;p=jalview.git JAL-1713 don’t close an automatically created overview window for projects from Jalview versions older than 2.11.3 --- diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 4d35021..8d2efe0 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -1510,7 +1510,7 @@ public class Jalview2XML ov.getCanvas().getResidueColour().getRGB()); overview.setHiddenColour(ov.getCanvas().getHiddenColour().getRGB()); view.setOverview(overview); - } + } if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme) { view.setBgColour(setUserColourScheme(av.getGlobalColourScheme(), @@ -4122,7 +4122,7 @@ public class Jalview2XML loadPCAViewers(jalviewModel, ap); loadPDBStructures(jprovider, jseqs, af, ap); loadRnaViewers(jprovider, jseqs, ap); - loadOverview(view, af); + loadOverview(view, jalviewModel.getVersion(), af); } // and finally return. return af; @@ -4135,8 +4135,13 @@ public class Jalview2XML * @param view * @param af */ - protected void loadOverview(Viewport view, AlignFrame af) + protected void loadOverview(Viewport view, String version, AlignFrame af) { + if (!isVersionStringLaterThan("2.11.3", + version) && view.getOverview()==null) + { + return; + } /* * first close any Overview that was opened automatically * (if so configured in Preferences) so that the view is @@ -4676,7 +4681,7 @@ public class Jalview2XML * - minimum version we are comparing against * @param version * - version of data being processsed - * @return + * @return true if version is equal to or later than supported */ public static boolean isVersionStringLaterThan(String supported, String version) diff --git a/test/jalview/project/Jalview2xmlTests.java b/test/jalview/project/Jalview2xmlTests.java index cd8a4b0..c070edb 100644 --- a/test/jalview/project/Jalview2xmlTests.java +++ b/test/jalview/project/Jalview2xmlTests.java @@ -593,6 +593,14 @@ public class Jalview2xmlTests extends Jalview2xmlBase assertFalse(Jalview2XML.isVersionStringLaterThan("2.8.3b1", "2.8.3")); assertFalse(Jalview2XML.isVersionStringLaterThan("2.8.3", "2.8.2b1")); assertFalse(Jalview2XML.isVersionStringLaterThan("2.8.0b2", "2.8.0b1")); + /* + * test for patch release versions + */ + assertFalse(Jalview2XML.isVersionStringLaterThan("2.11.3.0", "2.11.2")); + assertTrue(Jalview2XML.isVersionStringLaterThan("2.11.3.0","2.11.4")); + assertFalse(Jalview2XML.isVersionStringLaterThan("2.12.2.0b1","2.12.2.0")); + assertFalse(Jalview2XML.isVersionStringLaterThan("2.12.2.3","2.12.2.2")); + } /** @@ -1479,6 +1487,23 @@ public class Jalview2xmlTests extends Jalview2xmlBase } /** + * Test that a view from an older version of Jalview is restored with Overview automatically shown when the preference is set + * + * @throws Exception + */ + @Test(groups = { "Functional" }, enabled = true) + public void testAutoShowOverviewForLegacyProjects() throws Exception + { + Desktop.instance.closeAll_actionPerformed(null); + Cache.setProperty("SHOW_OVERVIEW", "true"); + AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( + "examples/exampleFile.jvp", DataSourceType.FILE); + + Cache.setProperty("SHOW_OVERVIEW", "false"); + assertNotNull(af.alignPanel.getOverviewPanel()); + } + + /** * Test that loading example.jvp, doing some stuff, then hitting reload * doesn't leave the modified window still open *