*/
package jalview.io;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
import jalview.analysis.CrossRef;
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.AlignedCodonFrame;
JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION);
}
+ @Test(groups = { "Functional" }, enabled = true)
+ public void openCrossrefsForEnsemblTwice()
+ {
+ AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
+ "examples/testdata/CantShowEnsemblCrossrefsTwice.jvp",
+ DataSourceType.FILE);
+ assertNotNull(af, "Couldn't load test's project.");
+ AlignmentI origAlig = af.getViewport().getAlignment();
+ List<String> source = new CrossRef(origAlig.getSequencesArray(),
+ origAlig.getDataset()).findXrefSourcesForSequences(true);
+ assertEquals(source.size(), 1, "Expected just one crossref to show.");
+ List<AlignmentViewPanel> views;
+ {
+ // try to show once - in a code block so handler is forgotten about
+ CrossRefAction xref1 = CrossRefAction.getHandlerFor(
+ origAlig.getSequencesArray(), true, source.get(0), af);
+ try
+ {
+ xref1.run();
+ views = (List<AlignmentViewPanel>) PA.getValue(xref1, "xrefViews");
+ assertTrue(views.size() > 0,
+ "Couldn't get cross ref on first attempt (SERIOUS FAIL).");
+ } catch (Exception ex)
+ {
+ Assert.fail("Unexpected Exception for first xref action", ex);
+ }
+ }
+
+ views = null;
+ // now just try it again
+ CrossRefAction xref2 = CrossRefAction.getHandlerFor(
+ origAlig.getSequencesArray(), true, source.get(0), af);
+ try
+ {
+ xref2.run();
+ views = (List<AlignmentViewPanel>) PA.getValue(xref2, "xrefViews");
+ assertTrue(views.size() > 0,
+ "Couldn't get cross ref on second attempt (SERIOUS FAIL).");
+ } catch (Exception ex)
+ {
+ Assert.fail("Unexpected Exception for second xref action", ex);
+ }
+ // TODO : check that both views contain the same data
+ }
+
@DataProvider(name = "initialAccessions")
static Object[][] getAccessions()
{