From: gmungoc Date: Thu, 21 Nov 2019 10:43:21 +0000 (+0000) Subject: JAL-3081 test and fix for preserve annotation order on New View X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=71cf7645b3b66be24a155fd39a0f0e98c9ec1430;p=jalview.git JAL-3081 test and fix for preserve annotation order on New View --- diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index eaabd47..b58b01c 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -199,14 +199,14 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; /** - * Write out the current jalview desktop state as a Jalview XML stream. - * - * Note: the vamsas objects referred to here are primitive versions of the - * VAMSAS project schema elements - they are not the same and most likely never - * will be :) - * - * @author $author$ - * @version $Revision: 1.134 $ + * Provides methods to read in or write out the Jalview desktop state as a + * Jalview XML model, as one or more entries in a .jar archive. The jar file may + * include additional data file entries, such as + * */ public class Jalview2XML { @@ -3674,7 +3674,7 @@ public class Jalview2XML } al.addAnnotation(jda); - + addedAnnotation.add(jda); continue; } // Construct new annotation from model. diff --git a/test/jalview/project/Jalview2xmlTests.java b/test/jalview/project/Jalview2xmlTests.java index 57cade5..3e7279c 100644 --- a/test/jalview/project/Jalview2xmlTests.java +++ b/test/jalview/project/Jalview2xmlTests.java @@ -1267,6 +1267,28 @@ public class Jalview2xmlTests extends Jalview2xmlBase assertFalse(anns[3].visible); /* + * make a new view of the alignment (uses project save/load code) + * and verify annotations are ordered the same + */ + AlignmentPanel newPanel = af.newView("new", true); + AlignmentAnnotation[] newAnns = newPanel.getAlignment() + .getAlignmentAnnotation(); + assertEquals(newAnns.length, 4); + assertEquals(newAnns[0].label, "Occupancy"); + assertEquals(newAnns[1].label, "hello"); + assertEquals(newAnns[2].label, "Conservation"); + assertEquals(newAnns[3].label, "world"); + assertEquals(newAnns[0].graphHeight, 60); + assertEquals(newAnns[1].graphHeight, 70); + assertEquals(newAnns[2].graphHeight, 80); + assertEquals(newAnns[3].graphHeight, 90); + assertFalse(newAnns[0].visible); + assertTrue(newAnns[1].visible); + assertTrue(newAnns[2].visible); + assertFalse(newAnns[3].visible); + newPanel.closePanel(); + + /* * reload the project with Preferences set to not create Occupancy; * this should still appear, as it is in the saved project */