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;
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.");
+
+ }
}