From: Jim Procter Date: Thu, 27 Apr 2017 15:39:33 +0000 (+0100) Subject: JAL-1933 test for SHOW_OCCUPANCY .jalview_properties setting X-Git-Tag: Release_2_10_2~3^2~123^2~3 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=faa3d71f9d120d665870e72b7217ae6b8bd6062d;p=jalview.git JAL-1933 test for SHOW_OCCUPANCY .jalview_properties setting --- diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index 06df70a..d76ac33 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -50,6 +50,7 @@ import jalview.util.MapList; import java.util.ArrayList; import java.util.List; +import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -404,4 +405,40 @@ public class AlignViewportTest av.setSelectionGroup(sg2); assertSame(sg2.getContext(), sg1); // unchanged } + /** + * Verify that setting/clearing SHOW_OCCUPANCY preference adds or omits occupancy row from viewport + */ + @Test(groups = { "Functional" }) + public void testShowOrDontShowOccupancy() + { + // disable occupancy + jalview.bin.Cache.setProperty("SHOW_OCCUPANCY", Boolean.FALSE.toString()); + AlignFrame af = new FileLoader().LoadFileWaitTillLoaded( + "examples/uniref50.fa", DataSourceType.FILE); + AlignViewport av = af.getViewport(); + Assert.assertNull(av.getAlignmentGapAnnotation(), "Preference did not disable occupancy row."); + int c = 0; + for (AlignmentAnnotation aa : av.getAlignment().findAnnotations(null, + null, "Occupancy")) + { + c++; + } + Assert.assertEquals(c, 0, "Expected zero occupancy rows."); + + // enable occupancy + jalview.bin.Cache.setProperty("SHOW_OCCUPANCY", Boolean.TRUE.toString()); + af = new FileLoader().LoadFileWaitTillLoaded( + "examples/uniref50.fa", DataSourceType.FILE); + av = af.getViewport(); + Assert.assertNotNull(av.getAlignmentGapAnnotation(), "Preference did not enable occupancy row."); + c = 0; + for (AlignmentAnnotation aa : av.getAlignment().findAnnotations(null, + null, av.getAlignmentGapAnnotation().label)) + { + c++; + } + ; + Assert.assertEquals(c, 1, "Expected to find one occupancy row."); + + } }