X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fdatamodel%2FAlignmentAnnotationTests.java;fp=test%2Fjalview%2Fdatamodel%2FAlignmentAnnotationTests.java;h=74c2b63cb923d58ce4b3df6cccd3e5992845ebee;hb=72e63582d51fbaa0cc5a3963abc96814f984039b;hp=2948f833c10062214706741414e172fba220b284;hpb=aa218da8aa3bf61463d84e478b1ed498d7d964cb;p=jalview.git diff --git a/test/jalview/datamodel/AlignmentAnnotationTests.java b/test/jalview/datamodel/AlignmentAnnotationTests.java index 2948f83..74c2b63 100644 --- a/test/jalview/datamodel/AlignmentAnnotationTests.java +++ b/test/jalview/datamodel/AlignmentAnnotationTests.java @@ -626,6 +626,50 @@ public class AlignmentAnnotationTests assertThat(ann.annotations, is(emptyArray())); } + @Test(groups = "Functional") + public void testMakeVisibleAnnotation_HiddenRegionBeyondSize() + { + Annotation[] annots = annotsRange(4); + AlignmentAnnotation ann = new AlignmentAnnotation("label", "desc", annots); + HiddenColumns hc = new HiddenColumns(); + hc.hideColumns(6, 7); + ann.makeVisibleAnnotation(hc); + assertThat(ann.annotations, matchesAnnotations(annots)); + } + + @Test(groups = "Functional") + public void testMakeVisibleAnnotation_HiddenRegionAndTrimEndBeyondSize() + { + Annotation[] annots = annotsRange(4); + AlignmentAnnotation ann = new AlignmentAnnotation("label", "desc", annots); + HiddenColumns hc = new HiddenColumns(); + hc.hideColumns(6, 7); + ann.makeVisibleAnnotation(0, 10, hc); + assertThat(ann.annotations, matchesAnnotations(annots)); + } + + @Test(groups = "Functional") + public void testMakeVisibleAnnotation_HiddenRegionBeforeStart() + { + Annotation[] annots = annotsRange(4); + AlignmentAnnotation ann = new AlignmentAnnotation("label", "desc", annots); + HiddenColumns hc = new HiddenColumns(); + hc.hideColumns(-3, -2); + ann.makeVisibleAnnotation(hc); + assertThat(ann.annotations, matchesAnnotations(annots)); + } + + @Test(groups = "Functional") + public void testMakeVisibleAnnotation_HiddenRegionAndTrimStartBeforeStart() + { + Annotation[] annots = annotsRange(4); + AlignmentAnnotation ann = new AlignmentAnnotation("label", "desc", annots); + HiddenColumns hc = new HiddenColumns(); + hc.hideColumns(-3, -2); + ann.makeVisibleAnnotation(-5, annots.length - 1, hc); + assertThat(ann.annotations, matchesAnnotations(annots)); + } + static Annotation[] annotsRange(int stop) { Annotation[] annotations = new Annotation[stop];