X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FAlignViewportTest.java;fp=test%2Fjalview%2Fgui%2FAlignViewportTest.java;h=b3c6b2ae1fb9fbe92c5ce1e03c8aa3ecc3c4d9db;hb=3459a8a691cb22508d7067f240b7254e588e77d3;hp=00267b31d4ee5b3cda04325dde87c5493f4cf633;hpb=5b27f1062b2203c4c31702e205f4c78e1992063e;p=jalview.git diff --git a/test/jalview/gui/AlignViewportTest.java b/test/jalview/gui/AlignViewportTest.java index 00267b3..b3c6b2a 100644 --- a/test/jalview/gui/AlignViewportTest.java +++ b/test/jalview/gui/AlignViewportTest.java @@ -73,8 +73,9 @@ public class AlignViewportTest @BeforeClass(alwaysRun = true) public static void setUpBeforeClass() throws Exception { - Jalview.main(new String[] { "-nonews", "-props", - "test/jalview/testProps.jvprops" }); + Jalview.main( + new String[] + { "-nonews", "-props", "test/jalview/testProps.jvprops" }); /* * remove any sequence mappings left lying around by other tests @@ -106,16 +107,18 @@ public class AlignViewportTest /* * alignment with reference to mappings */ - AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded( - ">Seq1\nCAGT\n", DataSourceType.PASTE); + AlignFrame af1 = new FileLoader() + .LoadFileWaitTillLoaded(">Seq1\nCAGT\n", DataSourceType.PASTE); SequenceI s1 = af1.getViewport().getAlignment().getSequenceAt(0); AlignedCodonFrame acf1 = new AlignedCodonFrame(); - acf1.addMap(s1, s1, new MapList(new int[] { 1, 4 }, new int[] { 1, 4 }, - 1, 1)); + acf1.addMap(s1, s1, + new MapList(new int[] + { 1, 4 }, new int[] { 1, 4 }, 1, 1)); AlignedCodonFrame acf2 = new AlignedCodonFrame(); - acf2.addMap(s1, s1, new MapList(new int[] { 1, 4 }, new int[] { 4, 1 }, - 1, 1)); + acf2.addMap(s1, s1, + new MapList(new int[] + { 1, 4 }, new int[] { 4, 1 }, 1, 1)); List mappings = new ArrayList<>(); mappings.add(acf1); @@ -156,24 +159,27 @@ public class AlignViewportTest .getStructureSelectionManager(Desktop.instance); ssm.resetAll(); - AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded( - ">Seq1\nRSVQ\n", DataSourceType.PASTE); - AlignFrame af2 = new FileLoader().LoadFileWaitTillLoaded( - ">Seq2\nDGEL\n", DataSourceType.PASTE); + AlignFrame af1 = new FileLoader() + .LoadFileWaitTillLoaded(">Seq1\nRSVQ\n", DataSourceType.PASTE); + AlignFrame af2 = new FileLoader() + .LoadFileWaitTillLoaded(">Seq2\nDGEL\n", DataSourceType.PASTE); SequenceI cs1 = new Sequence("cseq1", "CCCGGGTTTAAA"); SequenceI cs2 = new Sequence("cseq2", "CTTGAGTCTAGA"); SequenceI s1 = af1.getViewport().getAlignment().getSequenceAt(0); SequenceI s2 = af2.getViewport().getAlignment().getSequenceAt(0); // need to be distinct AlignedCodonFrame acf1 = new AlignedCodonFrame(); - acf1.addMap(cs1, s1, new MapList(new int[] { 1, 4 }, - new int[] { 1, 12 }, 1, 3)); + acf1.addMap(cs1, s1, + new MapList(new int[] + { 1, 4 }, new int[] { 1, 12 }, 1, 3)); AlignedCodonFrame acf2 = new AlignedCodonFrame(); - acf2.addMap(cs2, s2, new MapList(new int[] { 1, 4 }, - new int[] { 1, 12 }, 1, 3)); + acf2.addMap(cs2, s2, + new MapList(new int[] + { 1, 4 }, new int[] { 1, 12 }, 1, 3)); AlignedCodonFrame acf3 = new AlignedCodonFrame(); - acf3.addMap(cs2, cs2, new MapList(new int[] { 1, 12 }, new int[] { 1, - 12 }, 1, 1)); + acf3.addMap(cs2, cs2, + new MapList(new int[] + { 1, 12 }, new int[] { 1, 12 }, 1, 1)); List mappings1 = new ArrayList<>(); mappings1.add(acf1); @@ -219,24 +225,27 @@ public class AlignViewportTest .getStructureSelectionManager(Desktop.instance); ssm.resetAll(); - AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded( - ">Seq1\nRSVQ\n", DataSourceType.PASTE); - AlignFrame af2 = new FileLoader().LoadFileWaitTillLoaded( - ">Seq2\nDGEL\n", DataSourceType.PASTE); + AlignFrame af1 = new FileLoader() + .LoadFileWaitTillLoaded(">Seq1\nRSVQ\n", DataSourceType.PASTE); + AlignFrame af2 = new FileLoader() + .LoadFileWaitTillLoaded(">Seq2\nDGEL\n", DataSourceType.PASTE); SequenceI cs1 = new Sequence("cseq1", "CCCGGGTTTAAA"); SequenceI cs2 = new Sequence("cseq2", "CTTGAGTCTAGA"); SequenceI s1 = af1.getViewport().getAlignment().getSequenceAt(0); SequenceI s2 = af2.getViewport().getAlignment().getSequenceAt(0); // need to be distinct AlignedCodonFrame acf1 = new AlignedCodonFrame(); - acf1.addMap(cs1, s1, new MapList(new int[] { 1, 4 }, - new int[] { 1, 12 }, 1, 3)); + acf1.addMap(cs1, s1, + new MapList(new int[] + { 1, 4 }, new int[] { 1, 12 }, 1, 3)); AlignedCodonFrame acf2 = new AlignedCodonFrame(); - acf2.addMap(cs2, s2, new MapList(new int[] { 1, 4 }, - new int[] { 1, 12 }, 1, 3)); + acf2.addMap(cs2, s2, + new MapList(new int[] + { 1, 4 }, new int[] { 1, 12 }, 1, 3)); AlignedCodonFrame acf3 = new AlignedCodonFrame(); - acf3.addMap(cs2, cs2, new MapList(new int[] { 1, 12 }, new int[] { 1, - 12 }, 1, 1)); + acf3.addMap(cs2, cs2, + new MapList(new int[] + { 1, 12 }, new int[] { 1, 12 }, 1, 1)); List mappings1 = new ArrayList<>(); mappings1.add(acf1); @@ -277,7 +286,7 @@ public class AlignViewportTest * Test for JAL-1306 - conservation thread should run even when only Quality * (and not Conservation) is enabled in Preferences */ - @Test(groups = { "Functional" }, timeOut=2000) + @Test(groups = { "Functional" }, timeOut = 2000) public void testUpdateConservation_qualityOnly() { Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", @@ -319,7 +328,7 @@ public class AlignViewportTest { synchronized (this) { - while (viewport.getCalcManager().isWorking()) + do { try { @@ -327,7 +336,7 @@ public class AlignViewportTest } catch (InterruptedException e) { } - } + } while (viewport.getCalcManager().isWorking()); } } @@ -345,8 +354,7 @@ public class AlignViewportTest ColourSchemeI cs = new PIDColourScheme(); AlignViewport viewport = af.getViewport(); viewport.setGlobalColourScheme(cs); - assertFalse(viewport.getResidueShading() - .conservationApplied()); + assertFalse(viewport.getResidueShading().conservationApplied()); /* * JAL-3201 groups have their own ColourSchemeI instances @@ -426,18 +434,22 @@ public class AlignViewportTest av.setSelectionGroup(sg3); assertTrue(sg3.isDefined()); // unchanged } + /** - * Verify that setting/clearing SHOW_OCCUPANCY preference adds or omits occupancy row from viewport + * 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()); + 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."); + Assert.assertNull(av.getAlignmentGapAnnotation(), + "Preference did not disable occupancy row."); int c = 0; for (AlignmentAnnotation aa : av.getAlignment().findAnnotations(null, null, "Occupancy")) @@ -445,13 +457,15 @@ public class AlignViewportTest 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); + 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."); + Assert.assertNotNull(av.getAlignmentGapAnnotation(), + "Preference did not enable occupancy row."); c = 0; for (AlignmentAnnotation aa : av.getAlignment().findAnnotations(null, null, av.getAlignmentGapAnnotation().label)) @@ -508,8 +522,9 @@ public class AlignViewportTest /* * hide first and third sequences */ - testee.hideSequence(new SequenceI[] { al.getSequenceAt(0), - al.getSequenceAt(2) }); + testee.hideSequence( + new SequenceI[] + { al.getSequenceAt(0), al.getSequenceAt(2) }); assertEquals(1, al.getHeight()); assertEquals(0, ranges.getStartSeq()); assertEquals(0, ranges.getEndSeq());