import jalview.datamodel.SearchResults;
import jalview.datamodel.SearchResultsI;
import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
public class AlignViewportTest
{
+ @BeforeClass(alwaysRun = true)
+ public void setUpJvOptionPane()
+ {
+ JvOptionPane.setInteractiveMode(false);
+ JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
+ }
+
AlignmentI al;
AlignViewport testee;
@BeforeClass(alwaysRun = true)
public static void setUpBeforeClass() throws Exception
{
- Jalview.main(new String[] { "-props", "test/jalview/testProps.jvprops" });
+ Jalview.main(new String[] { "-nonews", "-props",
+ "test/jalview/testProps.jvprops" });
}
@BeforeMethod(alwaysRun = true)
public void testSetGlobalColourScheme()
{
/*
- * test for JAL-2283 don't inadvertently turn on colour by conservation
+ * test for JAL-2283: don't inadvertently turn on colour by conservation
*/
- Cache.applicationProperties.setProperty("DEFAULT_COLOUR_PROT", "NONE");
+ Cache.applicationProperties.setProperty("DEFAULT_COLOUR_PROT", "None");
Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
Boolean.TRUE.toString());
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
ColourSchemeI cs = new PIDColourScheme();
af.getViewport().setGlobalColourScheme(cs);
- assertFalse(cs.conservationApplied());
+ assertFalse(af.getViewport().getResidueShading()
+ .conservationApplied());
}
@Test(groups = { "Functional" })
af.getViewport().setSearchResults(null);
assertFalse(af.getViewport().hasSearchResults());
}
+
+ /**
+ * Verify that setting the selection group has the side-effect of setting the
+ * context on the group, unless it already has one
+ */
+ @Test(groups = { "Functional" })
+ public void testSetSelectionGroup()
+ {
+ AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
+ "examples/uniref50.fa", DataSourceType.FILE);
+ AlignViewport av = af.getViewport();
+ SequenceGroup sg1 = new SequenceGroup();
+ SequenceGroup sg2 = new SequenceGroup();
+
+ av.setSelectionGroup(sg1);
+ assertSame(sg1.getContext(), av.getAlignment()); // context set
+
+ sg2.setContext(sg1);
+ av.setSelectionGroup(sg2);
+ assertSame(sg2.getContext(), sg1); // unchanged
+ }
}