X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FAnnotationLabelsTest.java;h=2a6e5b9cd984d2357617d60856e43385fc5ab7e8;hb=e9a1c2c372f4bbf6cf658de3dba73ef326b20c20;hp=31839a92d6e202603d3d5b20f3ca0a9dc176ad5c;hpb=943e92b0135861f6d400e10f12de8251222a9952;p=jalview.git diff --git a/test/jalview/gui/AnnotationLabelsTest.java b/test/jalview/gui/AnnotationLabelsTest.java index 31839a9..2a6e5b9 100644 --- a/test/jalview/gui/AnnotationLabelsTest.java +++ b/test/jalview/gui/AnnotationLabelsTest.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.gui; import static org.testng.Assert.assertEquals; @@ -62,7 +82,7 @@ public class AnnotationLabelsTest ann.description = null; assertEquals(AnnotationLabels.getTooltip(ann), " Score: 2.34"); - + /* * sequenceref, simple description */ @@ -102,4 +122,52 @@ public class AnnotationLabelsTest ann.sequenceRef = null; assertNull(AnnotationLabels.getTooltip(ann)); } + + @Test(groups = "Functional") + public void testGetStatusMessage() + { + assertNull(AnnotationLabels.getStatusMessage(null, null)); + + /* + * simple label + */ + AlignmentAnnotation aa = new AlignmentAnnotation("IUPredWS Short", + "Protein disorder", null); + assertEquals(AnnotationLabels.getStatusMessage(aa, null), + "IUPredWS Short"); + + /* + * with sequence ref + */ + aa.setSequenceRef(new Sequence("FER_CAPAA", "MIGRKQL")); + assertEquals(AnnotationLabels.getStatusMessage(aa, null), + "FER_CAPAA : IUPredWS Short"); + + /* + * with graph group (degenerate, one annotation only) + */ + aa.graphGroup = 1; + AlignmentAnnotation aa2 = new AlignmentAnnotation("IUPredWS Long", + "Protein disorder", null); + assertEquals( + AnnotationLabels.getStatusMessage(aa, new AlignmentAnnotation[] + { aa, aa2 }), "FER_CAPAA : IUPredWS Short"); + + /* + * graph group with two members; note labels are appended in + * reverse order (matching rendering order on screen) + */ + aa2.graphGroup = 1; + assertEquals( + AnnotationLabels.getStatusMessage(aa, new AlignmentAnnotation[] + { aa, aa2 }), "FER_CAPAA : IUPredWS Long, IUPredWS Short"); + + /* + * graph group with no sequence ref + */ + aa.sequenceRef = null; + assertEquals( + AnnotationLabels.getStatusMessage(aa, new AlignmentAnnotation[] + { aa, aa2 }), "IUPredWS Long, IUPredWS Short"); + } }