*/
package jalview.gui;
+import static org.junit.Assert.assertNotEquals;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotSame;
import jalview.datamodel.SequenceI;
import jalview.io.DataSourceType;
import jalview.io.FileLoader;
-import jalview.io.Jalview2xmlTests;
+import jalview.project.Jalview2xmlTests;
import jalview.renderer.ResidueShaderI;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.FeatureColour;
AlignFrame af;
@BeforeClass(alwaysRun = true)
- public void setUpJvOptionPane()
+ public static void setUpBeforeClass() throws Exception
+ {
+ setUpJvOptionPane();
+ /*
+ * use read-only test properties file
+ */
+ Cache.loadProperties("test/jalview/io/testProps.jvprops");
+ Jalview.main(new String[] { "-nonews" });
+ }
+
+ @AfterMethod(alwaysRun = true)
+ public void tearDown()
+ {
+ Desktop.instance.closeAll_actionPerformed(null);
+ }
+
+ /**
+ * configure (read-only) properties for test to ensure Consensus is computed for
+ * colour Above PID testing
+ */
+ @BeforeMethod(alwaysRun = true)
+ public void setUp()
+ {
+ Cache.loadProperties("test/jalview/io/testProps.jvprops");
+ Cache.applicationProperties.setProperty("SHOW_IDENTITY",
+ Boolean.TRUE.toString());
+ af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
+ DataSourceType.FILE);
+
+ /*
+ * wait for Consensus thread to complete
+ */
+ synchronized (this)
+ {
+ while (af.getViewport().getConsensusSeq() == null)
+ {
+ try
+ {
+ wait(50);
+ } catch (InterruptedException e)
+ {
+ }
+ }
+ }
+ }
+
+ public static void setUpJvOptionPane()
{
JvOptionPane.setInteractiveMode(false);
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
assertEquals(next[1], 8);
}
- @BeforeClass(alwaysRun = true)
- public static void setUpBeforeClass() throws Exception
- {
- /*
- * use read-only test properties file
- */
- Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Jalview.main(new String[] { "-nonews" });
- }
-
- @AfterMethod(alwaysRun = true)
- public void tearDown()
- {
- Desktop.instance.closeAll_actionPerformed(null);
- }
-
- /**
- * configure (read-only) properties for test to ensure Consensus is computed
- * for colour Above PID testing
- */
- @BeforeMethod(alwaysRun = true)
- public void setUp()
- {
- Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Cache.applicationProperties.setProperty("SHOW_IDENTITY",
- Boolean.TRUE.toString());
- af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
- DataSourceType.FILE);
-
- /*
- * wait for Consensus thread to complete
- */
- synchronized (this)
- {
- while (af.getViewport().getConsensusSeq() == null)
- {
- try
- {
- wait(50);
- } catch (InterruptedException e)
- {
- }
- }
- }
- }
-
/**
* Test that changing background (alignment) colour scheme
* <ul>
/*
* apply 30% Conservation to group
+ * (notice menu action applies to selection group even if mouse click
+ * is at a sequence not in the group)
*/
- PopupMenu popupMenu = new PopupMenu(af.alignPanel, null, null);
+ PopupMenu popupMenu = new PopupMenu(af.alignPanel, al.getSequenceAt(2),
+ null);
popupMenu.changeColour_actionPerformed(JalviewColourScheme.Strand
.toString());
assertTrue(sg.getColourScheme() instanceof StrandColourScheme);
sg.setStartRes(15);
sg.setEndRes(25);
av.setSelectionGroup(sg);
- PopupMenu popupMenu = new PopupMenu(af.alignPanel, null, null);
+ PopupMenu popupMenu = new PopupMenu(af.alignPanel, al.getSequenceAt(0),
+ null);
popupMenu.changeColour_actionPerformed(JalviewColourScheme.Strand
.toString());
assertTrue(sg.getColourScheme() instanceof StrandColourScheme);
sp.valueChanged(22);
assertEquals(av2.getResidueShading().getConservationInc(), 22);
}
+
+ /**
+ * Verify that making a New View preserves the dataset reference for the
+ * alignment. Otherwise, see a 'duplicate jar entry' reference when trying to
+ * save alignments with multiple views, and codon mappings will not be shared
+ * across all panels in a split frame.
+ *
+ * @see Jalview2xmlTests#testStoreAndRecoverColourThresholds()
+ */
+ @Test(groups = "Functional")
+ public void testNewView_dsRefPreserved()
+ {
+ AlignViewport av = af.getViewport();
+ AlignmentI al = av.getAlignment();
+ AlignmentI original_ds = al.getDataset();
+ af.newView_actionPerformed(null);
+ assertNotEquals("New view didn't select the a new panel", av,
+ af.getViewport());
+ org.testng.Assert.assertEquals(original_ds,
+ af.getViewport().getAlignment().getDataset(),
+ "Dataset was not preserved in new view");
+ }
}