X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Fgui%2FAnnotationChooserTest.java;h=6621a9434beb848f1bcd3c5bc45e5a965955658b;hb=37de9310bec3501cbc6381e0c3dcb282fcaad812;hp=a7e84b16b393fa83414200658aee533a113608aa;hpb=ab22918ab8fc67d30dad1fb1ae0f37e51f49df95;p=jalview.git diff --git a/test/jalview/gui/AnnotationChooserTest.java b/test/jalview/gui/AnnotationChooserTest.java index a7e84b1..6621a94 100644 --- a/test/jalview/gui/AnnotationChooserTest.java +++ b/test/jalview/gui/AnnotationChooserTest.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.AssertJUnit.assertEquals; @@ -52,18 +72,19 @@ public class AnnotationChooserTest AlignFrame af; - @BeforeMethod + @BeforeMethod(alwaysRun = true) public void setUp() throws IOException { + Cache.loadProperties("test/jalview/io/testProps.jvprops"); // pin down annotation sort order for test Cache.applicationProperties.setProperty(Preferences.SORT_ANNOTATIONS, SequenceAnnotationOrder.NONE.name()); - final String True = Boolean.TRUE.toString(); + final String TRUE = Boolean.TRUE.toString(); Cache.applicationProperties.setProperty( - Preferences.SHOW_AUTOCALC_ABOVE, True); - Cache.applicationProperties.setProperty("SHOW_QUALITY", True); - Cache.applicationProperties.setProperty("SHOW_CONSERVATION", True); - Cache.applicationProperties.setProperty("SHOW_IDENTITY", True); + Preferences.SHOW_AUTOCALC_ABOVE, TRUE); + Cache.applicationProperties.setProperty("SHOW_QUALITY", TRUE); + Cache.applicationProperties.setProperty("SHOW_CONSERVATION", TRUE); + Cache.applicationProperties.setProperty("SHOW_IDENTITY", TRUE); AlignmentI al = new jalview.io.FormatAdapter().readFile(TEST_DATA, AppletFormatAdapter.PASTE, "FASTA"); @@ -85,8 +106,7 @@ public class AnnotationChooserTest private void addAnnotations() { Annotation an = new Annotation(2f); - Annotation[] anns = new Annotation[] - { an, an, an }; + Annotation[] anns = new Annotation[] { an, an, an }; AlignmentAnnotation ann0 = new AlignmentAnnotation("IUPRED", "", anns); AlignmentAnnotation ann1 = new AlignmentAnnotation("Beauty", "", anns); AlignmentAnnotation ann2 = new AlignmentAnnotation("JMol", "", anns); @@ -107,7 +127,7 @@ public class AnnotationChooserTest /** * Test creation of panel with OK and Cancel buttons */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildActionButtonsPanel() { testee = new AnnotationChooser(parentPanel); @@ -136,7 +156,7 @@ public class AnnotationChooserTest * Test 'Apply to' has 3 radio buttons enabled, 'Selected Sequences' selected, * when there is a current selection group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildApplyToOptionsPanel_withSelectionGroup() { selectSequences(0, 2, 3); @@ -183,7 +203,7 @@ public class AnnotationChooserTest * Test 'Apply to' has 1 radio button enabled, 'All Sequences' selected, when * there is no current selection group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildApplyToOptionsPanel_noSelectionGroup() { testee = new AnnotationChooser(parentPanel); @@ -224,7 +244,7 @@ public class AnnotationChooserTest /** * Test Show and Hide radio buttons created, with Hide initially selected. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildShowHidePanel() { testee = new AnnotationChooser(parentPanel); @@ -262,7 +282,7 @@ public class AnnotationChooserTest /** * Test construction of panel containing two sub-panels */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testBuildShowHideOptionsPanel() { testee = new AnnotationChooser(parentPanel); @@ -279,7 +299,7 @@ public class AnnotationChooserTest * Test that annotation types are (uniquely) identified. * */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testGetAnnotationTypes() { selectSequences(1); @@ -311,7 +331,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set hidden. Other annotations * should be left visible. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectType_hideForAll() { selectSequences(1, 2); @@ -347,7 +367,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set hidden. Other annotations should be left visible. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectType_hideForSelected() { selectSequences(1, 2); @@ -384,7 +404,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set visible. Other annotations * should be left unchanged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeselectType_hideForAll() { selectSequences(1, 2); @@ -426,7 +446,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set visible. Other annotations should be left unchanged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeselectType_hideForSelected() { selectSequences(1, 2); @@ -461,7 +481,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set visible. Other annotations * should be left unchanged */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectType_showForAll() { selectSequences(1, 2); @@ -500,7 +520,7 @@ public class AnnotationChooserTest * We expect all annotations of that type, linked to the sequence group, to be * set visible. Other annotations should be left unchanged */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testSelectType_showForSelected() { // sequences 1 and 2 have annotations IUPred and Jmol @@ -542,7 +562,7 @@ public class AnnotationChooserTest * We expect all annotations of that type to be set hidden. Other annotations * should be left unchanged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeselectType_showForAll() { selectSequences(1, 2); @@ -583,7 +603,7 @@ public class AnnotationChooserTest * We expect the annotations of that type, linked to the sequence group, to be * set hidden. Other annotations should be left unchanged. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testDeselectType_showForSelected() { selectSequences(1, 2); @@ -677,7 +697,7 @@ public class AnnotationChooserTest * Test cases include sequences in the selection group, and others not in the * group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testIsInActionScope_selectedScope() { // sequences 1 and 2 have annotations 4 and 3 respectively @@ -703,7 +723,7 @@ public class AnnotationChooserTest * Test cases include sequences in the selection group, and others not in the * group. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testIsInActionScope_unselectedScope() { // sequences 1 and 2 have annotations 4 and 3 respectively @@ -727,7 +747,7 @@ public class AnnotationChooserTest /** * Test that the reset method restores previous visibility flags. */ - @Test(groups ={ "Functional" }) + @Test(groups = { "Functional" }) public void testResetOriginalState() { testee = new AnnotationChooser(parentPanel); @@ -740,6 +760,9 @@ public class AnnotationChooserTest assertTrue(i + "'th sequence not visible", anns[i].visible); } + /* + * check options to hide JMol and IUPRED annotations for all sequences + */ final Checkbox hideCheckbox = (Checkbox) getComponent(testee, 1, 0, 1); setSelected(hideCheckbox, true); @@ -753,8 +776,8 @@ public class AnnotationChooserTest assertTrue(anns[0].visible); // Conservation assertTrue(anns[1].visible); // Quality assertTrue(anns[2].visible); // Consensus - assertTrue(anns[3].visible); // Beauty (not seq-related) - assertFalse(anns[4].visible); // IUPRED + assertFalse(anns[3].visible); // IUPRED + assertTrue(anns[4].visible); // Beauty (not seq-related) assertFalse(anns[5].visible); // JMol assertFalse(anns[6].visible); // IUPRED assertFalse(anns[7].visible); // JMol